Bug 904835 - Don't stomp on the new plugin's prototype if we load a plugin nested inside unloading a plugin. r=josh

This commit is contained in:
John Schoenick 2013-09-05 13:54:58 -07:00
parent 46be07f2c1
commit 07c93d89be

View File

@ -2399,6 +2399,14 @@ nsObjectLoadingContent::UnloadObject(bool aResetState)
mScriptRequested = false;
if (!mInstanceOwner) {
// The protochain is normally thrown out after a plugin stops, but if we
// re-enter while stopping a plugin and try to load something new, we need
// to throw away the old protochain in the nested unload.
TeardownProtoChain();
mIsStopping = false;
}
// This call should be last as it may re-enter
StopPluginInstance();
}
@ -2786,9 +2794,17 @@ nsObjectLoadingContent::DoStopPlugin(nsPluginInstanceOwner* aInstanceOwner,
NS_ASSERTION(pluginHost, "No plugin host?");
pluginHost->StopPluginInstance(inst);
}
TeardownProtoChain();
aInstanceOwner->Destroy();
// If we re-enter in plugin teardown UnloadObject will tear down the
// protochain -- the current protochain could be from a new, unrelated, load.
if (!mIsStopping) {
LOG(("OBJLC [%p]: Re-entered in plugin teardown", this));
return;
}
TeardownProtoChain();
mIsStopping = false;
}