diff --git a/js/src/jsobj.c b/js/src/jsobj.c index 1ecbccd3c7a..b6f5186ee89 100644 --- a/js/src/jsobj.c +++ b/js/src/jsobj.c @@ -1128,7 +1128,8 @@ obj_eval(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) rt = cx->runtime; if (rt->findObjectPrincipals) { scopePrincipals = rt->findObjectPrincipals(cx, scopeobj); - if (!principals->subsume(principals, scopePrincipals)) { + if (scopePrincipals && + !principals->subsume(principals, scopePrincipals)) { JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BAD_INDIRECT_CALL, js_eval_str); return JS_FALSE; diff --git a/js/src/jsscript.c b/js/src/jsscript.c index ed4e93b8d0f..131964bc0a9 100644 --- a/js/src/jsscript.c +++ b/js/src/jsscript.c @@ -306,7 +306,8 @@ script_exec(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) rt = cx->runtime; if (rt->findObjectPrincipals) { scopePrincipals = rt->findObjectPrincipals(cx, scopeobj); - if (!principals->subsume(principals, scopePrincipals)) { + if (scopePrincipals && + !principals->subsume(principals, scopePrincipals)) { JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BAD_INDIRECT_CALL, "Script.prototype.exec");