зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1137336 - Explicitly disallow WeakMapTracer.callback from GCing, r=terrence
--HG-- extra : rebase_source : 49c1862cdb21a3089f91a3234276ae394e3928e1
This commit is contained in:
Родитель
fe060f5fe7
Коммит
ae44364491
|
@ -480,6 +480,8 @@ struct WeakMapTracer;
|
|||
* weak map that was live at the time of the last garbage collection.
|
||||
*
|
||||
* m will be nullptr if the weak map is not contained in a JS Object.
|
||||
*
|
||||
* The callback should not GC (and will assert in a debug build if it does so.)
|
||||
*/
|
||||
typedef void
|
||||
(* WeakMapTraceCallback)(WeakMapTracer *trc, JSObject *m, JS::GCCellPtr key, JS::GCCellPtr value);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче