Bug 980537 - Only store FakeBackstagePass instances in mThisObjects. r=khuey

This commit is contained in:
Bobby Holley 2014-04-06 12:32:39 -07:00
parent 5c2ac5c86b
commit 8daf887f60

View File

@ -566,7 +566,9 @@ mozJSComponentLoader::NoteSubScript(HandleScript aScript, HandleObject aThisObje
MOZ_CRASH();
}
mThisObjects.Put(aScript, aThisObject);
if (js::GetObjectJSClass(aThisObject) == &kFakeBackstagePassJSClass) {
mThisObjects.Put(aScript, aThisObject);
}
}
/* static */ size_t
@ -1012,10 +1014,13 @@ mozJSComponentLoader::ObjectForLocation(nsIFile *aComponentFile,
*aTableScript = tableScript;
// tableScript stays in the table until shutdown. To avoid it being
// collected and another script getting the same address, we root
// tableScript lower down in this function.
mThisObjects.Put(tableScript, obj);
if (js::GetObjectJSClass(obj) == &kFakeBackstagePassJSClass) {
MOZ_ASSERT(mReuseLoaderGlobal);
// tableScript stays in the table until shutdown. To avoid it being
// collected and another script getting the same address, we root
// tableScript lower down in this function.
mThisObjects.Put(tableScript, obj);
}
bool ok = false;
{