Bug 1291652 - Part 1: Return origin attributes from nsILoadInfo in NS_GetOriginAttributes. r=sicking

--HG--
extra : rebase_source : 4a52e6c80fec2ab11709e9e351232bb3bb1082cb
This commit is contained in:
Yoshi Huang 2016-08-22 08:42:00 -04:00
Родитель 425509d685
Коммит f31ae627b1
1 изменённых файлов: 2 добавлений и 15 удалений

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

@ -1251,25 +1251,12 @@ bool
NS_GetOriginAttributes(nsIChannel *aChannel,
mozilla::NeckoOriginAttributes &aAttributes)
{
nsCOMPtr<nsILoadContext> loadContext;
nsCOMPtr<nsILoadInfo> loadInfo = aChannel->GetLoadInfo();
NS_QueryNotificationCallbacks(aChannel, loadContext);
if (!loadContext && !loadInfo) {
if (!loadInfo) {
return false;
}
// Bug 1270678 - By default, we would acquire the originAttributes from
// the loadContext. But in some cases, say, loading the favicon, that the
// loadContext is not available. We would use the loadInfo to get
// originAttributes instead.
if (loadContext) {
DocShellOriginAttributes doa;
loadContext->GetOriginAttributes(doa);
aAttributes.InheritFromDocShellToNecko(doa);
} else {
loadInfo->GetOriginAttributes(&aAttributes);
}
loadInfo->GetOriginAttributes(&aAttributes);
aAttributes.SyncAttributesWithPrivateBrowsing(NS_UsePrivateBrowsing(aChannel));
return true;
}