mirror of
https://github.com/nodejs/node.git
synced 2025-05-15 10:01:49 +00:00

PR-URL: https://github.com/nodejs/node/pull/36360 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com>
16 lines
531 B
JavaScript
16 lines
531 B
JavaScript
'use strict';
|
|
const common = require('../../common');
|
|
const assert = require('assert');
|
|
const { MessageChannel } = require('worker_threads');
|
|
const { buffer } = require(`./build/${common.buildType}/binding`);
|
|
|
|
// Test that buffers allocated with a free callback through our APIs are not
|
|
// transferred.
|
|
|
|
const { port1 } = new MessageChannel();
|
|
const origByteLength = buffer.byteLength;
|
|
port1.postMessage(buffer, [buffer.buffer]);
|
|
|
|
assert.strictEqual(buffer.byteLength, origByteLength);
|
|
assert.notStrictEqual(buffer.byteLength, 0);
|