From 0ef8b05101110c127453a5bfa52a5e16c52ef86d Mon Sep 17 00:00:00 2001 From: Moonchild Date: Thu, 4 Jul 2024 22:34:00 +0200 Subject: [PATCH] Issue #2542 - Part 5: Assume browser-initiated requests for unspecified content types to always be user-triggered. --- dom/security/SecFetch.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dom/security/SecFetch.cpp b/dom/security/SecFetch.cpp index d0591ed9f8..203832af4c 100644 --- a/dom/security/SecFetch.cpp +++ b/dom/security/SecFetch.cpp @@ -186,6 +186,12 @@ bool IsUserTriggeredForSecFetchSite(nsIHttpChannel* aHTTPChannel) { nsCOMPtr 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 &&