зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1088228 part 4. Add a version of JS_CloneFunctionObject that allows passing in a scope chain. r=shu
This commit is contained in:
Родитель
d29ace60f6
Коммит
347688a3f0
|
@ -3919,6 +3919,21 @@ JS_CloneFunctionObject(JSContext *cx, HandleObject funobj, HandleObject parentAr
|
|||
return CloneFunctionObject(cx, fun, parent, fun->getAllocKind());
|
||||
}
|
||||
|
||||
namespace JS {
|
||||
|
||||
JS_PUBLIC_API(JSObject *)
|
||||
CloneFunctionObject(JSContext *cx, HandleObject funobj, AutoObjectVector &scopeChain)
|
||||
{
|
||||
RootedObject dynamicScope(cx);
|
||||
RootedObject unusedStaticScope(cx);
|
||||
if (!CreateScopeObjectsForScopeChain(cx, scopeChain, &dynamicScope, &unusedStaticScope))
|
||||
return nullptr;
|
||||
|
||||
return JS_CloneFunctionObject(cx, funobj, dynamicScope);
|
||||
}
|
||||
|
||||
} // namespace JS
|
||||
|
||||
JS_PUBLIC_API(JSObject *)
|
||||
JS_GetFunctionObject(JSFunction *fun)
|
||||
{
|
||||
|
|
|
@ -3534,6 +3534,18 @@ JS_DefineFunctionById(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid>
|
|||
extern JS_PUBLIC_API(JSObject *)
|
||||
JS_CloneFunctionObject(JSContext *cx, JS::Handle<JSObject*> funobj, JS::Handle<JSObject*> parent);
|
||||
|
||||
namespace JS {
|
||||
|
||||
/*
|
||||
* As above, but providing an explicit scope chain. scopeChain must not include
|
||||
* the global object on it; that's implicit. It needs to contain the other
|
||||
* objects that should end up on the clone's scope chain.
|
||||
*/
|
||||
extern JS_PUBLIC_API(JSObject *)
|
||||
CloneFunctionObject(JSContext *cx, HandleObject funobj, AutoObjectVector &scopeChain);
|
||||
|
||||
} // namespace JS
|
||||
|
||||
/*
|
||||
* Given a buffer, return false if the buffer might become a valid
|
||||
* javascript statement with the addition of more lines. Otherwise return
|
||||
|
|
Загрузка…
Ссылка в новой задаче