mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-12 09:01:16 +00:00
Back out changeset a8252fe3f211 due to turning everything orange.
This commit is contained in:
parent
d602680591
commit
e59d7a4125
@ -1243,8 +1243,8 @@ JS_SetGlobalObject(JSContext *cx, JSObject *obj)
|
||||
CHECK_REQUEST(cx);
|
||||
|
||||
cx->globalObject = obj;
|
||||
if (!cx->hasfp())
|
||||
cx->resetCompartment();
|
||||
if (!cx->maybefp())
|
||||
cx->compartment = obj ? obj->getCompartment(cx) : cx->runtime->defaultCompartment;
|
||||
}
|
||||
|
||||
class AutoResolvingEntry {
|
||||
|
@ -2086,41 +2086,9 @@ struct JSContext
|
||||
friend class js::StackSpace;
|
||||
friend bool js::Interpret(JSContext *, JSStackFrame *, uintN, uintN);
|
||||
|
||||
void resetCompartment() {
|
||||
JSObject *scopeobj;
|
||||
if (hasfp()) {
|
||||
scopeobj = &fp()->scopeChain();
|
||||
} else {
|
||||
scopeobj = globalObject;
|
||||
if (!scopeobj) {
|
||||
compartment = runtime->defaultCompartment;
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Innerize. Assert, but check anyway, that this succeeds. (It
|
||||
* can only fail due to bugs in the engine or embedding.)
|
||||
*/
|
||||
OBJ_TO_INNER_OBJECT(this, scopeobj);
|
||||
if (!scopeobj) {
|
||||
/*
|
||||
* Bug. Return NULL, not defaultCompartment, to crash rather
|
||||
* than open a security hole.
|
||||
*/
|
||||
JS_ASSERT(0);
|
||||
compartment = NULL;
|
||||
return;
|
||||
}
|
||||
}
|
||||
compartment = scopeobj->getCompartment(this);
|
||||
}
|
||||
|
||||
/* 'regs' must only be changed by calling this function. */
|
||||
void setCurrentRegs(JSFrameRegs *regs) {
|
||||
JS_ASSERT_IF(regs, regs->fp);
|
||||
this->regs = regs;
|
||||
if (!regs)
|
||||
resetCompartment();
|
||||
}
|
||||
|
||||
/* Temporary arena pool used while compiling and decompiling. */
|
||||
|
@ -573,9 +573,8 @@ AutoCompartment::leave()
|
||||
JS_ASSERT(entered);
|
||||
if (origin != destination) {
|
||||
frame.destroy();
|
||||
context->resetCompartment();
|
||||
JS_ASSERT_IF(context->hasfp(), context->compartment == origin);
|
||||
context->compartment->wrapException(context);
|
||||
context->compartment = origin;
|
||||
origin->wrapException(context);
|
||||
}
|
||||
entered = false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user