mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-29 20:07:30 +09:00
Use SessionStore.promiseInitialized() to avoid race condition in "about:home" (#774)
* Use SessionStore.promiseInitialized() to avoid race condition in "about:home" * Improve code style of [d6c3adb91c9f29786f8ed8d93baa14c076494017]
This commit is contained in:
parent
a8ea1c8875
commit
0c0d82689f
1 changed files with 12 additions and 5 deletions
|
|
@ -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))
|
||||
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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue