[Pkg-mozext-commits] [tabmixplus] 19/44: Remove hidden tab groups from state. Update changeset 90deaeb2cc7a.

David Prévot taffit at moszumanska.debian.org
Fri Mar 18 20:57:15 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 1c9dfc514678928e75af12d7b4919dc08ac5bfe3
Author: onemen <tabmix.onemen at gmail.com>
Date:   Sun Feb 28 22:17:55 2016 +0200

    Remove hidden tab groups from state. Update changeset 90deaeb2cc7a.
---
 .eslintrc                                      |  1 +
 chrome/content/minit/tabView.js                |  4 +--
 chrome/content/session/session.js              | 35 +++++++++++++---------
 chrome/locale/en-US/session-manager.properties |  1 +
 modules/TabGroupsMigrator.jsm                  | 40 +++++++++++++++++++-------
 5 files changed, 55 insertions(+), 26 deletions(-)

diff --git a/.eslintrc b/.eslintrc
index 7651047..102fa00 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -345,6 +345,7 @@
         "SidebarUtils": false,
         "SessionStore": false,
         "TabContextMenu": false,
+        "TabGroupsMigrator": false,
         "TAB_DROP_TYPE": false,
         "TabsInTitlebar": false,
         "TabsOnTop": false,
diff --git a/chrome/content/minit/tabView.js b/chrome/content/minit/tabView.js
index 3fb44c7..38b9d32 100644
--- a/chrome/content/minit/tabView.js
+++ b/chrome/content/minit/tabView.js
@@ -207,12 +207,12 @@
     this._updateUIpageBounds = false;
   };
 
