mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
Signed-off-by: avivkeller <me@aviv.sh> PR-URL: https://github.com/nodejs/node/pull/65323 Refs: https://github.com/nodejs/node/pull/64894 Refs: https://github.com/nodejs/node/issues/43583 Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
19 lines
623 B
JavaScript
19 lines
623 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
if (!common.hasCrypto) common.skip('missing crypto');
|
|
|
|
const assert = require('node:assert');
|
|
const source = `
|
|
import value from 'data:text/javascript,export default 42';
|
|
postMessage([import.meta.url, location.href, value]);
|
|
`;
|
|
const url = URL.createObjectURL(new Blob([source], { type: 'text/javascript' }));
|
|
const worker = new Worker(url, { type: 'module' });
|
|
URL.revokeObjectURL(url);
|
|
worker.onerror = common.mustNotCall('worker failed');
|
|
worker.onmessage = common.mustCall(({ data }) => {
|
|
worker.terminate();
|
|
assert.deepStrictEqual(data, [url, url, 42]);
|
|
});
|