1// Flags: --expose-internals 2'use strict'; 3 4const common = require('../common'); 5 6const assert = require('assert'); 7const { 8 JSTransferable, 9} = require('internal/worker/js_transferable'); 10const { E, F } = require('internal/test/transfer'); 11 12// Tests that F is transferable even tho it does not directly, 13// observably extend the JSTransferable class. 14 15const mc = new MessageChannel(); 16 17mc.port1.onmessageerror = common.mustNotCall(); 18 19mc.port1.onmessage = common.mustCall(({ data }) => { 20 assert(!(data instanceof JSTransferable)); 21 assert(data instanceof F); 22 assert(data instanceof E); 23 assert.strictEqual(data.b, 1); 24 mc.port1.close(); 25}); 26 27mc.port2.postMessage(new F(1)); 28