mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
fix: initialize asar support in worker threads (#33396)
* fix: initialize asar support in worker threads (#33216) * fix: initialize asar support in worker threads Use `ObjectWrap` instead of gin's Wrap in `electron_api_asar.cc` because gin isn't fully initialized (and apparently not possible to initialize without ruining the isolate configuration and array buffer allocator) in worker threads. In the worker thread call `setupAsarSupport` just as we do for the main process. * Update lib/asar/fs-wrapper.ts Co-authored-by: Darshan Sen <raisinten@gmail.com> * Update patches/node/worker_thread_add_asar_support.patch Co-authored-by: Darshan Sen <raisinten@gmail.com> * Add a test Co-authored-by: Darshan Sen <raisinten@gmail.com> Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * chore: update .patches after merge Co-authored-by: Fedor Indutny <fedor@indutny.com> Co-authored-by: Darshan Sen <raisinten@gmail.com> Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
This commit is contained in:
@@ -44,3 +44,4 @@ unix_remove_uv_cloexec_ioctl_3515.patch
|
||||
process_simplify_uv_write_int_calls_3519.patch
|
||||
macos_don_t_use_thread-unsafe_strtok_3524.patch
|
||||
process_fix_hang_after_note_exit_3521.patch
|
||||
worker_thread_add_asar_support.patch
|
||||
|
||||
41
patches/node/worker_thread_add_asar_support.patch
Normal file
41
patches/node/worker_thread_add_asar_support.patch
Normal file
@@ -0,0 +1,41 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Fedor Indutny <indutny@signal.org>
|
||||
Date: Wed, 9 Mar 2022 17:52:32 -0800
|
||||
Subject: worker_thread: add asar support
|
||||
|
||||
This patch initializes asar support in workers threads in
|
||||
Node.js.
|
||||
|
||||
diff --git a/lib/internal/bootstrap/pre_execution.js b/lib/internal/bootstrap/pre_execution.js
|
||||
index 419ffd9d5deb84eb94381259d3084411f6c3341b..17a1860d158976f11035553601560d171c7fc25a 100644
|
||||
--- a/lib/internal/bootstrap/pre_execution.js
|
||||
+++ b/lib/internal/bootstrap/pre_execution.js
|
||||
@@ -505,6 +505,7 @@ module.exports = {
|
||||
loadPreloadModules,
|
||||
setupTraceCategoryState,
|
||||
setupInspectorHooks,
|
||||
+ setupAsarSupport,
|
||||
initializeReport,
|
||||
initializeCJSLoader,
|
||||
initializeWASI
|
||||
diff --git a/lib/internal/main/worker_thread.js b/lib/internal/main/worker_thread.js
|
||||
index e3ce67987ee3185a93750ebad72beab304c71e3a..ef5082d73b6153b49875c61d9b365b873b16145d 100644
|
||||
--- a/lib/internal/main/worker_thread.js
|
||||
+++ b/lib/internal/main/worker_thread.js
|
||||
@@ -27,6 +27,7 @@ const {
|
||||
initializeReport,
|
||||
initializeSourceMapsHandlers,
|
||||
loadPreloadModules,
|
||||
+ setupAsarSupport,
|
||||
setupTraceCategoryState
|
||||
} = require('internal/bootstrap/pre_execution');
|
||||
|
||||
@@ -154,6 +155,8 @@ port.on('message', (message) => {
|
||||
};
|
||||
workerIo.sharedCwdCounter = cwdCounter;
|
||||
|
||||
+ setupAsarSupport();
|
||||
+
|
||||
const CJSLoader = require('internal/modules/cjs/loader');
|
||||
assert(!CJSLoader.hasLoadedAnyUserCJSModule);
|
||||
loadPreloadModules();
|
||||
Reference in New Issue
Block a user