Changeset 272221 in webkit
- Timestamp:
- Feb 2, 2021 10:30:42 AM (18 months ago)
- Location:
- trunk
- Files:
-
- 7 edited
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/wasm/wasm_stream_compile_test-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/wasm/wasm_stream_compile_test.html (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/wasm/wasm_stream_instantiate_test-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/wasm/wasm_stream_instantiate_test.html (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/bindings/js/JSDOMGlobalObject.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/imported/w3c/ChangeLog
r272193 r272221 1 2021-02-02 Yusuke Suzuki <ysuzuki@apple.com> 2 3 WebAssembly: add support for stream APIs - JavaScript API: Implement loading for the Blob type 4 https://bugs.webkit.org/show_bug.cgi?id=184886 5 6 Reviewed by Youenn Fablet. 7 8 * web-platform-tests/wasm/wasm_stream_compile_test-expected.txt: 9 * web-platform-tests/wasm/wasm_stream_compile_test.html: 10 * web-platform-tests/wasm/wasm_stream_instantiate_test-expected.txt: 11 * web-platform-tests/wasm/wasm_stream_instantiate_test.html: 12 1 13 2021-02-02 Rob Buis <rbuis@igalia.com> 2 14 -
trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/wasm_stream_compile_test-expected.txt
r271993 r272221 10 10 PASS compileStreaming receive promise with response created from ArrayBuffer 11 11 PASS compileStreaming receive response that deliver data by chunks as bufferArray 12 PASS compileStreaming using blob 13 FAIL compileStreaming using FormData promise_rejects_js: function "function () { throw e }" threw object "TypeError: FormData is not supported" ("TypeError") expected instance of function "function CompileError() { 14 [native code] 15 }" ("CompileError") 12 16 -
trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/wasm_stream_compile_test.html
r271993 r272221 106 106 assert_true(module instanceof WebAssembly.Module); 107 107 }, "compileStreaming receive response that deliver data by chunks as bufferArray"); 108 109 promise_test(async function() { 110 var response = await fetch('resources/incrementer.wasm'); 111 var blob = await response.blob(); 112 const module = await WebAssembly.compileStreaming(new Response(blob, { headers: { "Content-Type" : "application/wasm" }})); 113 assert_true(module instanceof WebAssembly.Module); 114 }, "compileStreaming using blob"); 115 116 promise_test(async function(t) { 117 var response = await fetch('resources/incrementer.wasm'); 118 var blob = await response.blob(); 119 var formData = new FormData; 120 formData.append('blob', blob); 121 formData.append('blob2', "Hello"); 122 await promise_rejects_js(t, WebAssembly.CompileError, WebAssembly.compileStreaming(new Response(formData, { headers: { "Content-Type" : "application/wasm" }}))); 123 }, "compileStreaming using FormData"); 108 124 </script> 109 125 -
trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/wasm_stream_instantiate_test-expected.txt
r271993 r272221 10 10 PASS instantiateStreaming receive promise with response created from ArrayBuffer 11 11 PASS instantiateStreaming receive response that deliver data by chunks as bufferArray 12 PASS instantiateStreaming using blob 13 FAIL instantiateStreaming using FormData promise_rejects_js: function "function () { throw e }" threw object "TypeError: FormData is not supported" ("TypeError") expected instance of function "function CompileError() { 14 [native code] 15 }" ("CompileError") 12 16 -
trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/wasm_stream_instantiate_test.html
r271993 r272221 104 104 assert_true(instance instanceof WebAssembly.Instance); 105 105 }, "instantiateStreaming receive response that deliver data by chunks as bufferArray"); 106 107 promise_test(async function() { 108 var response = await fetch('resources/incrementer.wasm'); 109 var blob = await response.blob(); 110 const { instance, module } = await WebAssembly.instantiateStreaming(new Response(blob, { headers: { "Content-Type" : "application/wasm" }})); 111 assert_true(instance instanceof WebAssembly.Instance); 112 assert_true(module instanceof WebAssembly.Module); 113 }, "instantiateStreaming using blob"); 114 115 promise_test(async function(t) { 116 var response = await fetch('resources/incrementer.wasm'); 117 var blob = await response.blob(); 118 var formData = new FormData; 119 formData.append('blob', blob); 120 formData.append('blob2', "Hello"); 121 await promise_rejects_js(t, WebAssembly.CompileError, WebAssembly.instantiateStreaming(new Response(formData, { headers: { "Content-Type" : "application/wasm" }}))); 122 }, "instantiateStreaming using FormData"); 106 123 </script> -
trunk/Source/WebCore/ChangeLog
r272218 r272221 1 2021-02-02 Yusuke Suzuki <ysuzuki@apple.com> 2 3 WebAssembly: add support for stream APIs - JavaScript API: Implement loading for the Blob type 4 https://bugs.webkit.org/show_bug.cgi?id=184886 5 6 Reviewed by Youenn Fablet. 7 8 This patch adds compileStreaming / instantiateStreaming with FetchResponse created from Blob. 9 We materialize ReadableStream to load Blob for now. In the future, if more efficient way is 10 implemented, we will switch to that. 11 More complex FormData is not supported, tracked in https://bugs.webkit.org/show_bug.cgi?id=221248. 12 13 * bindings/js/JSDOMGlobalObject.cpp: 14 (WebCore::handleResponseOnStreamingAction): 15 1 16 2021-02-02 Chris Dumez <cdumez@apple.com> 2 17 -
trunk/Source/WebCore/bindings/js/JSDOMGlobalObject.cpp
r271993 r272221 340 340 } 341 341 342 // FIXME: for efficiency, we should load blobs directly instead of going through the readableStream path. 343 if (inputResponse->isBlobBody()) { 344 auto streamOrException = inputResponse->readableStream(*globalObject); 345 if (UNLIKELY(streamOrException.hasException())) { 346 deferred->reject(streamOrException.releaseException()); 347 return jsCast<JSC::JSPromise*>(deferred->promise()); 348 } 349 } 350 342 351 auto compiler = JSC::Wasm::StreamingCompiler::create(vm, compilerMode, globalObject, jsCast<JSC::JSPromise*>(deferred->promise()), importObject); 343 352 … … 388 397 return; 389 398 } 390 // FIXME: http://webkit.org/b/184886> Implement loading for the Blob type 391 compiler->fail(globalObject, createTypeError(globalObject, "Blob is not supported"_s)); 399 // FIXME: Support FormData loading. 400 // https://bugs.webkit.org/show_bug.cgi?id=221248 401 compiler->fail(globalObject, createDOMException(*globalObject, Exception { NotSupportedError, "Not implemented"_s })); 392 402 }, [&](Ref<SharedBuffer>& buffer) { 393 403 compiler->addBytes(reinterpret_cast<const uint8_t*>(buffer->data()), buffer->size());
Note: See TracChangeset
for help on using the changeset viewer.