From 7d9e073b4dc823fffaef30240d755034261e329b Mon Sep 17 00:00:00 2001 From: David Barksdale Date: Fri, 26 Jan 2018 22:39:39 -0600 Subject: Copy buffer for postMessage --- gnunet-build/packages/gnunet/gnunet/files/network.js | 5 +++-- 1 file 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); -- cgit v1.2.3-18-g5258