From 59d3ff8e4ab9389908ade89f842ab8b886e25364 Mon Sep 17 00:00:00 2001 From: "dbaron%dbaron.org" Date: Wed, 22 Feb 2006 00:50:47 +0000 Subject: [PATCH] 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 --- mozilla/js/src/xpconnect/src/xpcwrappednativeinfo.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mozilla/js/src/xpconnect/src/xpcwrappednativeinfo.cpp b/mozilla/js/src/xpconnect/src/xpcwrappednativeinfo.cpp index cbd93a98680..dd161b38e09 100644 --- a/mozilla/js/src/xpconnect/src/xpcwrappednativeinfo.cpp +++ b/mozilla/js/src/xpconnect/src/xpcwrappednativeinfo.cpp @@ -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;