[Pkg-mozext-commits] [tabmixplus] 24/47: Update TMP_BrowserOpenTab to call gBrowser.loadOneTab. don't set special flag for google.toolbar case

David Prévot taffit at moszumanska.debian.org
Fri Sep 26 20:57:01 UTC 2014


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

taffit pushed a commit to branch upstream
in repository tabmixplus.

commit 117d21985a71c9aa5b2dff1faad1545ca792843e
Author: onemen <tabmix.onemen at gmail.com>
Date:   Sat Sep 20 13:47:51 2014 +0300

    Update TMP_BrowserOpenTab to call gBrowser.loadOneTab. don't set special flag for google.toolbar case
---
 chrome/content/extensions/extensions.js |  2 +-
 chrome/content/links/userInterface.js   | 34 +++++++++++++--------------------
 2 files changed, 14 insertions(+), 22 deletions(-)

diff --git a/chrome/content/extensions/extensions.js b/chrome/content/extensions/extensions.js
index f3db34e..7ce56bd 100644
--- a/chrome/content/extensions/extensions.js
+++ b/chrome/content/extensions/extensions.js
@@ -659,7 +659,7 @@ TMP_extensionsCompatibility.treeStyleTab = {
     }
 
     Tabmix.changeCode(window, "window.TMP_BrowserOpenTab")._replace(
-      'var newTab = gBrowser.addTab',
+      'var newTab = gBrowser.loadOneTab',
       'gBrowser.treeStyleTab.onBeforeNewTabCommand();\n   $&'
     ).toCode();
   }
diff --git a/chrome/content/links/userInterface.js b/chrome/content/links/userInterface.js
index 2d3f42c..ae48d51 100644
--- a/chrome/content/links/userInterface.js
+++ b/chrome/content/links/userInterface.js
@@ -135,22 +135,26 @@ function TMP_BrowserOpenTab(aTab, replaceLastTab) {
       default:
          url = newTabUrl;
    }
-   var flags = nsIWebNavigation.LOAD_FLAGS_NONE;
    // if google.toolbar extension installed check google.toolbar.newtab pref
    if ("GTB_GoogleToolbarOverlay" in window) {
      try {
-       if (Services.prefs.getBoolPref("google.toolbar.newtab")) {
+       if (Services.prefs.getBoolPref("google.toolbar.newtab"))
          url = "chrome://google-toolbar/content/new-tab.html";
-         flags = nsIWebNavigation.LOAD_FLAGS_BYPASS_HISTORY
-       }
      } catch (ex) {/* no pref - do noting */}
    }
    if (TabmixTabbar.widthFitTitle && replaceLastTab && !gBrowser.mCurrentTab.collapsed)
      gBrowser.mCurrentTab.collapsed = true;
 
+   // always select new tab when replacing last tab
+   var loadInBackground = replaceLastTab ? false :
+                          Tabmix.prefs.getBoolPref("loadNewInBackground");
    var loadBlank = isBlankPageURL(url);
-   var _url = loadBlank ? url : "about:blank";
-   var newTab = gBrowser.addTab(_url, {skipAnimation: replaceLastTab, dontMove: true});
+   var charset = loadBlank ? null : gBrowser.selectedBrowser.characterSet;
+   var newTab = gBrowser.loadOneTab(url, {
+                                    charset: charset,
+                                    inBackground: loadInBackground,
+                                    skipAnimation: replaceLastTab,
+                                    dontMove: true});
    if (replaceLastTab) {
      newTab.__newLastTab = url;
      if (Services.prefs.getCharPref("general.skins.selectedSkin") == "Vista-aero" ) {
@@ -163,16 +167,6 @@ function TMP_BrowserOpenTab(aTab, replaceLastTab) {
      }
    }
 
-   if (!loadBlank) {
-      try { // just in case.....
-         let browser = newTab.linkedBrowser;
-         browser.stop();
-         let originCharset = gBrowser.selectedBrowser.characterSet;
-         browser.loadURIWithFlags(url, flags, null, originCharset);
-         gBrowser.selectedBrowser.focus();
-      }
-      catch (ex) {}
-   }
    if (aTab && aTab.localName == "tab")
       gBrowser.moveTabTo(newTab, aTab._tPos + 1);
    else if (!replaceLastTab && Tabmix.prefs.getBoolPref("openNewTabNext")) {
@@ -180,16 +174,13 @@ function TMP_BrowserOpenTab(aTab, replaceLastTab) {
       // and it mess with recently used tabs order
       gBrowser.moveTabTo(newTab, gBrowser.selectedTab._tPos + 1);
    }
-
-   // always select new tab when replacing last tab
-   var loadInBackground  = replaceLastTab ? false : Tabmix.prefs.getBoolPref("loadNewInBackground");
-   gBrowser.TMP_selectNewForegroundTab(newTab, loadInBackground);
    // make sure to update recently used tabs
    // if user open many tabs quickly select event don't have time to fire
    // before new tab select
    if (!loadInBackground)
      TMP_LastTab.PushSelectedTab();
 
+   gBrowser.selectedBrowser.focus();
    // focus the address bar on new tab
    var clearUrlBar = !replaceLastTab && Tabmix.prefs.getBoolPref("selectLocationBar") ||
        replaceLastTab && Tabmix.prefs.getBoolPref("selectLocationBar.afterLastTabClosed") ||
@@ -204,11 +195,12 @@ Tabmix.selectedTab = null;
 Tabmix.clearUrlBar = function TMP_clearUrlBar(aTab, aUrl, aTimeOut) {
   if(/about:home|(www\.)*(google|bing)\./.test(aUrl))
     return;
-  if (!isBlankPageURL(aUrl)) {
+  if (aTab.selected && !isBlankPageURL(aUrl)) {
     // clean the the address bar as if the user laod about:blank tab
     this.selectedTab = aTab;
     this.userTypedValue = aUrl;
     gBrowser.userTypedValue = "";
+    URLBarSetURI();
   }
   // don't try to focus urlbar on popup
   if (aTab.selected && window.toolbar.visible) {

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