Back out changeset a8252fe3f211 due to turning everything orange.

This commit is contained in:
Jason Orendorff 2010-09-16 20:58:40 -07:00
parent d602680591
commit e59d7a4125
3 changed files with 4 additions and 37 deletions

View File

@ -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 {

View File

@ -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. */

View File

@ -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;
}