- From: juj <notifications@github.com>
- Date: Thu, 18 Apr 2019 00:41:41 -0700
- To: whatwg/fetch <fetch@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Thursday, 18 April 2019 07:42:03 UTC
Multithreaded WebAssembly applications may wish to perform HTTP POST uploads from data that lives within their WebAssembly heaps. That is, they may execute ```js var x = new XMLHttpRequest(); x.open('POST', 'http://localhost.com/', true); var a = new Uint8Array(new SharedArrayBuffer(10)); x.send(a); ``` but that fails with an error ``` VM231:1 Uncaught TypeError: Failed to execute 'send' on 'XMLHttpRequest': The provided ArrayBufferView value must not be shared. ``` as a workaround, one can perform a deep copy of the data from a shared array view to an unshared array view with ```js var x = new XMLHttpRequest(); x.open('POST', 'http://localhost.com/', true); var a = new Uint8Array(new Uint8Array(new SharedArrayBuffer(10))); x.send(a); ``` This works, but having to do this potentially large deep intermediate copy of all data to upload can be costly. Several other entry points of web apis have been expanded to allow SABs as inputs. Would it make sense for xhr.send() as well? CC @lars-t-hansen -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/whatwg/fetch/issues/897
Received on Thursday, 18 April 2019 07:42:03 UTC