From 3dd48dc331a0ffd9cdf434883c2f6cbab2fae15a Mon Sep 17 00:00:00 2001 From: Honza Bambas Date: Mon, 10 Feb 2020 09:15:26 +0000 Subject: [PATCH] Bug 1545909 - Part 1 of 2: Recheck whether to use appcache on the parent process on the redirected top-level loading channel, r=michal Differential Revision: https://phabricator.services.mozilla.com/D61842 --HG-- extra : moz-landing-system : lando --- netwerk/protocol/http/HttpChannelParent.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/netwerk/protocol/http/HttpChannelParent.cpp b/netwerk/protocol/http/HttpChannelParent.cpp index c372b962c43d..3f493e510c18 100644 --- a/netwerk/protocol/http/HttpChannelParent.cpp +++ b/netwerk/protocol/http/HttpChannelParent.cpp @@ -914,7 +914,22 @@ mozilla::ipc::IPCResult HttpChannelParent::RecvRedirect2Verify( nsCOMPtr appCacheChannel = do_QueryInterface(newHttpChannel); if (appCacheChannel) { - appCacheChannel->SetChooseApplicationCache(aChooseAppcache); + bool setChooseAppCache = false; + if (aChooseAppcache) { + nsCOMPtr uri; + // Using GetURI because this is what DoAsyncOpen uses. + newHttpChannel->GetURI(getter_AddRefs(uri)); + + OriginAttributes attrs; + NS_GetOriginAttributes(newHttpChannel, attrs); + + nsCOMPtr principal = + BasePrincipal::CreateContentPrincipal(uri, attrs); + + setChooseAppCache = NS_ShouldCheckAppCache(principal); + } + + appCacheChannel->SetChooseApplicationCache(setChooseAppCache); } nsCOMPtr newLoadInfo = newHttpChannel->LoadInfo();