mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 04:15:43 +00:00
Bug 897322 - Assert when scripts are created that we've fired onNewGlobalObject. r=jimb
This commit is contained in:
parent
629aa44c5b
commit
fa44cda1c7
@ -42,6 +42,9 @@ JSCompartment::JSCompartment(Zone *zone, const JS::CompartmentOptions &options =
|
||||
principals(NULL),
|
||||
isSystem(false),
|
||||
marked(true),
|
||||
#ifdef DEBUG
|
||||
firedOnNewGlobalObject(false),
|
||||
#endif
|
||||
global_(NULL),
|
||||
enterCompartmentDepth(0),
|
||||
lastCodeRelease(0),
|
||||
|
@ -130,6 +130,10 @@ struct JSCompartment
|
||||
bool isSystem;
|
||||
bool marked;
|
||||
|
||||
#ifdef DEBUG
|
||||
bool firedOnNewGlobalObject;
|
||||
#endif
|
||||
|
||||
void mark() { marked = true; }
|
||||
|
||||
private:
|
||||
|
@ -677,6 +677,11 @@ Debugger::onNewScript(JSContext *cx, HandleScript script, GlobalObject *compileA
|
||||
{
|
||||
JS_ASSERT_IF(script->compileAndGo, compileAndGoGlobal);
|
||||
JS_ASSERT_IF(script->compileAndGo, compileAndGoGlobal == &script->global());
|
||||
// We early return in slowPathOnNewScript for self-hosted scripts, so we can
|
||||
// ignore those in our assertion here.
|
||||
JS_ASSERT_IF(!script->compartment()->options().invisibleToDebugger &&
|
||||
!script->selfHosted,
|
||||
script->compartment()->firedOnNewGlobalObject);
|
||||
JS_ASSERT_IF(!script->compileAndGo, !compileAndGoGlobal);
|
||||
if (!script->compartment()->getDebuggees().empty())
|
||||
slowPathOnNewScript(cx, script, compileAndGoGlobal);
|
||||
@ -685,6 +690,10 @@ Debugger::onNewScript(JSContext *cx, HandleScript script, GlobalObject *compileA
|
||||
void
|
||||
Debugger::onNewGlobalObject(JSContext *cx, Handle<GlobalObject *> global)
|
||||
{
|
||||
JS_ASSERT(!global->compartment()->firedOnNewGlobalObject);
|
||||
#ifdef DEBUG
|
||||
global->compartment()->firedOnNewGlobalObject = true;
|
||||
#endif
|
||||
if (!JS_CLIST_IS_EMPTY(&cx->runtime()->onNewGlobalObjectWatchers))
|
||||
Debugger::slowPathOnNewGlobalObject(cx, global);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user