summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Debugger-enabled-01.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit-test/tests/debug/Debugger-enabled-01.js')
-rw-r--r--js/src/jit-test/tests/debug/Debugger-enabled-01.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/debug/Debugger-enabled-01.js b/js/src/jit-test/tests/debug/Debugger-enabled-01.js
new file mode 100644
index 000000000..3c4ab227f
--- /dev/null
+++ b/js/src/jit-test/tests/debug/Debugger-enabled-01.js
@@ -0,0 +1,18 @@
+var desc = Object.getOwnPropertyDescriptor(Debugger.prototype, "enabled");
+assertEq(typeof desc.get, 'function');
+assertEq(typeof desc.set, 'function');
+
+var g = newGlobal();
+var hits;
+var dbg = new Debugger(g);
+assertEq(dbg.enabled, true);
+dbg.onDebuggerStatement = function () { hits++; };
+
+var vals = [true, false, null, undefined, NaN, "blah", {}];
+for (var i = 0; i < vals.length; i++) {
+ dbg.enabled = vals[i];
+ assertEq(dbg.enabled, !!vals[i]);
+ hits = 0;
+ g.eval("debugger;");
+ assertEq(hits, vals[i] ? 1 : 0);
+}