mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
fixes bug 108267 "scale back NS_BINDING_REDIRECTED proliferation"
r=gagan, sr=rpotts
This commit is contained in:
parent
e460f31d71
commit
16c15bf9cb
@ -414,13 +414,7 @@ nsURLFetcher::OnStateChange(nsIWebProgress *aProgress, nsIRequest *aRequest,
|
||||
// the url....
|
||||
|
||||
if (NS_FAILED(aStatus))
|
||||
{
|
||||
//... but we must ignore abort message caused by a redirection!
|
||||
if (aStatus == NS_BINDING_REDIRECTED)
|
||||
return NS_OK;
|
||||
|
||||
OnStopRequest(aRequest, nsnull, aStatus);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -445,13 +445,6 @@ ProxyListener::~ProxyListener()
|
||||
/* void onStartRequest (in nsIRequest request, in nsISupports ctxt); */
|
||||
NS_IMETHODIMP ProxyListener::OnStartRequest(nsIRequest *aRequest, nsISupports *ctxt)
|
||||
{
|
||||
// if the request has been redirected, then we'll get another pair
|
||||
// of OnStartRequest/OnStopRequest from the new request.
|
||||
nsresult status = 0;
|
||||
aRequest->GetStatus(&status);
|
||||
if (status == NS_BINDING_REDIRECTED)
|
||||
return NS_OK;
|
||||
|
||||
if (!mDestListener)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
@ -490,11 +483,6 @@ NS_IMETHODIMP ProxyListener::OnStartRequest(nsIRequest *aRequest, nsISupports *c
|
||||
/* void onStopRequest (in nsIRequest request, in nsISupports ctxt, in nsresult status); */
|
||||
NS_IMETHODIMP ProxyListener::OnStopRequest(nsIRequest *aRequest, nsISupports *ctxt, nsresult status)
|
||||
{
|
||||
// if the request has been redirected, then we'll get another pair
|
||||
// of OnStartRequest/OnStopRequest from the new request.
|
||||
if (status == NS_BINDING_REDIRECTED)
|
||||
return NS_OK;
|
||||
|
||||
if (!mDestListener)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
@ -128,11 +128,6 @@ NS_IMETHODIMP
|
||||
nsDownloader::OnStopRequest(nsIRequest *request, nsISupports *ctxt,
|
||||
nsresult aStatus)
|
||||
{
|
||||
// if the request has been redirected, then we'll get another pair
|
||||
// of OnStartRequest/OnStopRequest from the new request.
|
||||
if (aStatus == NS_BINDING_REDIRECTED)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIFile> file;
|
||||
if (NS_SUCCEEDED(aStatus))
|
||||
{
|
||||
|
@ -128,9 +128,7 @@ NS_IMETHODIMP
|
||||
nsStreamLoader::OnStopRequest(nsIRequest* request, nsISupports *ctxt,
|
||||
nsresult aStatus)
|
||||
{
|
||||
// if the request has been redirected, then we'll get another pair
|
||||
// of OnStartRequest/OnStopRequest from the new request.
|
||||
if ((aStatus != NS_BINDING_REDIRECTED) && mObserver) {
|
||||
if (mObserver) {
|
||||
// provide nsIStreamLoader::request during call to OnStreamComplete
|
||||
mRequest = request;
|
||||
mObserver->OnStreamComplete(this, mContext, aStatus,
|
||||
|
@ -179,10 +179,6 @@ nsURIChecker::OnStartRequest(nsIRequest *aRequest, nsISupports *aCtxt)
|
||||
{
|
||||
nsresult status;
|
||||
nsresult rv = aRequest->GetStatus(&status);
|
||||
// if the request has been redirected, then we'll get another pair
|
||||
// of OnStartRequest/OnStopRequest from the new request.
|
||||
if (status == NS_BINDING_REDIRECTED)
|
||||
return NS_OK;
|
||||
// DNS errors and other obvious problems will return failure status
|
||||
if (NS_FAILED(rv) || NS_FAILED(status)) {
|
||||
SetStatusAndCallBack(NS_BINDING_FAILED);
|
||||
|
@ -345,7 +345,7 @@ nsHttpChannel::AsyncRedirect_EventCleanupFunc(PLEvent *ev)
|
||||
void
|
||||
nsHttpChannel::HandleAsyncRedirect()
|
||||
{
|
||||
nsresult rv;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
LOG(("nsHttpChannel::HandleAsyncRedirect [this=%p]\n", this));
|
||||
|
||||
@ -354,24 +354,18 @@ nsHttpChannel::HandleAsyncRedirect()
|
||||
// in processing the redirect.
|
||||
if (NS_SUCCEEDED(mStatus)) {
|
||||
rv = ProcessRedirection(mResponseHead->Status());
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = NS_BINDING_REDIRECTED;
|
||||
mStatus = rv;
|
||||
if (NS_FAILED(rv))
|
||||
mStatus = rv;
|
||||
}
|
||||
|
||||
mListener->OnStartRequest(this, mListenerContext);
|
||||
|
||||
// close the cache entry... no need to destroy it.
|
||||
CloseCacheEntry(NS_OK);
|
||||
// close the cache entry... blow it away if we couldn't process
|
||||
// the redirect for some reason.
|
||||
CloseCacheEntry(rv);
|
||||
|
||||
mIsPending = PR_FALSE;
|
||||
mListener->OnStopRequest(this, mListenerContext, mStatus);
|
||||
|
||||
if (mLoadGroup)
|
||||
mLoadGroup->RemoveRequest(this, nsnull, mStatus);
|
||||
|
||||
mListener = 0;
|
||||
mListenerContext = 0;
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -1229,13 +1223,16 @@ nsHttpChannel::ProcessRedirection(PRUint32 redirectType)
|
||||
rv = newChannel->AsyncOpen(mListener, mListenerContext);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// close down this transaction (null if processing a cached redirect)
|
||||
if (mTransaction) {
|
||||
mStatus = NS_BINDING_REDIRECTED;
|
||||
mTransaction->Cancel(NS_BINDING_REDIRECTED);
|
||||
mListener->OnStartRequest(this, mListenerContext);
|
||||
}
|
||||
// set redirect status
|
||||
mStatus = NS_BINDING_REDIRECTED;
|
||||
|
||||
// close down this transaction (null if processing a cached redirect)
|
||||
if (mTransaction)
|
||||
mTransaction->Cancel(NS_BINDING_REDIRECTED);
|
||||
|
||||
// disconnect from our listener
|
||||
mListener = 0;
|
||||
mListenerContext = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -501,12 +501,6 @@ nsStreamXferOp::OnStopRequest( nsIRequest *request,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// A request has been redirected. We ignore this "failure" and pick up with the
|
||||
// subsequent OnStartRequest for the redirected URL.
|
||||
if ( aStatus == NS_BINDING_REDIRECTED ) {
|
||||
return NS_OK;
|
||||
}
|
||||
#endif // USE_ASYNC_READ
|
||||
|
||||
// If an error occurred, shut down.
|
||||
|
Loading…
Reference in New Issue
Block a user