Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions lib/internal/webstreams/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const {
MathMax,
NumberIsNaN,
PromisePrototypeThen,
ReflectApply,
ReflectGet,
Symbol,
SymbolAsyncIterator,
Expand Down Expand Up @@ -166,15 +167,9 @@ function enqueueValueWithSize(controller, value, size) {
controller[kState].queueTotalSize += size;
}

// This implements "invoke a callback function type" for callback functions that return a promise.
// See https://webidl.spec.whatwg.org/#es-invoking-callback-functions
async function invokePromiseCallback(fn, thisArg, ...args) {
return FunctionPrototypeCall(fn, thisArg, ...args);
}

function createPromiseCallback(name, fn, thisArg) {
validateFunction(fn, name);
return (...args) => invokePromiseCallback(fn, thisArg, ...args);
return async (...args) => ReflectApply(fn, thisArg, args);
}

function isPromisePending(promise) {
Expand Down Expand Up @@ -281,7 +276,6 @@ module.exports = {
extractHighWaterMark,
extractSizeAlgorithm,
lazyTransfer,
invokePromiseCallback,
isBrandCheck,
isPromisePending,
peekQueueValue,
Expand Down
Loading