Bug 928315 - Adding functionlity to allow Shift+Enter to search backwards in the debugger, r=vporof
authorJacob Clark <jacob.jh.clark@googlemail.com>
Sun, 20 Oct 2013 17:50:20 +0300
changeset 165281 b3778525478565f794546e4b23a1d13ed4d72a0e
parent 165280 06cc867fd5d17b2871de4da824b2e8501f55e752
child 165282 89914159a708b1aa7992100cfe1618c9477105c4
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvporof
bugs928315
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 928315 - Adding functionlity to allow Shift+Enter to search backwards in the debugger, r=vporof
browser/devtools/debugger/debugger-toolbar.js
browser/devtools/debugger/test/browser_dbg_search-basic-01.js
--- a/browser/devtools/debugger/debugger-toolbar.js
+++ b/browser/devtools/debugger/debugger-toolbar.js
@@ -965,17 +965,20 @@ FilterView.prototype = {
     else if ((e.char == "G" && e.metaKey) || e.char == "p" && e.ctrlKey) {
       actionToPerform = "selectPrev";
     }
     // Return, enter, down and up keys focus next or previous matches, while
     // the escape key switches focus from the search container.
     else switch (e.keyCode) {
       case e.DOM_VK_RETURN:
       case e.DOM_VK_ENTER:
-        var isReturnKey = true; // Fall through.
+        var isReturnKey = true;
+        // If the shift key is pressed, focus on the previous result
+        actionToPerform = e.shiftKey ? "selectPrev" : "selectNext";
+        break;
       case e.DOM_VK_DOWN:
         actionToPerform = "selectNext";
         break;
       case e.DOM_VK_UP:
         actionToPerform = "selectPrev";
         break;
     }
 
--- a/browser/devtools/debugger/test/browser_dbg_search-basic-01.js
+++ b/browser/devtools/debugger/test/browser_dbg_search-basic-01.js
@@ -21,16 +21,36 @@ function test() {
     gFiltering = gDebugger.DebuggerView.Filtering;
     gSearchBox = gDebugger.DebuggerView.Filtering._searchbox;
 
     waitForSourceShown(gPanel, ".html").then(performTest);
   });
 }
 
 function performTest() {
+  setText(gSearchBox, "#html");
+  
+  EventUtils.synthesizeKey("VK_RETURN", { shiftKey: true }, gDebugger);
+  is(gFiltering.searchData.toSource(), '["#", ["", "html"]]',
+    "The searchbox data wasn't parsed correctly.");
+  ok(isCaretPos(gPanel, 35, 7),
+    "The editor didn't jump to the correct line.");
+
+  EventUtils.synthesizeKey("VK_RETURN", { shiftKey: true }, gDebugger);
+  is(gFiltering.searchData.toSource(), '["#", ["", "html"]]',
+    "The searchbox data wasn't parsed correctly.");
+  ok(isCaretPos(gPanel, 5, 6),
+    "The editor didn't jump to the correct line.");
+
+  EventUtils.synthesizeKey("VK_RETURN", { shiftKey: true }, gDebugger);
+  is(gFiltering.searchData.toSource(), '["#", ["", "html"]]',
+    "The searchbox data wasn't parsed correctly.");
+  ok(isCaretPos(gPanel, 3, 15),
+    "The editor didn't jump to the correct line.");
+  
   setText(gSearchBox, ":12");
   is(gFiltering.searchData.toSource(), '[":", ["", 12]]',
     "The searchbox data wasn't parsed correctly.");
   ok(isCaretPos(gPanel, 12),
     "The editor didn't jump to the correct line.");
 
   EventUtils.synthesizeKey("g", { metaKey: true }, gDebugger);
   is(gFiltering.searchData.toSource(), '[":", ["", 13]]',