summaryrefslogtreecommitdiffstats
path: root/browser/components
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-04-30 23:05:55 +0200
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-04-30 23:05:55 +0200
commit3dec348f43b3633cdcd1cfa52bc24b0fba45cb84 (patch)
treeb1d1415a87d7d049d7ebbae4c0e7953045cbfe7a /browser/components
parent2cb9f3ceb89038721eb9528dcc56dd33b66b0c85 (diff)
downloadUXP-3dec348f43b3633cdcd1cfa52bc24b0fba45cb84.tar
UXP-3dec348f43b3633cdcd1cfa52bc24b0fba45cb84.tar.gz
UXP-3dec348f43b3633cdcd1cfa52bc24b0fba45cb84.tar.lz
UXP-3dec348f43b3633cdcd1cfa52bc24b0fba45cb84.tar.xz
UXP-3dec348f43b3633cdcd1cfa52bc24b0fba45cb84.zip
Bug 1307736 - Store triggeringPrincipal with all history entries
Diffstat (limited to 'browser/components')
-rw-r--r--browser/components/sessionstore/SessionHistory.jsm5
-rw-r--r--browser/components/sessionstore/SessionMigration.jsm14
-rw-r--r--browser/components/sessionstore/SessionStore.jsm4
3 files changed, 17 insertions, 6 deletions
diff --git a/browser/components/sessionstore/SessionHistory.jsm b/browser/components/sessionstore/SessionHistory.jsm
index aa9c10379..3d28d87db 100644
--- a/browser/components/sessionstore/SessionHistory.jsm
+++ b/browser/components/sessionstore/SessionHistory.jsm
@@ -95,7 +95,10 @@ var SessionHistoryInternal = {
// record it. For about:blank we explicitly want an empty array without
// an 'index' property to denote that there are no history entries.
if (uri != "about:blank" || (body && body.hasChildNodes())) {
- data.entries.push({ url: uri });
+ data.entries.push({
+ url: uri,
+ triggeringPrincipal_base64: Utils.SERIALIZED_SYSTEMPRINCIPAL
+ });
data.index = 1;
}
}
diff --git a/browser/components/sessionstore/SessionMigration.jsm b/browser/components/sessionstore/SessionMigration.jsm
index ff339eba9..1aa22f1a9 100644
--- a/browser/components/sessionstore/SessionMigration.jsm
+++ b/browser/components/sessionstore/SessionMigration.jsm
@@ -11,6 +11,9 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
Cu.import("resource://gre/modules/Task.jsm", this);
Cu.import("resource://gre/modules/osfile.jsm", this);
+XPCOMUtils.defineLazyModuleGetter(this, "Utils",
+ "resource://gre/modules/sessionstore/Utils.jsm");
+
// An encoder to UTF-8.
XPCOMUtils.defineLazyGetter(this, "gEncoder", function () {
return new TextEncoder();
@@ -27,7 +30,7 @@ var SessionMigrationInternal = {
* only contain:
* - open windows
* - with tabs
- * - with history entries with only title, url
+ * - with history entries with only title, url, triggeringPrincipal
* - with pinned state
* - with tab group info (hidden + group id)
* - with selected tab info
@@ -45,9 +48,11 @@ var SessionMigrationInternal = {
var win = {extData: {}};
win.tabs = oldWin.tabs.map(function(oldTab) {
var tab = {};
- // Keep only titles and urls for history entries
+ // Keep only titles, urls and triggeringPrincipals for history entries
tab.entries = oldTab.entries.map(function(entry) {
- return {url: entry.url, title: entry.title};
+ return { url: entry.url,
+ triggeringPrincipal_base64: entry.triggeringPrincipal_base64,
+ title: entry.title };
});
tab.index = oldTab.index;
tab.hidden = oldTab.hidden;
@@ -60,7 +65,8 @@ var SessionMigrationInternal = {
});
let url = "about:welcomeback";
let formdata = {id: {sessionData: state}, url};
- return {windows: [{tabs: [{entries: [{url}], formdata}]}]};
+ let entry = { url, triggeringPrincipal_base64: Utils.SERIALIZED_SYSTEMPRINCIPAL };
+ return { windows: [{ tabs: [{ entries: [ entry ], formdata}]}]};
},
/**
* Asynchronously read session restore state (JSON) from a path
diff --git a/browser/components/sessionstore/SessionStore.jsm b/browser/components/sessionstore/SessionStore.jsm
index 93e21357f..6b30943f3 100644
--- a/browser/components/sessionstore/SessionStore.jsm
+++ b/browser/components/sessionstore/SessionStore.jsm
@@ -603,12 +603,14 @@ var SessionStoreInternal = {
// replace the crashed session with a restore-page-only session
let url = "about:sessionrestore";
let formdata = {id: {sessionData: state}, url};
- state = { windows: [{ tabs: [{ entries: [{url}], formdata }] }] };
+ let entry = {url, triggeringPrincipal_base64: Utils.SERIALIZED_SYSTEMPRINCIPAL };
+ state = { windows: [{ tabs: [{ entries: [entry], formdata }] }] };
} else if (this._hasSingleTabWithURL(state.windows,
"about:welcomeback")) {
// On a single about:welcomeback URL that crashed, replace about:welcomeback
// with about:sessionrestore, to make clear to the user that we crashed.
state.windows[0].tabs[0].entries[0].url = "about:sessionrestore";
+ state.windows[0].tabs[0].entries[0].triggeringPrincipal_base64 = Utils.SERIALIZED_SYSTEMPRINCIPAL;
}
}