1'use strict'; 2require('../common'); 3const assert = require('assert'); 4const { MessageChannel } = require('worker_threads'); 5 6// Make sure that the pools used by the Buffer implementation are not 7// transferable. 8// Refs: https://github.com/nodejs/node/issues/32752 9 10const a = Buffer.from('hello world'); 11const b = Buffer.from('hello world'); 12assert.strictEqual(a.buffer, b.buffer); 13const length = a.length; 14 15const { port1 } = new MessageChannel(); 16port1.postMessage(a, [ a.buffer ]); 17 18// Verify that the pool ArrayBuffer has not actually been transferred: 19assert.strictEqual(a.buffer, b.buffer); 20assert.strictEqual(a.length, length); 21