mirror of https://github.com/tc39/test262.git
Fix testing for throw in an iterator via yield* throws
IsHTMLDDA is specified in INTERPRETING.md to return null on [[Call]] when called with no arguments or with single argument "". Return null causes the iterator protocol to throw. Also see star-iterable-return-emulates-undefined-throws-when-called.js
This commit is contained in:
parent
1fccea4471
commit
f1b0a1e270
|
@ -35,6 +35,14 @@ var inner = {
|
|||
|
||||
var outer = (function* () { yield* inner; })();
|
||||
outer.next();
|
||||
outer.throw();
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
// `IsHTMLDDA` is called here with `iter` as `this` and `emptyString` as the
|
||||
// sole argument, and it's specified to return `null` under these conditions.
|
||||
// As `iter`'s iteration isn't ending because of a throw, the iteration
|
||||
// protocol will then throw a `TypeError` because `null` isn't an object.
|
||||
var emptyString = "";
|
||||
outer.throw(emptyString);
|
||||
});
|
||||
|
||||
assert.sameValue(returnCalls, 0);
|
||||
|
|
Loading…
Reference in New Issue