summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Iterator/prototype/toArray/create-in-current-realm.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--js/src/tests/non262/Iterator/prototype/toArray/create-in-current-realm.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/js/src/tests/non262/Iterator/prototype/toArray/create-in-current-realm.js b/js/src/tests/non262/Iterator/prototype/toArray/create-in-current-realm.js
new file mode 100644
index 0000000000..850729e5e3
--- /dev/null
+++ b/js/src/tests/non262/Iterator/prototype/toArray/create-in-current-realm.js
@@ -0,0 +1,14 @@
+// |reftest| skip-if(!this.hasOwnProperty('Iterator')) -- Iterator is not enabled unconditionally
+
+const otherGlobal = newGlobal({newCompartment: true});
+
+let array = [1, 2, 3].values().toArray();
+assertEq(array instanceof Array, true);
+assertEq(array instanceof otherGlobal.Array, false);
+
+array = otherGlobal.Iterator.prototype.toArray.call([1, 2, 3].values());
+assertEq(array instanceof Array, false);
+assertEq(array instanceof otherGlobal.Array, true);
+
+if (typeof reportCompare === 'function')
+ reportCompare(0, 0);