Pass correct NPReason code to NPP_URLNotify when error with request (like 404) bug 130152 r=av sr=darin a=dbaron
git-svn-id: svn://10.0.0.236/trunk@116767 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user