Bug 184886

Summary: WebAssembly: add support for stream APIs - JavaScript API: Implement loading for the Blob type
Product: WebKit Reporter: GSkachkov <gskachkov>
Component: JavaScriptCoreAssignee: Yusuke Suzuki <ysuzuki>
Status: RESOLVED FIXED    
Severity: Normal CC: aakash_jain, benjamin, beyer, calvaris, cdumez, chi187, clopez, ews-watchlist, hotaru, jfbastien, kevinhart836, rob, webkit-bot-watchers-bugzilla, webkit-bug-importer, youennf, ysuzuki
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=221281
Bug Depends on: 183442    
Bug Blocks: 161709    
Attachments:
Description Flags
Patch youennf: review+

GSkachkov
Reported 2018-04-23 09:34:26 PDT
Implement loading for the Blob type for streaming API, currently implemented SharedBuffer
Attachments
Patch (7.68 KB, patch)
2021-02-02 00:21 PST, Yusuke Suzuki
youennf: review+
JF Bastien
Comment 1 2018-04-23 09:38:59 PDT
GSkachkov
Comment 2 2018-04-23 09:49:22 PDT
(In reply to JF Bastien from comment #1) > You mean this: https://developer.mozilla.org/en-US/docs/Web/API/Blob ? Yeah, this currently fails: ``` const blob = new Blob(...); WebAssembly.instantiateStreaming(new Response(blob, { headers: { "Content-Type" : "application/wasm" }})); ``` currently my patch support only Responses manually created from ReadableStream: ``` const stream = new ReadableStream(...); WebAssembly.instantiateStreaming(new Response(stream, { headers: { "Content-Type" : "application/wasm" }})); ```
Yusuke Suzuki
Comment 4 2021-01-25 14:02:41 PST
Will do at the same time. *** This bug has been marked as a duplicate of bug 173105 ***
Yusuke Suzuki
Comment 5 2021-01-26 23:10:35 PST
Initially, we do not support it.
Yusuke Suzuki
Comment 6 2021-02-01 02:06:55 PST
@Youenn Would you mind telling me the best way to load bytes from FormData? FetchResponse can have FormData as its body, and we would like to load byte streams from that to pass this data to Wasm streaming compiler.
Yusuke Suzuki
Comment 7 2021-02-02 00:21:37 PST
EWS Watchlist
Comment 8 2021-02-02 00:22:23 PST
This patch modifies the imported WPT tests. Please ensure that any changes on the tests (not coming from a WPT import) are exported to WPT. Please see https://trac.webkit.org/wiki/WPTExportProcess
youenn fablet
Comment 9 2021-02-02 01:28:01 PST
Comment on attachment 418968 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=418968&action=review > Source/WebCore/bindings/js/JSDOMGlobalObject.cpp:349 > + } Sounds good like this. Or maybe we could introduce a utility method that would handle blob through consumeBodyReceivedByChunk, since the same thing is used in DOMCache. > LayoutTests/imported/w3c/web-platform-tests/wasm/wasm_stream_instantiate_test.html:113 > + }, "instantiateStreaming using blob"); Might be worth adding a test with form data even though we fail it for now?
Yusuke Suzuki
Comment 10 2021-02-02 10:27:39 PST
Comment on attachment 418968 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=418968&action=review >> Source/WebCore/bindings/js/JSDOMGlobalObject.cpp:349 >> + } > > Sounds good like this. > Or maybe we could introduce a utility method that would handle blob through consumeBodyReceivedByChunk, since the same thing is used in DOMCache. For now, I want to have this separate from consumeBodyReceivedByChunk (first, making it ReadableStream, and then use it in consumeBodyReceivedByChunk), because creating ReadableStream can cause exception. And we need JSGlobalObject, while the other ones are not requiring it in consumeBodyReceivedByChunk. I think, possibly, in the future change, we could just call consumeBodyReceivedByChunk without making Blob to ReadableStream (using BlobLoader). >> LayoutTests/imported/w3c/web-platform-tests/wasm/wasm_stream_instantiate_test.html:113 >> + }, "instantiateStreaming using blob"); > > Might be worth adding a test with form data even though we fail it for now? Sounds good! Added.
Yusuke Suzuki
Comment 11 2021-02-02 10:30:50 PST
Radar WebKit Bug Importer
Comment 12 2021-02-02 10:35:23 PST
Yusuke Suzuki
Comment 14 2021-02-02 13:45:42 PST
(In reply to Aakash Jain from comment #13) > (In reply to Yusuke Suzuki from comment #11) > > Committed r272221: <https://trac.webkit.org/changeset/272221> > This seems to have broken two layout tests: > https://results.webkit.org/?suite=layout-tests&suite=layout- > tests&test=imported%2Fw3c%2Fweb-platform- > tests%2Fwasm%2Fwasm_stream_instantiate_test.html&test=imported%2Fw3c%2Fweb- > platform-tests%2Fwasm%2Fwasm_stream_instantiate_test.html Fixed in https://bugs.webkit.org/show_bug.cgi?id=221281
Note You need to log in before you can comment on or make changes to this bug.