@@ -1374,14 +1374,8 @@ bool body_reader_then_handler(JSContext *cx, HandleObject body_owner, HandleValu
1374
1374
if (!JS_GetProperty (cx, chunk_obj, " value" , &val))
1375
1375
return false ;
1376
1376
1377
+ // The read operation returned something that's not a Uint8Array
1377
1378
if (!val.isObject () || !JS_IsUint8Array (&val.toObject ())) {
1378
- // TODO: check if this should create a rejected promise instead, so an
1379
- // in-content handler for unhandled rejections could deal with it. The read
1380
- // operation returned a chunk that's not a Uint8Array.
1381
- fprintf (stderr, " Error: read operation on body ReadableStream didn't respond with a "
1382
- " Uint8Array. Received value: " );
1383
- dump_value (cx, val, stderr);
1384
-
1385
1379
// reject the request promise
1386
1380
if (Request::is_instance (body_owner)) {
1387
1381
RootedObject response_promise (cx, Request::response_promise (body_owner));
@@ -1397,6 +1391,10 @@ bool body_reader_then_handler(JSContext *cx, HandleObject body_owner, HandleValu
1397
1391
return JS::RejectPromise (cx, response_promise, exn);
1398
1392
}
1399
1393
1394
+ // TODO: should we also create a rejected promise if a response reads something that's not a Uint8Array?
1395
+ fprintf (stderr, " Error: read operation on body ReadableStream didn't respond with a "
1396
+ " Uint8Array. Received value: " );
1397
+ dump_value (cx, val, stderr);
1400
1398
return false ;
1401
1399
}
1402
1400
0 commit comments