chore: cleanup asar initialization logic (#39532)
This commit is contained in:
parent
213388cd87
commit
aeb89b143b
2 changed files with 14 additions and 30 deletions
|
@ -26,10 +26,10 @@ index 001343b74ce236f89dca030c0fc9dd0299df0b39..6f277daf4ce846f093f634c473daec07
|
||||||
try {
|
try {
|
||||||
resolvedArgv = Module._resolveFilename(process.argv[1], null, false);
|
resolvedArgv = Module._resolveFilename(process.argv[1], null, false);
|
||||||
diff --git a/lib/internal/process/pre_execution.js b/lib/internal/process/pre_execution.js
|
diff --git a/lib/internal/process/pre_execution.js b/lib/internal/process/pre_execution.js
|
||||||
index 2e35cbba2ac02494c44821af395fe0195b1ab6b5..f5b6fecf6843a6204ec532a77f39a36d33bf061d 100644
|
index 4e7a9e7a7585fea2013ff70161672568477172b1..f96d19969aa59a9964d947a9fd6295cf25ad3b03 100644
|
||||||
--- a/lib/internal/process/pre_execution.js
|
--- a/lib/internal/process/pre_execution.js
|
||||||
+++ b/lib/internal/process/pre_execution.js
|
+++ b/lib/internal/process/pre_execution.js
|
||||||
@@ -149,11 +149,13 @@ function patchProcessObject(expandArgv1) {
|
@@ -151,11 +151,13 @@ function patchProcessObject(expandArgv1) {
|
||||||
if (expandArgv1 && process.argv[1] &&
|
if (expandArgv1 && process.argv[1] &&
|
||||||
!StringPrototypeStartsWith(process.argv[1], '-')) {
|
!StringPrototypeStartsWith(process.argv[1], '-')) {
|
||||||
// Expand process.argv[1] into a full path.
|
// Expand process.argv[1] into a full path.
|
||||||
|
|
|
@ -5,25 +5,20 @@ Subject: feat: initialize asar support
|
||||||
|
|
||||||
This patch initializes asar support in Node.js.
|
This patch initializes asar support in Node.js.
|
||||||
|
|
||||||
diff --git a/lib/internal/process/policy.js b/lib/internal/process/policy.js
|
|
||||||
index 8e07cb92118c84b2bc1156532cae8b033b9a48f4..2073a024ad548fe80e84cafee012b003454d6c93 100644
|
|
||||||
--- a/lib/internal/process/policy.js
|
|
||||||
+++ b/lib/internal/process/policy.js
|
|
||||||
@@ -39,9 +39,6 @@ module.exports = ObjectFreeze({
|
|
||||||
process.binding = function binding(_module) {
|
|
||||||
throw new ERR_ACCESS_DENIED('process.binding');
|
|
||||||
};
|
|
||||||
- process._linkedBinding = function _linkedBinding(_module) {
|
|
||||||
- throw new ERR_ACCESS_DENIED('process._linkedBinding');
|
|
||||||
- };
|
|
||||||
},
|
|
||||||
|
|
||||||
get manifest() {
|
|
||||||
diff --git a/lib/internal/process/pre_execution.js b/lib/internal/process/pre_execution.js
|
diff --git a/lib/internal/process/pre_execution.js b/lib/internal/process/pre_execution.js
|
||||||
index 250a43c5455b4f9ff72dd3a34d5b0aa270f43cc6..2e35cbba2ac02494c44821af395fe0195b1ab6b5 100644
|
index 250a43c5455b4f9ff72dd3a34d5b0aa270f43cc6..4e7a9e7a7585fea2013ff70161672568477172b1 100644
|
||||||
--- a/lib/internal/process/pre_execution.js
|
--- a/lib/internal/process/pre_execution.js
|
||||||
+++ b/lib/internal/process/pre_execution.js
|
+++ b/lib/internal/process/pre_execution.js
|
||||||
@@ -117,12 +117,17 @@ function setupUserModules() {
|
@@ -49,6 +49,8 @@ function prepareWorkerThreadExecution() {
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
+
|
||||||
|
+let processLinkedBinding = process._linkedBinding;
|
||||||
|
function prepareExecution(options) {
|
||||||
|
const { expandArgv1, initializeModules, isMainThread } = options;
|
||||||
|
|
||||||
|
@@ -117,12 +119,17 @@ function setupUserModules() {
|
||||||
loadPreloadModules();
|
loadPreloadModules();
|
||||||
// Need to be done after --require setup.
|
// Need to be done after --require setup.
|
||||||
initializeFrozenIntrinsics();
|
initializeFrozenIntrinsics();
|
||||||
|
@ -35,20 +30,9 @@ index 250a43c5455b4f9ff72dd3a34d5b0aa270f43cc6..2e35cbba2ac02494c44821af395fe019
|
||||||
}
|
}
|
||||||
|
|
||||||
+function setupAsarSupport() {
|
+function setupAsarSupport() {
|
||||||
+ process._linkedBinding('electron_common_asar').initAsarSupport(require);
|
+ processLinkedBinding('electron_common_asar').initAsarSupport(require);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
function patchProcessObject(expandArgv1) {
|
function patchProcessObject(expandArgv1) {
|
||||||
const binding = internalBinding('process_methods');
|
const binding = internalBinding('process_methods');
|
||||||
binding.patchProcessObject(process);
|
binding.patchProcessObject(process);
|
||||||
diff --git a/test/fixtures/policy/process-binding/app.js b/test/fixtures/policy/process-binding/app.js
|
|
||||||
index 16e26d12a160286b1b6aaeb64b15668b05b9865b..a287d0a2363acbf24077eec040116f96ef18a7b3 100644
|
|
||||||
--- a/test/fixtures/policy/process-binding/app.js
|
|
||||||
+++ b/test/fixtures/policy/process-binding/app.js
|
|
||||||
@@ -5,6 +5,3 @@ const assert = require('assert');
|
|
||||||
assert.throws(() => { process.binding(); }, {
|
|
||||||
code: 'ERR_ACCESS_DENIED'
|
|
||||||
});
|
|
||||||
-assert.throws(() => { process._linkedBinding(); }, {
|
|
||||||
- code: 'ERR_ACCESS_DENIED'
|
|
||||||
-});
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue