Bug 1518986 - Change docshell/ to use infallible Principal URL accessor; r=bzbarsky

Depends on D16372

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Kyle Machulis 2019-01-14 22:40:33 +00:00
Родитель 9b6b2ec89d
Коммит 45119b66dd
1 изменённых файлов: 3 добавлений и 5 удалений

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

@ -5507,9 +5507,8 @@ nsDocShell::GetAllowMixedContentAndConnectionData(
// For things with system principal (e.g. scratchpad) there is no uri // For things with system principal (e.g. scratchpad) there is no uri
// aRootHasSecureConnection should be false. // aRootHasSecureConnection should be false.
nsCOMPtr<nsIURI> rootUri; nsCOMPtr<nsIURI> rootUri = rootPrincipal->GetURI();
if (nsContentUtils::IsSystemPrincipal(rootPrincipal) || if (nsContentUtils::IsSystemPrincipal(rootPrincipal) ||
NS_FAILED(rootPrincipal->GetURI(getter_AddRefs(rootUri))) ||
!rootUri || !SchemeIsHTTPS(rootUri)) { !rootUri || !SchemeIsHTTPS(rootUri)) {
*aRootHasSecureConnection = false; *aRootHasSecureConnection = false;
} }
@ -9590,9 +9589,7 @@ static bool IsConsideredSameOriginForUIR(nsIPrincipal* aTriggeringPrincipal,
return false; return false;
} }
nsCOMPtr<nsIURI> resultURI; nsCOMPtr<nsIURI> resultURI = aResultPrincipal->GetURI();
nsresult rv = aResultPrincipal->GetURI(getter_AddRefs(resultURI));
NS_ENSURE_SUCCESS(rv, false);
// We know this is a codebase principal, and codebase principals require valid // We know this is a codebase principal, and codebase principals require valid
// URIs, so we shouldn't need to check non-null here. // URIs, so we shouldn't need to check non-null here.
@ -9600,6 +9597,7 @@ static bool IsConsideredSameOriginForUIR(nsIPrincipal* aTriggeringPrincipal,
return false; return false;
} }
nsresult rv;
nsAutoCString tmpResultSpec; nsAutoCString tmpResultSpec;
rv = resultURI->GetSpec(tmpResultSpec); rv = resultURI->GetSpec(tmpResultSpec);
NS_ENSURE_SUCCESS(rv, false); NS_ENSURE_SUCCESS(rv, false);