Bug 916829 - Ensure Debugger::markAll() really marks all debugger weakmaps r=terrence

This commit is contained in:
Jon Coppeard 2013-09-23 10:42:53 +01:00
Родитель 5adc3c9cfa
Коммит 8efea3f164
1 изменённых файлов: 12 добавлений и 18 удалений

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

@ -1526,33 +1526,27 @@ void
Debugger::markAll(JSTracer *trc) Debugger::markAll(JSTracer *trc)
{ {
JSRuntime *rt = trc->runtime; JSRuntime *rt = trc->runtime;
for (CompartmentsIter c(rt); !c.done(); c.next()) { for (Debugger *dbg = rt->debuggerList.getFirst(); dbg; dbg = dbg->getNext()) {
GlobalObjectSet &debuggees = c->getDebuggees(); GlobalObjectSet &debuggees = dbg->debuggees;
for (GlobalObjectSet::Enum e(debuggees); !e.empty(); e.popFront()) { for (GlobalObjectSet::Enum e(debuggees); !e.empty(); e.popFront()) {
GlobalObject *global = e.front(); GlobalObject *global = e.front();
MarkObjectUnbarriered(trc, &global, "Global Object"); MarkObjectUnbarriered(trc, &global, "Global Object");
if (global != e.front()) if (global != e.front())
e.rekeyFront(global); e.rekeyFront(global);
}
const GlobalObject::DebuggerVector *debuggers = global->getDebuggers(); HeapPtrObject &dbgobj = dbg->toJSObjectRef();
JS_ASSERT(debuggers); MarkObject(trc, &dbgobj, "Debugger Object");
for (Debugger * const *p = debuggers->begin(); p != debuggers->end(); p++) {
Debugger *dbg = *p;
HeapPtrObject &dbgobj = dbg->toJSObjectRef(); dbg->scripts.trace(trc);
MarkObject(trc, &dbgobj, "Debugger Object"); dbg->sources.trace(trc);
dbg->objects.trace(trc);
dbg->environments.trace(trc);
dbg->scripts.trace(trc); for (Breakpoint *bp = dbg->firstBreakpoint(); bp; bp = bp->nextInDebugger()) {
dbg->sources.trace(trc); MarkScriptUnbarriered(trc, &bp->site->script, "breakpoint script");
dbg->objects.trace(trc); MarkObject(trc, &bp->getHandlerRef(), "breakpoint handler");
dbg->environments.trace(trc);
for (Breakpoint *bp = dbg->firstBreakpoint(); bp; bp = bp->nextInDebugger()) {
MarkScriptUnbarriered(trc, &bp->site->script, "breakpoint script");
MarkObject(trc, &bp->getHandlerRef(), "breakpoint handler");
}
}
} }
} }
} }