[Pkg-mozext-commits] [tabmixplus] 33/123: Fix compatibility issues with TreeStyleTab extension

David Prévot taffit at moszumanska.debian.org
Wed Sep 17 21:16:24 UTC 2014


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

taffit pushed a commit to branch master
in repository tabmixplus.

commit 4efa83b8619b5e499a119c80b4376f9a6536efcd
Author: onemen <tabmix.onemen at gmail.com>
Date:   Sun Aug 24 15:28:13 2014 +0300

    Fix compatibility issues with TreeStyleTab extension
---
 chrome/content/extensions/extensions.js |  9 +++++++--
 chrome/content/tabmix.js                |  4 +++-
 modules/Places.jsm                      | 15 ++++++++++-----
 3 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/chrome/content/extensions/extensions.js b/chrome/content/extensions/extensions.js
index 4698ff6..5b27f86 100644
--- a/chrome/content/extensions/extensions.js
+++ b/chrome/content/extensions/extensions.js
@@ -662,8 +662,8 @@ TMP_extensionsCompatibility.treeStyleTab = {
       /(function[^\(]*\([^\)]+)(\))/,
       '$1, TSTOpenGroupBookmarkBehavior$2'
     )._replace(
-      '{',
-      '{if (TSTOpenGroupBookmarkBehavior == null) TSTOpenGroupBookmarkBehavior = TreeStyleTabService.openGroupBookmarkBehavior();'
+      /"use strict";|{/,
+      '$&\nif (TSTOpenGroupBookmarkBehavior == null) TSTOpenGroupBookmarkBehavior = TreeStyleTabService.openGroupBookmarkBehavior();'
     )._replace(
       'index = prevTab._tPos + 1;',
       '  index = gBrowser.treeStyleTab.getNextSiblingTab(gBrowser.treeStyleTab.getRootTab(prevTab));' +
@@ -704,5 +704,10 @@ TMP_extensionsCompatibility.treeStyleTab = {
         'TreeStyleTabService.readyToOpenChildTab(gBrowser, true); $1 TreeStyleTabService.stopToOpenChildTab(gBrowser);'
       ).toCode();
     }
+
+    Tabmix.changeCode(window, "window.TMP_BrowserOpenTab")._replace(
+      'var newTab = gBrowser.addTab',
+      'gBrowser.treeStyleTab.onBeforeNewTabCommand();\n   $&'
+    ).toCode(true);
   }
 }
diff --git a/chrome/content/tabmix.js b/chrome/content/tabmix.js
index c16f1a1..d09ee36 100644
--- a/chrome/content/tabmix.js
+++ b/chrome/content/tabmix.js
@@ -141,13 +141,15 @@ Tabmix.getAfterTabsButtonsWidth = function TMP_getAfterTabsButtonsWidth() {
     }
     // we call gTMPprefObserver.miscellaneousRules to add some dynamic rules
     // from Tabmix.delayedStartup
-    Tabmix._buttonsHeight =
+    this._buttonsHeight =
             tabBar.visibleTabsFirstChild.getBoundingClientRect().height;
 
     this.setItem(tabsToolbar, "tabmix-show-newtabbutton", showButton);
     if (stripIsHidden)
       tabBar.visible = false;
   }
+  else
+    this._buttonsHeight = 24;
 }
 
 Tabmix.delayedStartup = function TMP_delayedStartup() {
diff --git a/modules/Places.jsm b/modules/Places.jsm
index 9ea16cf..63ca1c4 100644
--- a/modules/Places.jsm
+++ b/modules/Places.jsm
@@ -100,7 +100,7 @@ let PlacesUtilsInternal = {
         '      browserWindow.bookMarkIds = ids.join("|");'
       )._replace(
         /let openGroupBookmarkBehavior =|TSTOpenGroupBookmarkBehavior =/,
-        '$& behavior =', {check: treeStyleTab}
+        '$& behavior =', {check: treeStyleTab, silent: true}
       )._replace(
         'browserWindow.gBrowser.loadTabs(urls, loadInBackground, false);',
         'var changeWhere = where == "tabshifted" && aEvent.target.localName != "menuitem";\n' +
@@ -110,12 +110,17 @@ let PlacesUtilsInternal = {
       ).toCode();
     };
     if (treeStyleTab) {
+      // wait until TreeStyleTab to finish change PlacesUIUtils._openTabset
       let timer = this._timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
+      this.__index = 1;
       timer.initWithCallback(function() {
-        timer.cancel();
-        this._timer = null;
-        updateOpenTabset();
-      }.bind(this), 50, Ci.nsITimer.TYPE_ONE_SHOT);
+        if (this.__index > 10 || PlacesUIUtils._openTabset.toString().indexOf("GroupBookmarkBehavior") > -1) {
+          timer.cancel();
+          this._timer = null;
+          this.__index = null;
+          updateOpenTabset();
+        }
+      }.bind(this), 50, Ci.nsITimer.TYPE_REPEATING_SLACK);
     }
     else { // TreeStyleTab not installed
       updateOpenTabset();

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