diff --git a/mozilla/modules/plugin/base/src/ns4xPluginInstance.cpp b/mozilla/modules/plugin/base/src/ns4xPluginInstance.cpp index 5ef8c678001..e1dc05fc8b0 100644 --- a/mozilla/modules/plugin/base/src/ns4xPluginInstance.cpp +++ b/mozilla/modules/plugin/base/src/ns4xPluginInstance.cpp @@ -631,8 +631,14 @@ ns4xPluginStreamListener::OnStopBinding(nsIPluginStreamInfo* pluginInfo, // check if the stream is of seekable type and later its destruction // see bug 91140 nsresult rv = NS_OK; - if(mStreamType != nsPluginStreamType_Seek) - rv = CleanUpStream(NPRES_DONE); + if(mStreamType != nsPluginStreamType_Seek) { + NPReason reason = NPRES_DONE; + + if (NS_FAILED(status)) + reason = NPRES_NETWORK_ERR; // since the stream failed, we need to tell the plugin that + + rv = CleanUpStream(reason); + } if(rv != NPERR_NO_ERROR) return NS_ERROR_FAILURE; diff --git a/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp b/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp index 217137de966..57a6f785f89 100644 --- a/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp +++ b/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp @@ -1238,8 +1238,11 @@ private: nsIPluginInstanceOwner *mOwner; nsIPluginInstance *mInstance; nsIPluginStreamListener *mPStreamListener; - nsPluginStreamInfo *mPluginStreamInfo; - PRBool mSetUpListener; + nsPluginStreamInfo *mPluginStreamInfo; + PRPackedBool mSetUpListener; + + // Set to PR_TRUE if we request failed (like with a HTTP response of 404) + PRPackedBool mRequestFailed; /* * Set to PR_TRUE after nsIPluginInstancePeer::OnStartBinding() has @@ -1684,6 +1687,7 @@ nsPluginStreamListenerPeer::nsPluginStreamListenerPeer() mStartBinding = PR_FALSE; mLocalFile = nsnull; mAbort = PR_FALSE; + mRequestFailed = PR_FALSE; mPendingRequests = 0; mHaveFiredOnStartRequest = PR_FALSE; @@ -1953,9 +1957,11 @@ nsPluginStreamListenerPeer::OnStartRequest(nsIRequest *request, nsISupports* aCo PRUint32 responseCode = 0; rv = httpChannel->GetResponseStatus(&responseCode); if (NS_FAILED(rv) || responseCode > 206) { // not normal - // NPP_Notyfy() will be called from OnStopRequest + // NPP_Notify() will be called from OnStopRequest // in ns4xPluginStreamListener::CleanUpStream // return error will cancel this request + // ...and we also need to tell the plugin that + mRequestFailed = PR_TRUE; return NS_ERROR_FAILURE; } @@ -2336,6 +2342,10 @@ NS_IMETHODIMP nsPluginStreamListenerPeer::OnStopRequest(nsIRequest *request, if (aContentType) mPluginStreamInfo->SetContentType(aContentType); + // set error status if stream failed so we notify the plugin + if (mRequestFailed) + aStatus = NS_ERROR_FAILURE; + // on error status cleanup the stream if (mStartBinding || NS_FAILED(aStatus)) {