Bug 1954597 - Part 6: Succeed ValidatePrincipal during XPCOM shutdown, r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D242423
This commit is contained in:
Nika Layzell
2025-04-11 16:51:12 +00:00
parent 8bfa37cb3d
commit edb6852f7e

View File

@@ -6,6 +6,7 @@
#include "mozilla/dom/ProcessIsolation.h"
#include "mozilla/AppShutdown.h"
#include "mozilla/Assertions.h"
#include "mozilla/dom/BrowsingContextGroup.h"
#include "mozilla/dom/CanonicalBrowsingContext.h"
@@ -1178,6 +1179,12 @@ bool ValidatePrincipalCouldPotentiallyBeLoadedBy(
return aOptions.contains(ValidatePrincipalOptions::AllowSystem);
}
// Performing checks against the remote type requires the IOService and
// ThirdPartyService to be available, check we're not late in shutdown.
if (AppShutdown::IsInOrBeyond(ShutdownPhase::XPCOMShutdownFinal)) {
return true;
}
// We can load a `resource://` URI in any process. This usually comes up due
// to pdf.js and the JSON viewer. See bug 1686200.
if (aPrincipal->SchemeIs("resource")) {