summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/iterable
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /js/src/tests/non262/iterable
parentInitial commit. (diff)
downloadthunderbird-upstream.tar.xz
thunderbird-upstream.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/non262/iterable')
-rw-r--r--js/src/tests/non262/iterable/browser.js0
-rw-r--r--js/src/tests/non262/iterable/regress-340526-01.js27
-rw-r--r--js/src/tests/non262/iterable/regress-341815.js83
-rw-r--r--js/src/tests/non262/iterable/regress-341821.js72
-rw-r--r--js/src/tests/non262/iterable/regress-415922.js46
-rw-r--r--js/src/tests/non262/iterable/shell.js0
6 files changed, 228 insertions, 0 deletions
diff --git a/js/src/tests/non262/iterable/browser.js b/js/src/tests/non262/iterable/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/non262/iterable/browser.js
diff --git a/js/src/tests/non262/iterable/regress-340526-01.js b/js/src/tests/non262/iterable/regress-340526-01.js
new file mode 100644
index 0000000000..e3e1892784
--- /dev/null
+++ b/js/src/tests/non262/iterable/regress-340526-01.js
@@ -0,0 +1,27 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 340526;
+var summary = 'Iterators: cross-referenced objects with close handler can ' +
+ 'delay close handler execution';
+var actual = 'No Crash';
+var expect = 'No Crash';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+try
+{
+ var iter = Iterator({});
+ iter.foo = "bar";
+ for (var i in iter)
+ ;
+}
+catch(ex)
+{
+}
+
+reportCompare(expect, actual, summary);
diff --git a/js/src/tests/non262/iterable/regress-341815.js b/js/src/tests/non262/iterable/regress-341815.js
new file mode 100644
index 0000000000..cd5d9c2b12
--- /dev/null
+++ b/js/src/tests/non262/iterable/regress-341815.js
@@ -0,0 +1,83 @@
+// |reftest| skip -- bug xxx - fails to dismiss alert
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 341815;
+var summary = 'Close hook crash';
+var actual = 'No Crash';
+var expect = 'No Crash';
+
+var ialert = 0;
+//-----------------------------------------------------------------------------
+//test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ var globalToPokeGC = {};
+
+ function make_iterator()
+ {
+ function* generator() {
+ try {
+ yield 0;
+ } finally {
+ make_iterator();
+ }
+ }
+ generator().next();
+ globalToPokeGC = {};
+ if (typeof alert != 'undefined')
+ {
+ alert(++ialert);
+ }
+ }
+
+ make_iterator();
+
+ for (var i = 0; i != 50000; ++i) {
+ var x = {};
+ }
+
+ print('done');
+
+ setTimeout('checkTest()', 10000);
+}
+
+function init()
+{
+ // give the dialog closer time to register
+ setTimeout('test()', 5000);
+}
+
+var lastialert = 0;
+
+function checkTest()
+{
+ // this function is used to check if there
+ // additional alerts are still being fired
+ // in order to prevent the test from completing
+ // until all alerts have finished.
+
+ if (ialert != lastialert)
+ {
+ lastialert = ialert;
+ setTimeout('checkTest()', 10000);
+ return;
+ }
+
+ reportCompare(expect, actual, summary);
+ gDelayTestDriverEnd = false;
+ jsTestDriverEnd();
+}
+
+// delay test driver end
+gDelayTestDriverEnd = true;
+
+window.addEventListener("load", init, false);
diff --git a/js/src/tests/non262/iterable/regress-341821.js b/js/src/tests/non262/iterable/regress-341821.js
new file mode 100644
index 0000000000..2aef6d9756
--- /dev/null
+++ b/js/src/tests/non262/iterable/regress-341821.js
@@ -0,0 +1,72 @@
+// |reftest| skip -- bug xxx - fails to dismiss alert
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 341821;
+var summary = 'Close hook crash';
+var actual = 'No Crash';
+var expect = 'No Crash';
+
+var ialert = 0;
+
+//-----------------------------------------------------------------------------
+//test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ function* generator()
+ {
+ try {
+ yield [];
+ } finally {
+ make_iterator();
+ }
+ }
+
+ function make_iterator()
+ {
+ var iter = generator();
+ iter.next();
+ iter = null;
+ if (typeof alert != 'undefined')
+ {
+ alert(++ialert);
+ }
+ }
+
+ make_iterator();
+
+ // Trigger GC through the branch callback.
+ for (var i = 0; i != 50000; ++i) {
+ var x = {};
+ }
+
+ print('done');
+ reportCompare(expect, actual, summary);
+}
+
+function init()
+{
+ // give the dialog closer time to register
+ setTimeout('runtest()', 5000);
+}
+
+function runtest()
+{
+ test();
+ reportCompare(expect, actual, summary);
+ gDelayTestDriverEnd = false;
+ jsTestDriverEnd();
+}
+
+// delay test driver end
+gDelayTestDriverEnd = true;
+
+window.addEventListener("load", init, false);
diff --git a/js/src/tests/non262/iterable/regress-415922.js b/js/src/tests/non262/iterable/regress-415922.js
new file mode 100644
index 0000000000..cbbbcab465
--- /dev/null
+++ b/js/src/tests/non262/iterable/regress-415922.js
@@ -0,0 +1,46 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 415922;
+var summary = 'Support exception from withing JSNewEnumerateOp on JSENUMERATE_NEXT';
+var actual = 'No Error';
+var expect = 'Error: its enumeration failed';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ function f() { for (k in it) return k }
+
+ if (typeof it == 'undefined')
+ {
+ print(expect = actual = 'it not defined, test skipped');
+ }
+ else
+ {
+ try
+ {
+ it.enum_fail = true;
+ var r = f();
+ actual = 'No exception r: ' + r.toString();
+ }
+ catch (e)
+ {
+ actual = e + '';
+ }
+ finally
+ {
+ it.enum_fail = false;
+ }
+ }
+ reportCompare(expect, actual, summary);
+}
diff --git a/js/src/tests/non262/iterable/shell.js b/js/src/tests/non262/iterable/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/non262/iterable/shell.js