diff --git a/src/util.js b/src/util.js index a526d5e0..c94cfd61 100644 --- a/src/util.js +++ b/src/util.js @@ -79,8 +79,12 @@ export default { const reader = stream.getReader(readable); const { port1, port2 } = new MessageChannel(); port1.onmessage = async function({ data: { action } }) { - if (action === 'read') port1.postMessage(await reader.read()); - else if (action === 'cancel') port1.postMessage(await transformed.cancel()); + if (action === 'read') { + const result = await reader.read(); + port1.postMessage(result, util.getTransferables(result, true)); + } else if (action === 'cancel') { + port1.postMessage(await transformed.cancel()); + } }; obj[key] = port2; collection.push(port2); diff --git a/test/general/openpgp.js b/test/general/openpgp.js index b31dfb27..cfead605 100644 --- a/test/general/openpgp.js +++ b/test/general/openpgp.js @@ -1741,7 +1741,7 @@ describe('[Sauce Labs Group 2] OpenPGP.js public api tests', function() { if (i++ < 4) { let randomBytes = await openpgp.crypto.random.getRandomBytes(10); controller.enqueue(randomBytes); - plaintext.push(randomBytes); + plaintext.push(randomBytes.slice()); } else { controller.close(); }