[Pkg-mozext-commits] [tabmixplus] 06/56: Update compatibility with treeStyleTab - follow up changeset d5cd8b3c10e1 and changeset 3389b946b4d9, when our preference is to open the tab next and the current tab in pinned (app tab), open the new tab before the first non-pinned tab

David Prévot taffit at moszumanska.debian.org
Mon Jun 6 00:02:32 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 0c4cc8178ce1434f7dd5fe9ff24b2f1975a5cef0
Author: onemen <tabmix.onemen at gmail.com>
Date:   Tue Apr 26 21:05:32 2016 +0300

    Update compatibility with treeStyleTab - follow up changeset d5cd8b3c10e1 and  changeset 3389b946b4d9, when our preference is to open the tab next and the current tab in pinned (app tab), open the new tab before the first non-pinned tab
---
 chrome/content/extensions/extensions.js | 33 ++++++++++++++++++++++++++++++---
 1 file changed, 30 insertions(+), 3 deletions(-)

diff --git a/chrome/content/extensions/extensions.js b/chrome/content/extensions/extensions.js
index aea1fd2..fefcd36 100644
--- a/chrome/content/extensions/extensions.js
+++ b/chrome/content/extensions/extensions.js
@@ -806,16 +806,43 @@ TMP_extensionsCompatibility.treeStyleTab = {
     if (!browser) {
       return;
     }
-    let baseTab = tst.getTabFromBrowser(browser, tst.getTabBrowserFromChild(browser));
+    let ownerBrowser = tst.getTabBrowserFromChild(browser);
+    let baseTab = tst.getTabFromBrowser(browser, ownerBrowser);
+    let parentTab = tst.getParentTab(baseTab);
 
     // clean previously ready state set by treeStyleTab
     if (clean) {
       tst.stopToOpenChildTab(baseTab);
-      let parentTab = tst.getParentTab(baseTab);
       if (parentTab) {
         tst.stopToOpenChildTab(parentTab);
       }
     }
-    tst.readyToOpenNextSiblingTabNow(baseTab);
+
+    // based on treeStyleTab.readyToOpenNextSiblingTabNow
+    // we also set ready state for pinned tabs
+    let readyToOpenNextSiblingTab = function() {
+      if (!baseTab)
+        return false;
+      let nextTab = tst.getNextSiblingTab(baseTab);
+      if (parentTab) {
+        return tst.readyToOpenChildTab(parentTab, false, nextTab);
+      } else if (nextTab) {
+        ownerBrowser.treeStyleTab.readiedToAttachNewTab = true;
+        ownerBrowser.treeStyleTab.parentTab = null;
+        ownerBrowser.treeStyleTab.insertBefore = nextTab.getAttribute(tst.kID);
+        return true;
+      }
+      return false;
+    };
+
+    if (readyToOpenNextSiblingTab()) {
+      setTimeout(() => {
+        try {
+          tst.stopToOpenChildTab(baseTab);
+        } catch (ex) {
+          tst.defaultErrorHandler(ex);
+        }
+      }, 0);
+    }
   },
 };

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