зеркало из https://github.com/mozilla/pjs.git
Fix 33631 - crash when 304 is received but there's no entry in the cache.
This commit is contained in:
Родитель
bfee1357a0
Коммит
55965aee77
|
@ -1346,48 +1346,48 @@ nsresult nsHTTPChannel::ResponseCompleted(nsIStreamListener *aListener,
|
|||
nsresult aStatus,
|
||||
const PRUnichar* aMsg)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
//
|
||||
// First:
|
||||
//
|
||||
// Call the consumer OnStopRequest(...) to end the request...
|
||||
if (aListener) {
|
||||
rv = aListener->OnStopRequest(this, mResponseContext, aStatus, aMsg);
|
||||
//
|
||||
// First:
|
||||
//
|
||||
// Call the consumer OnStopRequest(...) to end the request...
|
||||
if (aListener)
|
||||
{
|
||||
rv = aListener -> OnStopRequest (this, mResponseContext, aStatus, aMsg);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
PR_LOG(gHTTPLog, PR_LOG_ERROR,
|
||||
("nsHTTPChannel::OnStopRequest(...) [this=%x]."
|
||||
"\tOnStopRequest to consumer failed! Status:%x\n",
|
||||
this, rv));
|
||||
if (NS_FAILED (rv))
|
||||
{
|
||||
PR_LOG(gHTTPLog, PR_LOG_ERROR, ("nsHTTPChannel::OnStopRequest(...) [this=%x]."
|
||||
"\tOnStopRequest to consumer failed! Status:%x\n",
|
||||
this, rv));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// After the consumer has been notified, remove the channel from its
|
||||
// load group... This will trigger an OnStopRequest from the load group.
|
||||
//
|
||||
if (mLoadGroup) {
|
||||
(void)mLoadGroup->RemoveChannel(this, nsnull, aStatus, nsnull);
|
||||
}
|
||||
//
|
||||
// After the consumer has been notified, remove the channel from its
|
||||
// load group... This will trigger an OnStopRequest from the load group.
|
||||
//
|
||||
|
||||
if (mLoadGroup)
|
||||
mLoadGroup -> RemoveChannel (this, nsnull, aStatus, nsnull);
|
||||
|
||||
//
|
||||
// Finally, notify the OpenObserver that the request has completed.
|
||||
//
|
||||
if (mOpenObserver) {
|
||||
(void) mOpenObserver->OnStopRequest(this, mOpenContext, aStatus, aMsg);
|
||||
}
|
||||
//
|
||||
// Finally, notify the OpenObserver that the request has completed.
|
||||
//
|
||||
if (mOpenObserver)
|
||||
mOpenObserver -> OnStopRequest (this, mOpenContext, aStatus, aMsg);
|
||||
|
||||
// Null out pointers that are no longer needed...
|
||||
// Null out pointers that are no longer needed...
|
||||
|
||||
// rjc says: don't null out mResponseContext;
|
||||
// it needs to be valid for the life of the channel
|
||||
// mResponseContext = 0;
|
||||
// rjc says: don't null out mResponseContext;
|
||||
// it needs to be valid for the life of the channel
|
||||
// mResponseContext = 0;
|
||||
|
||||
mResponseDataListener = 0;
|
||||
NS_IF_RELEASE(mCachedResponse);
|
||||
mResponseDataListener = 0;
|
||||
NS_IF_RELEASE (mCachedResponse);
|
||||
|
||||
return rv;
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult nsHTTPChannel::SetResponse(nsHTTPResponse* i_pResp)
|
||||
|
@ -1775,8 +1775,12 @@ nsHTTPChannel::ProcessStatusCode(void)
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsHTTPChannel::ProcessNotModifiedResponse(nsIStreamListener *aListener)
|
||||
nsHTTPChannel::ProcessNotModifiedResponse (nsIStreamListener *aListener)
|
||||
{
|
||||
// if there is no cached entry - bail right away
|
||||
if (!mCachedResponse)
|
||||
return NS_OK;
|
||||
|
||||
nsresult rv;
|
||||
NS_ASSERTION(!mCachedContentIsValid,
|
||||
"We should never have cached a 304 response");
|
||||
|
|
|
@ -127,6 +127,7 @@ public:
|
|||
nsHTTPRequest* mRequest;
|
||||
nsHTTPResponseListener* mHTTPServerListener;
|
||||
nsCOMPtr<nsISupports> mResponseContext;
|
||||
nsHTTPResponse* mCachedResponse;
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIURI> mOriginalURI;
|
||||
|
@ -150,7 +151,6 @@ protected:
|
|||
|
||||
// Cache-related members
|
||||
nsCOMPtr<nsICachedNetData> mCacheEntry;
|
||||
nsHTTPResponse* mCachedResponse;
|
||||
PRBool mCachedContentIsAvailable;
|
||||
PRBool mCachedContentIsValid;
|
||||
|
||||
|
|
|
@ -485,23 +485,19 @@ nsHTTPServerListener::OnStopRequest(nsIChannel* channel,
|
|||
|
||||
// Notify the HTTPChannel that the response has completed...
|
||||
NS_ASSERTION(mChannel, "HTTPChannel is null.");
|
||||
if (mChannel) {
|
||||
if (mChannel)
|
||||
{
|
||||
PRUint32 status = 0;
|
||||
|
||||
if (mResponse) {
|
||||
if (mResponse)
|
||||
mResponse->GetStatus(&status);
|
||||
|
||||
if (!mChannel -> mCachedResponse)
|
||||
{
|
||||
mChannel -> ResponseCompleted (mResponseDataListener, i_Status, i_pMsg);
|
||||
mChannel -> mHTTPServerListener = 0;
|
||||
}
|
||||
|
||||
if (status != 304) {
|
||||
mChannel->ResponseCompleted(mResponseDataListener,
|
||||
i_Status, i_pMsg);
|
||||
// The HTTPChannel no longer needs a reference to this object.
|
||||
mChannel->mHTTPServerListener = 0;
|
||||
} else {
|
||||
PR_LOG(gHTTPLog, PR_LOG_DEBUG,
|
||||
("nsHTTPServerListener::OnStopRequest [this=%x]. "
|
||||
"Discarding 304 response\n", this));
|
||||
}
|
||||
PRBool keepAlive = PR_FALSE;
|
||||
|
||||
if (mResponse)
|
||||
|
|
Загрузка…
Ссылка в новой задаче