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 --- js/src/jit-test/tests/basic/bug-1663741.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 js/src/jit-test/tests/basic/bug-1663741.js (limited to 'js/src/jit-test/tests/basic/bug-1663741.js') diff --git a/js/src/jit-test/tests/basic/bug-1663741.js b/js/src/jit-test/tests/basic/bug-1663741.js new file mode 100644 index 0000000000..866bd083a3 --- /dev/null +++ b/js/src/jit-test/tests/basic/bug-1663741.js @@ -0,0 +1,29 @@ +const thisGlobal = this; +const otherGlobalSameCompartment = newGlobal({sameCompartmentAs: thisGlobal}); +const otherGlobalNewCompartment = newGlobal({newCompartment: true}); + +const globals = [thisGlobal, otherGlobalSameCompartment, otherGlobalNewCompartment]; + +function testProperties(global, count) { + let {object: source, transplant} = transplantableObject(); + + // Create a bunch properties on |source|, which force allocation of dynamic + // slots. + for (let i = 0; i < count; i++) { + source["foo" + i] = i; + } + + // Calling |transplant| transplants the object and then returns undefined. + transplant(global); + + // Check the properties were copied over to the swapped object. + for (let i = 0; i < count; i++) { + assertEq(source["foo" + i], i); + } +} + +for (let global of globals) { + for (let count of [0, 10, 30]) { + testProperties(global, count); + } +} -- cgit v1.2.3