Bug 854614 - Root xpc_qsUnwrapThis. r=terrence,bholley

This commit is contained in:
Tom Schuster 2013-04-05 21:59:06 +02:00
parent 880dfc46bd
commit acce8e630a
3 changed files with 6 additions and 5 deletions

View File

@ -392,7 +392,7 @@ castNative(JSContext *cx,
template <class T> template <class T>
inline JSBool inline JSBool
xpc_qsUnwrapThis(JSContext *cx, xpc_qsUnwrapThis(JSContext *cx,
JSObject *obj, JS::HandleObject obj,
T **ppThis, T **ppThis,
nsISupports **pThisRef, nsISupports **pThisRef,
jsval *pThisVal, jsval *pThisVal,
@ -401,9 +401,10 @@ xpc_qsUnwrapThis(JSContext *cx,
{ {
XPCWrappedNative *wrapper; XPCWrappedNative *wrapper;
XPCWrappedNativeTearOff *tearoff; XPCWrappedNativeTearOff *tearoff;
nsresult rv = getWrapper(cx, obj, &wrapper, &obj, &tearoff); JS::RootedObject current(cx);
nsresult rv = getWrapper(cx, obj, &wrapper, current.address(), &tearoff);
if (NS_SUCCEEDED(rv)) if (NS_SUCCEEDED(rv))
rv = castNative(cx, wrapper, obj, tearoff, NS_GET_TEMPLATE_IID(T), rv = castNative(cx, wrapper, current, tearoff, NS_GET_TEMPLATE_IID(T),
reinterpret_cast<void **>(ppThis), pThisRef, pThisVal, reinterpret_cast<void **>(ppThis), pThisRef, pThisVal,
lccx); lccx);

View File

@ -57,7 +57,7 @@ NEW_BINDING(nsDOMEvent, Event);
template <> \ template <> \
MOZ_ALWAYS_INLINE JSBool \ MOZ_ALWAYS_INLINE JSBool \
xpc_qsUnwrapThis<_interface>(JSContext *cx, \ xpc_qsUnwrapThis<_interface>(JSContext *cx, \
JSObject *obj, \ JS::HandleObject obj, \
_interface **ppThis, \ _interface **ppThis, \
nsISupports **pThisRef, \ nsISupports **pThisRef, \
jsval *pThisVal, \ jsval *pThisVal, \

View File

@ -833,7 +833,7 @@ def writeQuickStub(f, customMethodCalls, stringtable, member, stubName,
f.write(" XPC_QS_ASSERT_CONTEXT_OK(cx);\n") f.write(" XPC_QS_ASSERT_CONTEXT_OK(cx);\n")
# Compute "this". # Compute "this".
f.write(" JSObject *obj = JS_THIS_OBJECT(cx, vp);\n" f.write(" JS::RootedObject obj(cx, JS_THIS_OBJECT(cx, vp));\n"
" if (!obj)\n" " if (!obj)\n"
" return JS_FALSE;\n") " return JS_FALSE;\n")