11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_cirequire('../common'); 31cb0ef41Sopenharmony_ciconst assert = require('assert'); 41cb0ef41Sopenharmony_ciconst { MessageChannel } = require('worker_threads'); 51cb0ef41Sopenharmony_ci 61cb0ef41Sopenharmony_ci// Make sure that the pools used by the Buffer implementation are not 71cb0ef41Sopenharmony_ci// transferable. 81cb0ef41Sopenharmony_ci// Refs: https://github.com/nodejs/node/issues/32752 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_ciconst a = Buffer.from('hello world'); 111cb0ef41Sopenharmony_ciconst b = Buffer.from('hello world'); 121cb0ef41Sopenharmony_ciassert.strictEqual(a.buffer, b.buffer); 131cb0ef41Sopenharmony_ciconst length = a.length; 141cb0ef41Sopenharmony_ci 151cb0ef41Sopenharmony_ciconst { port1 } = new MessageChannel(); 161cb0ef41Sopenharmony_ciport1.postMessage(a, [ a.buffer ]); 171cb0ef41Sopenharmony_ci 181cb0ef41Sopenharmony_ci// Verify that the pool ArrayBuffer has not actually been transferred: 191cb0ef41Sopenharmony_ciassert.strictEqual(a.buffer, b.buffer); 201cb0ef41Sopenharmony_ciassert.strictEqual(a.length, length); 21