diff --git a/netwerk/protocol/http/HttpChannelParent.cpp b/netwerk/protocol/http/HttpChannelParent.cpp index 3bf147d120eb..41553c0033fa 100644 --- a/netwerk/protocol/http/HttpChannelParent.cpp +++ b/netwerk/protocol/http/HttpChannelParent.cpp @@ -57,6 +57,7 @@ #include "nsIApplicationCacheService.h" #include "nsIOfflineCacheUpdate.h" #include "nsIRedirectChannelRegistrar.h" +#include "prinit.h" namespace mozilla { namespace net { @@ -67,6 +68,9 @@ HttpChannelParent::HttpChannelParent(PBrowserParent* iframeEmbedding) , mStoredProgress(0) , mStoredProgressMax(0) , mHeadersToSyncToChild(nsnull) + , mSentRedirect1Begin(false) + , mSentRedirect1BeginFailed(false) + , mReceviedRedirect2Verify(false) { // Ensure gHttpHandler is initialized: we need the atom table up and running. nsIHttpProtocolHandler* handler; @@ -329,6 +333,11 @@ HttpChannelParent::RecvUpdateAssociatedContentSecurity(const PRInt32& high, return true; } +// Bug 621446 investigation, we don't want conditional PR_Aborts bellow to be +// merged to a single address. +#pragma warning(disable : 4068) +#pragma GCC optimize ("O0") + bool HttpChannelParent::RecvRedirect2Verify(const nsresult& result, const RequestHeaderTuples& changedHeaders) @@ -346,11 +355,30 @@ HttpChannelParent::RecvRedirect2Verify(const nsresult& result, } } + if (!mRedirectCallback) { + // Bug 621446 investigation (optimization turned off above) + if (mReceviedRedirect2Verify) + ::PR_Abort(); + if (mSentRedirect1BeginFailed) + ::PR_Abort(); + if (mSentRedirect1Begin && NS_FAILED(result)) + ::PR_Abort(); + if (mSentRedirect1Begin && NS_SUCCEEDED(result)) + ::PR_Abort(); + if (!mRedirectChannel) + ::PR_Abort(); + } + + mReceviedRedirect2Verify = true; + mRedirectCallback->OnRedirectVerifyCallback(result); mRedirectCallback = nsnull; return true; } +// Bug 621446 investigation +#pragma GCC reset_options + bool HttpChannelParent::RecvDocumentChannelCleanup() { @@ -568,8 +596,14 @@ HttpChannelParent::StartRedirect(PRUint32 newChannelId, redirectFlags, responseHead ? *responseHead : nsHttpResponseHead()); - if (!result) + if (!result) { + // Bug 621446 investigation + mSentRedirect1BeginFailed = true; return NS_BINDING_ABORTED; + } + + // Bug 621446 investigation + mSentRedirect1Begin = true; // Result is handled in RecvRedirect2Verify above diff --git a/netwerk/protocol/http/HttpChannelParent.h b/netwerk/protocol/http/HttpChannelParent.h index ab82edc095a5..0807e36cdea6 100644 --- a/netwerk/protocol/http/HttpChannelParent.h +++ b/netwerk/protocol/http/HttpChannelParent.h @@ -138,6 +138,10 @@ private: // used while visiting headers, to send them to child: else null RequestHeaderTuples *mHeadersToSyncToChild; + + bool mSentRedirect1Begin : 1; + bool mSentRedirect1BeginFailed : 1; + bool mReceivedRedirect2Verify : 1; }; } // namespace net