blob: 0f49606349da2e015a01045dc67d606dc2ef4e09 [file] [log] [blame]
function shouldBe(actual, expected) {
if (actual !== expected)
throw new Error('bad value: ' + actual);
}
class DerivedPromise extends Promise {
constructor(executor) {
super(executor);
}
};
var array = [];
for (var i = 0; i < 1e5; ++i) {
array.push(new DerivedPromise(function (resolve, reject) {
resolve(i);
}));
}
DerivedPromise.all(array).then(function (results) {
for (var i = 0; i < results.length; ++i)
shouldBe(results[i], i);
});
drainMicrotasks();
for (var i = 0; i < array.length; ++i)
shouldBe(array[i].__proto__, DerivedPromise.prototype);