mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-17 04:37:46 +09:00
Bug 1307736 - Ensure History loads pass valid triggeringPrincipal
This commit is contained in:
parent
ea7e6d41a3
commit
9fca6b7ced
2 changed files with 11 additions and 5 deletions
|
|
@ -12660,12 +12660,11 @@ nsDocShell::LoadHistoryEntry(nsISHEntry* aEntry, uint32_t aLoadType)
|
||||||
srcdoc = NullString();
|
srcdoc = NullString();
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there is no triggeringPrincipal we can fall back to using the
|
// If there is no valid triggeringPrincipal, we deny the load
|
||||||
// SystemPrincipal as the triggeringPrincipal for loading the history
|
MOZ_ASSERT(triggeringPrincipal,
|
||||||
// entry, since the history entry can only end up in history if security
|
"need a valid triggeringPrincipal to load from history");
|
||||||
// checks passed in the initial loading phase.
|
|
||||||
if (!triggeringPrincipal) {
|
if (!triggeringPrincipal) {
|
||||||
triggeringPrincipal = nsContentUtils::GetSystemPrincipal();
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Passing nullptr as aSourceDocShell gives the same behaviour as before
|
// Passing nullptr as aSourceDocShell gives the same behaviour as before
|
||||||
|
|
|
||||||
|
|
@ -416,6 +416,9 @@ nsSHEntry::Create(nsIURI* aURI, const nsAString& aTitle,
|
||||||
uint64_t aDocShellID,
|
uint64_t aDocShellID,
|
||||||
bool aDynamicCreation)
|
bool aDynamicCreation)
|
||||||
{
|
{
|
||||||
|
MOZ_ASSERT(aTriggeringPrincipal,
|
||||||
|
"need a valid triggeringPrincipal to create a session history entry");
|
||||||
|
|
||||||
mURI = aURI;
|
mURI = aURI;
|
||||||
mTitle = aTitle;
|
mTitle = aTitle;
|
||||||
mPostData = aInputStream;
|
mPostData = aInputStream;
|
||||||
|
|
@ -515,6 +518,10 @@ nsSHEntry::GetTriggeringPrincipal(nsIPrincipal** aTriggeringPrincipal)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsSHEntry::SetTriggeringPrincipal(nsIPrincipal* aTriggeringPrincipal)
|
nsSHEntry::SetTriggeringPrincipal(nsIPrincipal* aTriggeringPrincipal)
|
||||||
{
|
{
|
||||||
|
MOZ_ASSERT(aTriggeringPrincipal, "need a valid triggeringPrincipal");
|
||||||
|
if (!aTriggeringPrincipal) {
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
}
|
||||||
mShared->mTriggeringPrincipal = aTriggeringPrincipal;
|
mShared->mTriggeringPrincipal = aTriggeringPrincipal;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue