'use strict';
|
var globalThis = require('../internals/global-this');
|
|
// https://github.com/tc39/ecma262/pull/3467
|
module.exports = function (METHOD_NAME, ExpectedError) {
|
var Iterator = globalThis.Iterator;
|
var IteratorPrototype = Iterator && Iterator.prototype;
|
var method = IteratorPrototype && IteratorPrototype[METHOD_NAME];
|
|
var CLOSED = false;
|
|
if (method) try {
|
method.call({
|
next: function () { return { done: true }; },
|
'return': function () { CLOSED = true; }
|
}, -1);
|
} catch (error) {
|
// https://bugs.webkit.org/show_bug.cgi?id=291195
|
if (!(error instanceof ExpectedError)) CLOSED = false;
|
}
|
|
if (!CLOSED) return method;
|
};
|