Bug 1636148 - "BandAid" - Cast Remaining Callers To BasePrincipal r=ckerschb

Differential Revision: https://phabricator.services.mozilla.com/D74248
This commit is contained in:
Sebastian Streich 2020-05-12 12:50:21 +00:00
Родитель 281f7b311b
Коммит 8dc87b9987
4 изменённых файлов: 10 добавлений и 7 удалений

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

@ -615,9 +615,9 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
}
nsCOMPtr<nsIURI> sourceURI;
aPrincipal->GetURI(getter_AddRefs(sourceURI));
auto* basePrin = BasePrincipal::Cast(aPrincipal);
basePrin->GetURI(getter_AddRefs(sourceURI));
if (!sourceURI) {
auto* basePrin = BasePrincipal::Cast(aPrincipal);
if (basePrin->Is<ExpandedPrincipal>()) {
auto expanded = basePrin->As<ExpandedPrincipal>();
for (auto& prin : expanded->AllowList()) {

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

@ -7615,7 +7615,7 @@ nsresult nsDocShell::CreateContentViewer(const nsACString& aContentType,
if (!parentSite.Equals(thisSite)) {
#ifdef MOZ_GECKO_PROFILER
nsCOMPtr<nsIURI> prinURI;
thisPrincipal->GetURI(getter_AddRefs(prinURI));
BasePrincipal::Cast(thisPrincipal)->GetURI(getter_AddRefs(prinURI));
nsPrintfCString marker("Iframe loaded in background: %s",
prinURI->GetSpecOrDefault().get());
TimeStamp now = TimeStamp::Now();

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

@ -110,7 +110,8 @@ nsresult GetOrigin(nsPIDOMWindowInner* aParent,
}
nsCOMPtr<nsIURI> originUri;
if (NS_FAILED(principal->GetURI(getter_AddRefs(originUri)))) {
auto* basePrin = BasePrincipal::Cast(principal);
if (NS_FAILED(basePrin->GetURI(getter_AddRefs(originUri)))) {
return NS_ERROR_FAILURE;
}
if (NS_FAILED(originUri->GetAsciiHost(aHost))) {
@ -128,8 +129,10 @@ nsresult RelaxSameOrigin(nsPIDOMWindowInner* aParent,
MOZ_ASSERT(doc);
nsCOMPtr<nsIPrincipal> principal = doc->NodePrincipal();
auto* basePrin = BasePrincipal::Cast(principal);
nsCOMPtr<nsIURI> uri;
if (NS_FAILED(principal->GetURI(getter_AddRefs(uri)))) {
if (NS_FAILED(basePrin->GetURI(getter_AddRefs(uri)))) {
return NS_ERROR_FAILURE;
}
nsAutoCString originHost;

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

@ -9755,8 +9755,8 @@ void nsHttpChannel::SetOriginHeader() {
}
nsCOMPtr<nsIURI> referrer;
mLoadInfo->TriggeringPrincipal()->GetURI(getter_AddRefs(referrer));
auto* basePrin = BasePrincipal::Cast(mLoadInfo->TriggeringPrincipal());
basePrin->GetURI(getter_AddRefs(referrer));
if (!referrer || !dom::ReferrerInfo::IsReferrerSchemeAllowed(referrer)) {
return;
}