Bug 1455326 - Don't open search in new tab if current tab is blank. r=adw
authorMichael Kaply <mozilla@kaply.com>
Thu, 05 Jul 2018 18:05:50 -0500
changeset 425338 aa2c71e82371ea573827dd8d9ece5d8185a67b0d
parent 425337 a8263446f439ee8f6f14ad8867ae4a0ab8184c4b
child 425339 79f689b050f2b64b83937388b58540a9707b5d1b
push id66042
push usermozilla@kaply.com
push dateFri, 06 Jul 2018 14:19:11 +0000
treeherderautoland@aa2c71e82371 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersadw
bugs1455326
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1455326 - Don't open search in new tab if current tab is blank. r=adw MozReview-Commit-ID: BqjoKZ3H7Yq
browser/components/search/content/search.xml
--- a/browser/components/search/content/search.xml
+++ b/browser/components/search/content/search.xml
@@ -276,18 +276,20 @@
               return;
             where = whereToOpenLink(aEvent, false, true);
           } else if (aForceNewTab) {
             where = "tab";
             if (Services.prefs.getBoolPref("browser.tabs.loadInBackground"))
               where += "-background";
           } else {
             var newTabPref = Services.prefs.getBoolPref("browser.search.openintab");
-            if (((aEvent instanceof KeyboardEvent) && aEvent.altKey) ^ newTabPref)
+            if (((aEvent instanceof KeyboardEvent && aEvent.altKey) ^ newTabPref) &&
+                !isTabEmpty(gBrowser.selectedTab)) {
               where = "tab";
+            }
             if ((aEvent instanceof MouseEvent) &&
                 (aEvent.button == 1 || aEvent.getModifierState("Accel"))) {
               where = "tab";
               params = {
                 inBackground: true,
               };
             }
           }
@@ -1778,18 +1780,20 @@
             where = "tab";
             if (Services.prefs.getBoolPref("browser.tabs.loadInBackground")) {
               params = {
                 inBackground: true,
               };
             }
           } else {
             var newTabPref = Services.prefs.getBoolPref("browser.search.openintab");
-            if (((aEvent instanceof KeyboardEvent) && aEvent.altKey) ^ newTabPref)
+            if (((aEvent instanceof KeyboardEvent && aEvent.altKey) ^ newTabPref) &&
+                !isTabEmpty(gBrowser.selectedTab)) {
               where = "tab";
+            }
             if ((aEvent instanceof MouseEvent) &&
                 (aEvent.button == 1 || aEvent.getModifierState("Accel"))) {
               where = "tab";
               params = {
                 inBackground: true,
               };
             }
           }