[Pkg-mozext-commits] [tabmixplus] 05/32: Clean our modification to gBrowserInit._delayedStartup – move the block deal with swap tab to gBrowser.swapBrowsersAndCloseOther

David Prévot taffit at moszumanska.debian.org
Sun Feb 7 19:23:12 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 d6be99313f4326116913d90d3be51bd6fb3a30e5
Author: onemen <tabmix.onemen at gmail.com>
Date:   Mon Dec 28 09:04:00 2015 +0200

    Clean our modification to gBrowserInit._delayedStartup – move the block deal with swap tab to gBrowser.swapBrowsersAndCloseOther
---
 chrome/content/links/setup.js  | 26 +++++++++-----------------
 chrome/content/minit/tablib.js | 11 +++++++++++
 2 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/chrome/content/links/setup.js b/chrome/content/links/setup.js
index f71c6b7..2405bb0 100644
--- a/chrome/content/links/setup.js
+++ b/chrome/content/links/setup.js
@@ -75,21 +75,6 @@ Tabmix.beforeBrowserInitOnLoad = function() {
     if (SM.firstNonPrivateWindow)
       TabmixSvc.sm.private = false;
 
-    // Bug 756313 - Don't load homepage URI before first paint
-    // moved this code from gBrowserInit.onLoad to gBrowserInit._delayedStartup
-    var swapOldCode = this.isVersion(380) ?
-        'gBrowser.swapBrowsersAndCloseOther(gBrowser.selectedTab, tabToOpen);' :
-        'gBrowser.swapBrowsersAndCloseOther(gBrowser.selectedTab, uriToLoad);';
-    var loadOnStartup, swapNewCode =
-      ' if (!Tabmix.singleWindowMode) {' +
-      '   Tabmix._afterTabduplicated = true;' +
-      '   TabmixSessionManager.init();' +
-      '   let remoteBrowser = uriToLoad.ownerDocument.defaultView.gBrowser;' +
-      '   let url = remoteBrowser.getBrowserForTab(uriToLoad).currentURI.spec;' +
-      '   gBrowser.tabContainer.adjustTabstrip(true, url);' +
-      '   $&' +
-      ' }';
-
     var firstWindow = this.firstWindowInSession || SM.firstNonPrivateWindow;
     var disabled = TMP_SessionStore.isSessionStoreEnabled() ||
                       this.extensions.sessionManager;
@@ -138,6 +123,7 @@ Tabmix.beforeBrowserInitOnLoad = function() {
       }
     }
 
+    var loadOnStartup;
     if (prepareLoadOnStartup) {
       // move this code from gBrowserInit.onLoad to gBrowserInit._delayedStartup after bug 756313
       loadOnStartup =
@@ -173,6 +159,10 @@ Tabmix.beforeBrowserInitOnLoad = function() {
       ssPromise = 'typeof ssPromise == "object" ? ssPromise : null';
 
     this.changeCode(gBrowserInit, fn)._replace(
+      '{',
+      '{\n' +
+      '  Tabmix.runningDelayedStartup = true;\n'
+    )._replace(
       'Services.obs.addObserver', loadOnStartup, {check: !!loadOnStartup}
     )._replace(
       insertionPoint,
@@ -181,10 +171,12 @@ Tabmix.beforeBrowserInitOnLoad = function() {
       '} catch (ex) {Tabmix.assert(ex);}\n' +
       '    $&'
     )._replace(
-      swapOldCode, swapNewCode
-    )._replace(
       'SessionStore.canRestoreLastSession',
       'TabmixSessionManager.canRestoreLastSession', {check: this.isVersion(260, 250) && sessionManager, silent: true}
+    )._replace(
+      /(\})(\)?)$/,
+      '  Tabmix.runningDelayedStartup = false;\n' +
+      '$1$2'
     ).toCode();
 
     // look for installed extensions that are incompatible with tabmix
diff --git a/chrome/content/minit/tablib.js b/chrome/content/minit/tablib.js
index 0c0a665..ca99ed8 100644
--- a/chrome/content/minit/tablib.js
+++ b/chrome/content/minit/tablib.js
@@ -1681,6 +1681,17 @@ var tablib = { // eslint-disable-line
           PrivateBrowsingUtils.isWindowPrivate(aOtherTab.ownerDocument.defaultView))
         return;
 
+      if (Tabmix.runningDelayedStartup) {
+        // we probably will never get here in single window mode
+        if (Tabmix.singleWindowMode) {
+          return;
+        }
+        Tabmix._afterTabduplicated = true;
+        TabmixSessionManager.init();
+        let url = aOtherTab.linkedBrowser.currentURI.spec;
+        gBrowser.tabContainer.adjustTabstrip(true, url);
+      }
+
       Tabmix.copyTabData(aOurTab, aOtherTab);
 
       let copy = aOtherTab._tabmixCopyToWindow;

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