mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 21:19:50 +01:00
fb9257f659
Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: https://github.com/nodejs/node/pull/37917 Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
32 lines
602 B
JavaScript
32 lines
602 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
|
|
const {
|
|
BlockList,
|
|
} = require('net');
|
|
|
|
const {
|
|
ok,
|
|
notStrictEqual,
|
|
} = require('assert');
|
|
|
|
const blocklist = new BlockList();
|
|
blocklist.addAddress('123.123.123.123');
|
|
|
|
const mc = new MessageChannel();
|
|
|
|
mc.port1.onmessage = common.mustCall(({ data }) => {
|
|
notStrictEqual(data, blocklist);
|
|
ok(data.check('123.123.123.123'));
|
|
ok(!data.check('123.123.123.124'));
|
|
|
|
data.addAddress('123.123.123.124');
|
|
ok(blocklist.check('123.123.123.124'));
|
|
ok(data.check('123.123.123.124'));
|
|
|
|
mc.port1.close();
|
|
});
|
|
|
|
mc.port2.postMessage(blocklist);
|