mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
The HTML structured serialize algorithm treats transferable and serializable as two different bits. A web platform interface can be both transferable and serializable. Splits BaseObject::TransferMode to be able to compose the two bits and distinguishes the transferable and cloneable. PR-URL: https://github.com/nodejs/node/pull/47956 Refs: https://github.com/v8/v8/commit/cf13b9b46572a9824d2d632abdd48c56161ace02 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
24 lines
564 B
JavaScript
24 lines
564 B
JavaScript
// Flags: --expose-internals
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
|
|
|
const assert = require('assert');
|
|
const { E, F } = require('internal/test/transfer');
|
|
|
|
// Tests that F is transferable even tho it does not directly,
|
|
// observably extend the JSTransferable class.
|
|
|
|
const mc = new MessageChannel();
|
|
|
|
mc.port1.onmessageerror = common.mustNotCall();
|
|
|
|
mc.port1.onmessage = common.mustCall(({ data }) => {
|
|
assert(data instanceof F);
|
|
assert(data instanceof E);
|
|
assert.strictEqual(data.b, 1);
|
|
mc.port1.close();
|
|
});
|
|
|
|
mc.port2.postMessage(new F(1));
|