diff --git a/dom/base/nsFrameLoader.cpp b/dom/base/nsFrameLoader.cpp index 625720533a26..1f88af430901 100644 --- a/dom/base/nsFrameLoader.cpp +++ b/dom/base/nsFrameLoader.cpp @@ -2111,10 +2111,7 @@ nsFrameLoader::MaybeCreateDocShell() PrincipalOriginAttributes poa = BasePrincipal::Cast(doc->NodePrincipal())->OriginAttributesRef(); // Assert on the firstPartyDomain from top-level docshell should be empty - if (mIsTopLevelContent) { - MOZ_ASSERT(attrs.mFirstPartyDomain.IsEmpty(), - "top-level docshell shouldn't have firstPartyDomain attribute."); - } + MOZ_ASSERT_IF(mIsTopLevelContent, attrs.mFirstPartyDomain.IsEmpty()); // So far we want to make sure InheritFromDocToChildDocShell doesn't override // any other origin attribute than firstPartyDomain. diff --git a/netwerk/protocol/http/HttpBaseChannel.cpp b/netwerk/protocol/http/HttpBaseChannel.cpp index b8812c8d02e9..2c5b3c77497b 100644 --- a/netwerk/protocol/http/HttpBaseChannel.cpp +++ b/netwerk/protocol/http/HttpBaseChannel.cpp @@ -2937,31 +2937,30 @@ HttpBaseChannel::SetupReplacementChannel(nsIURI *newURI, bool isTopLevelDoc = newLoadInfo->GetExternalContentPolicyType() == nsIContentPolicy::TYPE_DOCUMENT; - if (isTopLevelDoc) { - nsCOMPtr loadContext; - NS_QueryNotificationCallbacks(this, loadContext); - DocShellOriginAttributes docShellAttrs; - if (loadContext) { - loadContext->GetOriginAttributes(docShellAttrs); - } - MOZ_ASSERT(docShellAttrs.mFirstPartyDomain.IsEmpty(), - "top-level docshell shouldn't have firstPartyDomain attribute."); - - NeckoOriginAttributes attrs = newLoadInfo->GetOriginAttributes(); - - MOZ_ASSERT(docShellAttrs.mAppId == attrs.mAppId, - "docshell and necko should have the same appId attribute."); - MOZ_ASSERT(docShellAttrs.mUserContextId == attrs.mUserContextId, - "docshell and necko should have the same userContextId attribute."); - MOZ_ASSERT(docShellAttrs.mInIsolatedMozBrowser == attrs.mInIsolatedMozBrowser, - "docshell and necko should have the same inIsolatedMozBrowser attribute."); - MOZ_ASSERT(docShellAttrs.mPrivateBrowsingId == attrs.mPrivateBrowsingId, - "docshell and necko should have the same privateBrowsingId attribute."); - - attrs.InheritFromDocShellToNecko(docShellAttrs, true, newURI); - newLoadInfo->SetOriginAttributes(attrs); + nsCOMPtr loadContext; + NS_QueryNotificationCallbacks(this, loadContext); + DocShellOriginAttributes docShellAttrs; + if (loadContext) { + loadContext->GetOriginAttributes(docShellAttrs); } + // top-level docshell shouldn't have firstPartyDomain attribute. + MOZ_ASSERT_IF(isTopLevelDoc, docShellAttrs.mFirstPartyDomain.IsEmpty()); + + NeckoOriginAttributes attrs = newLoadInfo->GetOriginAttributes(); + + MOZ_ASSERT(docShellAttrs.mAppId == attrs.mAppId, + "docshell and necko should have the same appId attribute."); + MOZ_ASSERT(docShellAttrs.mUserContextId == attrs.mUserContextId, + "docshell and necko should have the same userContextId attribute."); + MOZ_ASSERT(docShellAttrs.mInIsolatedMozBrowser == attrs.mInIsolatedMozBrowser, + "docshell and necko should have the same inIsolatedMozBrowser attribute."); + MOZ_ASSERT(docShellAttrs.mPrivateBrowsingId == attrs.mPrivateBrowsingId, + "docshell and necko should have the same privateBrowsingId attribute."); + + attrs.InheritFromDocShellToNecko(docShellAttrs, isTopLevelDoc, newURI); + newLoadInfo->SetOriginAttributes(attrs); + bool isInternalRedirect = (redirectFlags & (nsIChannelEventSink::REDIRECT_INTERNAL | nsIChannelEventSink::REDIRECT_STS_UPGRADE));