summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/setter-argc.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
commit2aa4a82499d4becd2284cdb482213d541b8804dd (patch)
treeb80bf8bf13c3766139fbacc530efd0dd9d54394c /js/src/jit-test/tests/debug/setter-argc.js
parentInitial commit. (diff)
downloadfirefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz
firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/jit-test/tests/debug/setter-argc.js')
-rw-r--r--js/src/jit-test/tests/debug/setter-argc.js52
1 files changed, 52 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/debug/setter-argc.js b/js/src/jit-test/tests/debug/setter-argc.js
new file mode 100644
index 0000000000..f56195d00d
--- /dev/null
+++ b/js/src/jit-test/tests/debug/setter-argc.js
@@ -0,0 +1,52 @@
+// Check that setters throw TypeError when passed no arguments, instead of crashing.
+
+function check(obj) {
+ let proto = Object.getPrototypeOf(obj);
+ let props = Object.getOwnPropertyNames(proto);
+ for (let prop of props) {
+ let desc = Object.getOwnPropertyDescriptor(proto, prop);
+ if (desc.set) {
+ print("bleah: " + JSON.stringify(prop));
+ assertEq(typeof desc.set, 'function');
+ try {
+ desc.set.call(obj);
+ assertEq("should have thrown TypeError", false);
+ } catch (e) {
+ assertEq(e instanceof TypeError, true);
+ }
+ }
+ }
+}
+
+var dbg = new Debugger;
+var g = newGlobal({newCompartment: true});
+var gw = dbg.addDebuggee(g);
+
+// Debugger
+check(dbg);
+
+// Debugger.Memory
+check(dbg.memory);
+
+// Debugger.Object
+g.eval('function f() { debugger; }');
+var fw = gw.getOwnPropertyDescriptor('f').value;
+check(fw);
+
+// Debugger.Script
+check(fw.script);
+
+// Debugger.Source
+check(fw.script.source);
+
+// Debugger.Environment
+check(fw.environment);
+
+// Debugger.Frame
+var log = '';
+dbg.onDebuggerStatement = function(frame) {
+ log += 'd';
+ check(frame);
+}
+g.eval('f()');
+assertEq(log, 'd');