Bug 1142241. Stop using getParent() in js::GetObjectEnvironmentObjectForFunction. r=waldo

This commit is contained in:
Boris Zbarsky 2015-03-11 22:33:59 -04:00
parent 32fcbbd5d3
commit 9b5f48b73d

View File

@ -2503,11 +2503,11 @@ JS_FRIEND_API(JSObject *)
js::GetObjectEnvironmentObjectForFunction(JSFunction *fun)
{
if (!fun->isInterpreted())
return fun->getParent();
return &fun->global();
JSObject *env = fun->environment();
if (!env || !env->is<DynamicWithObject>())
return fun->getParent();
return &fun->global();
return &env->as<DynamicWithObject>().object();
}