mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 887334 - Stop setting the compartment to defaultCompartmentObject_->compartment(). r=luke
With this change, defaultCompartmentObject_ is just an opaque (though traced) piece of embedder state on the cx.
This commit is contained in:
parent
152a99c222
commit
8e0afa92a2
@ -2082,8 +2082,7 @@ nsGlobalWindow::SetOuterObject(JSContext* aCx, JS::Handle<JSObject*> aOuterObjec
|
||||
{
|
||||
JSAutoCompartment ac(aCx, aOuterObject);
|
||||
|
||||
// Force our context's global object to be the outer.
|
||||
// NB: JS_SetGlobalObject sets aCx->compartment.
|
||||
// Indicate the default compartment object associated with this cx.
|
||||
JS_SetGlobalObject(aCx, aOuterObject);
|
||||
|
||||
// Set up the prototype for the outer object.
|
||||
|
@ -1138,14 +1138,9 @@ JSContext::saveFrameChain()
|
||||
if (Activation *act = mainThread().activation())
|
||||
act->saveFrameChain();
|
||||
|
||||
if (defaultCompartmentObject_)
|
||||
setCompartment(defaultCompartmentObject_->compartment());
|
||||
else
|
||||
setCompartment(NULL);
|
||||
setCompartment(NULL);
|
||||
enterCompartmentDepth_ = 0;
|
||||
|
||||
if (isExceptionPending())
|
||||
wrapPendingException();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -401,19 +401,6 @@ inline void
|
||||
JSContext::setDefaultCompartmentObject(JSObject *obj)
|
||||
{
|
||||
defaultCompartmentObject_ = obj;
|
||||
|
||||
if (!hasEnteredCompartment()) {
|
||||
/*
|
||||
* If JSAPI callers want to JS_SetGlobalObject while code is running,
|
||||
* they must have entered a compartment (otherwise there will be no
|
||||
* final leaveCompartment call to set the context's compartment back to
|
||||
* defaultCompartmentObject->compartment()).
|
||||
*/
|
||||
JS_ASSERT(!currentlyRunning());
|
||||
setCompartment(obj ? obj->compartment() : NULL);
|
||||
if (throwing)
|
||||
wrapPendingException();
|
||||
}
|
||||
}
|
||||
|
||||
inline void
|
||||
@ -440,21 +427,9 @@ JSContext::leaveCompartment(JSCompartment *oldCompartment)
|
||||
enterCompartmentDepth_--;
|
||||
|
||||
compartment()->leave();
|
||||
setCompartment(oldCompartment);
|
||||
|
||||
/*
|
||||
* Before we entered the current compartment, 'compartment' was
|
||||
* 'oldCompartment', so we might want to simply set it back. However, we
|
||||
* currently have this terrible scheme whereby defaultCompartmentObject_ can
|
||||
* be updated while enterCompartmentDepth_ > 0. In this case, oldCompartment
|
||||
* != defaultCompartmentObject_->compartment and we must ignore
|
||||
* oldCompartment.
|
||||
*/
|
||||
if (hasEnteredCompartment() || !defaultCompartmentObject_)
|
||||
setCompartment(oldCompartment);
|
||||
else
|
||||
setCompartment(defaultCompartmentObject_->compartment());
|
||||
|
||||
if (throwing)
|
||||
if (throwing && oldCompartment)
|
||||
wrapPendingException();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user