Skip to content

Commit 3dd48dc

Browse files
committed
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
1 parent b903fe6 commit 3dd48dc

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

netwerk/protocol/http/HttpChannelParent.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,22 @@ mozilla::ipc::IPCResult HttpChannelParent::RecvRedirect2Verify(
914914
nsCOMPtr<nsIApplicationCacheChannel> appCacheChannel =
915915
do_QueryInterface(newHttpChannel);
916916
if (appCacheChannel) {
917-
appCacheChannel->SetChooseApplicationCache(aChooseAppcache);
917+
bool setChooseAppCache = false;
918+
if (aChooseAppcache) {
919+
nsCOMPtr<nsIURI> uri;
920+
// Using GetURI because this is what DoAsyncOpen uses.
921+
newHttpChannel->GetURI(getter_AddRefs(uri));
922+
923+
OriginAttributes attrs;
924+
NS_GetOriginAttributes(newHttpChannel, attrs);
925+
926+
nsCOMPtr<nsIPrincipal> principal =
927+
BasePrincipal::CreateContentPrincipal(uri, attrs);
928+
929+
setChooseAppCache = NS_ShouldCheckAppCache(principal);
930+
}
931+
932+
appCacheChannel->SetChooseApplicationCache(setChooseAppCache);
918933
}
919934

920935
nsCOMPtr<nsILoadInfo> newLoadInfo = newHttpChannel->LoadInfo();

0 commit comments

Comments
 (0)