[Pkg-mozext-commits] [tabmixplus] 18/73: Update compatibility with treeStyleTab - for all the calls to addTab from openUILinkIn or from external app, prepare the tree to open the new tab as next sibling, when our pref is to open new tabs next and only if treeStyletab did not set it to open as child. (changeset 3389b946b4d9)

David Prévot taffit at moszumanska.debian.org
Mon May 9 02:30:51 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 01827b9cf8ba0f2593b955c292ad33aa7a25b410
Author: onemen <tabmix.onemen at gmail.com>
Date:   Tue Mar 29 22:43:22 2016 +0300

    Update compatibility with treeStyleTab - for all the calls to addTab from openUILinkIn or from external app, prepare the tree to open the new tab as next sibling, when our pref is to open new tabs next and only if treeStyletab did not set it to open as child. (changeset 3389b946b4d9)
---
 chrome/content/extensions/extensions.js |  8 ++++++++
 chrome/content/minit/minit.js           | 11 ++---------
 chrome/content/minit/tablib.js          | 12 ++++++++----
 3 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/chrome/content/extensions/extensions.js b/chrome/content/extensions/extensions.js
index 5c97dc4..f883d22 100644
--- a/chrome/content/extensions/extensions.js
+++ b/chrome/content/extensions/extensions.js
@@ -783,6 +783,14 @@ TMP_extensionsCompatibility.treeStyleTab = {
     }
   },
 
+  // Don't call openNewTabNext if treeStyleTab already set readiedToAttachNewTab
+  checkToOpenTabNext: function(tab, check) {
+    if (this.installed && check &&
+        !gBrowser.treeStyleTab.checkToOpenChildTab(tab)) {
+      this.openNewTabNext(tab, true);
+    }
+  },
+
   // instruct treeStyleTab to use 'kNEWTAB_OPEN_AS_NEXT_SIBLING' when our preference
   // is to open the tab next
   openNewTabNext: function(tab, openTabNext, clean) {
diff --git a/chrome/content/minit/minit.js b/chrome/content/minit/minit.js
index 6365e26..5ac92ad 100644
--- a/chrome/content/minit/minit.js
+++ b/chrome/content/minit/minit.js
@@ -1191,7 +1191,6 @@ Tabmix.navToolbox = {
         Tabmix.originalFunctions.oldHandleCommand.toString().indexOf(TMP_fn) > -1)
       return;
 
-    let $LF = "\n                ";
     // we don't do anything regarding IeTab and URL Suffix extensions
     Tabmix.changeCode(obj, "gURLBar." + fn, {silent: this.urlBarInitialized})._replace(
       '{',
@@ -1219,14 +1218,8 @@ Tabmix.navToolbox = {
       '(where == "current" || !isMouseEvent && !loadNewTab && /^tab/.test(where))'
     )._replace(
       'openUILinkIn(url, where, params);',
-      'params.inBackground = Tabmix.prefs.getBoolPref("loadUrlInBackground");' + $LF +
-      'if (/^tab/.test(where)) {' + $LF +
-      '  let openTabNext = Tabmix.prefs.getBoolPref("openTabNext") &&' + $LF +
-      '    !Services.prefs.getBoolPref("browser.tabs.insertRelatedAfterCurrent");' + $LF +
-      '  TMP_extensionsCompatibility.treeStyleTab' + $LF +
-      '    .openNewTabNext(gBrowser.selectedTab, openTabNext);' + $LF +
-      '}' + $LF +
-      '$&'
+      'params.inBackground = Tabmix.prefs.getBoolPref("loadUrlInBackground");\
+       $&'
     ).toCode();
 
     // don't call ChangeCode.isValidToChange after urlbar initialized,
diff --git a/chrome/content/minit/tablib.js b/chrome/content/minit/tablib.js
index 0d8d357..24c0869 100644
--- a/chrome/content/minit/tablib.js
+++ b/chrome/content/minit/tablib.js
@@ -153,6 +153,7 @@ var tablib = { // eslint-disable-line
       [obj, fnName] = [gBrowser, "addTab"];
     }
 
+    let $LF = '\n            ';
     Tabmix.changeCode(obj, "gBrowser." + fnName)._replace(
       '{', '{\n' +
       '            let dontMove, isPending, callerTrace = Tabmix.callerTrace(),\n' +
@@ -192,17 +193,20 @@ var tablib = { // eslint-disable-line
       'Services.prefs.getBoolPref("browser.tabs.insertRelatedAfterCurrent")',
       'openTabnext'
     )._replace(
-      't.dispatchEvent(evt);',
+      'this.tabContainer.appendChild(t);',
       'var _selectedTab = this.selectedTab;' +
       'var _lastRelatedTab = this._lastRelatedTab;' +
-      't.dispatchEvent(evt);' +
       'var openTabnext = Tabmix.prefs.getBoolPref("openTabNext");' +
       'if (openTabnext) {' +
       '  if (dontMove || Tabmix.dontMoveNewTab(callerTrace))' +
       '    openTabnext = false;' +
       '  else if (!Services.prefs.getBoolPref("browser.tabs.insertRelatedAfterCurrent"))' +
-      '    aRelatedToCurrent = true;' +
-      '}'
+      '    aRelatedToCurrent = true;' + $LF +
+      '  let checkToOpenTabNext = openTabnext && (callerTrace.contain("openUILinkIn") || aFromExternal) &&' + $LF +
+      '      (aRelatedToCurrent == null ? aReferrerURI : aRelatedToCurrent);' + $LF +
+      '  TMP_extensionsCompatibility.treeStyleTab.checkToOpenTabNext(this.selectedTab, checkToOpenTabNext);' + $LF +
+      '}' + $LF +
+      '$&'
     )._replace(//  new tab can trigger selection change by some extensions (divX HiQ)
       't.owner = this.selectedTab;', 't.owner = _selectedTab;'
     ).toCode();

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