diff options
Diffstat (limited to '')
-rw-r--r-- | js/src/tests/non262/AsyncIterator/prototype/every/error-from-correct-realm.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/js/src/tests/non262/AsyncIterator/prototype/every/error-from-correct-realm.js b/js/src/tests/non262/AsyncIterator/prototype/every/error-from-correct-realm.js new file mode 100644 index 0000000000..2ff93254ce --- /dev/null +++ b/js/src/tests/non262/AsyncIterator/prototype/every/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().every().then(() => assertEq(true, false, 'expected error'), err => { + assertEq(err instanceof TypeError, true); +}); + +otherGlobal.AsyncIterator.prototype.every.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); |