Skip to content

Commit

Permalink
chore: bump node to v18.14.0 (main) (electron#37129)
Browse files Browse the repository at this point in the history
* chore: bump node in DEPS to v18.14.0

* src: add support for externally shared js builtins

nodejs/node#44376

* test: fix test broken under --node-builtin-modules-path

nodejs/node#45894

* build: add option to disable shared readonly heap

nodejs/node#45887

* src: remove unnecessary semicolons

nodejs/node#46171

* src: remove return after abort

nodejs/node#46172

* chore: fixup patch indices

* test_runner: parse yaml

nodejs/node#45815

* src: use simdutf for converting externalized builtins to UTF-16

nodejs/node#46119

* src: rename internal module declaration as internal bindings

nodejs/node#45551

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
  • Loading branch information
2 people authored and gecko19 committed Feb 28, 2023
1 parent e7ba2a7 commit cb27024
Show file tree
Hide file tree
Showing 26 changed files with 98 additions and 131 deletions.
2 changes: 1 addition & 1 deletion DEPS
Expand Up @@ -4,7 +4,7 @@ vars = {
'chromium_version':
'111.0.5560.0',
'node_version':
'v18.13.0',
'v18.14.0',
'nan_version':
'16fa32231e2ccd89d2804b3f765319128b20c4ac',
'squirrel.mac_version':
Expand Down
2 changes: 0 additions & 2 deletions patches/node/.patches
Expand Up @@ -34,5 +34,3 @@ fix_expose_lookupandcompile_with_parameters.patch
fix_prevent_changing_functiontemplateinfo_after_publish.patch
enable_crashpad_linux_node_processes.patch
allow_embedder_to_control_codegenerationfromstringscallback.patch
chore_remove_errant_semicolons.patch
chore_remove_unreached_return.patch
Expand Up @@ -8,10 +8,10 @@ This is needed to blend Blink and Node's code generation policy.
This should be upstreamed.

diff --git a/src/api/environment.cc b/src/api/environment.cc
index c0c422e969543dcd570dabfd8ff0755abe37face..4f14b308d14f3653c8646345a5b375014a51851f 100644
index e3c42d892eed8dd605301348c08ad24f4362a7aa..c718b9919bb30627e5da2b92a8de58c494bf4b93 100644
--- a/src/api/environment.cc
+++ b/src/api/environment.cc
@@ -267,11 +267,15 @@ void SetIsolateErrorHandlers(v8::Isolate* isolate, const IsolateSettings& s) {
@@ -268,11 +268,15 @@ void SetIsolateErrorHandlers(v8::Isolate* isolate, const IsolateSettings& s) {
void SetIsolateMiscHandlers(v8::Isolate* isolate, const IsolateSettings& s) {
isolate->SetMicrotasksPolicy(s.policy);

Expand Down
4 changes: 2 additions & 2 deletions patches/node/api_pass_oomdetails_to_oomerrorcallback.patch
Expand Up @@ -9,7 +9,7 @@ This patch can be removed when Node.js updates to a V8 version containing
the above CL.

diff --git a/src/node_errors.cc b/src/node_errors.cc
index 323fc7d4ff635ca287ee241cee234da0600340a2..36ab78f739f3faecab47eead99f9aa3c403672c0 100644
index 9f620154ce3696cff90bf308da934147319b1096..806d9700ca4b5faf46042814c0e2ce212945bece 100644
--- a/src/node_errors.cc
+++ b/src/node_errors.cc
@@ -495,9 +495,9 @@ void OnFatalError(const char* location, const char* message) {
Expand All @@ -25,7 +25,7 @@ index 323fc7d4ff635ca287ee241cee234da0600340a2..36ab78f739f3faecab47eead99f9aa3c
if (location) {
FPrintF(stderr, "FATAL ERROR: %s %s\n", location, message);
diff --git a/src/node_errors.h b/src/node_errors.h
index 926f54286ec72fda98a9a477ac8e22feef522291..f926cc1c70dd6f883c0729c46f09e10972ce6385 100644
index 850d437acdfe09fc43a7a37790c2926e6109749d..5a33d17b0e90e8ca8dc670e14f93de8fef99d526 100644
--- a/src/node_errors.h
+++ b/src/node_errors.h
@@ -21,7 +21,7 @@ void AppendExceptionLine(Environment* env,
Expand Down
39 changes: 33 additions & 6 deletions patches/node/build_add_gn_build_files.patch
Expand Up @@ -7,10 +7,10 @@ This adds GN build files for Node, so we don't have to build with GYP.

diff --git a/BUILD.gn b/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..db80a8f00a84bf54f723c21300e7579c994d0514
index 0000000000000000000000000000000000000000..5e8577795316984f3073204523d82a17f44b0f88
--- /dev/null
+++ b/BUILD.gn
@@ -0,0 +1,438 @@
@@ -0,0 +1,439 @@
+import("//v8/gni/v8.gni")
+import("node.gni")
+
Expand Down Expand Up @@ -223,8 +223,9 @@ index 0000000000000000000000000000000000000000..db80a8f00a84bf54f723c21300e7579c
+ deps = [
+ ":node_js2c",
+ "deps/googletest:gtest",
+ "deps/uvwasi",
+ "deps/base64",
+ "deps/simdutf",
+ "deps/uvwasi",
+ "//third_party/zlib",
+ "//third_party/brotli:dec",
+ "//third_party/brotli:enc",
Expand Down Expand Up @@ -945,6 +946,32 @@ index 0000000000000000000000000000000000000000..23eed033d31eced6a85c794eee550655
+ "lib/nghttp2_version.c",
+ ]
+}
diff --git a/deps/simdutf/BUILD.gn b/deps/simdutf/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..bfbd4e656db1a6c73048443f96f1d576a0df7519
--- /dev/null
+++ b/deps/simdutf/BUILD.gn
@@ -0,0 +1,20 @@
+config("simdutf_config") {
+ include_dirs = [ "." ]
+}
+
+static_library("simdutf") {
+ include_dirs = [ "." ]
+ sources = [
+ "simdutf.cpp",
+ ]
+
+ public_configs = [ ":simdutf_config" ]
+
+ cflags_cc = [
+ "-Wno-ambiguous-reversed-operator",
+ "-Wno-c++98-compat-extra-semi",
+ "-Wno-unreachable-code-break",
+ "-Wno-unused-const-variable",
+ "-Wno-unused-function",
+ ]
+}
diff --git a/deps/uv/BUILD.gn b/deps/uv/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..d6bed57461820ce08391fc424a1f842bd282fa75
Expand Down Expand Up @@ -1193,7 +1220,7 @@ index 0000000000000000000000000000000000000000..2c9d2826c85bdd033f1df1d6188df636
+}
diff --git a/filenames.json b/filenames.json
new file mode 100644
index 0000000000000000000000000000000000000000..a991bef2b98766a1cfb248d2af97101af305de82
index 0000000000000000000000000000000000000000..2a9146e592429c1726527353c6484bd4534731b1
--- /dev/null
+++ b/filenames.json
@@ -0,0 +1,653 @@
Expand Down Expand Up @@ -1358,7 +1385,6 @@ index 0000000000000000000000000000000000000000..a991bef2b98766a1cfb248d2af97101a
+ "lib/internal/assert.js",
+ "lib/internal/assert/assertion_error.js",
+ "lib/internal/assert/calltracker.js",
+ "lib/internal/assert/snapshot.js",
+ "lib/internal/async_hooks.js",
+ "lib/internal/blob.js",
+ "lib/internal/blocklist.js",
Expand Down Expand Up @@ -1548,6 +1574,7 @@ index 0000000000000000000000000000000000000000..a991bef2b98766a1cfb248d2af97101a
+ "lib/internal/test_runner/tap_stream.js",
+ "lib/internal/test_runner/test.js",
+ "lib/internal/test_runner/utils.js",
+ "lib/internal/test_runner/yaml_parser.js",
+ "lib/internal/timers.js",
+ "lib/internal/tls/secure-context.js",
+ "lib/internal/tls/secure-pair.js",
Expand Down Expand Up @@ -2091,7 +2118,7 @@ index 0000000000000000000000000000000000000000..d1d6b51e8c0c5bc6a5d09e217eb30483
+ args = rebase_path(inputs + outputs, root_build_dir)
+}
diff --git a/src/node_version.h b/src/node_version.h
index d6b2f18cf8599ed7994954c808379565b740ac83..cd73f646bb3e9dbc4d9f4a3f24ef5970ec33b3a5 100644
index c42b070a3367283155f9ff6b861b9f0160b5e9ed..ff8a64174e6f09af533b2fe05b2fe6e600624910 100644
--- a/src/node_version.h
+++ b/src/node_version.h
@@ -89,7 +89,10 @@
Expand Down
Expand Up @@ -7,7 +7,7 @@ Subject: build: ensure native module compilation fails if not using a new
This should not be upstreamed, it is a quality-of-life patch for downstream module builders.

diff --git a/common.gypi b/common.gypi
index 6704d96142f806be9c0605f0b41206e77f492b96..f1404d27e14ce7143d3b2dbccde7af8269369cbf 100644
index b661dc4a1b3149e780eef46033e70e68038417b0..15b6155017233ed9d4c60c2453f498ba8a33403d 100644
--- a/common.gypi
+++ b/common.gypi
@@ -79,6 +79,8 @@
Expand Down Expand Up @@ -40,10 +40,10 @@ index 6704d96142f806be9c0605f0b41206e77f492b96..f1404d27e14ce7143d3b2dbccde7af82
'defines': [
'V8_COMPRESS_POINTERS',
diff --git a/configure.py b/configure.py
index bae674fd264ff0bfbe025c286279182358872b23..1f3c398c034d2c0bf0eca51b892ca87c3fcf7ce1 100755
index 171afd04030e6933da054db866d44428ae808acf..363bf746101c85630a6c52146303986e7e0dcdce 100755
--- a/configure.py
+++ b/configure.py
@@ -1511,6 +1511,7 @@ def configure_library(lib, output, pkgname=None):
@@ -1517,6 +1517,7 @@ def configure_library(lib, output, pkgname=None):


def configure_v8(o):
Expand Down
Expand Up @@ -8,7 +8,7 @@ Aligns common.gypi with the current build flag state of //v8.
Specifically enables `V8_ENABLE_SANDBOX`, `V8_SANDBOXED_POINTERS`, `V8_COMPRESS_POINTERS` and `V8_COMPRESS_POINTERS_IN_SHARED_CAGE`.

diff --git a/common.gypi b/common.gypi
index cbbc7264c6ad097c5da4902ac1bdbdcebfdd36af..6704d96142f806be9c0605f0b41206e77f492b96 100644
index 2c2f3218a8ae387802af3d154ede601aedcb52dd..b661dc4a1b3149e780eef46033e70e68038417b0 100644
--- a/common.gypi
+++ b/common.gypi
@@ -65,6 +65,7 @@
Expand Down Expand Up @@ -42,14 +42,14 @@ index cbbc7264c6ad097c5da4902ac1bdbdcebfdd36af..6704d96142f806be9c0605f0b41206e7
'defines': ['V8_31BIT_SMIS_ON_64BIT_ARCH'],
}],
diff --git a/configure.py b/configure.py
index 81d54a14b7af51b77b6340a4f7bf605d6f1656bc..bae674fd264ff0bfbe025c286279182358872b23 100755
index 0a45c07f587ed8d21dff45d523b7074606c586ac..171afd04030e6933da054db866d44428ae808acf 100755
--- a/configure.py
+++ b/configure.py
@@ -1524,6 +1524,7 @@ def configure_v8(o):
@@ -1530,6 +1530,7 @@ def configure_v8(o):
o['variables']['v8_use_siphash'] = 0 if options.without_siphash else 1
o['variables']['v8_enable_pointer_compression'] = 1 if options.enable_pointer_compression else 0
o['variables']['v8_enable_31bit_smis_on_64bit_arch'] = 1 if options.enable_pointer_compression else 0
+ o['variables']['v8_enable_sandbox'] = 1 if options.enable_pointer_compression else 0
o['variables']['v8_enable_shared_ro_heap'] = 0 if options.enable_pointer_compression else 1
o['variables']['v8_enable_shared_ro_heap'] = 0 if options.enable_pointer_compression or options.disable_shared_ro_heap else 1
o['variables']['v8_trace_maps'] = 1 if options.trace_maps else 0
o['variables']['node_use_v8_platform'] = b(not options.without_v8_platform)
Expand Up @@ -14,10 +14,10 @@ renderer/browser/worker/sandboxed bootstrap scripts). These are loaded
through LoadEmbedderJavaScriptSource()

diff --git a/lib/internal/fs/watchers.js b/lib/internal/fs/watchers.js
index 7b820e70df1613a9f5565d6221b71354ff059560..405bda5d83c3312909439082ef69e8f266e53c2e 100644
index bc4555584ab1f97806a1e9cd17085a2488320908..b17dbf2a98c9f4b14fea60c87f05afcee6ec54fb 100644
--- a/lib/internal/fs/watchers.js
+++ b/lib/internal/fs/watchers.js
@@ -290,11 +290,13 @@ function emitCloseNT(self) {
@@ -293,11 +293,13 @@ function emitCloseNT(self) {

// Legacy alias on the C++ wrapper object. This is not public API, so we may
// want to runtime-deprecate it at some point. There's no hurry, though.
Expand All @@ -28,31 +28,31 @@ index 7b820e70df1613a9f5565d6221b71354ff059560..405bda5d83c3312909439082ef69e8f2
-});
+if (!'owner' in FSEvent.prototype) {
+ ObjectDefineProperty(FSEvent.prototype, 'owner', {
+ __proto__: null,
+ __proto__: null,
+ get() { return this[owner_symbol]; },
+ set(v) { return this[owner_symbol] = v; }
+ });
+}

async function* watch(filename, options = {}) {
async function* watch(filename, options = kEmptyObject) {
const path = toNamespacedPath(getValidatedPath(filename));
diff --git a/src/node_builtins.cc b/src/node_builtins.cc
index 9d82a06adcefe386ea230c7cfbdccffb67d0b8c1..6e1a55adbd0b01383f3e54e924864dfeb6a57f0b 100644
index 40d9025746d3c39cf9ea27b6cffc8f2eb7e62c1e..d3a0dd7cedb0d239ae427d1af2335e155345a454 100644
--- a/src/node_builtins.cc
+++ b/src/node_builtins.cc
@@ -32,6 +32,7 @@ BuiltinLoader BuiltinLoader::instance_;
@@ -33,6 +33,7 @@ BuiltinLoader BuiltinLoader::instance_;

BuiltinLoader::BuiltinLoader() : config_(GetConfig()), has_code_cache_(false) {
LoadJavaScriptSource();
+ LoadEmbedderJavaScriptSource();
#if defined(NODE_HAVE_I18N_SUPPORT)
#ifdef NODE_SHARED_BUILTIN_CJS_MODULE_LEXER_LEXER_PATH
AddExternalizedBuiltin(
"internal/deps/cjs-module-lexer/lexer",
diff --git a/src/node_builtins.h b/src/node_builtins.h
index a6fbff98ccb0a7f5fd33cf3b084cfdf47aaa995e..8228e57d27b2f883d87ec12274f2745628caa6e1 100644
index 90b158b84bb2a66781cf92f5b4c1a64f9e2ee651..8d9f7c409659a30747e5feeac6cfec4208791370 100644
--- a/src/node_builtins.h
+++ b/src/node_builtins.h
@@ -73,6 +73,7 @@ class NODE_EXTERN_PRIVATE BuiltinLoader {
@@ -71,6 +71,7 @@ class NODE_EXTERN_PRIVATE BuiltinLoader {

// Generated by tools/js2c.py as node_javascript.cc
void LoadJavaScriptSource(); // Loads data into source_
Expand Down
Expand Up @@ -8,7 +8,7 @@ modules from being used in the renderer process. This should be upstreamed as
a customizable error message.

diff --git a/src/node_binding.cc b/src/node_binding.cc
index c4e6347f6f302b46fe4569f543335e426cd4ded5..f772e71521c71edd7d40b0489c5fc875357e3790 100644
index 175d0bee02d3592891f671533857b737057ab684..cf1cbcd54448754c7199a128b5447945aecf3e92 100644
--- a/src/node_binding.cc
+++ b/src/node_binding.cc
@@ -4,6 +4,7 @@
Expand Down
Expand Up @@ -8,10 +8,10 @@ they use themselves as the entry point. We should try to upstream some form
of this.

diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js
index 44e4c22ebf39fc9c52f789173a2cc50300bcd181..035de64bf1f0ab46de2b803edeaf0596c8bf68a0 100644
index 207142322bba89e94f4e3052a22bef6ffebcdc39..c83d8b0db630d3fc26fb273170945c872bede091 100644
--- a/lib/internal/modules/cjs/loader.js
+++ b/lib/internal/modules/cjs/loader.js
@@ -1192,6 +1192,13 @@ Module.prototype._compile = function(content, filename) {
@@ -1200,6 +1200,13 @@ Module.prototype._compile = function(content, filename) {
if (getOptionValue('--inspect-brk') && process._eval == null) {
if (!resolvedArgv) {
// We enter the repl if we're not given a filename argument.
Expand Down
36 changes: 0 additions & 36 deletions patches/node/chore_remove_errant_semicolons.patch

This file was deleted.

22 changes: 0 additions & 22 deletions patches/node/chore_remove_unreached_return.patch

This file was deleted.

4 changes: 2 additions & 2 deletions patches/node/expose_get_builtin_module_function.patch
Expand Up @@ -9,7 +9,7 @@ modules to sandboxed renderers.
TODO(codebytere): remove and replace with a public facing API.

diff --git a/src/node_binding.cc b/src/node_binding.cc
index a7a325e591eba3daf80bebb11fc3cd83891b627d..c4e6347f6f302b46fe4569f543335e426cd4ded5 100644
index c7ae1c26fe2bbade7c5b3ffdb2d30efcf8551cb9..175d0bee02d3592891f671533857b737057ab684 100644
--- a/src/node_binding.cc
+++ b/src/node_binding.cc
@@ -608,6 +608,10 @@ void GetInternalBinding(const FunctionCallbackInfo<Value>& args) {
Expand All @@ -24,7 +24,7 @@ index a7a325e591eba3daf80bebb11fc3cd83891b627d..c4e6347f6f302b46fe4569f543335e42
Environment* env = Environment::GetCurrent(args);

diff --git a/src/node_binding.h b/src/node_binding.h
index 5bced5b41431dc7838d1a30774a1a41ff797290e..4233ee968fb4b3b5456997cbf1450ecf07392455 100644
index 13681bac67c64f5b9c81a034f0be1eeb2b346bb1..76898adc448c48715d8b9dc4aa782217a4fc7e05 100644
--- a/src/node_binding.h
+++ b/src/node_binding.h
@@ -91,6 +91,8 @@ void GetInternalBinding(const v8::FunctionCallbackInfo<v8::Value>& args);
Expand Down
Expand Up @@ -7,10 +7,10 @@ Subject: feat: add kNoStartDebugSignalHandler to Environment to prevent
This patch should be upstreamed, it allows embedders to prevent the call to StartDebugSignalHandler which handles SIGUSR1 and starts the inspector agent. Apps that have --inspect disabled also don't want SIGUSR1 to have this affect.

diff --git a/src/env-inl.h b/src/env-inl.h
index fbc4fbb27b065d6a9e3ce7492a21b1eee2f334eb..59bab65f4cd6f0f977a0edc8d33b96d7fc4cdb16 100644
index bea695bd8c92d44cb9526f347a9464549155ed85..0cbd1b25c107b5deba5fdd14551cc641904f7f21 100644
--- a/src/env-inl.h
+++ b/src/env-inl.h
@@ -665,6 +665,10 @@ inline bool Environment::no_global_search_paths() const {
@@ -669,6 +669,10 @@ inline bool Environment::no_global_search_paths() const {
!options_->global_search_paths;
}

Expand All @@ -22,10 +22,10 @@ index fbc4fbb27b065d6a9e3ce7492a21b1eee2f334eb..59bab65f4cd6f0f977a0edc8d33b96d7
// configure --no-browser-globals
#ifdef NODE_NO_BROWSER_GLOBALS
diff --git a/src/env.h b/src/env.h
index 4d5e72f9f44762fda4698f0bf62166d1222d1028..0cc91123f4b14439ea4f55814570c323b028ceb3 100644
index 673581fd0e2ef91886fa5e6be6523a2394df6db1..562610e6827d8302f146b81d599dd366ba25cd74 100644
--- a/src/env.h
+++ b/src/env.h
@@ -765,6 +765,7 @@ class Environment : public MemoryRetainer {
@@ -767,6 +767,7 @@ class Environment : public MemoryRetainer {
inline bool tracks_unmanaged_fds() const;
inline bool hide_console_windows() const;
inline bool no_global_search_paths() const;
Expand Down
Expand Up @@ -7,7 +7,7 @@ common.gypi is a file that's included in the node header bundle, despite
the fact that we do not build node with gyp.

diff --git a/common.gypi b/common.gypi
index f3e479096776395c6465efc2597bc51918e90322..cbbc7264c6ad097c5da4902ac1bdbdcebfdd36af 100644
index 5372c8d42de531b68b97a7e8405724676ea7d5cf..2c2f3218a8ae387802af3d154ede601aedcb52dd 100644
--- a/common.gypi
+++ b/common.gypi
@@ -80,6 +80,23 @@
Expand Down
2 changes: 1 addition & 1 deletion patches/node/fix_crypto_tests_to_run_with_bssl.patch
Expand Up @@ -31,7 +31,7 @@ index 4e3c32fdcd23fbe3e74bd5e624b739d224689f33..19d65aae7fa8ec9f9b907733ead17a20
// Test Parallel Execution w/ KeyObject is threadsafe in openssl3
{
diff --git a/test/parallel/test-crypto-authenticated.js b/test/parallel/test-crypto-authenticated.js
index 162b451c5b459c566980c7d3476b3df0cef72871..db59d7fb8b46b5a6d4c77de7b5c492408351816d 100644
index d358f6b63c0e9f5761157dc200daa484d9c5ead6..7a3e376d04020e7a883f56591bc07d9970d15c9a 100644
--- a/test/parallel/test-crypto-authenticated.js
+++ b/test/parallel/test-crypto-authenticated.js
@@ -50,7 +50,9 @@ const errMessages = {
Expand Down

0 comments on commit cb27024

Please sign in to comment.