Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
1 parent
e589e9b
commit ccb5b37
Showing
6 changed files
with
194 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Fedor Indutnyy <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 5b31df1207d4417a6f9b784574e3779650ba21d2..7b2558b87cecf1049f73b05754f4645c847a231f 100644 | ||
--- a/lib/internal/bootstrap/pre_execution.js | ||
+++ b/lib/internal/bootstrap/pre_execution.js | ||
@@ -506,6 +506,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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters