import from UXP: [image] Use the TriggeringPrincipal if we have one, not the SystemPrincipal (4667b7f4)

This commit is contained in:
2025-12-18 00:03:48 +08:00
parent 54292a2520
commit 2eae097a10
+5 -2
View File
@@ -765,10 +765,13 @@ NewImageChannel(nsIChannel** aResult,
// outside a document, in which case the triggeringPrincipal and
// triggeringPrincipal should always be the systemPrincipal.
// However, there are exceptions: one is Notifications which create a
// channel in the parent prcoess in which case we can't get a requestingNode.
// channel separate from content, in which case we can't get a
// requestingNode while we might still have a valid triggering principal.
// Use the triggering principal if we have a valid one, fall back to
// the system principal if we don't.
rv = NS_NewChannel(aResult,
aURI,
nsContentUtils::GetSystemPrincipal(),
aTriggeringPrincipal ? aTriggeringPrincipal : nsContentUtils::GetSystemPrincipal(),
securityFlags,
aPolicyType,
nullptr, // loadGroup