Bug 784730 - Crash in ReparentWrapperIfFound if wrapper already in scope. r=bholley

This commit is contained in:
Andrew McCreight 2013-02-06 12:18:54 +00:00
parent b43577c768
commit 2093b2df88
2 changed files with 3 additions and 2 deletions

View File

@ -107,6 +107,7 @@ public:
{
NS_PRECONDITION(wrapper,"bad param");
nsISupports* obj = wrapper->GetIdentityObject();
MOZ_ASSERT(!Find(obj), "wrapper already in new scope!");
Entry* entry = (Entry*)
JS_DHashTableOperate(mTable, obj, JS_DHASH_ADD);
if (!entry)

View File

@ -1582,8 +1582,8 @@ XPCWrappedNative::ReparentWrapperIfFound(XPCCallContext& ccx,
wrapper->UpdateScriptableInfo(newProto->GetScriptableInfo());
}
NS_ASSERTION(!newMap->Find(wrapper->GetIdentityObject()),
"wrapper already in new scope!");
if (newMap->Find(wrapper->GetIdentityObject()))
MOZ_CRASH();
if (!newMap->Add(wrapper))
MOZ_CRASH();