summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/bug-1663741.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit-test/tests/basic/bug-1663741.js')
-rw-r--r--js/src/jit-test/tests/basic/bug-1663741.js29
1 files changed, 29 insertions, 0 deletions
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);
+ }
+}