From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- .../tests/basic/for-in-densified-elements.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 js/src/jit-test/tests/basic/for-in-densified-elements.js (limited to 'js/src/jit-test/tests/basic/for-in-densified-elements.js') diff --git a/js/src/jit-test/tests/basic/for-in-densified-elements.js b/js/src/jit-test/tests/basic/for-in-densified-elements.js new file mode 100644 index 0000000000..4874901f17 --- /dev/null +++ b/js/src/jit-test/tests/basic/for-in-densified-elements.js @@ -0,0 +1,21 @@ +function test() { + // An array with sparse elements... + var arr = []; + arr[10_000] = 1; + arr[10_001] = 1; + + for (var prop in arr) { + assertEq(prop, "10000"); + assertEq(arr.length, 10_002); + + // Densify the elements. + for (var i = 0; i < arr.length; i++) { + arr[i] = 1; + } + + // Delete the last dense element (10001). It should not be visited by the + // active for-in (checked above). + arr.length = 10_001; + } +} +test(); -- cgit v1.2.3