1'use strict'; 2 3const common = require('../common'); 4 5const { 6 BlockList, 7} = require('net'); 8 9const { 10 ok, 11 notStrictEqual, 12} = require('assert'); 13 14const blocklist = new BlockList(); 15blocklist.addAddress('123.123.123.123'); 16 17const mc = new MessageChannel(); 18 19mc.port1.onmessage = common.mustCall(({ data }) => { 20 notStrictEqual(data, blocklist); 21 ok(data.check('123.123.123.123')); 22 ok(!data.check('123.123.123.124')); 23 24 data.addAddress('123.123.123.124'); 25 ok(blocklist.check('123.123.123.124')); 26 ok(data.check('123.123.123.124')); 27 28 mc.port1.close(); 29}); 30 31mc.port2.postMessage(blocklist); 32