mirror of
https://github.com/tc39/test262.git
synced 2025-07-23 14:04:51 +02:00
Merge pull request #1299 from jswalden/getiterator-async-funky
Add a test for GetIterator(obj, ~async~) attempting to call obj[@@asyncIterator] even if that value is an object with an [[IsHTMLDDA]] internal slot
This commit is contained in:
commit
883c505648
@ -0,0 +1,34 @@
|
|||||||
|
// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-getiterator
|
||||||
|
description: >
|
||||||
|
`GetIterator(obj, ~async~)` must attempt to call `obj[@@asyncIterator]` when
|
||||||
|
that value is an object with an [[IsHTMLDDA]] internal slot, not act as if
|
||||||
|
the value were `undefined`.
|
||||||
|
features: [async-iteration, uncallableAndIsHTMLDDA]
|
||||||
|
flags: [async]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
async function f() {
|
||||||
|
var fakeIter = {
|
||||||
|
[Symbol.asyncIterator]: $262.uncallableAndIsHTMLDDA(),
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error("shouldn't touch Symbol.iterator");
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
for await (var x of fakeIter)
|
||||||
|
return "for-await-of body shouldn't be reached";
|
||||||
|
|
||||||
|
return "should have failed earlier";
|
||||||
|
}
|
||||||
|
|
||||||
|
f().then($DONE,
|
||||||
|
function (e) {
|
||||||
|
assert.sameValue(e.constructor, TypeError,
|
||||||
|
"expeted TypeError from calling " +
|
||||||
|
"uncallableAndIsHTMLDDA() value");
|
||||||
|
})
|
||||||
|
.then($DONE, $DONE);
|
Loading…
x
Reference in New Issue
Block a user