summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorJustOff <Off.Just.Off@gmail.com>2018-09-18 00:13:21 +0300
committerwolfbeast <mcwerewolf@gmail.com>2018-09-18 08:25:39 +0200
commit775e800ca09a8756a7963204992703039c08f1bf (patch)
tree85b3d536fc9d9f1493efc376554f0fee33c901ed /application
parent882aaf5b1fda7b216051b55e268de78fd5126f42 (diff)
downloadUXP-775e800ca09a8756a7963204992703039c08f1bf.tar
UXP-775e800ca09a8756a7963204992703039c08f1bf.tar.gz
UXP-775e800ca09a8756a7963204992703039c08f1bf.tar.lz
UXP-775e800ca09a8756a7963204992703039c08f1bf.tar.xz
UXP-775e800ca09a8756a7963204992703039c08f1bf.zip
Use SessionStore.promiseInitialized() to avoid race condition in "about:home" (#774)PM28.1.0_Release
* Use SessionStore.promiseInitialized() to avoid race condition in "about:home" * Improve code style of [d6c3adb91c9f29786f8ed8d93baa14c076494017]
Diffstat (limited to 'application')
-rw-r--r--application/palemoon/base/content/browser.js17
1 files changed, 12 insertions, 5 deletions
diff --git a/application/palemoon/base/content/browser.js b/application/palemoon/base/content/browser.js
index 5cf43850a..4167f186c 100644
--- a/application/palemoon/base/content/browser.js
+++ b/application/palemoon/base/content/browser.js
@@ -2421,11 +2421,18 @@ function BrowserOnAboutPageLoad(doc) {
/* === about:home === */
if (doc.documentURI.toLowerCase() == "about:home") {
- let ss = Components.classes["@mozilla.org/browser/sessionstore;1"].
- getService(Components.interfaces.nsISessionStore);
- if (ss.canRestoreLastSession &&
- !PrivateBrowsingUtils.isWindowPrivate(window))
- doc.getElementById("launcher").setAttribute("session", "true");
+ if (!PrivateBrowsingUtils.isWindowPrivate(window)) {
+ let wrapper = {};
+ Cu.import("resource:///modules/sessionstore/SessionStore.jsm", wrapper);
+ let ss = wrapper.SessionStore;
+ ss.promiseInitialized.then(function() {
+ if (ss.canRestoreLastSession) {
+ doc.getElementById("launcher").setAttribute("session", "true");
+ }
+ }).then(null, function onError(x) {
+ Cu.reportError("Error in SessionStore init while processing 'about:home': " + x);
+ });
+ }
// Inject search engine and snippets URL.
let docElt = doc.documentElement;