summaryrefslogtreecommitdiffstats
path: root/docshell
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-04-30 23:00:04 +0200
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-04-30 23:00:04 +0200
commit6cb841b26e10af54559020b23a01ef93a639ac17 (patch)
tree1a7bf665765e6412ae24a17d6aa9bd7d4a47459a /docshell
parent74858918fa2445f7e4ebc4b615ec073d528039f1 (diff)
downloadUXP-6cb841b26e10af54559020b23a01ef93a639ac17.tar
UXP-6cb841b26e10af54559020b23a01ef93a639ac17.tar.gz
UXP-6cb841b26e10af54559020b23a01ef93a639ac17.tar.lz
UXP-6cb841b26e10af54559020b23a01ef93a639ac17.tar.xz
UXP-6cb841b26e10af54559020b23a01ef93a639ac17.zip
Bug 1332310 - Update AddState and CreateContentViewer to provide an accurate triggeringPrincipal for creating a history entry
Diffstat (limited to 'docshell')
-rw-r--r--docshell/base/nsDocShell.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp
index d7cb557ab..be8cd6a8d 100644
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -9147,8 +9147,13 @@ nsDocShell::CreateContentViewer(const nsACString& aContentType,
// Make sure we have a URI to set currentURI.
nsCOMPtr<nsIURI> failedURI;
+ nsCOMPtr<nsIPrincipal> triggeringPrincipal;
if (failedChannel) {
NS_GetFinalChannelURI(failedChannel, getter_AddRefs(failedURI));
+ } else {
+ // if there is no failed channel we have to explicitly provide
+ // a triggeringPrincipal for the history entry.
+ triggeringPrincipal = nsContentUtils::GetSystemPrincipal();
}
if (!failedURI) {
@@ -9169,7 +9174,8 @@ nsDocShell::CreateContentViewer(const nsACString& aContentType,
// Create an shistory entry for the old load.
if (failedURI) {
bool errorOnLocationChangeNeeded = OnNewURI(
- failedURI, failedChannel, nullptr, nullptr, mLoadType, false, false, false);
+ failedURI, failedChannel, triggeringPrincipal,
+ nullptr, mLoadType, false, false, false);
if (errorOnLocationChangeNeeded) {
FireOnLocationChange(this, failedChannel, failedURI,
@@ -12126,7 +12132,9 @@ nsDocShell::AddState(JS::Handle<JS::Value> aData, const nsAString& aTitle,
// Since we're not changing which page we have loaded, pass
// true for aCloneChildren.
- rv = AddToSessionHistory(newURI, nullptr, nullptr, nullptr, true,
+ rv = AddToSessionHistory(newURI, nullptr,
+ document->NodePrincipal(), // triggeringPrincipal
+ nullptr, true,
getter_AddRefs(newSHEntry));
NS_ENSURE_SUCCESS(rv, rv);