Bug 1404583 - Make openLinkIn not steal focus from the address bar when loading the New Tab page. r?florian draft
authorDão Gottwald <dao@mozilla.com>
Thu, 12 Oct 2017 11:08:23 +0200
changeset 679012 176bdb88927d94975ee25e291184e142bf2c3845
parent 678462 20d9ad08dd36fe5230ad0ccf6cb3e4865d7851cf
child 735507 06bbadb9743f2dfc0b8038e810c55ffd27163c9b
push id84116
push userdgottwald@mozilla.com
push dateThu, 12 Oct 2017 09:08:47 +0000
reviewersflorian
bugs1404583
milestone58.0a1
Bug 1404583 - Make openLinkIn not steal focus from the address bar when loading the New Tab page. r?florian MozReview-Commit-ID: IgO8FrSv2l3
browser/base/content/utilityOverlay.js
--- a/browser/base/content/utilityOverlay.js
+++ b/browser/base/content/utilityOverlay.js
@@ -443,16 +443,21 @@ function openLinkIn(url, where, params) 
     targetBrowser.loadURIWithFlags(url, {
       triggeringPrincipal: aTriggeringPrincipal,
       flags,
       referrerURI: aNoReferrer ? null : aReferrerURI,
       referrerPolicy: aReferrerPolicy,
       postData: aPostData,
       userContextId: aUserContextId
     });
+
+    // Don't focus the content area if focus is in the address bar and we're
+    // loading the New Tab page.
+    focusUrlBar = w.document.activeElement == w.gURLBar.inputField &&
+                  w.isBlankPageURL(url);
     break;
   case "tabshifted":
     loadInBackground = !loadInBackground;
     // fall through
   case "tab":
     focusUrlBar = !loadInBackground && w.isBlankPageURL(url);
 
     let tabUsedForLoad = w.gBrowser.loadOneTab(url, {