Bug 990787, part 8 - Add an OOM check in WeakMap_set_impl. r=Waldo.

--HG--
extra : rebase_source : e97b20a18d5cc0b3f76f2bd2333a18cf5587fbaf
This commit is contained in:
Jason Orendorff 2014-04-08 12:35:19 -05:00
parent 41dd38dcf1
commit 84614f9b19

View File

@ -312,6 +312,8 @@ WeakMap_set_impl(JSContext *cx, CallArgs args)
ObjectValueMap *map = thisObj->as<WeakMapObject>().getMap();
if (!map) {
map = cx->new_<ObjectValueMap>(cx, thisObj.get());
if (!map)
return false;
if (!map->init()) {
js_delete(map);
JS_ReportOutOfMemory(cx);