Bug 1620647 - Refactor nsHttpChannelAuthProvider r=ckerschb

Differential Revision: https://phabricator.services.mozilla.com/D65762

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Sebastian Streich 2020-03-09 18:38:29 +00:00
Родитель c5217006a9
Коммит 59362e319c
1 изменённых файлов: 7 добавлений и 11 удалений

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

@ -931,17 +931,13 @@ bool nsHttpChannelAuthProvider::BlockPrompt(bool proxyAuth) {
if (!topDoc && !xhr) {
nsCOMPtr<nsIURI> topURI;
Unused << chanInternal->GetTopWindowURI(getter_AddRefs(topURI));
if (!topURI) {
// If we do not have topURI try the loadingPrincipal.
nsCOMPtr<nsIPrincipal> loadingPrinc = loadInfo->LoadingPrincipal();
if (loadingPrinc) {
loadingPrinc->GetURI(getter_AddRefs(topURI));
}
}
if (!NS_SecurityCompareURIs(topURI, mURI, true)) {
mCrossOrigin = true;
nsCOMPtr<nsIPrincipal> loadingPrinc = loadInfo->LoadingPrincipal();
if (topURI) {
mCrossOrigin = !NS_SecurityCompareURIs(topURI, mURI, true);
} else {
bool sameOrigin = false;
loadingPrinc->IsSameOrigin(mURI, false, &sameOrigin);
mCrossOrigin = !sameOrigin;
}
}