Root new function objects before calling JS_SetReservedSlot on them. b=307560 r=brendan sr=jst

git-svn-id: svn://10.0.0.236/trunk@190772 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
dbaron%dbaron.org
2006-02-22 00:50:47 +00:00
parent 373f77a74d
commit 59d3ff8e4a

View File

@@ -1,5 +1,6 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
// vim:cindent:ts=8:et:sw=4:
/*
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -56,6 +57,8 @@ xpc_CloneJSFunction(XPCCallContext &ccx, JSObject *funobj, JSObject *parent)
if(!clone)
return nsnull;
AUTO_MARK_JSVAL(ccx, OBJECT_TO_JSVAL(clone));
XPCWrappedNativeScope *scope =
XPCWrappedNativeScope::FindInJSObjectScope(ccx, parent);
@@ -186,6 +189,8 @@ XPCNativeMember::Resolve(XPCCallContext& ccx, XPCNativeInterface* iface)
if(!funobj)
return JS_FALSE;
AUTO_MARK_JSVAL(ccx, OBJECT_TO_JSVAL(funobj));
if(!JS_SetReservedSlot(ccx, funobj, 0, PRIVATE_TO_JSVAL(iface))||
!JS_SetReservedSlot(ccx, funobj, 1, PRIVATE_TO_JSVAL(this)))
return JS_FALSE;