diff options
author | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-04-23 09:02:57 +0200 |
---|---|---|
committer | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-04-23 09:02:57 +0200 |
commit | b9ecf99332786f0040e63d868fa0d799ed1ab765 (patch) | |
tree | 4226709e8c9dc01228c7950c5af6b9ed86e93494 | |
parent | c30ebdac27c93b57e368c69e9c13055a17229992 (diff) | |
download | uxp-b9ecf99332786f0040e63d868fa0d799ed1ab765.tar.gz |
moebius#65: Fix: "about:..." - throws an errors
https://github.com/MoonchildProductions/moebius/pull/65
-rw-r--r-- | browser/base/content/sync/aboutSyncTabs.js | 13 | ||||
-rw-r--r-- | browser/base/jar.mn | 2 | ||||
-rw-r--r-- | browser/components/sessionstore/content/aboutSessionRestore.js | 52 | ||||
-rw-r--r-- | toolkit/components/aboutcache/content/aboutCache.js | 4 | ||||
-rw-r--r-- | toolkit/modules/sessionstore/FormData.jsm | 2 |
5 files changed, 43 insertions, 30 deletions
diff --git a/browser/base/content/sync/aboutSyncTabs.js b/browser/base/content/sync/aboutSyncTabs.js index 0c5dbb2d81..f4bb607ea2 100644 --- a/browser/base/content/sync/aboutSyncTabs.js +++ b/browser/base/content/sync/aboutSyncTabs.js @@ -7,7 +7,6 @@ var Cu = Components.utils; Cu.import("resource://services-common/utils.js"); Cu.import("resource://services-sync/main.js"); Cu.import("resource:///modules/PlacesUIUtils.jsm"); -Cu.import("resource://gre/modules/AppConstants.jsm"); Cu.import("resource://gre/modules/PlacesUtils.jsm", this); Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/XPCOMUtils.jsm"); @@ -15,10 +14,10 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "Promise", "resource://gre/modules/Promise.jsm"); -if (AppConstants.MOZ_SERVICES_CLOUDSYNC) { - XPCOMUtils.defineLazyModuleGetter(this, "CloudSync", - "resource://gre/modules/CloudSync.jsm"); -} +#ifdef MOZ_SERVICES_CLOUDSYNC +XPCOMUtils.defineLazyModuleGetter(this, "CloudSync", + "resource://gre/modules/CloudSync.jsm"); +#endif var RemoteTabViewer = { _tabsList: null, @@ -184,12 +183,16 @@ var RemoteTabViewer = { } } +#ifdef MOZ_SERVICES_CLOUDSYNC if (CloudSync && CloudSync.ready && CloudSync().tabsReady && CloudSync().tabs.hasRemoteTabs()) { this._generateCloudSyncTabList() .then(complete, complete); } else { complete(); } +#else + complete(); +#endif }, _clearTabList: function () { diff --git a/browser/base/jar.mn b/browser/base/jar.mn index 9cbfe7c151..63ae6c3663 100644 --- a/browser/base/jar.mn +++ b/browser/base/jar.mn @@ -138,7 +138,7 @@ browser.jar: content/browser/pageinfo/permissions.js (content/pageinfo/permissions.js) content/browser/pageinfo/security.js (content/pageinfo/security.js) content/browser/sync/aboutSyncTabs.xul (content/sync/aboutSyncTabs.xul) - content/browser/sync/aboutSyncTabs.js (content/sync/aboutSyncTabs.js) +* content/browser/sync/aboutSyncTabs.js (content/sync/aboutSyncTabs.js) content/browser/sync/aboutSyncTabs.css (content/sync/aboutSyncTabs.css) content/browser/sync/aboutSyncTabs-bindings.xml (content/sync/aboutSyncTabs-bindings.xml) content/browser/sync/setup.xul (content/sync/setup.xul) diff --git a/browser/components/sessionstore/content/aboutSessionRestore.js b/browser/components/sessionstore/content/aboutSessionRestore.js index cc8d2da0b9..8a9410aa8f 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); diff --git a/toolkit/components/aboutcache/content/aboutCache.js b/toolkit/components/aboutcache/content/aboutCache.js index 07067cce36..e945d683e0 100644 --- a/toolkit/components/aboutcache/content/aboutCache.js +++ b/toolkit/components/aboutcache/content/aboutCache.js @@ -40,5 +40,9 @@ function navigate() if ($('priv').checked) context += 'p,'; + if (storage == null) { + storage = ""; + } + window.location.href = 'about:cache?storage=' + storage + '&context=' + context; } diff --git a/toolkit/modules/sessionstore/FormData.jsm b/toolkit/modules/sessionstore/FormData.jsm index f90ba5825e..d4fb08d939 100644 --- a/toolkit/modules/sessionstore/FormData.jsm +++ b/toolkit/modules/sessionstore/FormData.jsm @@ -216,7 +216,7 @@ var FormDataInternal = { // We want to avoid saving data for about:sessionrestore as a string. // Since it's stored in the form as stringified JSON, stringifying further // causes an explosion of escape characters. cf. bug 467409 - if (isRestorationPage(ret.url)) { + if (isRestorationPage(ret.url) && ret.id && ret.id.sessionData) { ret.id.sessionData = JSON.parse(ret.id.sessionData); } |