diff --git a/uriloader/base/nsURILoader.cpp b/uriloader/base/nsURILoader.cpp index cfefba9bf0a5..a75b03f6df43 100644 --- a/uriloader/base/nsURILoader.cpp +++ b/uriloader/base/nsURILoader.cpp @@ -100,10 +100,6 @@ public: protected: virtual ~nsDocumentOpenInfo(); nsDocumentOpenInfo* Clone(); - // ProcessCanceledCase will do a couple of things....(1) it checks to see if the channel was canceled, - // if it was, it will go out and release all of the document open info's local state for this load - // and it will return TRUE. - PRBool ProcessCanceledCase(nsIRequest *request); protected: nsCOMPtr m_contentListener; @@ -144,33 +140,6 @@ nsDocumentOpenInfo* nsDocumentOpenInfo::Clone() return newObject; } -// ProcessCanceledCase will do a couple of things....(1) it checks to see if the channel was canceled, -// if it was, it will go out and release all of the document open info's local state for this load -// and it will return TRUE. -PRBool nsDocumentOpenInfo::ProcessCanceledCase(nsIRequest *request) -{ - PRBool canceled = PR_FALSE; - nsresult rv = NS_OK; - - if (request) - { - request->GetStatus(&rv); - - // if we were aborted or if the js returned no result (i.e. we aren't replacing any window content) - if (rv == NS_BINDING_ABORTED || rv == NS_ERROR_DOM_RETVAL_UNDEFINED) - { - canceled = PR_TRUE; - // free any local state for this load since we are aborting it so we - // can break any cycles... - m_contentListener = nsnull; - m_targetStreamListener = nsnull; - m_originalContext = nsnull; - } - } - - return canceled; -} - nsresult nsDocumentOpenInfo::Open(nsIChannel *aChannel, PRBool aIsContentPreferred, nsISupports * aWindowContext) @@ -235,8 +204,23 @@ NS_IMETHODIMP nsDocumentOpenInfo::OnStartRequest(nsIRequest *request, nsISupport } } - if (ProcessCanceledCase(request)) + // + // Make sure that the transaction has succeeded, so far... + // + nsresult status; + + rv = request->GetStatus(&status); + + NS_ASSERTION(NS_SUCCEEDED(rv), "Unable to get request status!"); + if (NS_FAILED(rv)) return rv; + + if (NS_FAILED(status)) { + // + // The transaction has already reported an error - so it will be torn + // down. Therefore, it is not necessary to return an error code... + // return NS_OK; + } rv = DispatchContent(request, aCtxt); if (m_targetStreamListener) @@ -252,9 +236,6 @@ NS_IMETHODIMP nsDocumentOpenInfo::OnDataAvailable(nsIRequest *request, nsISuppor nsresult rv = NS_OK; - if (ProcessCanceledCase(request)) - return NS_OK; - if (m_targetStreamListener) rv = m_targetStreamListener->OnDataAvailable(request, aCtxt, inStr, sourceOffset, count); return rv; @@ -271,6 +252,10 @@ NS_IMETHODIMP nsDocumentOpenInfo::OnStopRequest(nsIRequest *request, nsISupports listener->OnStopRequest(request, aCtxt, aStatus); } + // Remember... + // In the case of multiplexed streams (such as multipart/x-mixed-replace) + // these stream listener methods could be called again :-) + // return NS_OK; }