mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 05:15:45 +00:00
Bug 979481 - Prepare the cx stack machinery for a world where a cx has no default compartment object. r=bz
This commit is contained in:
parent
cacdca44ee
commit
b016448582
@ -79,17 +79,17 @@ XPCJSContextStack::Push(JSContext *cx)
|
||||
if ((e.cx == cx) && ssm) {
|
||||
// DOM JSContexts don't store their default compartment object on
|
||||
// the cx, so in those cases we need to fetch it via the scx
|
||||
// instead.
|
||||
// instead. And in some cases (i.e. the SafeJSContext), we have no
|
||||
// default compartment object at all.
|
||||
RootedObject defaultScope(cx, GetDefaultScopeFromJSContext(cx));
|
||||
|
||||
nsIPrincipal *currentPrincipal =
|
||||
GetCompartmentPrincipal(js::GetContextCompartment(cx));
|
||||
nsIPrincipal *defaultPrincipal = GetObjectPrincipal(defaultScope);
|
||||
bool equal = false;
|
||||
currentPrincipal->Equals(defaultPrincipal, &equal);
|
||||
if (equal) {
|
||||
mStack.AppendElement(cx);
|
||||
return true;
|
||||
if (defaultScope) {
|
||||
nsIPrincipal *currentPrincipal =
|
||||
GetCompartmentPrincipal(js::GetContextCompartment(cx));
|
||||
nsIPrincipal *defaultPrincipal = GetObjectPrincipal(defaultScope);
|
||||
if (currentPrincipal->Equals(defaultPrincipal)) {
|
||||
mStack.AppendElement(cx);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user