[Pkg-mozext-commits] [tabmixplus] 04/09: Restartless extensions not starts properly when our Session manager enabled. After changeset 5c6eda8c5ab8 (Refactor _sendRestoreCompletedNotifications), we don't send completed-notifications in case user preferences match condition to set notRestore to true in Tabmix.beforeBrowserInitOnLoad

David Prévot taffit at moszumanska.debian.org
Tue Sep 12 21:30:07 UTC 2017


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository tabmixplus.

commit f2d04ed896ce4a3e93291a18ac09bbc2324a5b4e
Author: onemen <tabmix.onemen at gmail.com>
Date:   Thu Sep 7 12:35:08 2017 +0300

    Restartless extensions not starts properly when our Session manager enabled. After changeset 5c6eda8c5ab8 (Refactor _sendRestoreCompletedNotifications), we don't send completed-notifications in case user preferences match condition to set notRestore to true in Tabmix.beforeBrowserInitOnLoad
---
 chrome/content/session/session.js | 28 +++++++++++++---------------
 1 file changed, 13 insertions(+), 15 deletions(-)

diff --git a/chrome/content/session/session.js b/chrome/content/session/session.js
index eefe084..5b47837 100644
--- a/chrome/content/session/session.js
+++ b/chrome/content/session/session.js
@@ -288,8 +288,8 @@ TabmixSessionManager = {
 
     let initializeSM = () => {
       this._init();
-      if (this.notifyObservers && this.waitForCallBack) {
-        Services.obs.notifyObservers(null, "sessionstore-browser-state-restored", "");
+      if (this.waitForCallBack || TabmixSvc.sm.restoreCount == -1) {
+        this._sendRestoreCompletedNotifications();
       }
       if (!this.waitForCallBack) {
         this.restoreWindowArguments();
@@ -415,16 +415,12 @@ TabmixSessionManager = {
       if (sanitized) {
         this.prefBranch.clearUserPref("sanitized");
         TabmixSvc.sm.sanitized = false;
-        TabmixSvc.sm.restoreCount = 1;
-        this._sendRestoreCompletedNotifications();
         this.loadHomePage();
         this.saveStateDelayed();
         return;
       }
 
       if (!this.enableManager && (!this.enableBackup || !crashed)) {
-        TabmixSvc.sm.restoreCount = 1;
-        this._sendRestoreCompletedNotifications();
         return;
       }
 
@@ -2347,8 +2343,6 @@ TabmixSessionManager = {
     var sessionList = this.getSessionList("onlyPath");
     var askifempty = restoreFlag > 1 ? false : this.prefBranch.getBoolPref("onStart.askifempty");
     if (sessionList === null) {
-      TabmixSvc.sm.restoreCount = 1;
-      this._sendRestoreCompletedNotifications();
       if (((askifempty && afterCrash) || restoreFlag == 1) && !this.corruptedFile) {
         msg = TabmixSvc.getSMString("sm.start.msg0") + "\n" +
           TabmixSvc.getSMString("sm.afterCrash.msg10");
@@ -2448,8 +2442,6 @@ TabmixSessionManager = {
       this.deferredRestore();
     else {
       // we are here not after a callback only when the startup file is empty
-      TabmixSvc.sm.restoreCount = 1;
-      this._sendRestoreCompletedNotifications();
       this.loadHomePage();
     }
 
@@ -2534,14 +2526,20 @@ TabmixSessionManager = {
   },
 
   _sendRestoreCompletedNotifications() {
-    // not all windows restored, yet
-    if (TabmixSvc.sm.restoreCount > 1) {
-      TabmixSvc.sm.restoreCount--;
+    // notify observers things are complete in these cases:
+    // when all windows restored
+    // when we have nothing to restore
+    // when we are waiting for user responds to a prompt dialog
+
+    // observers were already notified
+    if (TabmixSvc.sm.observersWereNotified || !this.notifyObservers) {
+      TabmixSvc.sm.restoreCount = -1;
       return;
     }
 
-    // observers were already notified
-    if (TabmixSvc.sm.observersWereNotified || TabmixSvc.sm.restoreCount == -1) {
+    // not all windows restored, yet
+    if (TabmixSvc.sm.restoreCount > 1) {
+      TabmixSvc.sm.restoreCount--;
       return;
     }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/tabmixplus.git



More information about the Pkg-mozext-commits mailing list