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>
Tue, 10 Oct 2017 13:12:02 +0200
changeset 677226 243cbec2c6999f2c6d70446c182557f1aeb578d4
parent 677139 4494c218fe4d16f1413d74b37b7fa178111951be
child 735150 308b2759c1970ef8de918007e648270180a33448
push id83728
push userdgottwald@mozilla.com
push dateTue, 10 Oct 2017 11:12:31 +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: BInIyg99m76
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 = document.activeElement == 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, {