Bug 1394304: Part 0b - Refactor _whereToOpen. r=adw
authorYuri Khan <yuri.v.khan@gmail.com>
Thu, 01 Feb 2018 22:56:03 +0700
changeset 402586 ff8ae0661153a0fe72cf7eead67060b4248e8372
parent 402585 256247373b45b3599feb86ee570004633587f864
child 402587 6c3394c9aec3d9d8e4f78aeb7a69045374886642
push id33393
push userrgurzau@mozilla.com
push dateTue, 06 Feb 2018 21:54:26 +0000
treeherdermozilla-central@0790ec12200d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersadw
bugs1394304
milestone60.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 1394304: Part 0b - Refactor _whereToOpen. r=adw Separate facts (altEnter) from intents (reuseEmpty).
browser/base/content/urlbarBindings.xml
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -517,27 +517,27 @@ file, You can obtain one at http://mozil
           return !isScrolling;
         ]]></body>
       </method>
 
       <method name="_whereToOpen">
         <parameter name="event"/>
         <body><![CDATA[
           let isMouseEvent = event instanceof MouseEvent;
+          let reuseEmpty = !isMouseEvent;
           let where = undefined;
           if (isMouseEvent) {
             where = whereToOpenLink(event, false, false);
           } else {
-            // If the current tab is empty, ignore Alt+Enter (reuse this tab)
-            let altEnter = !isMouseEvent &&
-                           event &&
-                           event.altKey &&
-                           !isTabEmpty(gBrowser.selectedTab);
+            let altEnter = event && event.altKey;
             where = altEnter ? "tab" : "current";
           }
+          if (where == "tab" && reuseEmpty && isTabEmpty(gBrowser.selectedTab)) {
+            where = "current";
+          }
           return where;
         ]]></body>
       </method>
 
       <!--
         This is ultimately called by the autocomplete controller as the result
         of handleEnter when the Return key is pressed in the textbox.  Since
         onPopupClick also calls handleEnter, this is also called as a result in