mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-31 11:01:40 +00:00
Fixing bug 434673. Fix GC safety issue when calling through XPCWrapper into an IDL defined function. r+sr=brendan@mozilla.org, a=shaver@mozilla.org
This commit is contained in:
parent
5fb49e58d7
commit
639c1461f9
@ -1391,14 +1391,7 @@ public:
|
||||
*pval = mVal; return JS_TRUE;}
|
||||
|
||||
JSBool NewFunctionObject(XPCCallContext& ccx, XPCNativeInterface* iface,
|
||||
JSObject *parent, jsval* pval)
|
||||
{NS_ASSERTION(!IsConstant(),
|
||||
"Only call this if you're sure this is not a constant!");
|
||||
if(!IsResolved() && !Resolve(ccx, iface)) return JS_FALSE;
|
||||
JSObject* funobj =
|
||||
xpc_CloneJSFunction(ccx, JSVAL_TO_OBJECT(mVal), parent);
|
||||
if(!funobj) return JS_FALSE;
|
||||
*pval = OBJECT_TO_JSVAL(funobj); return JS_TRUE;}
|
||||
JSObject *parent, jsval* pval);
|
||||
|
||||
JSBool IsMethod() const
|
||||
{return 0 != (mFlags & METHOD);}
|
||||
|
@ -109,6 +109,27 @@ XPCNativeMember::GetCallInfo(XPCCallContext& ccx,
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSBool
|
||||
XPCNativeMember::NewFunctionObject(XPCCallContext& ccx,
|
||||
XPCNativeInterface* iface, JSObject *parent,
|
||||
jsval* pval)
|
||||
{
|
||||
NS_ASSERTION(!IsConstant(),
|
||||
"Only call this if you're sure this is not a constant!");
|
||||
if(!IsResolved() && !Resolve(ccx, iface))
|
||||
return JS_FALSE;
|
||||
|
||||
AUTO_MARK_JSVAL(ccx, &mVal);
|
||||
JSObject* funobj =
|
||||
xpc_CloneJSFunction(ccx, JSVAL_TO_OBJECT(mVal), parent);
|
||||
if(!funobj)
|
||||
return JS_FALSE;
|
||||
|
||||
*pval = OBJECT_TO_JSVAL(funobj);
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSBool
|
||||
XPCNativeMember::Resolve(XPCCallContext& ccx, XPCNativeInterface* iface)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user