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
Родитель 2513cf740a
Коммит 4c5f7a4d5b
1 изменённых файлов: 7 добавлений и 3 удалений

Просмотреть файл

@ -173,6 +173,13 @@ XPCJSContextStack::InitSafeJSContext()
JS_SetErrorReporter(mSafeJSContext, xpc::SystemErrorReporter); 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; JS::CompartmentOptions options;
options.setZone(JS::SystemZone) options.setZone(JS::SystemZone)
.setTrace(TraceXPCGlobal); .setTrace(TraceXPCGlobal);
@ -194,8 +201,5 @@ XPCJSContextStack::InitSafeJSContext()
if (NS_FAILED(xpc->InitClasses(mSafeJSContext, mSafeJSContextGlobal))) if (NS_FAILED(xpc->InitClasses(mSafeJSContext, mSafeJSContextGlobal)))
MOZ_CRASH(); MOZ_CRASH();
JS::RootedObject glob(mSafeJSContext, mSafeJSContextGlobal);
JS_FireOnNewGlobalObject(mSafeJSContext, glob);
return mSafeJSContext; return mSafeJSContext;
} }