Disallow non-native global objects (609990, r=brendan).

This commit is contained in:
Andreas Gal 2011-01-05 19:56:42 -08:00
parent b4d33227f7
commit 6d6e6a903d
2 changed files with 8 additions and 0 deletions

View File

@ -345,3 +345,4 @@ 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")

View File

@ -947,6 +947,13 @@ Execute(JSContext *cx, JSObject *chain, JSScript *script,
if (!innerizedChain)
return false;
/* If we were handed a non-native object, complain bitterly. */
if (!innerizedChain->isNative()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
JSMSG_NON_NATIVE_SCOPE);
return false;
}
/* Initialize frame. */
frame.fp()->initGlobalFrame(script, *innerizedChain, flags);