зеркало из https://github.com/mozilla/pjs.git
Try harder to find a scope chain so that we can report exceptions when there is no code running currently. bug 390160, r=brendan sr=jst a=brendan
This commit is contained in:
Родитель
895acbb235
Коммит
d01c55bb5f
|
@ -1664,8 +1664,24 @@ JS_GetScopeChain(JSContext *cx)
|
|||
|
||||
fp = cx->fp;
|
||||
if (!fp) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_INACTIVE);
|
||||
return NULL;
|
||||
/*
|
||||
* There is no code active on this context. In place of an actual
|
||||
* scope chain, use the context's global object, which is set in
|
||||
* js_InitFunctionAndObjectClasses, and which represents the default
|
||||
* scope chain for the embedding. See also js_FindClassObject.
|
||||
*
|
||||
* For embeddings that use the inner and outer object hooks, the inner
|
||||
* object represents the ultimate global object, with the outer object
|
||||
* acting as a stand-in.
|
||||
*/
|
||||
JSObject *obj = cx->globalObject;
|
||||
if (!obj) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_INACTIVE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OBJ_TO_INNER_OBJECT(cx, obj);
|
||||
return obj;
|
||||
}
|
||||
return js_GetScopeChain(cx, fp);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче