summaryrefslogtreecommitdiffstats
path: root/browser/components/sessionstore
diff options
context:
space:
mode:
authorMoonchild <mcwerewolf@gmail.com>2018-04-23 11:44:12 +0200
committerGitHub <noreply@github.com>2018-04-23 11:44:12 +0200
commit531abf25517fd6b130bc5a1f799becf33684bb43 (patch)
tree76d45af609ba25efce252d6ec276c0da7b223046 /browser/components/sessionstore
parent1916969baaa5d2bd84f323ca0510ba2c8a04ef58 (diff)
parentb9ecf99332786f0040e63d868fa0d799ed1ab765 (diff)
downloadUXP-531abf25517fd6b130bc5a1f799becf33684bb43.tar
UXP-531abf25517fd6b130bc5a1f799becf33684bb43.tar.gz
UXP-531abf25517fd6b130bc5a1f799becf33684bb43.tar.lz
UXP-531abf25517fd6b130bc5a1f799becf33684bb43.tar.xz
UXP-531abf25517fd6b130bc5a1f799becf33684bb43.zip
Merge pull request #234 from janekptacijarabaci/about_errors_1
moebius#65: Fix: various "about:..." system pages errors
Diffstat (limited to 'browser/components/sessionstore')
-rw-r--r--browser/components/sessionstore/content/aboutSessionRestore.js52
1 files changed, 29 insertions, 23 deletions
diff --git a/browser/components/sessionstore/content/aboutSessionRestore.js b/browser/components/sessionstore/content/aboutSessionRestore.js
index cc8d2da0b..8a9410aa8 100644
--- a/browser/components/sessionstore/content/aboutSessionRestore.js
+++ b/browser/components/sessionstore/content/aboutSessionRestore.js
@@ -41,7 +41,11 @@ window.onload = function() {
return;
}
- gStateObject = JSON.parse(sessionData.value);
+ try {
+ gStateObject = JSON.parse(sessionData.value);
+ } catch (e) {
+ Cu.reportError(e);
+ }
// make sure the data is tracked to be restored in case of a subsequent crash
var event = document.createEvent("UIEvents");
@@ -68,30 +72,32 @@ function initTreeView() {
var winLabel = tabList.getAttribute("_window_label");
gTreeData = [];
- gStateObject.windows.forEach(function(aWinData, aIx) {
- var winState = {
- label: winLabel.replace("%S", (aIx + 1)),
- open: true,
- checked: true,
- ix: aIx
- };
- winState.tabs = aWinData.tabs.map(function(aTabData) {
- var entry = aTabData.entries[aTabData.index - 1] || { url: "about:blank" };
- var iconURL = aTabData.image || null;
- // don't initiate a connection just to fetch a favicon (see bug 462863)
- if (/^https?:/.test(iconURL))
- iconURL = "moz-anno:favicon:" + iconURL;
- return {
- label: entry.title || entry.url,
+ if (gStateObject) {
+ gStateObject.windows.forEach(function(aWinData, aIx) {
+ var winState = {
+ label: winLabel.replace("%S", (aIx + 1)),
+ open: true,
checked: true,
- src: iconURL,
- parent: winState
+ ix: aIx
};
- });
- gTreeData.push(winState);
- for (let tab of winState.tabs)
- gTreeData.push(tab);
- }, this);
+ winState.tabs = aWinData.tabs.map(function(aTabData) {
+ var entry = aTabData.entries[aTabData.index - 1] || { url: "about:blank" };
+ var iconURL = aTabData.image || null;
+ // don't initiate a connection just to fetch a favicon (see bug 462863)
+ if (/^https?:/.test(iconURL))
+ iconURL = "moz-anno:favicon:" + iconURL;
+ return {
+ label: entry.title || entry.url,
+ checked: true,
+ src: iconURL,
+ parent: winState
+ };
+ });
+ gTreeData.push(winState);
+ for (let tab of winState.tabs)
+ gTreeData.push(tab);
+ }, this);
+ }
tabList.view = treeView;
tabList.view.selection.select(0);