Bug 1137336 - Explicitly disallow WeakMapTracer.callback from GCing, r=terrence

This commit is contained in:
Steve Fink
2015-03-02 10:25:16 -08:00
parent b3b8af424a
commit b853382044
2 changed files with 7 additions and 1 deletions

View File

@@ -14,6 +14,7 @@
#include "jsobj.h"
#include "jswrapper.h"
#include "js/GCAPI.h"
#include "vm/GlobalObject.h"
#include "vm/WeakMapObject.h"
@@ -132,8 +133,11 @@ WeakMapBase::traceAllMappings(WeakMapTracer *tracer)
{
JSRuntime *rt = tracer->runtime;
for (CompartmentsIter c(rt, SkipAtoms); !c.done(); c.next()) {
for (WeakMapBase *m = c->gcWeakMapList; m; m = m->next)
for (WeakMapBase *m = c->gcWeakMapList; m; m = m->next) {
// The WeakMapTracer callback is not allowed to GC.
JS::AutoSuppressGCAnalysis nogc;
m->traceMappings(tracer);
}
}
}