Bug 1443925 - Part 5: Make it possible to get the system principal from any thread, r=ckerschb

This is required because the script security manager which currently owns the
singleton is main-thread only. This change still ties the lifecycle of the
static to that service, but also makes it generally available from any thread.

Differential Revision: https://phabricator.services.mozilla.com/D163035
This commit is contained in:
Nika Layzell
2022-12-02 00:53:51 +00:00
parent 9094520972
commit f6b916cc3e
4 changed files with 36 additions and 9 deletions

View File

@@ -1554,9 +1554,7 @@ nsresult nsScriptSecurityManager::Init() {
InitPrefs();
// Create our system principal singleton
RefPtr<SystemPrincipal> system = SystemPrincipal::Create();
mSystemPrincipal = system;
mSystemPrincipal = SystemPrincipal::Init();
return NS_OK;
}
@@ -1600,6 +1598,7 @@ nsScriptSecurityManager::~nsScriptSecurityManager(void) {
void nsScriptSecurityManager::Shutdown() {
NS_IF_RELEASE(sIOService);
BundleHelper::Shutdown();
SystemPrincipal::Shutdown();
}
nsScriptSecurityManager* nsScriptSecurityManager::GetScriptSecurityManager() {