diff options
Diffstat (limited to 'js/src/tests/non262/AsyncIterator/prototype/some/error-from-correct-realm.js')
-rw-r--r-- | js/src/tests/non262/AsyncIterator/prototype/some/error-from-correct-realm.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/js/src/tests/non262/AsyncIterator/prototype/some/error-from-correct-realm.js b/js/src/tests/non262/AsyncIterator/prototype/some/error-from-correct-realm.js new file mode 100644 index 0000000000..bb4b637c1a --- /dev/null +++ b/js/src/tests/non262/AsyncIterator/prototype/some/error-from-correct-realm.js @@ -0,0 +1,21 @@ +// |reftest| skip-if(!this.hasOwnProperty('AsyncIterator')) + +const otherGlobal = newGlobal({newCompartment: true}); +assertEq(TypeError !== otherGlobal.TypeError, true); + +async function *gen() {} + +gen().some().then(() => assertEq(true, false, 'expected error'), err => { + assertEq(err instanceof TypeError, true); +}); + +otherGlobal.AsyncIterator.prototype.some.call(gen()).then(() => assertEq(true, false, 'expected error'), err => { + assertEq( + err instanceof otherGlobal.TypeError, + true, + 'TypeError comes from the realm of the method.', + ); +}); + +if (typeof reportCompare === 'function') + reportCompare(0, 0); |