Bug 899759 - Prevent JS_NondeterministicGetWeakMapKeys from GCing while iterating over a weakmap (r=sfink)
This commit is contained in:
@@ -341,6 +341,8 @@ JS_NondeterministicGetWeakMapKeys(JSContext *cx, JSObject *objArg, JSObject **re
|
||||
return false;
|
||||
ObjectValueMap *map = obj->as<WeakMapObject>().getMap();
|
||||
if (map) {
|
||||
// Prevent GC from mutating the weakmap while iterating.
|
||||
AutoSuppressGC suppress(cx);
|
||||
for (ObjectValueMap::Base::Range r = map->all(); !r.empty(); r.popFront()) {
|
||||
RootedObject key(cx, r.front().key);
|
||||
if (!JS_WrapObject(cx, key.address()))
|
||||
|
||||
Reference in New Issue
Block a user