зеркало из https://github.com/mozilla/pjs.git
fixes bug 102743 "Crash pressing Back or Forward on O'Reilly website"
r=gagan, sr=rpotts
This commit is contained in:
Родитель
69ba58ac9c
Коммит
1bbb7d1f24
|
@ -445,6 +445,13 @@ 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;
|
||||
|
||||
|
@ -483,6 +490,11 @@ 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;
|
||||
|
||||
|
|
|
@ -80,7 +80,8 @@ interface nsIRequestObserver : nsISupports
|
|||
#define NS_BINDING_FAILED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 1)
|
||||
#define NS_BINDING_ABORTED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 2)
|
||||
|
||||
// The binding has been moved to another request in the same load group:
|
||||
// The binding has been moved to another request in the same load group;
|
||||
// the request observer should expect another On{Start/Stop}Request pair:
|
||||
#define NS_BINDING_REDIRECTED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 3)
|
||||
|
||||
// The binding has been moved to another request in a different load group:
|
||||
|
|
|
@ -128,6 +128,11 @@ 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))
|
||||
{
|
||||
|
|
|
@ -111,9 +111,9 @@ nsStreamLoader::GetNumBytesRead(PRUint32* aNumBytes)
|
|||
|
||||
/* readonly attribute nsIRequest request; */
|
||||
NS_IMETHODIMP
|
||||
nsStreamLoader::GetRequest(nsIRequest * *aRequest)
|
||||
nsStreamLoader::GetRequest(nsIRequest **aRequest)
|
||||
{
|
||||
NS_IF_ADDREF(*aRequest=mRequest);
|
||||
NS_IF_ADDREF(*aRequest = mRequest);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -128,14 +128,19 @@ NS_IMETHODIMP
|
|||
nsStreamLoader::OnStopRequest(nsIRequest* request, nsISupports *ctxt,
|
||||
nsresult aStatus)
|
||||
{
|
||||
nsresult rv;
|
||||
mRequest = request;
|
||||
if (mObserver) {
|
||||
rv = mObserver->OnStreamComplete(this, mContext, aStatus,
|
||||
mData.Length(),
|
||||
mData.get());
|
||||
// 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) {
|
||||
// provide nsIStreamLoader::request during call to OnStreamComplete
|
||||
mRequest = request;
|
||||
mObserver->OnStreamComplete(this, mContext, aStatus,
|
||||
mData.Length(), mData.get());
|
||||
// done.. cleanup
|
||||
mRequest = 0;
|
||||
mObserver = 0;
|
||||
mContext = 0;
|
||||
}
|
||||
return rv;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#define BUF_SIZE 1024
|
||||
|
|
|
@ -177,9 +177,13 @@ NS_IMETHODIMP nsURIChecker::SetLoadFlags(nsLoadFlags aLoadFlags)
|
|||
NS_IMETHODIMP
|
||||
nsURIChecker::OnStartRequest(nsIRequest *aRequest, nsISupports *aCtxt)
|
||||
{
|
||||
// DNS errors and other obvious problems will return failure status
|
||||
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);
|
||||
return NS_OK;
|
||||
|
|
|
@ -116,8 +116,6 @@ nsHttpChannel::Init(nsIURI *uri,
|
|||
mOriginalURI = uri;
|
||||
mCapabilities = caps;
|
||||
|
||||
LOG(("uri=%s\n", mSpec.get()));
|
||||
|
||||
//
|
||||
// Construct connection info object
|
||||
//
|
||||
|
@ -155,6 +153,8 @@ nsHttpChannel::Init(nsIURI *uri,
|
|||
rv = mURI->GetSpec(getter_Copies(mSpec));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
LOG(("uri=%s\n", mSpec.get()));
|
||||
|
||||
mConnectionInfo = new nsHttpConnectionInfo(host, port,
|
||||
proxyInfo, usingSSL);
|
||||
if (!mConnectionInfo)
|
||||
|
@ -1231,12 +1231,11 @@ nsHttpChannel::ProcessRedirection(PRUint32 redirectType)
|
|||
|
||||
// close down this transaction (null if processing a cached redirect)
|
||||
if (mTransaction) {
|
||||
mStatus = NS_BINDING_REDIRECTED;
|
||||
mTransaction->Cancel(NS_BINDING_REDIRECTED);
|
||||
|
||||
// disconnect from our listener
|
||||
mListener = 0;
|
||||
mListenerContext = 0;
|
||||
mListener->OnStartRequest(this, mListenerContext);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1692,7 +1691,7 @@ NS_IMETHODIMP
|
|||
nsHttpChannel::GetName(PRUnichar **aName)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aName);
|
||||
*aName = ToNewUnicode(NS_ConvertASCIItoUCS2(mSpec));
|
||||
*aName = ToNewUnicode(mSpec);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче