electron/patches/node/feat_initialize_asar_support.patch

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

39 lines
1.2 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shelley Vohr <shelley.vohr@gmail.com>
Date: Thu, 13 Sep 2018 08:56:07 -0700
Subject: feat: initialize asar support
chore: bump node to v12.16.1 (master) (#22168) * chore: bump node in DEPS to v12.16.0 * Fixup asar support setup patch https://github.com/nodejs/node/pull/30862 * Fixup InternalCallbackScope patch https://github.com/nodejs/node/pull/30236 * Fixup GN buildfiles patch https://github.com/nodejs/node/pull/30755 * Fixup low-level hooks patch https://github.com/nodejs/node/pull/30466 * Fixup globals require patch https://github.com/nodejs/node/pull/31643 * Fixup process stream patch https://github.com/nodejs/node/pull/30862 * Fixup js2c modification patch https://github.com/nodejs/node/pull/30755 * Fixup internal fs override patch https://github.com/nodejs/node/pull/30610 * Fixup context-aware warn patch https://github.com/nodejs/node/pull/30336 * Fixup Node.js with ltcg config https://github.com/nodejs/node/pull/29388 * Fixup oaepLabel patch https://github.com/nodejs/node/pull/30917 * Remove redundant ESM test patch https://github.com/nodejs/node/pull/30997 * Remove redundant cli flag patch https://github.com/nodejs/node/pull/30466 * Update filenames.json * Remove macro generation in GN build files https://github.com/nodejs/node/pull/30755 * Fix some compilation errors upstream * Add uvwasi to deps https://github.com/nodejs/node/pull/30258 * Fix BoringSSL incompatibilities * Fixup linked module patch https://github.com/nodejs/node/pull/30274 * Add missing sources to GN uv build https://github.com/libuv/libuv/pull/2347 * Patch some uvwasi incompatibilities * chore: bump Node.js to v12.6.1 * Remove mark_arraybuffer_as_untransferable.patch https://github.com/nodejs/node/pull/30549 * Fix uvwasi build failure on win * Fixup --perf-prof cli option error * Fixup early cjs module loading * fix: initialize diagnostics properly https://github.com/nodejs/node/pull/30025 * Disable new esm syntax specs https://github.com/nodejs/node/pull/30219 * Fixup v8 weakref hook spec https://github.com/nodejs/node/pull/29874 * Fix async context timer issue * Disable monkey-patch-main spec It relies on https://github.com/nodejs/node/pull/29777, and we don't override prepareStackTrace. * Disable new tls specs https://github.com/nodejs/node/pull/23188 We don't support much of TLS owing to schisms between BoringSSL and OpenSSL. Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2020-02-24 21:02:04 +00:00
This patch initializes asar support in Node.js.
chore: upgrade to Node.js v18 (#35999) * chore: update to Node.js v18 * child_process: improve argument validation https://github.com/nodejs/node/pull/41305 * bootstrap: support configure-time user-land snapshot https://github.com/nodejs/node/pull/42466 * chore: update GN patch * src: disambiguate terms used to refer to builtins and addons https://github.com/nodejs/node/pull/44135 * src: use a typed array internally for process._exiting https://github.com/nodejs/node/pull/43883 * chore: lib/internal/bootstrap -> lib/internal/process * src: disambiguate terms used to refer to builtins and addons https://github.com/nodejs/node/pull/44135 * chore: remove redudant browserGlobals patch * chore: update BoringSSL patch * src: allow embedder-provided PageAllocator in NodePlatform https://github.com/nodejs/node/pull/38362 * chore: fixup Node.js crypto tests - https://github.com/nodejs/node/pull/44171 - https://github.com/nodejs/node/pull/41600 * lib: add Promise methods to avoid-prototype-pollution lint rule https://github.com/nodejs/node/pull/43849 * deps: update V8 to 10.1 https://github.com/nodejs/node/pull/42657 * src: add kNoBrowserGlobals flag for Environment https://github.com/nodejs/node/pull/40532 * chore: consolidate asar initialization patches * deps: update V8 to 10.1 https://github.com/nodejs/node/pull/42657 * deps: update V8 to 9.8 https://github.com/nodejs/node/pull/41610 * src,crypto: remove AllocatedBuffers from crypto_spkac https://github.com/nodejs/node/pull/40752 * build: enable V8's shared read-only heap https://github.com/nodejs/node/pull/42809 * src: fix ssize_t error from nghttp2.h https://github.com/nodejs/node/pull/44393 * chore: fixup ESM patch * chore: fixup patch indices * src: merge NativeModuleEnv into NativeModuleLoader https://github.com/nodejs/node/pull/43824 * [API] Pass OOMDetails to OOMErrorCallback https://chromium-review.googlesource.com/c/v8/v8/+/3647827 * src: iwyu in cleanup_queue.cc * src: return Maybe from a couple of functions https://github.com/nodejs/node/pull/39603 * src: clean up embedder API https://github.com/nodejs/node/pull/35897 * src: refactor DH groups to delete crypto_groups.h https://github.com/nodejs/node/pull/43896 * deps,src: use SIMD for normal base64 encoding https://github.com/nodejs/node/pull/39775 * chore: remove deleted source file * chore: update patches * chore: remove deleted source file * lib: add fetch https://github.com/nodejs/node/pull/41749 * chore: remove nonexistent node specs * test: split report OOM tests https://github.com/nodejs/node/pull/44389 * src: trace fs async api https://github.com/nodejs/node/pull/44057 * http: trace http request / response https://github.com/nodejs/node/pull/44102 * test: split test-crypto-dh.js https://github.com/nodejs/node/pull/40451 * crypto: introduce X509Certificate API https://github.com/nodejs/node/pull/36804 * src: split property helpers from node::Environment https://github.com/nodejs/node/pull/44056 * https://github.com/nodejs/node/pull/38905 bootstrap: implement run-time user-land snapshots via --build-snapshot and --snapshot-blob * lib,src: implement WebAssembly Web API https://github.com/nodejs/node/pull/42701 * fixup! deps,src: use SIMD for normal base64 encoding * fixup! src: refactor DH groups to delete crypto_groups.h * chore: fixup base64 GN file * fix: check that node::InitializeContext() returns true * chore: delete _noBrowserGlobals usage * chore: disable fetch in renderer procceses * dns: default to verbatim=true in dns.lookup() https://github.com/nodejs/node/pull/39987 Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2022-11-10 21:31:20 +00:00
diff --git a/lib/internal/process/pre_execution.js b/lib/internal/process/pre_execution.js
index b4a24bbffb6c43638d13063e85b6cfba5c0cc9c7..fcbd9ee1af002bc176937e6bb5af55791b2f64b2 100644
chore: upgrade to Node.js v18 (#35999) * chore: update to Node.js v18 * child_process: improve argument validation https://github.com/nodejs/node/pull/41305 * bootstrap: support configure-time user-land snapshot https://github.com/nodejs/node/pull/42466 * chore: update GN patch * src: disambiguate terms used to refer to builtins and addons https://github.com/nodejs/node/pull/44135 * src: use a typed array internally for process._exiting https://github.com/nodejs/node/pull/43883 * chore: lib/internal/bootstrap -> lib/internal/process * src: disambiguate terms used to refer to builtins and addons https://github.com/nodejs/node/pull/44135 * chore: remove redudant browserGlobals patch * chore: update BoringSSL patch * src: allow embedder-provided PageAllocator in NodePlatform https://github.com/nodejs/node/pull/38362 * chore: fixup Node.js crypto tests - https://github.com/nodejs/node/pull/44171 - https://github.com/nodejs/node/pull/41600 * lib: add Promise methods to avoid-prototype-pollution lint rule https://github.com/nodejs/node/pull/43849 * deps: update V8 to 10.1 https://github.com/nodejs/node/pull/42657 * src: add kNoBrowserGlobals flag for Environment https://github.com/nodejs/node/pull/40532 * chore: consolidate asar initialization patches * deps: update V8 to 10.1 https://github.com/nodejs/node/pull/42657 * deps: update V8 to 9.8 https://github.com/nodejs/node/pull/41610 * src,crypto: remove AllocatedBuffers from crypto_spkac https://github.com/nodejs/node/pull/40752 * build: enable V8's shared read-only heap https://github.com/nodejs/node/pull/42809 * src: fix ssize_t error from nghttp2.h https://github.com/nodejs/node/pull/44393 * chore: fixup ESM patch * chore: fixup patch indices * src: merge NativeModuleEnv into NativeModuleLoader https://github.com/nodejs/node/pull/43824 * [API] Pass OOMDetails to OOMErrorCallback https://chromium-review.googlesource.com/c/v8/v8/+/3647827 * src: iwyu in cleanup_queue.cc * src: return Maybe from a couple of functions https://github.com/nodejs/node/pull/39603 * src: clean up embedder API https://github.com/nodejs/node/pull/35897 * src: refactor DH groups to delete crypto_groups.h https://github.com/nodejs/node/pull/43896 * deps,src: use SIMD for normal base64 encoding https://github.com/nodejs/node/pull/39775 * chore: remove deleted source file * chore: update patches * chore: remove deleted source file * lib: add fetch https://github.com/nodejs/node/pull/41749 * chore: remove nonexistent node specs * test: split report OOM tests https://github.com/nodejs/node/pull/44389 * src: trace fs async api https://github.com/nodejs/node/pull/44057 * http: trace http request / response https://github.com/nodejs/node/pull/44102 * test: split test-crypto-dh.js https://github.com/nodejs/node/pull/40451 * crypto: introduce X509Certificate API https://github.com/nodejs/node/pull/36804 * src: split property helpers from node::Environment https://github.com/nodejs/node/pull/44056 * https://github.com/nodejs/node/pull/38905 bootstrap: implement run-time user-land snapshots via --build-snapshot and --snapshot-blob * lib,src: implement WebAssembly Web API https://github.com/nodejs/node/pull/42701 * fixup! deps,src: use SIMD for normal base64 encoding * fixup! src: refactor DH groups to delete crypto_groups.h * chore: fixup base64 GN file * fix: check that node::InitializeContext() returns true * chore: delete _noBrowserGlobals usage * chore: disable fetch in renderer procceses * dns: default to verbatim=true in dns.lookup() https://github.com/nodejs/node/pull/39987 Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2022-11-10 21:31:20 +00:00
--- a/lib/internal/process/pre_execution.js
+++ b/lib/internal/process/pre_execution.js
@@ -52,6 +52,8 @@ function prepareWorkerThreadExecution() {
});
}
+
+let processLinkedBinding = process._linkedBinding;
function prepareExecution(options) {
const { expandArgv1, initializeModules, isMainThread } = options;
@@ -130,12 +132,17 @@ function setupUserModules() {
loadPreloadModules();
chore: bump node to v18.13.0 (main) (#36818) * chore: bump node in DEPS to v18.13.0 * child_process: validate arguments for null bytes https://github.com/nodejs/node/pull/44782 * bootstrap: merge main thread and worker thread initializations https://github.com/nodejs/node/pull/44869 * module: ensure relative requires work from deleted directories https://github.com/nodejs/node/pull/42384 * src: add support for externally shared js builtins https://github.com/nodejs/node/issues/44000 * lib: disambiguate `native module` to `binding` https://github.com/nodejs/node/pull/45673 * test: convert test-debugger-pid to async/await https://github.com/nodejs/node/pull/45179 * deps: upgrade to libuv 1.44.2 https://github.com/nodejs/node/pull/42340 * src: fix cppgc incompatibility in v8 https://github.com/nodejs/node/pull/43521 * src: use qualified `std::move` call in node_http2 https://github.com/nodejs/node/pull/45555 * build: fix env.h for cpp20 https://github.com/nodejs/node/pull/45516 * test: remove experimental-wasm-threads flag https://github.com/nodejs/node/pull/45074 * src: iwyu in cleanup_queue.cc https://github.com/nodejs/node/pull/44983 * src: add missing include for `std::all_of` https://github.com/nodejs/node/pull/45541 * deps: update ICU to 72.1 https://github.com/nodejs/node/pull/45068 * chore: fixup patch indices * chore: remove errant semicolons - https://github.com/nodejs/node/pull/44179 - https://github.com/nodejs/node/pull/44193 * src: add support for externally shared js builtins https://github.com/nodejs/node/pull/44376 * chore: add missing GN filenames * deps: update nghttp2 to 1.51.0 https://github.com/nodejs/node/pull/45537 * chore: disable more Node.js snapshot tests The Snapshot feature is currently disabled * chore: disable ICU timezone tests Node.js uses a different version of ICU than Electron so they will often be out of sync. * chore: disable threadpool event tracing test Event tracing is not enabled in embedded Node.js * chore: fixup patch indices * chore: comments from review Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-01-11 10:33:48 +00:00
// Need to be done after --require setup.
initializeFrozenIntrinsics();
+ setupAsarSupport();
}
chore: bump node to v16.17.0 (main) (#35350) * chore: bump node in DEPS to v16.17.0 * chore: fixup asar patch * lib: use null-prototype objects for property descriptors https://github.com/nodejs/node/pull/43270 * src: make SecureContext fields private https://github.com/nodejs/node/pull/43173 * crypto: remove Node.js-specific webcrypto extensions https://github.com/nodejs/node/pull/43310 * test: refactor to top-level await https://github.com/nodejs/node/pull/43500 * deps: cherry-pick two libuv fixes https://github.com/nodejs/node/pull/43950 * src: slim down env-inl.h https://github.com/nodejs/node/pull/43745 * util: add AggregateError.prototype.errors to inspect output https://github.com/nodejs/node/pull/43646 * esm: improve performance & tidy tests https://github.com/nodejs/node/pull/43784 * src: NodeArrayBufferAllocator delegates to v8's allocator https://github.com/nodejs/node/pull/43594 * chore: update patch indices * chore: update filenames * src: refactor IsSupportedAuthenticatedMode https://github.com/nodejs/node/pull/42368 * src: add --openssl-legacy-provider option https://github.com/nodejs/node/pull/40478 * lib,src: add source map support for global eval https://github.com/nodejs/node/pull/43428 * trace_events: trace net connect event https://github.com/nodejs/node/pull/43903 * deps: update ICU to 71.1 https://github.com/nodejs/node/pull/42655 This fails the test because it's missing https://chromium-review.googlesource.com/c/chromium/deps/icu/+/3841093 * lib: give names to promisified exists() and question() https://github.com/nodejs/node/pull/43218 * crypto: add CFRG curves to Web Crypto API https://github.com/nodejs/node/pull/42507 * src: fix memory leak for v8.serialize https://github.com/nodejs/node/pull/42695 This test does not work for Electron as they do not use V8's ArrayBufferAllocator. * buffer: fix atob input validation https://github.com/nodejs/node/pull/42539 * src: fix ssize_t error from nghttp2.h https://github.com/nodejs/node/pull/44393 Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-08-29 13:55:36 +00:00
function refreshRuntimeOptions() {
chore: upgrade to Node.js v18 (#35999) * chore: update to Node.js v18 * child_process: improve argument validation https://github.com/nodejs/node/pull/41305 * bootstrap: support configure-time user-land snapshot https://github.com/nodejs/node/pull/42466 * chore: update GN patch * src: disambiguate terms used to refer to builtins and addons https://github.com/nodejs/node/pull/44135 * src: use a typed array internally for process._exiting https://github.com/nodejs/node/pull/43883 * chore: lib/internal/bootstrap -> lib/internal/process * src: disambiguate terms used to refer to builtins and addons https://github.com/nodejs/node/pull/44135 * chore: remove redudant browserGlobals patch * chore: update BoringSSL patch * src: allow embedder-provided PageAllocator in NodePlatform https://github.com/nodejs/node/pull/38362 * chore: fixup Node.js crypto tests - https://github.com/nodejs/node/pull/44171 - https://github.com/nodejs/node/pull/41600 * lib: add Promise methods to avoid-prototype-pollution lint rule https://github.com/nodejs/node/pull/43849 * deps: update V8 to 10.1 https://github.com/nodejs/node/pull/42657 * src: add kNoBrowserGlobals flag for Environment https://github.com/nodejs/node/pull/40532 * chore: consolidate asar initialization patches * deps: update V8 to 10.1 https://github.com/nodejs/node/pull/42657 * deps: update V8 to 9.8 https://github.com/nodejs/node/pull/41610 * src,crypto: remove AllocatedBuffers from crypto_spkac https://github.com/nodejs/node/pull/40752 * build: enable V8's shared read-only heap https://github.com/nodejs/node/pull/42809 * src: fix ssize_t error from nghttp2.h https://github.com/nodejs/node/pull/44393 * chore: fixup ESM patch * chore: fixup patch indices * src: merge NativeModuleEnv into NativeModuleLoader https://github.com/nodejs/node/pull/43824 * [API] Pass OOMDetails to OOMErrorCallback https://chromium-review.googlesource.com/c/v8/v8/+/3647827 * src: iwyu in cleanup_queue.cc * src: return Maybe from a couple of functions https://github.com/nodejs/node/pull/39603 * src: clean up embedder API https://github.com/nodejs/node/pull/35897 * src: refactor DH groups to delete crypto_groups.h https://github.com/nodejs/node/pull/43896 * deps,src: use SIMD for normal base64 encoding https://github.com/nodejs/node/pull/39775 * chore: remove deleted source file * chore: update patches * chore: remove deleted source file * lib: add fetch https://github.com/nodejs/node/pull/41749 * chore: remove nonexistent node specs * test: split report OOM tests https://github.com/nodejs/node/pull/44389 * src: trace fs async api https://github.com/nodejs/node/pull/44057 * http: trace http request / response https://github.com/nodejs/node/pull/44102 * test: split test-crypto-dh.js https://github.com/nodejs/node/pull/40451 * crypto: introduce X509Certificate API https://github.com/nodejs/node/pull/36804 * src: split property helpers from node::Environment https://github.com/nodejs/node/pull/44056 * https://github.com/nodejs/node/pull/38905 bootstrap: implement run-time user-land snapshots via --build-snapshot and --snapshot-blob * lib,src: implement WebAssembly Web API https://github.com/nodejs/node/pull/42701 * fixup! deps,src: use SIMD for normal base64 encoding * fixup! src: refactor DH groups to delete crypto_groups.h * chore: fixup base64 GN file * fix: check that node::InitializeContext() returns true * chore: delete _noBrowserGlobals usage * chore: disable fetch in renderer procceses * dns: default to verbatim=true in dns.lookup() https://github.com/nodejs/node/pull/39987 Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2022-11-10 21:31:20 +00:00
refreshOptions();
}
+function setupAsarSupport() {
+ processLinkedBinding('electron_common_asar').initAsarSupport(require);
+}
+
chore: upgrade to Node.js v18 (#35999) * chore: update to Node.js v18 * child_process: improve argument validation https://github.com/nodejs/node/pull/41305 * bootstrap: support configure-time user-land snapshot https://github.com/nodejs/node/pull/42466 * chore: update GN patch * src: disambiguate terms used to refer to builtins and addons https://github.com/nodejs/node/pull/44135 * src: use a typed array internally for process._exiting https://github.com/nodejs/node/pull/43883 * chore: lib/internal/bootstrap -> lib/internal/process * src: disambiguate terms used to refer to builtins and addons https://github.com/nodejs/node/pull/44135 * chore: remove redudant browserGlobals patch * chore: update BoringSSL patch * src: allow embedder-provided PageAllocator in NodePlatform https://github.com/nodejs/node/pull/38362 * chore: fixup Node.js crypto tests - https://github.com/nodejs/node/pull/44171 - https://github.com/nodejs/node/pull/41600 * lib: add Promise methods to avoid-prototype-pollution lint rule https://github.com/nodejs/node/pull/43849 * deps: update V8 to 10.1 https://github.com/nodejs/node/pull/42657 * src: add kNoBrowserGlobals flag for Environment https://github.com/nodejs/node/pull/40532 * chore: consolidate asar initialization patches * deps: update V8 to 10.1 https://github.com/nodejs/node/pull/42657 * deps: update V8 to 9.8 https://github.com/nodejs/node/pull/41610 * src,crypto: remove AllocatedBuffers from crypto_spkac https://github.com/nodejs/node/pull/40752 * build: enable V8's shared read-only heap https://github.com/nodejs/node/pull/42809 * src: fix ssize_t error from nghttp2.h https://github.com/nodejs/node/pull/44393 * chore: fixup ESM patch * chore: fixup patch indices * src: merge NativeModuleEnv into NativeModuleLoader https://github.com/nodejs/node/pull/43824 * [API] Pass OOMDetails to OOMErrorCallback https://chromium-review.googlesource.com/c/v8/v8/+/3647827 * src: iwyu in cleanup_queue.cc * src: return Maybe from a couple of functions https://github.com/nodejs/node/pull/39603 * src: clean up embedder API https://github.com/nodejs/node/pull/35897 * src: refactor DH groups to delete crypto_groups.h https://github.com/nodejs/node/pull/43896 * deps,src: use SIMD for normal base64 encoding https://github.com/nodejs/node/pull/39775 * chore: remove deleted source file * chore: update patches * chore: remove deleted source file * lib: add fetch https://github.com/nodejs/node/pull/41749 * chore: remove nonexistent node specs * test: split report OOM tests https://github.com/nodejs/node/pull/44389 * src: trace fs async api https://github.com/nodejs/node/pull/44057 * http: trace http request / response https://github.com/nodejs/node/pull/44102 * test: split test-crypto-dh.js https://github.com/nodejs/node/pull/40451 * crypto: introduce X509Certificate API https://github.com/nodejs/node/pull/36804 * src: split property helpers from node::Environment https://github.com/nodejs/node/pull/44056 * https://github.com/nodejs/node/pull/38905 bootstrap: implement run-time user-land snapshots via --build-snapshot and --snapshot-blob * lib,src: implement WebAssembly Web API https://github.com/nodejs/node/pull/42701 * fixup! deps,src: use SIMD for normal base64 encoding * fixup! src: refactor DH groups to delete crypto_groups.h * chore: fixup base64 GN file * fix: check that node::InitializeContext() returns true * chore: delete _noBrowserGlobals usage * chore: disable fetch in renderer procceses * dns: default to verbatim=true in dns.lookup() https://github.com/nodejs/node/pull/39987 Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2022-11-10 21:31:20 +00:00
function patchProcessObject(expandArgv1) {
const binding = internalBinding('process_methods');
binding.patchProcessObject(process);