[Pkg-mozext-commits] [tabmixplus] 12/26: Remove support for Firefox 19

David Prévot taffit at moszumanska.debian.org
Fri Mar 25 21:56:15 UTC 2016


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

taffit pushed a commit to tag 0.4.2.3pre.160319a1
in repository tabmixplus.

commit 3497a3b2ff430f0d967a2279b2b5ebce8a88eae7
Author: onemen <tabmix.onemen at gmail.com>
Date:   Sun Mar 13 17:39:00 2016 +0200

    Remove support for Firefox 19
---
 chrome/content/minit/tablib.js    |  48 +++++++----------
 chrome/content/places/places.js   |   2 +-
 chrome/content/session/session.js | 108 ++++----------------------------------
 chrome/content/tabmix.js          |  34 +++++-------
 chrome/content/utils.js           |   9 ++--
 modules/ContentClick.jsm          |   9 ++--
 modules/MergeWindows.jsm          |  18 +++----
 modules/Shortcuts.jsm             |  15 ++----
 modules/SingleWindowModeUtils.jsm |  18 ++-----
 9 files changed, 66 insertions(+), 195 deletions(-)

diff --git a/chrome/content/minit/tablib.js b/chrome/content/minit/tablib.js
index c4f4a2d..f2e7954 100644
--- a/chrome/content/minit/tablib.js
+++ b/chrome/content/minit/tablib.js
@@ -627,24 +627,21 @@ var tablib = { // eslint-disable-line
       Tabmix.changeCode(nsContextMenu.prototype, "nsContextMenu.prototype.initOpenItems")._replace(
         /context-openlink",/, '$& !Tabmix.singleWindowMode &&'
       )._replace(
-        /context-openlinkprivate",/, '$& (!Tabmix.singleWindowMode || !isWindowPrivate) &&',
-        {check: Tabmix.isVersion(200)}
+        /context-openlinkprivate",/, '$& (!Tabmix.singleWindowMode || !isWindowPrivate) &&'
       ).toCode();
 
-      if (Tabmix.isVersion(200)) {
-        Tabmix.changeCode(nsContextMenu.prototype, "nsContextMenu.prototype.openLinkInPrivateWindow")._replace(
-          'openLinkIn(this.linkURL, "window",',
-          'var [win, where] = [window, "window"];\
-           if (Tabmix.singleWindowMode) {\
-             let pbWindow = Tabmix.RecentWindow.getMostRecentBrowserWindow({ private: true });\
-             if (pbWindow) {\
-               [win, where] = [pbWindow, "tab"];\
-               pbWindow.focus();\
-             }\
+      Tabmix.changeCode(nsContextMenu.prototype, "nsContextMenu.prototype.openLinkInPrivateWindow")._replace(
+        'openLinkIn(this.linkURL, "window",',
+        'var [win, where] = [window, "window"];\
+         if (Tabmix.singleWindowMode) {\
+           let pbWindow = Tabmix.RecentWindow.getMostRecentBrowserWindow({ private: true });\
+           if (pbWindow) {\
+             [win, where] = [pbWindow, "tab"];\
+             pbWindow.focus();\
            }\
-           win.openLinkIn(this.linkURL, where,'
-        ).toCode();
-      }
+         }\
+         win.openLinkIn(this.linkURL, where,'
+      ).toCode();
     }
 
     /**
@@ -826,9 +823,7 @@ var tablib = { // eslint-disable-line
       'window = #1.undoCloseWindow(aIndex || 0);'.
        replace("#1", Tabmix.isVersion(260) ? "SessionStore" : "ss"),
       '{if (Tabmix.singleWindowMode) {\
-         window = TabmixSvc.version(200) ?\
-            Tabmix.RecentWindow.getMostRecentBrowserWindow({private: false}) :\
-            Tabmix.getTopWin();\
+          window = Tabmix.RecentWindow.getMostRecentBrowserWindow({private: false});\
        }\
        if (window) {\
         window.focus();\
@@ -869,7 +864,7 @@ var tablib = { // eslint-disable-line
       '$& \
        let SM = TabmixSessionManager;\
        Tabmix.setItem("Browser:RestoreLastSession", "disabled", !SM.canRestoreLastSession || SM.isPrivateWindow);',
-       {check: Tabmix.isVersion(200) && Tabmix.prefs.getBoolPref("sessions.manager")}
+       {check: Tabmix.prefs.getBoolPref("sessions.manager")}
     ).toCode();
 
     Tabmix.changeCode(HistoryMenu.prototype, "HistoryMenu.prototype.populateUndoWindowSubmenu")._replace(
@@ -1690,9 +1685,10 @@ var tablib = { // eslint-disable-line
     let swapTab = function tabmix_swapBrowsersAndCloseOther(aOurTab, aOtherTab) {
       // Do not allow transfering a private tab to a non-private window
       // and vice versa.
-      if (Tabmix.isVersion(200) && PrivateBrowsingUtils.isWindowPrivate(window) !=
-          PrivateBrowsingUtils.isWindowPrivate(aOtherTab.ownerDocument.defaultView))
+      if (PrivateBrowsingUtils.isWindowPrivate(window) !=
+          PrivateBrowsingUtils.isWindowPrivate(aOtherTab.ownerDocument.defaultView)) {
         return;
+      }
 
       if (Tabmix.runningDelayedStartup) {
         // we probably will never get here in single window mode
@@ -1907,14 +1903,10 @@ var tablib = { // eslint-disable-line
       if (Services.prefs.getBoolPref("browser.sessionstore.resume_session_once"))
         return false;
 
-      if (Tabmix.isVersion(200)) {
-        // try to find non-private window
-        let nonPrivateWindow = Tabmix.RecentWindow.getMostRecentBrowserWindow({private: false});
-        if (!nonPrivateWindow)
-          return false;
-      } else if (TabmixSessionManager.globalPrivateBrowsing) {
+      // try to find non-private window
+      let nonPrivateWindow = Tabmix.RecentWindow.getMostRecentBrowserWindow({private: false});
+      if (!nonPrivateWindow)
         return false;
-      }
 
       // last windows with tabs
       var windowtype = aCountOnlyBrowserWindows ? "navigator:browser" : null;
diff --git a/chrome/content/places/places.js b/chrome/content/places/places.js
index 9875186..bcc81a6 100644
--- a/chrome/content/places/places.js
+++ b/chrome/content/places/places.js
@@ -723,7 +723,7 @@ Tabmix.onContentLoaded = {
       'var w = getTopWin();',
       '$&\n' +
       '  if (w && where == "window" &&\n' +
-      '      !Tabmix.isNewWindowAllow(Tabmix.isVersion(200) ? aIsPrivate : false)) {\n' +
+      '      !Tabmix.isNewWindowAllow(aIsPrivate)) {\n' +
       '    where = "tab";\n' +
       '  }'
     )._replace(
diff --git a/chrome/content/session/session.js b/chrome/content/session/session.js
index b82bc12..dcd5ee0 100644
--- a/chrome/content/session/session.js
+++ b/chrome/content/session/session.js
@@ -325,17 +325,13 @@ TabmixSessionManager = {
     obs.addObserver(this, "quit-application-requested", true);
     obs.addObserver(this, "browser-lastwindow-close-requested", true);
     obs.addObserver(this, "browser:purge-session-history", true);
-    if (!Tabmix.isVersion(200)) {
-      obs.addObserver(this, "private-browsing", true);
-      obs.addObserver(this, "private-browsing-change-granted", true);
-    }
     if (Tabmix.isVersion(270)) {
       if (!isFirstWindow && this.enableBackup && this.canRestoreLastSession)
         window.__SS_lastSessionWindowID = "" + Date.now() + Math.random();
       obs.addObserver(this, "sessionstore-last-session-cleared", true);
     }
 
-    if (Tabmix.isVersion(200) && this.isPrivateWindow) {
+    if (this.isPrivateWindow) {
       // disable saveing or changeing any data on the disk in private window
       document.getElementById("tmp_contextmenu_ThisWindow").setAttribute("disabled", true);
       document.getElementById("tmp_contextmenu_AllWindows").setAttribute("disabled", true);
@@ -438,7 +434,7 @@ TabmixSessionManager = {
       this.saveStateDelayed();
   },
 
-  // we call this function after session restored by sessionStore, after restart or after exit private-browsing
+  // we call this function after session restored by sessionStore
   onSessionRestored: function SM_onSessionRestored(aKeepClosedWindows) {
     // sync rdf list with sessionstore closed tab after restart
     // we need it when we delete/restore close tab
@@ -449,7 +445,6 @@ TabmixSessionManager = {
 
     // we keep the old session after restart.
     // just remove the restored session from close window list
-    // if we are not exiting private browsing mode
     var sessionContainer = this.initContainer(this.gSessionPath[0]);
     if (!aKeepClosedWindows)
       this.deleteWithProp(sessionContainer, "status", "saved");
@@ -537,12 +532,10 @@ TabmixSessionManager = {
     window.focus();
     var title = TabmixSvc.getSMString("sm.askBeforSave.title");
     var msg = TabmixSvc.getSMString("sm.askBeforSave.msg0");
-    if (Tabmix.isVersion(200)) {
-      // add remark - Only non-private windows will save
-      // when there is one private window or more..
-      if (Tabmix.RecentWindow.getMostRecentBrowserWindow({private: true}))
-        msg += "\n" + TabmixSvc.getSMString("sm.askBeforSave.msg2");
-    }
+    // add remark - Only non-private windows will save
+    // when there is one private window or more..
+    if (Tabmix.RecentWindow.getMostRecentBrowserWindow({private: true}))
+      msg += "\n" + TabmixSvc.getSMString("sm.askBeforSave.msg2");
     msg += "\n\n" + TabmixSvc.getSMString("sm.askBeforSave.msg1");
     var chkBoxLabel = TabmixSvc.getSMString("sm.saveClosedTab.chkbox.label");
     var chkBoxState = this.saveClosedTabs ? Tabmix.CHECKBOX_CHECKED : Tabmix.HIDE_CHECKBOX;
@@ -557,8 +550,9 @@ TabmixSessionManager = {
   windowIsClosing: function SM_WindowIsClosing(aCanClose, aLastWindow,
                                                 aSaveSession, aRemoveClosedTabs, aKeepClosedWindows) {
 
-    if (Tabmix.isVersion(200) && this.isPrivateWindow)
+    if (this.isPrivateWindow) {
       this.removeSession(this.gThisWin, this.gSessionPath[0]);
+    }
 
     if (this.windowClosed || this.isPrivateSession)
       return;
@@ -593,7 +587,6 @@ TabmixSessionManager = {
         if (aSaveSession) {
           var rdfNodeClosedWindows = this.RDFService.GetResource(this.gSessionPath[0]);
           var sessionContainer = this.initContainer(rdfNodeClosedWindows);
-          // don't remove closed windows when entring private browsing mode
           if (!aKeepClosedWindows)
             this.deleteWithProp(sessionContainer, "dontLoad");
           var count = this.countWinsAndTabs(sessionContainer, "dontLoad");
@@ -686,16 +679,8 @@ TabmixSessionManager = {
       obs.removeObserver(this, "quit-application-requested");
       obs.removeObserver(this, "browser-lastwindow-close-requested");
       obs.removeObserver(this, "browser:purge-session-history", true);
-      if (!Tabmix.isVersion(200)) {
-        obs.removeObserver(this, "private-browsing");
-        obs.removeObserver(this, "private-browsing-change-granted");
-      }
       if (Tabmix.isVersion(270))
         obs.removeObserver(this, "sessionstore-last-session-cleared");
-      if (this.afterExitPrivateBrowsing) {
-        clearTimeout(this.afterExitPrivateBrowsing);
-        this.afterExitPrivateBrowsing = null;
-      }
     }
     if ("tabmixdata" in window) {
       let {restoreID} = window.tabmixdata;
@@ -1121,7 +1106,7 @@ TabmixSessionManager = {
   },
 
   savedPrefs: {},
-  observe: function SM_observe(aSubject, aTopic, aData) {
+  observe: function SM_observe(aSubject, aTopic) {
     switch (aTopic) {
       case "quit-application-requested":
         // TabView
@@ -1169,76 +1154,6 @@ TabmixSessionManager = {
           this.toggleRecentlyClosedWindowsButton();
         }, 0);
         break;
-      case "private-browsing-change-granted":
-        // Whether we restore the session upon resume will be determined by the
-        // usual startup prefs see Bug 660785
-        if (aData == "enter" && (this.prefBranch.getBoolPref("manager") ||
-                                 this.prefBranch.getBoolPref("crashRecovery"))) {
-          this.canQuitApplication(true, true);
-        }
-        break;
-      case "private-browsing":
-        switch (aData) {
-          case "enter":
-            // check if we need to close protected tab here
-            var needToCloseProtected = true;
-            try {
-              if (Services.prefs.getBoolPref("browser.privatebrowsing.keep_current_session"))
-                needToCloseProtected = false;
-            } catch (ex) { }
-            // noting to do here if we are not using tabmix session manager
-            if (!this.prefBranch.getBoolPref("manager") && !this.prefBranch.getBoolPref("crashRecovery")) {
-              // nsPrivateBrowsingService.js can not close protected tab we have to do it our self
-              // we only close this tab here after nsPrivateBrowsingService save the session
-              if (needToCloseProtected)
-                this.closeProtectedTabs();
-              this.globalPrivateBrowsing = true;
-              TMP_ClosedTabs.setButtonDisableState(true);
-              this.toggleRecentlyClosedWindowsButton();
-              break;
-            }
-            this.globalPrivateBrowsing = true;
-            if (needToCloseProtected)
-              this.closeProtectedTabs();
-            this.enableManager = this.prefBranch.getBoolPref("manager") && !this.globalPrivateBrowsing;
-            this.enableBackup = this.prefBranch.getBoolPref("crashRecovery") && !this.globalPrivateBrowsing;
-            this.updateSettings();
-            TMP_ClosedTabs.setButtonDisableState(true);
-            break;
-          case "exit":
-            // nsPrivateBrowsingService.js can not close protected tab we have to do it our self
-            this.closeProtectedTabs();
-            aSubject.QueryInterface(Ci.nsISupportsPRBool);
-            var quitting = aSubject.data;
-            if (quitting)
-              break;
-            // build-in sessionStore restore the session for us
-            if (!this.prefBranch.getBoolPref("manager") && !this.prefBranch.getBoolPref("crashRecovery")) {
-              this.globalPrivateBrowsing = false;
-              window.setTimeout(() => {
-                TMP_ClosedTabs.setButtonDisableState();
-                this.toggleRecentlyClosedWindowsButton();
-              }, 100);
-              break;
-            }
-            TMP_ClosedTabs.removeAllClosedTabs(); // to be on the safe side...
-            this.removeSession(this.gThisWin, this.gSessionPath[0]);
-            window.setTimeout(() => {
-              TMP_ClosedTabs.setButtonDisableState();
-            }, 0);
-            this.afterExitPrivateBrowsing = window.setTimeout(() => {
-              this.globalPrivateBrowsing = false;
-              this.windowClosed = false;
-              this.onSessionRestored(true);
-              this.updateSettings();
-              this.removeAttribute(this.gThisWin, "dontLoad");
-              this.saveStateDelayed();
-              this.updateClosedWindowsMenu("check");
-              this.afterExitPrivateBrowsing = null;
-            }, 0);
-            break;
-        }
-        break;
     }
   },
 
@@ -2288,9 +2203,7 @@ TabmixSessionManager = {
   },
 
   prepareSavedSessions: function SM_prepareSavedSessions() {
-    // make sure we delete closed windows that may exist if we exit Firefox
-    // from private browsing mode. we skip this command in windowIsClosing
-    // when entring private browsing mode
+    // make sure we delete closed windows
     this.deleteWithProp(this.initContainer(this.gSessionPath[0]), "dontLoad");
 
     // don't remove oldest session if last session was empty
@@ -3124,7 +3037,6 @@ TabmixSessionManager = {
       this.mergeWindows(state);
     }
 
-    // Firefox 20 introduced per-window private browsing mode
     // we restore multi-windows session to the same privacy state of the current window
     var windowEnum = Tabmix.windowEnumerator();
     var windowsList = [];
diff --git a/chrome/content/tabmix.js b/chrome/content/tabmix.js
index ef86393..fe8fca3 100644
--- a/chrome/content/tabmix.js
+++ b/chrome/content/tabmix.js
@@ -9,29 +9,23 @@
 Tabmix.startup = function TMP_startup() {
   var cmdNewWindow = document.getElementById("cmd_newNavigator");
   var originalNewNavigator = cmdNewWindow.getAttribute("oncommand");
-  // Firefox 20+ implemented per-window Private Browsing
   // When in single window mode allow one normal window and one private window.
   // otherwise open new tab in most recent window of the appropriate type
-  if (this.isVersion(200)) {
-    this._openNewTab = function(aPrivate) {
-      if (this.singleWindowMode) {
-        let win = this.RecentWindow.getMostRecentBrowserWindow({private: aPrivate});
-        if (win) {
-          win.focus();
-          win.BrowserOpenTab();
-          return false;
-        }
+  this._openNewTab = function(aPrivate) {
+    if (this.singleWindowMode) {
+      let win = this.RecentWindow.getMostRecentBrowserWindow({private: aPrivate});
+      if (win) {
+        win.focus();
+        win.BrowserOpenTab();
+        return false;
       }
-      return true;
-    };
-    let command = document.getElementById("Tools:PrivateBrowsing");
-    let originalCode = command.getAttribute("oncommand");
-    Tabmix.setItem(command, "oncommand", "if (Tabmix._openNewTab(true)) {" + originalCode + "}");
-    Tabmix.setItem(cmdNewWindow, "oncommand", "if (Tabmix._openNewTab(false)) {" + originalNewNavigator + "}");
-  } else {
-    Tabmix.setItem(cmdNewWindow, "oncommand", "if (Tabmix.singleWindowMode) BrowserOpenTab(); " +
-                                          "else {" + originalNewNavigator + "}");
-  }
+    }
+    return true;
+  };
+  let command = document.getElementById("Tools:PrivateBrowsing");
+  let originalCode = command.getAttribute("oncommand");
+  Tabmix.setItem(command, "oncommand", "if (Tabmix._openNewTab(true)) {" + originalCode + "}");
+  Tabmix.setItem(cmdNewWindow, "oncommand", "if (Tabmix._openNewTab(false)) {" + originalNewNavigator + "}");
 
   TabmixContext.toggleEventListener(true);
 
diff --git a/chrome/content/utils.js b/chrome/content/utils.js
index ea37bab..c7cc3a9 100644
--- a/chrome/content/utils.js
+++ b/chrome/content/utils.js
@@ -75,7 +75,7 @@ var Tabmix = { // jshint ignore:line
     //   user are not in single window mode or
     //   there is no other window with the same privacy type
     return !this.getSingleWindowMode() ||
-      this.isVersion(200) && !this.RecentWindow.getMostRecentBrowserWindow({private: isPrivate});
+      !this.RecentWindow.getMostRecentBrowserWindow({private: isPrivate});
   },
 
   lazy_import: function(aObject, aName, aModule, aSymbol, aFlag, aArg) {
@@ -238,11 +238,8 @@ var Tabmix = { // jshint ignore:line
     Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
     Components.utils.import("resource://gre/modules/Services.jsm");
     this.lazy_import(window, "TabmixSvc", "Services", "TabmixSvc");
-    if (this.isVersion(200)) {
-      let resource = this.isVersion(210) ? "resource:///" : "resource://gre/";
-      XPCOMUtils.defineLazyModuleGetter(this, "RecentWindow",
-                 resource + "modules/RecentWindow.jsm");
-    }
+    XPCOMUtils.defineLazyModuleGetter(this, "RecentWindow",
+                                      "resource:///modules/RecentWindow.jsm");
 
     window.addEventListener("unload", function tabmix_destroy() {
       window.removeEventListener("unload", tabmix_destroy, false);
diff --git a/modules/ContentClick.jsm b/modules/ContentClick.jsm
index 68acfc9..df3f063 100644
--- a/modules/ContentClick.jsm
+++ b/modules/ContentClick.jsm
@@ -978,11 +978,10 @@ ContentClickInternal = {
     let isValidWindow = function(aWindow) {
       // window is valid only if both source and destination are in the same
       // privacy state and multiProcess state
-      if ((TabmixSvc.version(200) &&
-           PrivateBrowsingUtils.isWindowPrivate(window) !=
-           PrivateBrowsingUtils.isWindowPrivate(aWindow)) ||
-          (TabmixSvc.version(320) &&
-           window.gMultiProcessBrowser != aWindow.gMultiProcessBrowser)) {
+      if (PrivateBrowsingUtils.isWindowPrivate(window) !=
+          PrivateBrowsingUtils.isWindowPrivate(aWindow) ||
+          TabmixSvc.version(320) &&
+          window.gMultiProcessBrowser != aWindow.gMultiProcessBrowser) {
         return false;
       }
       return true;
diff --git a/modules/MergeWindows.jsm b/modules/MergeWindows.jsm
index fccadae..1b86a58 100644
--- a/modules/MergeWindows.jsm
+++ b/modules/MergeWindows.jsm
@@ -7,6 +7,9 @@ const Cu = Components.utils;
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://tabmixplus/Services.jsm");
 
+XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
+  "resource://gre/modules/PrivateBrowsingUtils.jsm");
+
 //////////////////////////////////////////////////////////////////////
 // The Original Code is the Merge Window function of "Duplicate Tab"//
 // extension for Mozilla Firefox.                                   //
@@ -33,7 +36,7 @@ this.MergeWindows = {
     var selectedTabs = tabbrowser.tabContainer.getElementsByAttribute("mergeselected", true);
     let options = {
       skipPopup: !this.prefs.getBoolPref("mergePopups"),
-      private: TabmixSvc.version(200) ? this.isWindowPrivate(aWindow) : false,
+      private: this.isWindowPrivate(aWindow),
       tabsSelected: selectedTabs.length > 0,
       multiple: mergeAllWindows && !selectedTabs.length
     };
@@ -98,8 +101,7 @@ this.MergeWindows = {
 
   mergePopUpsToNewWindow: function(aWindows, aPrivate) {
     var features = "chrome,all,dialog=no";
-    if (TabmixSvc.version(200))
-      features += aPrivate ? ",private" : ",non-private";
+    features += aPrivate ? ",private" : ",non-private";
     var newWindow = aWindows[0].openDialog("chrome://browser/content/browser.xul",
         "_blank", features, null);
     let mergePopUps = function _mergePopUps() {
@@ -201,16 +203,10 @@ this.MergeWindows = {
     return !aWindow.toolbar.visible;
   },
 
-  // we use it only for Fireofx 20+, before that always return false
   isWindowPrivate: function() {
     delete this.isWindowPrivate;
-    if (TabmixSvc.version(200)) {
-      Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
-      this.isWindowPrivate = aWindow => PrivateBrowsingUtils.isWindowPrivate(aWindow);
-      return this.isWindowPrivate(arguments[0]);
-    }
-    this.isWindowPrivate = () => false;
-    return false;
+    this.isWindowPrivate = aWindow => PrivateBrowsingUtils.isWindowPrivate(aWindow);
+    return this.isWindowPrivate(arguments[0]);
   },
 
   /*
diff --git a/modules/Shortcuts.jsm b/modules/Shortcuts.jsm
index a4fc5d4..4f2a5e2 100644
--- a/modules/Shortcuts.jsm
+++ b/modules/Shortcuts.jsm
@@ -8,6 +8,9 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://tabmixplus/Services.jsm");
 
+XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
+                                  "resource://gre/modules/PrivateBrowsingUtils.jsm");
+
 var KeyConfig;
 this.Shortcuts = {
   keys: {
@@ -63,7 +66,6 @@ this.Shortcuts = {
   updatingShortcuts: false,
   prefBackup: null,
   initialized: false,
-  permanentPrivateBrowsing: false,
   keyConfigInstalled: false,
 
   initService: function(aWindow) {
@@ -71,15 +73,6 @@ this.Shortcuts = {
       return;
     this.initialized = true;
 
-    if (TabmixSvc.version(200)) {
-      let tmp = {};
-      Cu.import("resource://gre/modules/PrivateBrowsingUtils.jsm", tmp);
-      this.permanentPrivateBrowsing = tmp.PrivateBrowsingUtils.permanentPrivateBrowsing;
-    } else {
-      this.permanentPrivateBrowsing = Cc["@mozilla.org/privatebrowsing;1"].
-          getService(Ci.nsIPrivateBrowsingService).autoStarted;
-    }
-
     // update keys initial value and label
     // get our key labels from shortcutsLabels.xml
     let $ = id => id && aWindow.document.getElementById(id);
@@ -282,7 +275,7 @@ this.Shortcuts = {
 
   _getChangedKeys: function TMP_SC__getChangedKeys(aOptions) {
     let shortcuts = !aOptions.onChange && this.prefBackup || this._getShortcutsPref();
-    let disableSessionKeys = this.permanentPrivateBrowsing ||
+    let disableSessionKeys = PrivateBrowsingUtils.permanentPrivateBrowsing ||
         !this.prefs.getBoolPref("sessions.manager");
     let changedKeys = {}, onOpen = aOptions.onOpen;
     for (let key of Object.keys(this.keys)) {
diff --git a/modules/SingleWindowModeUtils.jsm b/modules/SingleWindowModeUtils.jsm
index aca1221..efc33e1 100644
--- a/modules/SingleWindowModeUtils.jsm
+++ b/modules/SingleWindowModeUtils.jsm
@@ -6,18 +6,9 @@ const {interfaces: Ci, utils: Cu} = Components;
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://tabmixplus/Services.jsm");
+Cu.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
 
 this.SingleWindowModeUtils = {
-  initialized: false,
-  initService: function() {
-    if (this.initialized)
-      return;
-    this.initialized = true;
-
-    if (TabmixSvc.version(200))
-      Cu.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
-  },
-
  /**
   * @brief Locate a browser window.
   *
@@ -30,14 +21,12 @@ this.SingleWindowModeUtils = {
   getBrowserWindow: function(aExclude) {
     // on per-window private browsing mode,
     // allow to open one normal window and one private window in single window mode
-    var checkPrivacy = TabmixSvc.version(200);
-    var isPrivate = checkPrivacy && PrivateBrowsingUtils.isWindowPrivate(aExclude);
+    var isPrivate = PrivateBrowsingUtils.isWindowPrivate(aExclude);
 
     function isSuitableBrowserWindow(win) {
       return (!win.closed && win.document.readyState == "complete" &&
               win.toolbar.visible && win != aExclude &&
-              (!checkPrivacy ||
-                PrivateBrowsingUtils.isWindowPrivate(win) == isPrivate));
+              PrivateBrowsingUtils.isWindowPrivate(win) == isPrivate);
     }
 
     var windows = Services.wm.getEnumerator("navigator:browser");
@@ -56,7 +45,6 @@ this.SingleWindowModeUtils = {
     if (!aWindow.arguments || aWindow.arguments.length === 0)
       return false;
 
-    this.initService();
     aWindow.addEventListener("load", function _onLoad(aEvent) {
       let window = aEvent.currentTarget;
       window.removeEventListener("load", _onLoad, 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