• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2const common = require('../../common');
3const assert = require('assert');
4const { MessageChannel } = require('worker_threads');
5const { buffer } = require(`./build/${common.buildType}/binding`);
6
7// Test that buffers allocated with a free callback through our APIs are not
8// transferred.
9
10const { port1 } = new MessageChannel();
11const origByteLength = buffer.byteLength;
12port1.postMessage(buffer, [buffer]);
13
14assert.strictEqual(buffer.byteLength, origByteLength);
15assert.notStrictEqual(buffer.byteLength, 0);
16