Bug 1001198 - Stop firing onNewGlobalObject for the SafeJSContext global. r=gabor

This commit is contained in:
Bobby Holley 2014-05-06 23:17:43 -07:00
parent 648f667734
commit f54ff48188

View File

@ -173,6 +173,13 @@ XPCJSContextStack::InitSafeJSContext()
JS_SetErrorReporter(mSafeJSContext, xpc::SystemErrorReporter);
// Note - We intentionally avoid firing OnNewGlobalObject while
// simultaneously skipping the call to setInvisibleToDebugger(true) here.
// This lets us piggy-back on the assertions in the JS engine (which make
// sure that, for non-invisible globals, we always fire onNewGlobalObject
// before creating scripts), to assert that we never create scripts with
// the SafeJSContextGlobal. This is all happening way before anyone could be
// listening for debugger notifications anyway.
JS::CompartmentOptions options;
options.setZone(JS::SystemZone)
.setTrace(TraceXPCGlobal);
@ -194,8 +201,5 @@ XPCJSContextStack::InitSafeJSContext()
if (NS_FAILED(xpc->InitClasses(mSafeJSContext, mSafeJSContextGlobal)))
MOZ_CRASH();
JS::RootedObject glob(mSafeJSContext, mSafeJSContextGlobal);
JS_FireOnNewGlobalObject(mSafeJSContext, glob);
return mSafeJSContext;
}