From b07e12a9cd8701b41021c8328bad1e909dd178c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Sun, 1 Jan 2023 14:31:15 +0100 Subject: [PATCH] fixup --- lib/internal/modules/esm/worker.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/internal/modules/esm/worker.js b/lib/internal/modules/esm/worker.js index faf572adc747b8..1fb0425da7058f 100644 --- a/lib/internal/modules/esm/worker.js +++ b/lib/internal/modules/esm/worker.js @@ -3,14 +3,12 @@ const { ReflectApply, SafeWeakMap, - Uint8Array, globalThis: { Atomics, }, } = primordials; const { ERR_INVALID_RETURN_VALUE, - ERR_OUT_OF_RANGE, } = require('internal/errors').codes; // Create this WeakMap in js-land because V8 has no C++ API for WeakMap. @@ -19,7 +17,6 @@ internalBinding('module_wrap').callbackMap = new SafeWeakMap(); const { isMainThread, workerData: { lock, syncCommPort }, - parentPort, } = require('worker_threads'); if (isMainThread) { return; } // Needed to pass some tests that happen to load this file on the main thread @@ -44,7 +41,7 @@ function releaseLock() { initializationError = exception; } - parentPort.on('message', handleSyncMessage); + syncCommPort.on('message', handleSyncMessage); // ! Put as little above this line as possible releaseLock(); // Send 'ready' signal to main @@ -67,9 +64,9 @@ function releaseLock() { // Send the method response (or exception) to the main thread try { - parentPort.postMessage(response); + syncCommPort.postMessage(response); } catch (exception) { - parentPort.postMessage(exception); + syncCommPort.postMessage(exception); } releaseLock(); }