Bug 941766 - Fix an exact rooting hazard in NPAPI; r=johns

--HG--
extra : rebase_source : f82a0e94f689ce0c5b88e05d9ae56ef52ce2f662
This commit is contained in:
Terrence Cole 2013-12-06 13:52:13 -08:00
parent cef6a4d1df
commit 4966a3b266

View File

@ -1007,11 +1007,8 @@ nsJSObjWrapper::GetNewOrUsed(NPP npp, JSContext *cx, JS::Handle<JSObject*> obj)
}
}
nsJSObjWrapperKey key(obj, npp);
JSObjWrapperTable::AddPtr p = sJSObjWrappers.lookupForAdd(key);
if (p/* && p->value()*/) {
JSObjWrapperTable::Ptr p = sJSObjWrappers.lookupForAdd(nsJSObjWrapperKey(obj, npp));
if (p) {
MOZ_ASSERT(p->value());
// Found a live nsJSObjWrapper, return it.
@ -1030,7 +1027,8 @@ nsJSObjWrapper::GetNewOrUsed(NPP npp, JSContext *cx, JS::Handle<JSObject*> obj)
wrapper->mJSObj = obj;
if (!sJSObjWrappers.add(p, key, wrapper)) {
nsJSObjWrapperKey key(obj, npp);
if (!sJSObjWrappers.putNew(key, wrapper)) {
// Out of memory, free the wrapper we created.
_releaseobject(wrapper);
return nullptr;