mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1089026 part 3. Add a friend API for getting the scope object for a function, if it has one. r=shu
This commit is contained in:
parent
526be6f105
commit
021f135323
@ -2675,6 +2675,15 @@ extern JS_FRIEND_API(void)
|
||||
SetJitExceptionHandler(JitExceptionHandler handler);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Get the object underlying the object environment (in the ES
|
||||
* NewObjectEnvironment) sense for a given function. If the function is not
|
||||
* scripted or does not have an object environment, just returns the function's
|
||||
* parent.
|
||||
*/
|
||||
extern JS_FRIEND_API(JSObject *)
|
||||
GetObjectEnvironmentObjectForFunction(JSFunction *fun);
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
extern JS_FRIEND_API(bool)
|
||||
|
@ -2517,6 +2517,20 @@ js::GetDebugScopeForFrame(JSContext *cx, AbstractFramePtr frame, jsbytecode *pc)
|
||||
return GetDebugScope(cx, si);
|
||||
}
|
||||
|
||||
// See declaration and documentation in jsfriendapi.h
|
||||
JS_FRIEND_API(JSObject *)
|
||||
js::GetObjectEnvironmentObjectForFunction(JSFunction *fun)
|
||||
{
|
||||
if (!fun->isInterpreted())
|
||||
return fun->getParent();
|
||||
|
||||
JSObject *env = fun->environment();
|
||||
if (!env || !env->is<DynamicWithObject>())
|
||||
return fun->getParent();
|
||||
|
||||
return &env->as<DynamicWithObject>().object();
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
typedef HashSet<PropertyName *> PropertyNameSet;
|
||||
|
Loading…
Reference in New Issue
Block a user