diff --git a/lib/internal/webstreams/util.js b/lib/internal/webstreams/util.js index 5bf016f73b7af5..070fc09f17f505 100644 --- a/lib/internal/webstreams/util.js +++ b/lib/internal/webstreams/util.js @@ -11,6 +11,7 @@ const { MathMax, NumberIsNaN, PromisePrototypeThen, + ReflectApply, ReflectGet, Symbol, SymbolAsyncIterator, @@ -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) { @@ -281,7 +276,6 @@ module.exports = { extractHighWaterMark, extractSizeAlgorithm, lazyTransfer, - invokePromiseCallback, isBrandCheck, isPromisePending, peekQueueValue,