Bug 899759 - Prevent JS_NondeterministicGetWeakMapKeys from GCing while iterating over a weakmap (r=sfink)

This commit is contained in:
Bill McCloskey
2013-07-31 11:45:37 -07:00
parent 0db9ca5a48
commit 9196927873

View File

@@ -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()))