2020-07-13 10:39:42 +02:00
|
|
|
// Copyright 2020 the V8 project authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
// Flags: --allow-natives-syntax
|
|
|
|
|
2021-08-29 14:20:49 +02:00
|
|
|
d8.file.execute('test/mjsunit/test-async.js');
|
2020-07-13 10:39:42 +02:00
|
|
|
|
2020-10-15 20:17:08 +02:00
|
|
|
// Promise.all should not call GetIterator if Promise.resolve is not callable.
|
2020-07-13 10:39:42 +02:00
|
|
|
|
2020-10-15 20:17:08 +02:00
|
|
|
let getIteratorCount = 0;
|
2020-07-13 10:39:42 +02:00
|
|
|
let iter = {
|
2020-10-15 20:17:08 +02:00
|
|
|
get [Symbol.iterator]() {
|
|
|
|
++getIteratorCount;
|
2020-07-13 10:39:42 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
Promise.resolve = "certainly not callable";
|
|
|
|
|
|
|
|
testAsync(assert => {
|
|
|
|
assert.plan(2);
|
|
|
|
Promise.all(iter).then(assert.unreachable, reason => {
|
|
|
|
assert.equals(true, reason instanceof TypeError);
|
2020-10-15 20:17:08 +02:00
|
|
|
assert.equals(0, getIteratorCount);
|
2020-07-13 10:39:42 +02:00
|
|
|
});
|
|
|
|
});
|