Bug 932305 - The Cmd-D shortcut no longer works, r=past
authorVictor Porof <vporof@mozilla.com>
Thu, 28 Nov 2013 20:38:42 +0200
changeset 158053 e193c7a76f4f341ebf14c40226b61a21152778c4
parent 158052 662e8032dccec26c23af53aaa6883178f27e4cc0
child 158054 b86e0d3d034bba88903aa9c82dbe680c9b486b9d
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewerspast
bugs932305
milestone28.0a1
Bug 932305 - The Cmd-D shortcut no longer works, r=past
browser/devtools/debugger/debugger-view.js
--- a/browser/devtools/debugger/debugger-view.js
+++ b/browser/devtools/debugger/debugger-view.js
@@ -184,24 +184,27 @@ let DebuggerView = {
    *
    * @param function aCallback
    *        Called after the editor finishes initializing.
    */
   _initializeEditor: function(aCallback) {
     dumpn("Initializing the DebuggerView editor");
 
     let extraKeys = {};
-    let tokenSearch = document.getElementById("tokenSearchKey").getAttribute("key");
-    let globalSearch = document.getElementById("globalSearchKey").getAttribute("key");
-    let tokenSearchShortcut = Editor.accel(tokenSearch);
-    let globalSearchShortcut = Editor.accel(globalSearch, { alt: true });
-    extraKeys[tokenSearchShortcut] = () => this.Filtering._doTokenSearch();
-    extraKeys[globalSearchShortcut] = () => this.Filtering._doGlobalSearch();
+    bindKey("_doTokenSearch", "tokenSearchKey");
+    bindKey("_doGlobalSearch", "globalSearchKey", { alt: true });
+    bindKey("_doFunctionSearch", "functionSearchKey");
     extraKeys[Editor.keyFor("jumpToLine")] = false;
 
+    function bindKey(func, key, modifiers = {}) {
+      let key = document.getElementById(key).getAttribute("key");
+      let shortcut = Editor.accel(key, modifiers);
+      extraKeys[shortcut] = () => DebuggerView.Filtering[func]();
+    }
+
     this.editor = new Editor({
       mode: Editor.modes.text,
       readOnly: true,
       lineNumbers: true,
       showAnnotationRuler: true,
       gutters: [ "breakpoints" ],
       extraKeys: extraKeys,
       contextMenu: "sourceEditorContextMenu"