diff options
author | David Barksdale <amatus@amat.us> | 2018-01-26 22:39:39 -0600 |
---|---|---|
committer | David Barksdale <amatus@amat.us> | 2018-01-26 22:39:39 -0600 |
commit | 7d9e073b4dc823fffaef30240d755034261e329b (patch) | |
tree | 3bc7cdaf99afd3e808fb5abd810868e9f81bd89d | |
parent | 0fdddc32842077a03f0ef8c47d47b89b73cb86a7 (diff) |
Copy buffer for postMessage
-rw-r--r-- | gnunet-build/packages/gnunet/gnunet/files/network.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gnunet-build/packages/gnunet/gnunet/files/network.js b/gnunet-build/packages/gnunet/gnunet/files/network.js index 011ec8f..d33fdda 100644 --- a/gnunet-build/packages/gnunet/gnunet/files/network.js +++ b/gnunet-build/packages/gnunet/gnunet/files/network.js @@ -90,9 +90,10 @@ mergeInto(LibraryManager.library, { ___setErrNo(ERRNO_CODES.ENOTCONN); return -1; } - var view = {{{ makeHEAPView('U8', 'buffer', 'buffer+length') }}}; + var view = + new Uint8Array({{{ makeHEAPView('U8', 'buffer', 'buffer+length') }}}); try { - SOCKETS[desc].port.postMessage(new Uint8Array(view)); + SOCKETS[desc].port.postMessage(new Uint8Array(view, [view])); } catch (e) { console.error("Failed to send"); ___setErrNo(ERRNO_CODES.ECONNRESET); |