Bug 1296366 - Ctrl+Click awesomebar entry with "Switch to Tab" doesn't open new tab. r?mak draft
authorDrew Willcoxon <adw@mozilla.com>
Tue, 18 Oct 2016 16:03:15 -0700
changeset 426631 d350733203a99bcf9c1459e7918cf9d4c633537b
parent 406453 3c4c4accb1392bbc70fed3ddebbaa42453963900
child 534232 58ae510d4b7ceae04d185af66a8c59c3b89cf7ed
push id32763
push userdwillcoxon@mozilla.com
push dateTue, 18 Oct 2016 23:04:08 +0000
reviewersmak
bugs1296366
milestone51.0a1
Bug 1296366 - Ctrl+Click awesomebar entry with "Switch to Tab" doesn't open new tab. r?mak MozReview-Commit-ID: LIWox4QayLo
browser/base/content/urlbarBindings.xml
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -173,17 +173,17 @@ file, You can obtain one at http://mozil
           } else {
             let originalUrl = ReaderMode.getOriginalUrl(aValue);
             if (originalUrl) {
               returnValue = originalUrl;
             }
           }
 
           // Set the actiontype only if the user is not overriding actions.
-          if (action && this._noActionsKeys.size == 0) {
+          if (action && this._pressedNoActionKeys.size == 0) {
             this.setAttribute("actiontype", action.type);
           } else {
             this.removeAttribute("actiontype");
           }
           return returnValue;
         ]]></body>
       </method>
 
@@ -978,24 +978,32 @@ file, You can obtain one at http://mozil
               action.params.displayUrl = action.params.url;
             }
           }
 
           return action;
         ]]></body>
       </method>
 
-      <field name="_noActionsKeys"><![CDATA[
-        new Set();
+      <field name="_noActionKeys"><![CDATA[
+        [
+          KeyEvent.DOM_VK_ALT,
+          KeyEvent.DOM_VK_SHIFT,
+          KeyEvent.DOM_VK_META,
+        ]
+      ]]></field>
+
+      <field name="_pressedNoActionKeys"><![CDATA[
+        new Set()
       ]]></field>
 
       <method name="_clearNoActions">
         <parameter name="aURL"/>
         <body><![CDATA[
-          this._noActionsKeys.clear();
+          this._pressedNoActionKeys.clear();
           this.popup.removeAttribute("noactions");
           let action = this._parseActionUrl(this._value);
           if (action)
             this.setAttribute("actiontype", action.type);
         ]]></body>
       </method>
 
       <method name="onInput">
@@ -1082,34 +1090,32 @@ file, You can obtain one at http://mozil
                  this._prefs.getIntPref("daysBeforeHidingSuggestionsPrompt");
         ]]></getter>
       </property>
 
     </implementation>
 
     <handlers>
       <handler event="keydown"><![CDATA[
-        if ((event.keyCode === KeyEvent.DOM_VK_ALT ||
-             event.keyCode === KeyEvent.DOM_VK_SHIFT) &&
+        if (this._noActionKeys.includes(event.keyCode) &&
             this.popup.selectedIndex >= 0 &&
-            !this._noActionsKeys.has(event.keyCode)) {
-          if (this._noActionsKeys.size == 0) {
+            !this._pressedNoActionKeys.has(event.keyCode)) {
+          if (this._pressedNoActionKeys.size == 0) {
             this.popup.setAttribute("noactions", "true");
             this.removeAttribute("actiontype");
           }
-          this._noActionsKeys.add(event.keyCode);
+          this._pressedNoActionKeys.add(event.keyCode);
         }
       ]]></handler>
 
       <handler event="keyup"><![CDATA[
-        if ((event.keyCode === KeyEvent.DOM_VK_ALT ||
-             event.keyCode === KeyEvent.DOM_VK_SHIFT) &&
-            this._noActionsKeys.has(event.keyCode)) {
-          this._noActionsKeys.delete(event.keyCode);
-          if (this._noActionsKeys.size == 0)
+        if (this._noActionKeys.includes(event.keyCode) &&
+            this._pressedNoActionKeys.has(event.keyCode)) {
+          this._pressedNoActionKeys.delete(event.keyCode);
+          if (this._pressedNoActionKeys.size == 0)
             this._clearNoActions();
         }
       ]]></handler>
 
       <handler event="focus"><![CDATA[
         if (event.originalTarget == this.inputField) {
           this._hideURLTooltip();
           this.formatValue();