Issue #2542 - Part 5: Assume browser-initiated requests for unspecified content types to always be user-triggered.

This commit is contained in:
Moonchild 2024-07-04 22:34:00 +02:00 committed by roytam1
commit 0ef8b05101

View file

@ -186,6 +186,12 @@ bool IsUserTriggeredForSecFetchSite(nsIHttpChannel* aHTTPChannel) {
nsCOMPtr<nsILoadInfo> loadInfo = aHTTPChannel->GetLoadInfo();
nsContentPolicyType contentType = loadInfo->InternalContentPolicyType();
// A request issued by the browser is always user initiated.
if (nsContentUtils::IsSystemPrincipal(loadInfo->TriggeringPrincipal()) &&
contentType == nsIContentPolicy::TYPE_OTHER) {
return true;
}
// only requests wich result in type "document" are subject to
// user initiated actions in the context of SecFetch.
if (contentType != nsIContentPolicy::TYPE_DOCUMENT &&