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:03 +0200
changeset 10703 81b871cdd9f8a450042956eb053c7d937c5614bf
parent 10699 9bdfa24dedd96e185bc55fe1b27eba9fd979e32e
child 10704 62053a3b1aeebcac1b48185a336bccdf222b3b99
push id435
push userstefanh@inbox.com
push dateThu, 05 Apr 2012 14:16:25 +0000
treeherdercomm-beta@81b871cdd9f8 [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);