[Pkg-mozext-commits] [tabmixplus] 44/123: When restoring session with the preference 'Don’t load tabs until selected' set unloaded tab-styling updates slowly

David Prévot taffit at moszumanska.debian.org
Wed Sep 17 21:16:25 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 1bcf7c88304db9412d6127fccbe78fcf4f4fca36
Author: onemen <tabmix.onemen at gmail.com>
Date:   Mon Aug 25 19:45:04 2014 +0300

    When restoring session with the preference 'Don’t load tabs until selected' set unloaded tab-styling updates slowly
---
 chrome/content/links/userInterface.js |  3 ++-
 chrome/content/minit/tablib.js        | 13 ++++++++-----
 chrome/content/session/session.js     |  6 +++++-
 chrome/content/tab/tab.js             |  2 ++
 chrome/content/tab/tabbrowser_4.xml   |  2 ++
 chrome/content/tabmix.js              |  2 ++
 6 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/chrome/content/links/userInterface.js b/chrome/content/links/userInterface.js
index 3409c5e..f5a624e 100644
--- a/chrome/content/links/userInterface.js
+++ b/chrome/content/links/userInterface.js
@@ -371,7 +371,8 @@ Tabmix.setTabStyle = function(aTab, boldChanged) {
   if (aTab.selected)
     style = "current";
   // if pending tab is blank we don't style it as unload or unread
-  else if (Tabmix.prefs.getBoolPref("unloadedTab") && aTab.hasAttribute("pending"))
+  else if (Tabmix.prefs.getBoolPref("unloadedTab") &&
+      (aTab.hasAttribute("pending") || aTab.hasAttribute("tabmix_pending")))
     style = TMP_SessionStore.isBlankPendingTab(aTab) ? "other" : "unloaded";
   else if (Tabmix.prefs.getBoolPref("unreadTab") &&
       !aTab.hasAttribute("visited") && !isTabEmpty(aTab))
diff --git a/chrome/content/minit/tablib.js b/chrome/content/minit/tablib.js
index ec7e08b..0ceadbb 100644
--- a/chrome/content/minit/tablib.js
+++ b/chrome/content/minit/tablib.js
@@ -67,18 +67,19 @@ var tablib = {
       [obj, fnName] = [gBrowser, "addTab"];
 
     Tabmix.changeCode(obj, "gBrowser." + fnName)._replace(
-      '{','{ \
-       var dontMove;'
-    )._replace(
       '{','{\n\
-       if (!TabmixSvc.sm.promiseInitialized && !this.tabs[0].loadOnStartup && Tabmix.callerName() == "ssi_restoreWindow" && !Tabmix.isWindowAfterSessionRestore)\n\
+       if (!TabmixSvc.sm.promiseInitialized && !this.tabs[0].loadOnStartup && isRestoringTab && !Tabmix.isWindowAfterSessionRestore)\n\
          return this.tabs[0];\n', {check: Tabmix.isVersion(250) && TabmixSessionManager.doRestore}
     )._replace(
+      '{','{\n\
+      let dontMove, isPending, isRestoringTab = Tabmix.callerName() == "ssi_restoreWindow";\n'
+    )._replace(
       'params = arguments[1];',
       '$&\
        let props = ["referrerURI","charset","postData","ownerTab","allowThirdPartyFixup","fromExternal","relatedToCurrent","skipAnimation"];\
        props.forEach(function(prop){if (typeof params[prop] == "undefined") params[prop] = null;}); \
-       dontMove = params.dontMove || null;'
+       dontMove = params.dontMove || null;\
+       isPending = params.isPending || null;'
     )._replace(
       't.setAttribute("label", aURI);',
       't.setAttribute("label", TabmixTabbar.widthFitTitle && aURI.indexOf("about") != 0 ? this.mStringBundle.getString("tabs.connecting") : aURI);',
@@ -87,6 +88,8 @@ var tablib = {
       't.className = "tabbrowser-tab";',
       '$&\
        t.setAttribute("last-tab", "true"); \
+       if (isPending || isRestoringTab && Services.prefs.getBoolPref("browser.sessionstore.restore_on_demand")) \
+         t.setAttribute("tabmix_pending", "true"); \
        var lastChild = this.tabContainer.lastChild; \
        if (lastChild) lastChild.removeAttribute("last-tab"); \
        if (TabmixTabbar.widthFitTitle) t.setAttribute("newtab", true);'
diff --git a/chrome/content/session/session.js b/chrome/content/session/session.js
index 5ef9f44..1460e2c 100644
--- a/chrome/content/session/session.js
+++ b/chrome/content/session/session.js
@@ -2976,8 +2976,9 @@ try{
       var lastSelectedIndex = restoreSelect ? this.getIntValue(rdfNodeWindow, "selectedIndex") : 0;
       if (lastSelectedIndex < 0 || lastSelectedIndex >= newtabsCount) lastSelectedIndex = 0;
 
+      let pending = Services.prefs.getBoolPref("browser.sessionstore.restore_on_demand")
       function TMP_addTab() {
-        let newTab = gBrowser.addTab("about:blank", {skipAnimation: true, dontMove: true});
+        let newTab = gBrowser.addTab("about:blank", {skipAnimation: true, dontMove: true, isPending: pending});
         newTab.setAttribute("tabmix_hide", "true");
         // flag. dont save tab that are in restore phase
         newTab.setAttribute("inrestore", "true");
@@ -3246,6 +3247,9 @@ try{
         if (aTab.hasAttribute(attrib))
           aTab.removeAttribute(attrib);
       });
+      if (Services.prefs.getBoolPref("browser.sessionstore.restore_on_demand"))
+        aTab.setAttribute("tabmix_pending", "true");
+      Tabmix.setTabStyle(aTab);
 
       if (aTab.pinned)
         gBrowser.unpinTab(aTab);
diff --git a/chrome/content/tab/tab.js b/chrome/content/tab/tab.js
index b520dff..8102198 100644
--- a/chrome/content/tab/tab.js
+++ b/chrome/content/tab/tab.js
@@ -1944,6 +1944,8 @@ var TabmixProgressListener = {
           this.mTabBrowser.setTabTitle(tab);
         }
         else if (!(aStateFlags & nsIWebProgressListener.STATE_RESTORING)) {
+          if (tab.hasAttribute("tabmix_pending"))
+            tab.removeAttribute("tabmix_pending");
           Tabmix.setTabStyle(tab);
           // this code run after setTabTitleLoading, so we must set tab width on setTabTitleLoading
           // at this stage only unhide the button if needed.
diff --git a/chrome/content/tab/tabbrowser_4.xml b/chrome/content/tab/tabbrowser_4.xml
index 4cc21c2..d4a88df 100644
--- a/chrome/content/tab/tabbrowser_4.xml
+++ b/chrome/content/tab/tabbrowser_4.xml
@@ -423,6 +423,8 @@
           let tab = this.firstChild;
           tab.setAttribute("tabmix_selectedID", Tabmix._nextSelectedID++);
           tab.setAttribute("visited", true);
+          if (Services.prefs.getBoolPref("browser.sessionstore.restore_on_demand"))
+            tab.setAttribute("tabmix_pending", "true");
           Tabmix.setTabStyle(tab);
           TabmixTabbar.lockallTabs = Tabmix.prefs.getBoolPref("lockallTabs");
           if (TabmixTabbar.lockallTabs) {
diff --git a/chrome/content/tabmix.js b/chrome/content/tabmix.js
index 1397b85..a246eb2 100644
--- a/chrome/content/tabmix.js
+++ b/chrome/content/tabmix.js
@@ -859,6 +859,8 @@ var TMP_eventListener = {
     if (!tab.hasAttribute("visited"))
       tab.setAttribute("visited", true);
 
+    if (tab.hasAttribute("tabmix_pending"))
+      tab.removeAttribute("tabmix_pending");
     let lastSelected = document.getElementsByAttribute("tabmix_tabStyle",
       Tabmix.tabStyles["current"] || "current")[0];
     Tabmix.setTabStyle(lastSelected);

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