Bug 1044205 - Invoke XPCWrappedNativeScope::TraceSelf from TraceXPCGlobal. r=billm

This commit is contained in:
Bobby Holley 2014-07-29 08:48:32 -07:00
parent 85a6735f8c
commit 5bfdc1a8eb
4 changed files with 13 additions and 14 deletions

View File

@ -2504,15 +2504,7 @@ ConvertExceptionToPromise(JSContext* cx,
void
CreateGlobalOptions<nsGlobalWindow>::TraceGlobal(JSTracer* aTrc, JSObject* aObj)
{
mozilla::dom::TraceProtoAndIfaceCache(aTrc, aObj);
// We might be called from a GC during the creation of a global, before we've
// been able to set up the compartment private or the XPCWrappedNativeScope,
// so we need to null-check those.
xpc::CompartmentPrivate* compartmentPrivate = xpc::CompartmentPrivate::Get(aObj);
if (compartmentPrivate && compartmentPrivate->scope) {
compartmentPrivate->scope->TraceSelf(aTrc);
}
xpc::TraceXPCGlobal(aTrc, aObj);
}
/* static */

View File

@ -298,10 +298,17 @@ static inline T UnexpectedFailure(T rv)
}
void
TraceXPCGlobal(JSTracer *trc, JSObject *obj)
xpc::TraceXPCGlobal(JSTracer *trc, JSObject *obj)
{
if (js::GetObjectClass(obj)->flags & JSCLASS_DOM_GLOBAL)
mozilla::dom::TraceProtoAndIfaceCache(trc, obj);
// We might be called from a GC during the creation of a global, before we've
// been able to set up the compartment private or the XPCWrappedNativeScope,
// so we need to null-check those.
xpc::CompartmentPrivate* compartmentPrivate = xpc::CompartmentPrivate::Get(obj);
if (compartmentPrivate && compartmentPrivate->scope)
compartmentPrivate->scope->TraceSelf(trc);
}
namespace xpc {

View File

@ -1987,9 +1987,6 @@ private:
void *xpc_GetJSPrivate(JSObject *obj);
void
TraceXPCGlobal(JSTracer *trc, JSObject *obj);
/***************************************************************************/
// XPCWrappedNative the wrapper around one instance of a native xpcom object
// to be used from JavaScript.
@ -2180,7 +2177,7 @@ public:
GetScope()->TraceSelf(trc);
if (mFlatJSObject && JS_IsGlobalObject(mFlatJSObject))
{
TraceXPCGlobal(trc, mFlatJSObject);
xpc::TraceXPCGlobal(trc, mFlatJSObject);
}
}

View File

@ -139,6 +139,9 @@ IsXrayWrapper(JSObject *obj);
JSObject *
XrayAwareCalleeGlobal(JSObject *fun);
void
TraceXPCGlobal(JSTracer *trc, JSObject *obj);
} /* namespace xpc */
namespace JS {