mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-23 10:15:41 +00:00
Reflect call object into runtime scope chain before reflecting block objects (352797, r=mrbkap).
This commit is contained in:
parent
60895ac5c3
commit
9ff2661554
@ -611,6 +611,7 @@ js_GetCallObject(JSContext *cx, JSStackFrame *fp, JSObject *parent)
|
||||
fp->callobj = callobj;
|
||||
|
||||
/* Make callobj be the scope chain and the variables object. */
|
||||
JS_ASSERT(fp->scopeChain == parent);
|
||||
fp->scopeChain = callobj;
|
||||
fp->varobj = callobj;
|
||||
return callobj;
|
||||
|
@ -471,10 +471,28 @@ js_GetScopeChain(JSContext *cx, JSStackFrame *fp)
|
||||
|
||||
obj = fp->blockChain;
|
||||
if (!obj) {
|
||||
/*
|
||||
* Don't force a call object for a lightweight function call, but do
|
||||
* insist that there is a call object for a heavyweight function call.
|
||||
*/
|
||||
JS_ASSERT(!fp->fun ||
|
||||
!(fp->fun->flags & JSFUN_HEAVYWEIGHT) ||
|
||||
fp->callobj);
|
||||
JS_ASSERT(fp->scopeChain);
|
||||
return fp->scopeChain;
|
||||
}
|
||||
|
||||
/*
|
||||
* We have one or more lexical scopes to reflect into fp->scopeChain, so
|
||||
* make sure there's a call object at the current head of the scope chain,
|
||||
* if this frame is a call frame.
|
||||
*/
|
||||
if (fp->fun && !fp->callobj) {
|
||||
JS_ASSERT(OBJ_GET_CLASS(cx, fp->scopeChain) != &js_BlockClass);
|
||||
if (!js_GetCallObject(cx, fp, fp->scopeChain))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Clone the block chain. To avoid recursive cloning we set the parent of
|
||||
* the cloned child after we clone the parent. In the following loop when
|
||||
|
Loading…
Reference in New Issue
Block a user