File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed
Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -512,6 +512,18 @@ jsg::Optional<uint32_t> ByteLengthQueuingStrategy::size(
512512 } else if ((value)->IsArrayBufferView ()) {
513513 auto view = value.As <v8::ArrayBufferView>();
514514 return view->ByteLength ();
515+ } else {
516+ // Per the WHATWG Streams spec, ByteLengthQueuingStrategy.size should return
517+ // GetV(chunk, "byteLength"), which means getting the byteLength property
518+ // from any object, not just ArrayBuffer/ArrayBufferView.
519+ KJ_IF_SOME (obj, jsg::JsValue (value).tryCast <jsg::JsObject>()) {
520+ auto byteLength = obj.get (js, " byteLength" _kj);
521+ KJ_IF_SOME (num, byteLength.tryCast <jsg::JsNumber>()) {
522+ KJ_IF_SOME (val, num.value (js)) {
523+ return static_cast <uint32_t >(val);
524+ }
525+ }
526+ }
515527 }
516528 }
517529 return kj::none;
Original file line number Diff line number Diff line change @@ -727,13 +727,7 @@ export default {
727727 'write: returning a rejected promise (second write) should cause writer write() and ready to reject' ,
728728 ] ,
729729 } ,
730- 'writable-streams/byte-length-queuing-strategy.any.js' : {
731- comment :
732- 'TypeError: The value cannot be converted because it is not an integer.' ,
733- expectedFailures : [
734- 'Closing a writable stream with in-flight writes below the high water mark delays the close call properly' ,
735- ] ,
736- } ,
730+ 'writable-streams/byte-length-queuing-strategy.any.js' : { } ,
737731 'writable-streams/close.any.js' : {
738732 comment : 'To be investigated' ,
739733 expectedFailures : [
You can’t perform that action at this time.
0 commit comments