Bug 735946 - Make sure to focus content when opening new tabs with loadDivertedInBackground set to false. r=Neil.
authorstefanh@inbox.com
Tue, 03 Apr 2012 18:18:30 +0200
changeset 9814 b3f800023045585111988a00a85c40f9f383d7de
parent 9813 44b53c77d457133376af6f72f9b9dc4fb37318ed
child 9815 c3ad1d23cdfe2cc746a5b65ae05a0409e7f8310c
push id7482
push userstefanh@inbox.com
push dateTue, 03 Apr 2012 16:18:37 +0000
treeherdercomm-central@b3f800023045 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersNeil
bugs735946
Bug 735946 - Make sure to focus content when opening new tabs with loadDivertedInBackground set to false. r=Neil.
suite/browser/navigator.js
--- a/suite/browser/navigator.js
+++ b/suite/browser/navigator.js
@@ -398,17 +398,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);