Bug 735946 - Make sure to focus content when opening new tabs with loadDivertedInBackground set to false. r=Neil, a=Callek.
authorstefanh@inbox.com
Thu, 05 Apr 2012 16:15:24 +0200
changeset 10350 b7d96060bc37f4ae199e4d4b3833e66a51bfed20
parent 10349 a4075036955b049cd483b9de9549bc354d086e1c
child 10351 5ff32daa3b7e9389b58bb1d19f5a1df0b4edb6be
push id470
push userstefanh@inbox.com
push dateThu, 05 Apr 2012 14:15:58 +0000
treeherdercomm-aurora@b7d96060bc37 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersNeil, Callek
bugs735946
Bug 735946 - Make sure to focus content when opening new tabs with loadDivertedInBackground set to false. r=Neil, a=Callek.
suite/browser/navigator.js
--- a/suite/browser/navigator.js
+++ b/suite/browser/navigator.js
@@ -390,17 +390,20 @@ nsBrowserAccess.prototype = {
                                  uri, null, referrer);
       case nsIBrowserDOMWindow.OPEN_NEWTAB:
         var bgLoad = Services.prefs.getBoolPref("browser.tabs.loadDivertedInBackground");
         var isRelated = referrer ? true : false;
         var newTab = gBrowser.loadOneTab(uri, {inBackground: bgLoad,
                                                fromExternal: isExternal,
                                                relatedToCurrent: isRelated,
                                                referrerURI: referrer});
-        return gBrowser.getBrowserForTab(newTab).contentWindow;
+        var contentWin = gBrowser.getBrowserForTab(newTab).contentWindow;
+        if (!bgLoad)
+          contentWin.focus();
+        return contentWin;
       default:
         var loadflags = isExternal ?
                         nsIWebNavigation.LOAD_FLAGS_FROM_EXTERNAL :
                         nsIWebNavigation.LOAD_FLAGS_NONE;
 
         if (!aOpener) {
           if (aURI)
             gBrowser.loadURIWithFlags(aURI.spec, loadflags);