-  TabmixSessionManager._setWindowStateReady = function(aOverwriteTabs, showNotification) {
+  TabmixSessionManager._setWindowStateReady = function(aOverwriteTabs, showNotification, tabsRemoved) {
     if (Tabmix.isVersion(350)) {
       TabmixSvc.SessionStore._setWindowStateReady(window);
     }
     if (!this.tabViewInstalled) {
-      this.notifyAboutMissingTabView(showNotification);
+      this.notifyAboutMissingTabView(tabsRemoved);
       return;
     }
 
diff --git a/chrome/content/session/session.js b/chrome/content/session/session.js
index c03a82a..b4aa8cd 100644
--- a/chrome/content/session/session.js
+++ b/chrome/content/session/session.js
@@ -3053,8 +3053,13 @@ TabmixSessionManager = {
     if (Tabmix.singleWindowMode)
       concatenate = true;
 
+    let tabsRemoved;
     let state = TabmixConvertSession.getSessionState(path, true);
-
+    if (!this.tabViewInstalled) {
+      // strips out the hidden tab groups and all tabview metadata
+      let hiddenTabState = this.TabmixGroupsMigrator.removeHiddenTabGroupsFromState(state);
+      tabsRemoved = hiddenTabState.windows.length > 0;
+    }
     if (concatenate) {
       // move all tabs & closed tabs into one window
       this.mergeWindows(state);
@@ -3077,6 +3082,7 @@ TabmixSessionManager = {
     }
 
     state.windows.forEach(winData => {
+      winData.tabsRemoved = tabsRemoved;
       sessionCount++;
       let win = windowsList.pop();
       let canOverwriteWindow = win && (overwriteWindows ||
@@ -3394,7 +3400,7 @@ TabmixSessionManager = {
 
     // show notification and clean up our data
     var showNotification = caller != "firstwindowopen" || this.prefBranch.getIntPref("onStart") == 1;
-    this._setWindowStateReady(overwrite, showNotification);
+    this._setWindowStateReady(overwrite, showNotification, winData.tabsRemoved);
 
     // when resuming at startup: add additionally requested pages to the end
     if (caller == "firstwindowopen" && loadOnStartup.length) {
@@ -3774,21 +3780,24 @@ TabmixSessionManager = {
 
   notifyAboutMissingTabView: function(showNotification) {
     // show notification when Tabview is missing and the session have hidden tabs
-    if (showNotification || !this.tabViewInstalled) {
+    if (TabmixSvc.isPaleMoon) {
       let hiddenTabs = gBrowser.tabs.length > gBrowser.visibleTabs.length;
-      if (this._groupCount > 1 && hiddenTabs) {
-        this.TabmixGroupsMigrator.missingTabViewNotification(window);
-      }
+      showNotification = this._groupCount > 1 && hiddenTabs;
+    }
+    if (showNotification) {
+      this.TabmixGroupsMigrator.missingTabViewNotification(window);
     }
   },
 
   _beforeRestore: function(winData) {
     TabmixSvc.SessionStore._setWindowStateBusy(window);
-    // save group count before we start the restore
-    let extData = winData.extData || {};
-    let data = extData["tabview-groups"] || "{}";
-    let parsedData = TabmixSvc.JSON.parse(data);
-    this._groupCount = parsedData.totalNumber || 1;
+    if (this.tabViewInstalled || TabmixSvc.isPaleMoon) {
+      // save group count before we start the restore
+      let extData = winData.extData || {};
+      let data = extData["tabview-groups"] || "{}";
+      let parsedData = TabmixSvc.JSON.parse(data);
+      this._groupCount = parsedData.totalNumber || 1;
+    }
   },
 
   // we override these functions when TabView exist
@@ -3796,11 +3805,11 @@ TabmixSessionManager = {
     this._beforeRestore(winData);
   },
 
-  _setWindowStateReady: function(aOverwriteTabs, showNotification) {
+  _setWindowStateReady: function(aOverwriteTabs, showNotification, tabsRemoved) {
     if (Tabmix.isVersion(350)) {
       TabmixSvc.SessionStore._setWindowStateReady(window);
     }
-    this.notifyAboutMissingTabView(showNotification);
+    this.notifyAboutMissingTabView(tabsRemoved);
   },
 
   _saveTabviewData: function() { },
diff --git a/chrome/locale/en-US/session-manager.properties b/chrome/locale/en-US/session-manager.properties
index 92b6133..0dbf4a5 100644
--- a/chrome/locale/en-US/session-manager.properties
+++ b/chrome/locale/en-US/session-manager.properties
@@ -105,6 +105,7 @@ sm.extension.convert.selectfile=Select session.rdf file to convert
 sm.extension.convert.rdffiles=RDF Files
 sm.extension.convert.sessionfiles=Session Files
 sm.tabview.hiddengroups=More tabs restored into hidden groups.
+sm.tabview.hiddengroups.removed=Hidden tab groups was removed.
 sm.tabview.removed=The Tab Groups (Panorama) feature was removed from Firefox.
 sm.tabview.removed.learnMore.label=Learn More
 sm.tabview.removed.learnMore.accesskey=L
diff --git a/modules/TabGroupsMigrator.jsm b/modules/TabGroupsMigrator.jsm
index 20c6e51..f7d6e42 100644
--- a/modules/TabGroupsMigrator.jsm
+++ b/modules/TabGroupsMigrator.jsm
@@ -9,8 +9,21 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "Services",
                                   "resource://gre/modules/Services.jsm");
 
-XPCOMUtils.defineLazyModuleGetter(this, "TabGroupsMigrator",
-                                  "resource:///modules/TabGroupsMigrator.jsm");
+XPCOMUtils.defineLazyGetter(this, "TabGroupsMigrator", function() {
+  if (!TabmixSvc.version(470)) {
+    return null;
+  }
+
+  let tmp = {};
+  let resource = "resource:///modules/TabGroupsMigrator.jsm";
+  try {
+    Cu.import(resource, tmp);
+  } catch (ex) {
+    TabmixSvc.console.reportError("Failed to load module " + resource + ".");
+    return null;
+  }
+  return tmp.TabGroupsMigrator;
+});
 
 XPCOMUtils.defineLazyModuleGetter(this, "TabmixSvc",
                                   "resource://tabmixplus/Services.jsm");
@@ -102,14 +115,10 @@ this.TabmixGroupsMigrator = {
     let notificationBox = this.getNotificationBox(win.document);
     let notification = notificationBox.getNotificationWithValue("tabmix-missing-tabview");
     if (notification) {
-      if (notification.tabmixSavedBackup) {
-        notification.label += " " + string("hiddengroups");
-        delete notification.tabmixSavedBackup;
-      }
       return;
     }
 
-    let message = backup || string("hiddengroups");
+    let message = backup;
     let buttons = [{
       label: string("install.label"),
       accessKey: string("install.accesskey"),
@@ -121,7 +130,9 @@ this.TabmixGroupsMigrator = {
       }
     }];
 
-    if (!TabmixSvc.isPaleMoon) {
+    if (TabmixSvc.isPaleMoon) {
+      message = string("hiddengroups");
+    } else {
       buttons.push({
         label: string("removed.learnMore.label"),
         accessKey: string("removed.learnMore.accesskey"),
@@ -129,7 +140,7 @@ this.TabmixGroupsMigrator = {
           win.openUILinkIn("http://tabmixplus.org/support/viewpage.php?t=2&p=tab-groups-removal", "tab");
         }
       });
-      message = string("removed") + " " + message;
+      message = string("removed") + " " + string("hiddengroups.removed") + " " + message;
     }
 
     notification = notificationBox.appendNotification(
@@ -145,8 +156,15 @@ this.TabmixGroupsMigrator = {
         }
       }
     );
-    if (backup) {
-      notification.tabmixSavedBackup = true;
+  },
+
+  removeHiddenTabGroupsFromState: function(state) {
+    if (!TabGroupsMigrator) {
+      return {windows: []};
     }
+
+    let groupData = TabGroupsMigrator._gatherGroupData(state);
+    let hiddenTabState = TabGroupsMigrator._removeHiddenTabGroupsFromState(state, groupData);
+    return hiddenTabState;
   },
 };

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