diff --git a/js/src/js.msg b/js/src/js.msg index befda7d04182..71fc75458736 100644 --- a/js/src/js.msg +++ b/js/src/js.msg @@ -316,7 +316,7 @@ MSG_DEF(JSMSG_SC_RECURSION, 262, 0, JSEXN_INTERNALERR, "recursive obje MSG_DEF(JSMSG_CANT_WRAP_XML_OBJECT, 263, 0, JSEXN_TYPEERR, "can't wrap XML objects") MSG_DEF(JSMSG_BAD_CLONE_VERSION, 264, 0, JSEXN_ERR, "unsupported structured clone version") MSG_DEF(JSMSG_CANT_CLONE_OBJECT, 265, 0, JSEXN_TYPEERR, "can't clone object") -MSG_DEF(JSMSG_NON_NATIVE_SCOPE, 266, 0, JSEXN_TYPEERR, "non-native scope object") +MSG_DEF(JSMSG_UNUSED266, 266, 0, JSEXN_NONE, "") MSG_DEF(JSMSG_STRICT_FUNCTION_STATEMENT, 267, 0, JSEXN_SYNTAXERR, "in strict mode code, functions may be declared only at top level or immediately within another function") MSG_DEF(JSMSG_INVALID_FOR_IN_INIT, 268, 0, JSEXN_SYNTAXERR, "for-in loop let declaration may not have an initializer") MSG_DEF(JSMSG_CLEARED_SCOPE, 269, 0, JSEXN_TYPEERR, "attempt to run compile-and-go script on a cleared scope") diff --git a/js/src/jsinterp.cpp b/js/src/jsinterp.cpp index 3d7ffd2f7cf7..c5c259a94ec0 100644 --- a/js/src/jsinterp.cpp +++ b/js/src/jsinterp.cpp @@ -552,12 +552,14 @@ js::Execute(JSContext *cx, HandleScript script, JSObject &scopeChainArg, Value * if (!scopeChain) return false; - /* If we were handed a non-native object, complain bitterly. */ - if (!scopeChain->isNative()) { - JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_NON_NATIVE_SCOPE); - return false; - } - JS_ASSERT(!scopeChain->getOps()->defineProperty); + /* Ensure the scope chain is all same-compartment and terminates in a global. */ +#ifdef DEBUG + RawObject s = scopeChain; + do { + assertSameCompartment(cx, s); + JS_ASSERT_IF(!s->enclosingScope(), s->isGlobal()); + } while ((s = s->enclosingScope())); +#endif /* The VAROBJFIX option makes varObj == globalObj in global code. */ if (!cx->hasRunOption(JSOPTION_VAROBJFIX)) { diff --git a/js/src/jsinterpinlines.h b/js/src/jsinterpinlines.h index 2699a0498f10..87df5aefc035 100644 --- a/js/src/jsinterpinlines.h +++ b/js/src/jsinterpinlines.h @@ -476,7 +476,6 @@ inline bool DefVarOrConstOperation(JSContext *cx, HandleObject varobj, HandlePropertyName dn, unsigned attrs) { JS_ASSERT(varobj->isVarObj()); - JS_ASSERT(!varobj->getOps()->defineProperty || varobj->isDebugScope()); RootedShape prop(cx); RootedObject obj2(cx);