зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1301649 - nits for bug 1260931. r=smaug
- use MOZ_ASSERT_IF - always call inherit function
This commit is contained in:
Родитель
a43d017190
Коммит
00f6846c07
|
@ -2111,10 +2111,7 @@ nsFrameLoader::MaybeCreateDocShell()
|
||||||
PrincipalOriginAttributes poa = BasePrincipal::Cast(doc->NodePrincipal())->OriginAttributesRef();
|
PrincipalOriginAttributes poa = BasePrincipal::Cast(doc->NodePrincipal())->OriginAttributesRef();
|
||||||
|
|
||||||
// Assert on the firstPartyDomain from top-level docshell should be empty
|
// Assert on the firstPartyDomain from top-level docshell should be empty
|
||||||
if (mIsTopLevelContent) {
|
MOZ_ASSERT_IF(mIsTopLevelContent, attrs.mFirstPartyDomain.IsEmpty());
|
||||||
MOZ_ASSERT(attrs.mFirstPartyDomain.IsEmpty(),
|
|
||||||
"top-level docshell shouldn't have firstPartyDomain attribute.");
|
|
||||||
}
|
|
||||||
|
|
||||||
// So far we want to make sure InheritFromDocToChildDocShell doesn't override
|
// So far we want to make sure InheritFromDocToChildDocShell doesn't override
|
||||||
// any other origin attribute than firstPartyDomain.
|
// any other origin attribute than firstPartyDomain.
|
||||||
|
|
|
@ -2937,31 +2937,30 @@ HttpBaseChannel::SetupReplacementChannel(nsIURI *newURI,
|
||||||
bool isTopLevelDoc =
|
bool isTopLevelDoc =
|
||||||
newLoadInfo->GetExternalContentPolicyType() == nsIContentPolicy::TYPE_DOCUMENT;
|
newLoadInfo->GetExternalContentPolicyType() == nsIContentPolicy::TYPE_DOCUMENT;
|
||||||
|
|
||||||
if (isTopLevelDoc) {
|
nsCOMPtr<nsILoadContext> loadContext;
|
||||||
nsCOMPtr<nsILoadContext> loadContext;
|
NS_QueryNotificationCallbacks(this, loadContext);
|
||||||
NS_QueryNotificationCallbacks(this, loadContext);
|
DocShellOriginAttributes docShellAttrs;
|
||||||
DocShellOriginAttributes docShellAttrs;
|
if (loadContext) {
|
||||||
if (loadContext) {
|
loadContext->GetOriginAttributes(docShellAttrs);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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 =
|
bool isInternalRedirect =
|
||||||
(redirectFlags & (nsIChannelEventSink::REDIRECT_INTERNAL |
|
(redirectFlags & (nsIChannelEventSink::REDIRECT_INTERNAL |
|
||||||
nsIChannelEventSink::REDIRECT_STS_UPGRADE));
|
nsIChannelEventSink::REDIRECT_STS_UPGRADE));
|
||||||
|
|
Загрузка…
Ссылка в новой задаче