Bug 1345433 - Bring back assertion that history entries need a valid triggeringPrincipal r=smaug

MozReview-Commit-ID: 9GfGIxkqfhM

--HG--
extra : rebase_source : 4e5909e77cc89e43a129e81baacd8e0f8962c1a9
This commit is contained in:
Thomas Nguyen 2017-10-23 18:14:28 +08:00
parent 41f2111481
commit 18b893a6f4
2 changed files with 8 additions and 1 deletions

View File

@ -12880,8 +12880,10 @@ nsDocShell::LoadHistoryEntry(nsISHEntry* aEntry, uint32_t aLoadType)
srcdoc = VoidString();
}
// If there is no valid triggeringPrincipal, we deny the load
MOZ_ASSERT(triggeringPrincipal, "need a valid triggeringPrincipal to load from history");
if (!triggeringPrincipal) {
triggeringPrincipal = nsContentUtils::GetSystemPrincipal();
return NS_ERROR_FAILURE;
}
// Passing nullptr as aSourceDocShell gives the same behaviour as before

View File

@ -550,6 +550,11 @@ nsSHEntry::GetTriggeringPrincipal(nsIPrincipal** aTriggeringPrincipal)
NS_IMETHODIMP
nsSHEntry::SetTriggeringPrincipal(nsIPrincipal* aTriggeringPrincipal)
{
MOZ_ASSERT(aTriggeringPrincipal, "need a valid triggeringPrincipal");
if (!aTriggeringPrincipal) {
return NS_ERROR_FAILURE;
}
mShared->mTriggeringPrincipal = aTriggeringPrincipal;
return NS_OK;
}