Bug 1508654 - adding in assert for referrer implied codebase principal. r=ckerschb

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jonathan Kingston 2018-12-17 15:35:45 +00:00
parent a464905af4
commit 9c1d3b46db
2 changed files with 6 additions and 13 deletions

View File

@ -665,9 +665,13 @@ nsDocShell::LoadURI(nsDocShellLoadState* aLoadState) {
"Should not have these flags set");
MOZ_ASSERT(aLoadState->URI(), "Should have a valid URI to load");
if (mUseStrictSecurityChecks && !aLoadState->TriggeringPrincipal()) {
if (!aLoadState->TriggeringPrincipal()) {
#ifndef ANDROID
MOZ_ASSERT(false, "LoadURI must have a triggering principal");
return NS_ERROR_FAILURE;
#endif
if (mUseStrictSecurityChecks) {
return NS_ERROR_FAILURE;
}
}
// Note: we allow loads to get through here even if mFiredUnloadEvent is
@ -3863,9 +3867,6 @@ nsDocShell::LoadURI(const nsAString& aURI, uint32_t aLoadFlags,
nsIURI* aReferringURI, nsIInputStream* aPostStream,
nsIInputStream* aHeaderStream,
nsIPrincipal* aTriggeringPrincipal) {
#ifndef ANDROID
MOZ_ASSERT(aTriggeringPrincipal, "LoadURI: Need a valid triggeringPrincipal");
#endif
if (mUseStrictSecurityChecks && !aTriggeringPrincipal) {
return NS_ERROR_FAILURE;
}
@ -3901,11 +3902,6 @@ nsDocShell::LoadURIWithOptions(const nsAString& aURI, uint32_t aLoadFlags,
uriString.StripCRLF();
NS_ENSURE_TRUE(!uriString.IsEmpty(), NS_ERROR_FAILURE);
#ifndef ANDROID
MOZ_ASSERT(aTriggeringPrincipal,
"LoadURIWithOptions: Need a valid triggeringPrincipal");
#endif
if (mUseStrictSecurityChecks && !aTriggeringPrincipal) {
return NS_ERROR_FAILURE;
}

View File

@ -333,9 +333,6 @@ nsresult nsDocShellLoadState::SetupTriggeringPrincipal(
return NS_ERROR_FAILURE;
}
} else {
#ifndef ANDROID
MOZ_ASSERT(false, "LoadURI: System principal required.");
#endif
mTriggeringPrincipal = nsContentUtils::GetSystemPrincipal();
}
}