[Pkg-mozext-commits] [tabmixplus] 07/32: Clean up the code that set SessionStroe last session state

David Prévot taffit at moszumanska.debian.org
Sun Feb 7 19:23:12 UTC 2016


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

taffit pushed a commit to branch master
in repository tabmixplus.

commit 2828a27adb6bec926ce410198b3a2fb2b7136e43
Author: onemen <tabmix.onemen at gmail.com>
Date:   Mon Dec 28 20:28:24 2015 +0200

    Clean up the code that set SessionStroe last session state
---
 chrome/content/links/setup.js     | 10 ----------
 chrome/content/session/session.js | 13 ++++++++-----
 chrome/content/tabmix.js          | 16 ++++------------
 3 files changed, 12 insertions(+), 27 deletions(-)

diff --git a/chrome/content/links/setup.js b/chrome/content/links/setup.js
index f3e8b74..f56ac00 100644
--- a/chrome/content/links/setup.js
+++ b/chrome/content/links/setup.js
@@ -138,13 +138,6 @@ Tabmix.beforeBrowserInitOnLoad = function() {
         '    $&';
     }
 
-    if (Tabmix.isVersion(270) && sessionManager) {
-      this.changeCode(RestoreLastSessionObserver, "RestoreLastSessionObserver.init")._replace(
-        'SessionStore.canRestoreLastSession',
-        'TabmixSessionManager.canRestoreLastSession'
-      ).toCode();
-    }
-
     // At the moment we must init TabmixSessionManager before sessionStore.init
     var fn;
     if (typeof gBrowserInit.__treestyletab___delayedStartup == "function") {
@@ -167,9 +160,6 @@ Tabmix.beforeBrowserInitOnLoad = function() {
       '} catch (ex) {Tabmix.assert(ex);}\n' +
       '    $&'
     )._replace(
-      'SessionStore.canRestoreLastSession',
-      'TabmixSessionManager.canRestoreLastSession', {check: this.isVersion(260, 250) && sessionManager, silent: true}
-    )._replace(
       /(\})(\)?)$/,
       '  Tabmix.runningDelayedStartup = false;\n' +
       '$1$2'
diff --git a/chrome/content/session/session.js b/chrome/content/session/session.js
index 6934404..3b2f71e 100644
--- a/chrome/content/session/session.js
+++ b/chrome/content/session/session.js
@@ -2979,13 +2979,16 @@ var TabmixSessionManager = { // jshint ignore:line
   setLastSession: function(restoring) {
     let state = TabmixConvertSession.getSessionState(this.gSessionPath[1]);
     TabmixSvc.sm.lastSessionPath = this.gSessionPath[1];
-    if (!Tabmix.isVersion(270))
-      return state;
+
     // add __SS_lastSessionWindowID to force SessionStore.restoreLastSession
     // to open new window
     if (restoring)
       window.__SS_lastSessionWindowID = "" + Date.now() + Math.random();
-    TabmixSvc.SessionStoreGlobal.LastSession.setState(state);
+    if (Tabmix.isVersion(270)) {
+      TabmixSvc.SessionStoreGlobal.LastSession.setState(state);
+    } else {
+      TabmixSvc.SessionStore._lastSessionState = state;
+    }
     return state;
   },
 
@@ -2995,10 +2998,10 @@ var TabmixSessionManager = { // jshint ignore:line
       this.setLastSession(true);
     if (path == lastSession) {
       TabmixSvc.sm.lastSessionPath = null;
+      // Since Firefox 27 SessionStore LastSession.clear send
+      // NOTIFY_LAST_SESSION_CLEARED
       TabmixSvc.ss.canRestoreLastSession = false;
       Tabmix.setItem("Browser:RestoreLastSession", "disabled", true);
-      if (Tabmix.isVersion(270))
-        Services.obs.notifyObservers(null, "sessionstore-last-session-cleared", null);
     }
 
     var sessionContainer = this.initContainer(path);
diff --git a/chrome/content/tabmix.js b/chrome/content/tabmix.js
index 858e0c5..5c7b53d 100644
--- a/chrome/content/tabmix.js
+++ b/chrome/content/tabmix.js
@@ -73,16 +73,11 @@ Tabmix.sessionInitialized = function() {
     window.restoreLastSession = function restoreLastSession() {
       TabmixSessionManager.restoreLastSession();
     };
-    if (this.isVersion(200)) {
-      this.setItem("Browser:RestoreLastSession", "disabled",
-        !SM.canRestoreLastSession || SM.isPrivateWindow);
-    } else {
-      this.changeCode(HistoryMenu.prototype, "HistoryMenu.prototype.toggleRestoreLastSession")._replace(
-        'this._ss', 'TabmixSessionManager'
-      ).toCode();
-    }
 
-    if (!this.isVersion(260)) {
+    this.setItem("Browser:RestoreLastSession", "disabled",
+                 !SM.canRestoreLastSession || SM.isPrivateWindow);
+
+    if (TabmixSvc.isPaleMoon) {
       this.changeCode(window, "window.BrowserOnAboutPageLoad")._replace(
         'function updateSearchEngine',
         'let updateSearchEngine = function _updateSearchEngine', {silent: true}
@@ -96,9 +91,6 @@ Tabmix.sessionInitialized = function() {
         'ss = TabmixSessionManager;\
          $&'
       ).toCode();
-    } else if (!this.isVersion(270)) {
-      // from Firefox 27 SessionStore notify sessionstore-last-session-cleared
-      SessionStore.canRestoreLastSession = false;
     }
   }
 

-- 
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