File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,8 @@ const {
6969 CountQueuingStrategy,
7070} = require ( 'internal/webstreams/queuingstrategies' ) ;
7171
72+ const { queueMicrotask } = require ( 'internal/process/task_queues' ) ;
73+
7274const kHandle = Symbol ( 'kHandle' ) ;
7375const kType = Symbol ( 'kType' ) ;
7476const kLength = Symbol ( 'kLength' ) ;
@@ -284,7 +286,7 @@ class Blob {
284286 }
285287 if ( buffer !== undefined )
286288 buffers . push ( buffer ) ;
287- readNext ( ) ;
289+ queueMicrotask ( ( ) => readNext ( ) ) ;
288290 } ) ;
289291 } ;
290292 readNext ( ) ;
Original file line number Diff line number Diff line change @@ -315,3 +315,16 @@ assert.throws(() => new Blob({}), {
315315
316316 delete Object . prototype . type ;
317317}
318+
319+ ( async ( ) => {
320+ // Refs: https://github.com/nodejs/node/issues/47301
321+
322+ const random = Buffer . alloc ( 256 ) . fill ( '0' ) ;
323+ const chunks = [ ] ;
324+
325+ for ( let i = 0 ; i < random . length ; i += 2 ) {
326+ chunks . push ( random . subarray ( i , i + 2 ) ) ;
327+ }
328+
329+ await new Blob ( chunks ) . arrayBuffer ( ) ;
330+ } ) ( ) . then ( common . mustCall ( ) ) ;
You can’t perform that action at this time.
0 commit comments