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
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 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(); |
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