Bug 1532748 - Properly signal error in getPossibleBreakpoints error case. r=jorendorff
authorLogan Smyth <loganfsmyth@gmail.com>
Fri, 15 Mar 2019 17:10:17 +0000
changeset 464409 0b05d8817659
parent 464408 f6a8502a80bf
child 464410 b063e2b487b6
push id35716
push useraciure@mozilla.com
push dateSun, 17 Mar 2019 09:42:17 +0000
treeherdermozilla-central@8ee97c045359 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs1532748
milestone67.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 1532748 - Properly signal error in getPossibleBreakpoints error case. r=jorendorff Differential Revision: https://phabricator.services.mozilla.com/D23702
js/src/jit-test/tests/debug/Script-getPossibleBreakpoints-02.js
js/src/vm/Debugger.cpp
--- a/js/src/jit-test/tests/debug/Script-getPossibleBreakpoints-02.js
+++ b/js/src/jit-test/tests/debug/Script-getPossibleBreakpoints-02.js
@@ -27,37 +27,57 @@ function onDebuggerStatement(frame) {
   assertBPCount({ line: 7 }, 2);
   assertBPCount({ line: 8 }, 3);
   assertBPCount({ line: 9 }, 1);
   assertBPCount({ line: 10 }, 1);
 
   assertBPCount({ line: 6, minColumn: 7 }, 3);
   assertBPCount({ line: 6, maxColumn: 16 }, 3);
   assertBPCount({ line: 6, minColumn: 7, maxColumn: 16 }, 2);
+  assertBPError({ line: 1, minLine: 1 }, "line", "not allowed alongside 'minLine'/'maxLine'");
+  assertBPError({ line: 1, maxLine: 1 }, "line", "not allowed alongside 'minLine'/'maxLine'");
+  assertBPError({ line: "1" }, "line", "not an integer");
 
   assertBPCount({ minLine: 9 }, 2);
   assertBPCount({ minLine: 9, minColumn: 0 }, 2);
   assertBPCount({ minLine: 9, minColumn: 8 }, 1);
+  assertBPError({ minLine: "1" }, "minLine", "not an integer");
+  assertBPError({ minColumn: 1 }, "minColumn", "not allowed without 'line' or 'minLine'");
+  assertBPError({ minLine: 1, minColumn: "1" }, "minColumn", "not an integer");
 
   assertBPCount({ maxLine: 7 }, 5);
   assertBPCount({ maxLine: 7, maxColumn: 0 }, 5);
   assertBPCount({ maxLine: 7, maxColumn: 8 }, 6);
+  assertBPError({ maxLine: "1" }, "maxLine", "not an integer");
+  assertBPError({ maxColumn: 1 }, "maxColumn", "not allowed without 'line' or 'maxLine'");
+  assertBPError({ maxLine: 1, maxColumn: "1" }, "maxColumn", "not an integer");
 
   assertBPCount({ minLine: 6, maxLine: 8 }, 6);
   assertBPCount({ minLine: 6, minColumn: 8, maxLine: 8 }, 5);
   assertBPCount({ minLine: 6, maxLine: 8, maxColumn: 8 }, 7);
   assertBPCount({ minLine: 6, minColumn: 8, maxLine: 8, maxColumn: 8 }, 6);
 
   assertBPCount({
     minOffset: fScript.getPossibleBreakpoints({ line: 6 })[3].offset,
   }, 8);
+  assertBPError({ minOffset: "1" }, "minOffset", "not an integer");
   assertBPCount({
     maxOffset: fScript.getPossibleBreakpoints({ line: 6 })[3].offset,
   }, 4);
+  assertBPError({ maxOffset: "1" }, "maxOffset", "not an integer");
   assertBPCount({
     minOffset: fScript.getPossibleBreakpoints({ line: 6 })[2].offset,
     maxOffset: fScript.getPossibleBreakpoints({ line: 7 })[1].offset,
   }, 3);
 
+  function assertBPError(query, field, message) {
+    try {
+      fScript.getPossibleBreakpoints(query);
+      assertEq(false, true);
+    } catch (err) {
+      assertEq(err.message, `getPossibleBreakpoints' '${field}' is ${message}`);
+    }
+  }
+
   function assertBPCount(query, count) {
     assertEq(fScript.getPossibleBreakpoints(query).length, count);
   }
 };
--- a/js/src/vm/Debugger.cpp
+++ b/js/src/vm/Debugger.cpp
@@ -6489,16 +6489,17 @@ class DebuggerScriptGetPossibleBreakpoin
     }
 
     if (!lineValue.isUndefined()) {
       if (!minLineValue.isUndefined() || !maxLineValue.isUndefined()) {
         JS_ReportErrorNumberASCII(cx_, GetErrorMessage, nullptr,
                                   JSMSG_UNEXPECTED_TYPE,
                                   "getPossibleBreakpoints' 'line'",
                                   "not allowed alongside 'minLine'/'maxLine'");
+        return false;
       }
 
       size_t line;
       if (!parseIntValue(lineValue, &line)) {
         JS_ReportErrorNumberASCII(
             cx_, GetErrorMessage, nullptr, JSMSG_UNEXPECTED_TYPE,
             "getPossibleBreakpoints' 'line'", "not an integer");
         return false;