Bug 1312646 - Carry ChooseApplicationCache flag from child after redirect callback is done, r=jduell a=ritu
--- a/netwerk/protocol/http/HttpChannelChild.cpp
+++ b/netwerk/protocol/http/HttpChannelChild.cpp
@@ -1655,19 +1655,26 @@ HttpChannelChild::OnRedirectVerifyCallba
}
nsCOMPtr<nsIRequest> request = do_QueryInterface(mRedirectChannelChild);
if (request) {
request->GetLoadFlags(&loadFlags);
}
}
+ bool chooseAppcache = false;
+ nsCOMPtr<nsIApplicationCacheChannel> appCacheChannel =
+ do_QueryInterface(newHttpChannel);
+ if (appCacheChannel) {
+ appCacheChannel->GetChooseApplicationCache(&chooseAppcache);
+ }
+
if (mIPCOpen)
SendRedirect2Verify(result, *headerTuples, loadFlags, redirectURI,
- corsPreflightArgs);
+ corsPreflightArgs, chooseAppcache);
return NS_OK;
}
//-----------------------------------------------------------------------------
// HttpChannelChild::nsIRequest
//-----------------------------------------------------------------------------
--- a/netwerk/protocol/http/HttpChannelParent.cpp
+++ b/netwerk/protocol/http/HttpChannelParent.cpp
@@ -627,17 +627,18 @@ HttpChannelParent::RecvUpdateAssociatedC
return true;
}
bool
HttpChannelParent::RecvRedirect2Verify(const nsresult& result,
const RequestHeaderTuples& changedHeaders,
const uint32_t& loadFlags,
const OptionalURIParams& aAPIRedirectURI,
- const OptionalCorsPreflightArgs& aCorsPreflightArgs)
+ const OptionalCorsPreflightArgs& aCorsPreflightArgs,
+ const bool& aChooseAppcache)
{
LOG(("HttpChannelParent::RecvRedirect2Verify [this=%p result=%x]\n",
this, result));
if (NS_SUCCEEDED(result)) {
nsCOMPtr<nsIHttpChannel> newHttpChannel =
do_QueryInterface(mRedirectChannel);
if (newHttpChannel) {
@@ -664,16 +665,22 @@ HttpChannelParent::RecvRedirect2Verify(c
if (aCorsPreflightArgs.type() == OptionalCorsPreflightArgs::TCorsPreflightArgs) {
nsCOMPtr<nsIHttpChannelInternal> newInternalChannel =
do_QueryInterface(newHttpChannel);
MOZ_RELEASE_ASSERT(newInternalChannel);
const CorsPreflightArgs& args = aCorsPreflightArgs.get_CorsPreflightArgs();
newInternalChannel->SetCorsPreflightParameters(args.unsafeHeaders());
}
+
+ nsCOMPtr<nsIApplicationCacheChannel> appCacheChannel =
+ do_QueryInterface(newHttpChannel);
+ if (appCacheChannel) {
+ appCacheChannel->SetChooseApplicationCache(aChooseAppcache);
+ }
}
}
if (!mRedirectCallback) {
// This should according the logic never happen, log the situation.
if (mReceivedRedirect2Verify)
LOG(("RecvRedirect2Verify[%p]: Duplicate fire", this));
if (mSentRedirect1BeginFailed)
--- a/netwerk/protocol/http/HttpChannelParent.h
+++ b/netwerk/protocol/http/HttpChannelParent.h
@@ -147,17 +147,18 @@ protected:
virtual bool RecvSetCacheTokenCachedCharset(const nsCString& charset) override;
virtual bool RecvSuspend() override;
virtual bool RecvResume() override;
virtual bool RecvCancel(const nsresult& status) override;
virtual bool RecvRedirect2Verify(const nsresult& result,
const RequestHeaderTuples& changedHeaders,
const uint32_t& loadFlags,
const OptionalURIParams& apiRedirectUri,
- const OptionalCorsPreflightArgs& aCorsPreflightArgs) override;
+ const OptionalCorsPreflightArgs& aCorsPreflightArgs,
+ const bool& aChooseAppcache) override;
virtual bool RecvUpdateAssociatedContentSecurity(const int32_t& broken,
const int32_t& no) override;
virtual bool RecvDocumentChannelCleanup() override;
virtual bool RecvMarkOfflineCacheEntryAsForeign() override;
virtual bool RecvDivertOnDataAvailable(const nsCString& data,
const uint64_t& offset,
const uint32_t& count) override;
virtual bool RecvDivertOnStopRequest(const nsresult& statusCode) override;
--- a/netwerk/protocol/http/PHttpChannel.ipdl
+++ b/netwerk/protocol/http/PHttpChannel.ipdl
@@ -41,17 +41,18 @@ parent:
async Suspend();
async Resume();
async Cancel(nsresult status);
// Reports approval/veto of redirect by child process redirect observers
async Redirect2Verify(nsresult result, RequestHeaderTuples changedHeaders,
uint32_t loadFlags, OptionalURIParams apiRedirectTo,
- OptionalCorsPreflightArgs corsPreflightArgs);
+ OptionalCorsPreflightArgs corsPreflightArgs,
+ bool chooseAppcache);
// For document loads we keep this protocol open after child's
// OnStopRequest, and send this msg (instead of __delete__) to allow
// partial cleanup on parent.
async DocumentChannelCleanup();
// This might have to be sync. If this fails we must fail the document load
// to avoid endless loop.