summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Promise/allSettled/resolve-non-callable.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/tests/test262/built-ins/Promise/allSettled/resolve-non-callable.js
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/built-ins/Promise/allSettled/resolve-non-callable.js')
-rw-r--r--js/src/tests/test262/built-ins/Promise/allSettled/resolve-non-callable.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Promise/allSettled/resolve-non-callable.js b/js/src/tests/test262/built-ins/Promise/allSettled/resolve-non-callable.js
new file mode 100644
index 0000000000..ebc4350938
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Promise/allSettled/resolve-non-callable.js
@@ -0,0 +1,37 @@
+// |reftest| async
+// Copyright (C) 2020 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-promise.allsettled
+description: >
+ Promise.resolve is retrieved before GetIterator call (non-callable).
+info: |
+ Promise.allSettled ( iterable )
+
+ [...]
+ 3. Let promiseResolve be GetPromiseResolve(C).
+ 4. IfAbruptRejectPromise(promiseResolve, promiseCapability).
+
+ GetPromiseResolve ( promiseConstructor )
+
+ [...]
+ 2. Let promiseResolve be ? Get(promiseConstructor, "resolve").
+ 3. If IsCallable(promiseResolve) is false, throw a TypeError exception.
+flags: [async]
+features: [Promise.allSettled, Symbol.iterator]
+---*/
+
+const iter = { 
+ get [Symbol.iterator]() {
+ throw new Test262Error("unreachable");
+ },
+};
+
+Promise.resolve = "certainly not callable";
+
+Promise.allSettled(iter).then(() => {
+ throw new Test262Error("The promise should be rejected, but it was resolved");
+}, (reason) => {
+ assert(reason instanceof TypeError);
+}).then($DONE, $DONE);