diff --git a/patches/node/.patches b/patches/node/.patches index 6a85c12fb5f..a74a476eb8d 100644 --- a/patches/node/.patches +++ b/patches/node/.patches @@ -39,3 +39,4 @@ chore_handle_default_configuration_not_being_set_in_the_electron_env.patch revert_crypto_add_outputlength_option_to_crypto_createhash.patch add_openssl_is_boringssl_guard_to_oaep_hash_check.patch fix_microtasks.patch +fix_enable_worker_threads.patch diff --git a/patches/node/fix_enable_worker_threads.patch b/patches/node/fix_enable_worker_threads.patch new file mode 100644 index 00000000000..195b4058321 --- /dev/null +++ b/patches/node/fix_enable_worker_threads.patch @@ -0,0 +1,29 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shelley Vohr +Date: Thu, 3 Oct 2019 19:03:30 +0200 +Subject: fix: enable worker_threads + +Electron sets NODE_USE_V8_PLATFORM to false, because Electron +initializes the v8 platform itself and Node.js worker thread +initialization relies on the platform it uses having been set inside +code guarded by NODE_USE_V8_PLATFORM. + +This commit fixes this problem by changing node_worker to use the three-arg +implementation of `NewIsolate` to prevent it trying to use a possibly-null ptr. + +diff --git a/src/node_worker.cc b/src/node_worker.cc +index 11e44a92757e41e737087c5d08ce9931f0b0fab3..3dce5e25980ce2c6f17cda02dab9c0f8b4fab813 100644 +--- a/src/node_worker.cc ++++ b/src/node_worker.cc +@@ -116,7 +116,10 @@ class WorkerThreadData { + : w_(w) { + CHECK_EQ(uv_loop_init(&loop_), 0); + +- Isolate* isolate = NewIsolate(w->array_buffer_allocator_.get(), &loop_); ++ Isolate* isolate = NewIsolate( ++ w->array_buffer_allocator_.get(), ++ &loop_, ++ w->platform_); + CHECK_NOT_NULL(isolate); + + { diff --git a/script/node-disabled-tests.json b/script/node-disabled-tests.json index 7c38d497bc2..a18a4362a62 100644 --- a/script/node-disabled-tests.json +++ b/script/node-disabled-tests.json @@ -141,7 +141,6 @@ "parallel/test-tls-socket-allow-half-open-option", "parallel/test-tls-ticket", "parallel/test-tls-write-error", - "parallel/test-trace-events-api-worker-disabled", "parallel/test-tls-ticket-cluster", "parallel/test-trace-events-dynamic-enable", "parallel/test-trace-events-dynamic-enable-workers-disabled", @@ -170,62 +169,13 @@ "parallel/test-vm-syntax-error-message", "parallel/test-warn-sigprof", "parallel/test-whatwg-encoding-custom-textdecoder", - "parallel/test-worker", - "parallel/test-worker-abort-on-uncaught-exception-terminate", - "parallel/test-worker-cleanexit-with-js", - "parallel/test-worker-cleanexit-with-moduleload", - "parallel/test-worker-cleanup-handles", - "parallel/test-worker-console-listeners", - "parallel/test-worker-dns-terminate", - "parallel/test-worker-error-stack-getter-throws", - "parallel/test-worker-esm-missing-main", "parallel/test-worker-debug", - "parallel/test-worker-dns-terminate-during-query", - "parallel/test-worker-esm-exit", - "parallel/test-worker-esmodule", - "parallel/test-worker-exit-from-uncaught-exception", - "parallel/test-worker-exit-code", - "parallel/test-worker-execargv", - "parallel/test-worker-fs-stat-watcher", "parallel/test-worker-message-channel", - "parallel/test-worker-memory", - "parallel/test-worker-http2-generic-streams-terminate", - "parallel/test-worker-message-channel-sharedarraybuffer", - "parallel/test-worker-message-not-serializable", - "parallel/test-worker-message-port-drain", - "parallel/test-worker-message-port-message-before-close", "parallel/test-worker-message-port-transfer-duplicate", "parallel/test-worker-message-port-transfer-target", - "parallel/test-worker-message-port-transfer-terminate", - "parallel/test-worker-message-port-wasm-module", - "parallel/test-worker-message-port-wasm-threads", - "parallel/test-worker-mjs-workerdata", - "parallel/test-worker-process-env-shared", - "parallel/test-worker-onmessage", - "parallel/test-worker-parent-port-ref", - "parallel/test-worker-nexttick-terminate", - "parallel/test-worker-no-stdin-stdout-interaction", - "parallel/test-worker-onmessage-not-a-function", - "parallel/test-worker-process-cwd", - "parallel/test-worker-process-env", - "parallel/test-worker-ref", "parallel/test-worker-ref-onexit", - "parallel/test-worker-relative-path", - "parallel/test-worker-relative-path-double-dot", - "parallel/test-worker-safe-getters", - "parallel/test-worker-message-type-unknown", - "parallel/test-worker-stack-overflow", - "parallel/test-worker-uncaught-exception", - "parallel/test-worker-syntax-error", - "parallel/test-worker-terminate-microtask-loop", - "parallel/test-worker-vm-context-terminate", + "parallel/test-worker-sharedarraybuffer-from-worker-thread", "parallel/test-worker-stdio", - "parallel/test-worker-syntax-error-file", - "parallel/test-worker-terminate-timers", - "parallel/test-worker-terminate-http2-respond-with-file", - "parallel/test-worker-unsupported-things", - "parallel/test-worker-uncaught-exception-async", - "parallel/test-worker-workerdata-sharedarraybuffer", "async-hooks/test-crypto-randomBytes", "async-hooks/test-fseventwrap", "async-hooks/test-fsreqcallback-readFile", @@ -260,7 +210,6 @@ "es-module/test-esm-type-flag", "report/test-report-writereport", "abort/test-abort-backtrace", - "abort/test-worker-abort-uncaught-exception", "sequential/test-child-process-execsync", "sequential/test-cli-syntax-bad", "sequential/test-cli-syntax-good",