mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-05 08:35:26 +00:00
Use the currently executing function as the nominal parent for our function so that we pull the correct prototype for our function. bug 370127, r+sr=jst
This commit is contained in:
parent
32aa4e72ac
commit
8a5949ceb1
@ -231,13 +231,15 @@ WrapFunction(JSContext* cx, JSObject* funobj, jsval *rval)
|
||||
// function's parent will be the original function and that's how we
|
||||
// get the right thing to call when this function is called.
|
||||
JSFunction *funWrapper =
|
||||
::JS_NewFunction(cx, XPC_NW_FunctionWrapper, 0, 0, funobj,
|
||||
::JS_NewFunction(cx, XPC_NW_FunctionWrapper, 0, 0, nsnull,
|
||||
"XPCNativeWrapper function wrapper");
|
||||
if (!funWrapper) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
*rval = OBJECT_TO_JSVAL(::JS_GetFunctionObject(funWrapper));
|
||||
JSObject* funWrapperObj = ::JS_GetFunctionObject(funWrapper);
|
||||
::JS_SetParent(cx, funWrapperObj, funobj);
|
||||
*rval = OBJECT_TO_JSVAL(funWrapperObj);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user