Skip to content

Commit ce7ec43

Browse files
committed
fixup! worker: discard queued messages on termination
1 parent 5a55669 commit ce7ec43

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎test/parallel/test-webworker-postmessage-overloads.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
const common = require('../common');
55
const assert = require('node:assert');
6-
const { isMainThread } = require('node:worker_threads');
76
const { pathToFileURL } = require('node:url');
87

98
function checkPostMessage(post) {
@@ -39,7 +38,8 @@ function checkPostMessage(post) {
3938
}
4039
}
4140

42-
if (isMainThread) {
41+
// The test runner can also execute this file in a regular Node worker.
42+
if (typeof globalThis.DedicatedWorkerGlobalScope === 'undefined') {
4343
const worker = new Worker(pathToFileURL(__filename));
4444
worker.onerror = common.mustNotCall('worker failed');
4545
const done = common.mustCall(() => worker.terminate());

0 commit comments

Comments
 (0)