Bug 923565: make ctrl-enter open the focused link in a new tab. r=evilpie
authorMike de Boer <mdeboer@mozilla.com>
Wed, 16 Oct 2013 17:45:42 +0200
changeset 165752 60ff0c915b5c80f4085a5273693f74b3d74fc05c
parent 165751 0bc8a298c227e2dedc3f466ca9bda70fc040a583
child 165753 d0cf13b1749a891948e8f06aa1ea7a3da1595e3a
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersevilpie
bugs923565
milestone27.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 923565: make ctrl-enter open the focused link in a new tab. r=evilpie
toolkit/modules/Finder.jsm
--- a/toolkit/modules/Finder.jsm
+++ b/toolkit/modules/Finder.jsm
@@ -139,18 +139,28 @@ Finder.prototype = {
     } catch (e) {}
   },
 
   keyPress: function (aEvent) {
     let controller = this._getSelectionController(this._getWindow());
 
     switch (aEvent.keyCode) {
       case Ci.nsIDOMKeyEvent.DOM_VK_RETURN:
-        if (this._fastFind.foundLink) // Todo: Handle ctrl click.
-          this._fastFind.foundLink.click();
+        if (this._fastFind.foundLink) {
+          let view = this._fastFind.foundLink.ownerDocument.defaultView;
+          this._fastFind.foundLink.dispatchEvent(new view.MouseEvent("click", {
+            view: view,
+            cancelable: true,
+            bubbles: true,
+            ctrlKey: aEvent.ctrlKey,
+            altKey: aEvent.altKey,
+            shiftKey: aEvent.shiftKey,
+            metaKey: aEvent.metaKey
+          }));
+        }
         break;
       case Ci.nsIDOMKeyEvent.DOM_VK_TAB:
         let direction = Services.focus.MOVEFOCUS_FORWARD;
         if (aEvent.shiftKey) {
           direction = Services.focus.MOVEFOCUS_BACKWARD;
         }
         Services.focus.moveFocus(this._getWindow(), null, direction, 0);
         break;