Bug 1464374 part 6 - Use GetRealmPrincipals in Scriptability constructor. r=bz

This commit is contained in:
Jan de Mooij 2018-05-31 11:28:49 +02:00
parent 1c0105d7ef
commit 1edb6a4c17
2 changed files with 4 additions and 4 deletions

View File

@ -197,7 +197,7 @@ CompartmentPrivate::SystemIsBeingShutDown()
}
RealmPrivate::RealmPrivate(JS::Realm* realm)
: scriptability(JS::GetCompartmentForRealm(realm))
: scriptability(realm)
, scope(nullptr)
{
}
@ -367,11 +367,11 @@ PrincipalImmuneToScriptPolicy(nsIPrincipal* aPrincipal)
return false;
}
Scriptability::Scriptability(JSCompartment* c) : mScriptBlocks(0)
Scriptability::Scriptability(JS::Realm* realm) : mScriptBlocks(0)
, mDocShellAllowsScript(true)
, mScriptBlockedByPolicy(false)
{
nsIPrincipal* prin = nsJSPrincipals::get(JS_GetCompartmentPrincipals(c));
nsIPrincipal* prin = nsJSPrincipals::get(JS::GetRealmPrincipals(realm));
mImmuneToScriptPolicy = PrincipalImmuneToScriptPolicy(prin);
// If we're not immune, we should have a real principal with a codebase URI.

View File

@ -43,7 +43,7 @@ namespace xpc {
class Scriptability {
public:
explicit Scriptability(JSCompartment* c);
explicit Scriptability(JS::Realm* realm);
bool Allowed();
bool IsImmuneToScriptPolicy();