diff --git a/dom/plugins/base/nsNPAPIPluginStreamListener.cpp b/dom/plugins/base/nsNPAPIPluginStreamListener.cpp index aca8809ff077..d44a7614dfce 100644 --- a/dom/plugins/base/nsNPAPIPluginStreamListener.cpp +++ b/dom/plugins/base/nsNPAPIPluginStreamListener.cpp @@ -208,14 +208,17 @@ nsNPAPIPluginStreamListener::CleanUpStream(NPReason reason) // Seekable streams have an extra addref when they are created which must // be matched here. - if (NP_SEEK == mStreamType) + if (NP_SEEK == mStreamType && mStreamStarted) NS_RELEASE_THIS(); - + + if (mStreamListenerPeer) { + mStreamListenerPeer->CancelRequests(NS_BINDING_ABORTED); + mStreamListenerPeer = nullptr; + } + if (!mInst || !mInst->CanFireNotifications()) return rv; - mStreamListenerPeer = nullptr; - PluginDestructionGuard guard(mInst); nsNPAPIPlugin* plugin = mInst->GetPlugin(); @@ -280,7 +283,7 @@ nsNPAPIPluginStreamListener::CallURLNotify(NPReason reason) nsresult nsNPAPIPluginStreamListener::OnStartBinding(nsPluginStreamListenerPeer* streamPeer) { - if (!mInst || !mInst->CanFireNotifications()) + if (!mInst || !mInst->CanFireNotifications() || mStreamCleanedUp) return NS_ERROR_FAILURE; PluginDestructionGuard guard(mInst);