Merge mozilla-central to autoland

This commit is contained in:
Iris Hsiao 2016-10-20 15:36:39 +08:00
Родитель e65ab6898b 703b663355
Коммит 0ba3e39262
2 изменённых файлов: 27 добавлений и 23 удалений

Просмотреть файл

@ -2089,7 +2089,10 @@ nsFrameLoader::MaybeCreateDocShell()
PrincipalOriginAttributes poa = BasePrincipal::Cast(doc->NodePrincipal())->OriginAttributesRef();
// Assert on the firstPartyDomain from top-level docshell should be empty
MOZ_ASSERT_IF(mIsTopLevelContent, attrs.mFirstPartyDomain.IsEmpty());
if (mIsTopLevelContent) {
MOZ_ASSERT(attrs.mFirstPartyDomain.IsEmpty(),
"top-level docshell shouldn't have firstPartyDomain attribute.");
}
// So far we want to make sure InheritFromDocToChildDocShell doesn't override
// any other origin attribute than firstPartyDomain.

Просмотреть файл

@ -2945,30 +2945,31 @@ HttpBaseChannel::SetupReplacementChannel(nsIURI *newURI,
bool isTopLevelDoc =
newLoadInfo->GetExternalContentPolicyType() == nsIContentPolicy::TYPE_DOCUMENT;
nsCOMPtr<nsILoadContext> loadContext;
NS_QueryNotificationCallbacks(this, loadContext);
DocShellOriginAttributes docShellAttrs;
if (loadContext) {
loadContext->GetOriginAttributes(docShellAttrs);
if (isTopLevelDoc) {
nsCOMPtr<nsILoadContext> 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);
}
// 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));