1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

fix(ext/webidl): change createPromiseConverter (#16367)

This commit is contained in:
Marcos Casagrande 2023-05-18 16:05:11 +02:00 committed by Levente Kurusa
parent 81f3ce99aa
commit 69ad1a530e
No known key found for this signature in database
GPG key ID: 9F72F3C05BA137C4
2 changed files with 13 additions and 27 deletions

View file

@ -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(

View file

@ -1843,14 +1843,8 @@
"bad-buffers-and-views.any.worker.html": true,
"construct-byob-request.any.html": true,
"construct-byob-request.any.worker.html": true,
"general.any.html": [
"ReadableStream with byte source: Respond to multiple pull() by separate enqueue()",
"ReadableStream with byte source: enqueue() discards auto-allocated BYOB request"
],
"general.any.worker.html": [
"ReadableStream with byte source: Respond to multiple pull() by separate enqueue()",
"ReadableStream with byte source: enqueue() discards auto-allocated BYOB request"
],
"general.any.html": true,
"general.any.worker.html": true,
"non-transferable-buffers.any.html": true,
"non-transferable-buffers.any.worker.html": true,
"enqueue-with-detached-buffer.window.html": false,
@ -1862,10 +1856,7 @@
"enqueue-with-detached-buffer.any.worker.html": true
},
"readable-streams": {
"async-iterator.any.html": [
"next() that succeeds; return()",
"next() that succeeds; return() [no awaiting]"
],
"async-iterator.any.html": true,
"bad-strategies.any.html": true,
"bad-strategies.any.worker.html": true,
"bad-underlying-sources.any.html": true,
@ -1892,10 +1883,7 @@
"tee.any.worker.html": true,
"templated.any.html": true,
"templated.any.worker.html": true,
"async-iterator.any.worker.html": [
"next() that succeeds; return()",
"next() that succeeds; return() [no awaiting]"
],
"async-iterator.any.worker.html": true,
"cross-realm-crash.window.html": false
},
"transform-streams": {
@ -1929,12 +1917,8 @@
"bad-underlying-sinks.any.worker.html": true,
"byte-length-queuing-strategy.any.html": true,
"byte-length-queuing-strategy.any.worker.html": true,
"close.any.html": [
"when close is called on a WritableStream in waiting state, ready should be fulfilled immediately even if close takes a long time"
],
"close.any.worker.html": [
"when close is called on a WritableStream in waiting state, ready should be fulfilled immediately even if close takes a long time"
],
"close.any.html": true,
"close.any.worker.html": true,
"constructor.any.html": true,
"constructor.any.worker.html": true,
"count-queuing-strategy.any.html": true,
@ -9087,4 +9071,4 @@
"media-sniff.window.html": false
}
}
}
}