summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/AsyncIterator/prototype/toArray/create-in-current-realm.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--js/src/tests/non262/AsyncIterator/prototype/toArray/create-in-current-realm.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/js/src/tests/non262/AsyncIterator/prototype/toArray/create-in-current-realm.js b/js/src/tests/non262/AsyncIterator/prototype/toArray/create-in-current-realm.js
new file mode 100644
index 0000000000..6f0b69f8ad
--- /dev/null
+++ b/js/src/tests/non262/AsyncIterator/prototype/toArray/create-in-current-realm.js
@@ -0,0 +1,22 @@
+// |reftest| skip-if(!this.hasOwnProperty('AsyncIterator'))
+
+const otherGlobal = newGlobal({newCompartment: true});
+
+async function* gen() {
+ yield 1;
+ yield 2;
+ yield 3;
+}
+
+gen().toArray().then(array => {
+ assertEq(array instanceof Array, true);
+ assertEq(array instanceof otherGlobal.Array, false);
+});
+
+otherGlobal.AsyncIterator.prototype.toArray.call(gen()).then(array => {
+ assertEq(array instanceof Array, false);
+ assertEq(array instanceof otherGlobal.Array, true);
+});
+
+if (typeof reportCompare === 'function')
+ reportCompare(0, 0);