summaryrefslogtreecommitdiff
path: root/ext/webidl/00_webidl.js
diff options
context:
space:
mode:
authorMarcos Casagrande <marcoscvp90@gmail.com>2023-05-18 16:05:11 +0200
committerGitHub <noreply@github.com>2023-05-18 17:05:11 +0300
commitb0f13560cb5a860df042649fbceb8cd728011b8b (patch)
tree2f5695e1326aa817d42496cfa314b5b5725d926c /ext/webidl/00_webidl.js
parentc3f7e6ed6ea2da6b8be5c7b29619eb51e0c9a6e3 (diff)
fix(ext/webidl): change createPromiseConverter (#16367)
Diffstat (limited to 'ext/webidl/00_webidl.js')
-rw-r--r--ext/webidl/00_webidl.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/ext/webidl/00_webidl.js b/ext/webidl/00_webidl.js
index 247ebfe0d..dfaa774e2 100644
--- a/ext/webidl/00_webidl.js
+++ b/ext/webidl/00_webidl.js
@@ -948,10 +948,12 @@ function createRecordConverter(keyConverter, valueConverter) {
function createPromiseConverter(converter) {
return (V, prefix, context, opts) =>
- PromisePrototypeThen(
- PromiseResolve(V),
- (V) => converter(V, prefix, context, opts),
- );
+ // should be able to handle thenables
+ // see: https://github.com/web-platform-tests/wpt/blob/a31d3ba53a79412793642366f3816c9a63f0cf57/streams/writable-streams/close.any.js#L207
+ typeof V?.then === "function"
+ ? PromisePrototypeThen(PromiseResolve(V), (V) =>
+ converter(V, prefix, context, opts))
+ : PromiseResolve(converter(V, prefix, context, opts));
}
function invokeCallbackFunction(