summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/extensions/errorcolumnblame.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/tests/non262/extensions/errorcolumnblame.js
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/non262/extensions/errorcolumnblame.js')
-rw-r--r--js/src/tests/non262/extensions/errorcolumnblame.js79
1 files changed, 79 insertions, 0 deletions
diff --git a/js/src/tests/non262/extensions/errorcolumnblame.js b/js/src/tests/non262/extensions/errorcolumnblame.js
new file mode 100644
index 0000000000..80c776520c
--- /dev/null
+++ b/js/src/tests/non262/extensions/errorcolumnblame.js
@@ -0,0 +1,79 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ */
+
+var BUGNUMBER = 568142;
+var summary = 'error reporting blames column as well as line';
+
+function test(f, col) {
+ var caught = false;
+ try {
+ f();
+ } catch (e) {
+ caught = true;
+ assertEq(e.columnNumber, col);
+ }
+ assertEq(caught, true);
+}
+
+/* Note single hard tab before return! */
+function foo(o) {
+ return o.p;
+}
+test(foo, 2);
+
+//345678901234567890
+test(function(f) { return f.bar; }, 20);
+// 1 2
+//3456789012345678901234567
+test(function(f) { return f(); }, 27);
+/* Cover negative colspan case using for(;;) loop with error in update part. */
+test(function(){
+ // 1 2 3 4
+ //123456789012345678901234567890123456789012
+ eval("function baz() { for (var i = 0; i < 10; i += a.b); assertEq(i !== i, true); }");
+ baz();
+}, 42);
+
+// 1 2 3
+//3456789012345678901234567890123456
+test(function() { var tmp = null; tmp(); }, 35)
+test(function() { var tmp = null; tmp.foo; }, 36)
+
+/* Just a generic 'throw'. */
+test(function() {
+// 1 2
+//345678901234567890
+ foo({}); throw new Error('a');
+}, 20);
+
+/* Be sure to report the right statement */
+test(function() {
+ function f() { return true; }
+ function g() { return false; }
+// 1 2
+//345678901234567890123456789
+ f(); g(); f(); if (f()) a += e;
+}, 29);
+
+// 1 2
+//345678901234567890
+test(function() { e++; }, 19);
+test(function() {print += e; }, 18);
+test(function(){e += 1 }, 17);
+test(function() { print[e]; }, 20);
+test(function() { e[1]; }, 19);
+test(function() { e(); }, 19);
+test(function() { 1(); }, 20);
+test(function() { Object.defineProperty() }, 26);
+
+test(function() {
+// 1 2
+//34567890123456789012
+ function foo() { asdf; } foo()
+}, 22);
+
+reportCompare(0, 0, "ok");
+
+printStatus("All tests passed!");