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:
Jeff Walden 2017-10-18 00:08:09 -07:00
parent d38701abc8
commit 2974f19e89
1 changed files with 34 additions and 0 deletions

View File

@ -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);