Skip to content
This repository has been archived by the owner on Oct 30, 2023. It is now read-only.

Commit

Permalink
chore: bump node to v16.17.0 (main) (electron#35350)
Browse files Browse the repository at this point in the history
* chore: bump node in DEPS to v16.17.0

* chore: fixup asar patch

* lib: use null-prototype objects for property descriptors

nodejs/node#43270

* src: make SecureContext fields private

nodejs/node#43173

* crypto: remove Node.js-specific webcrypto extensions

nodejs/node#43310

* test: refactor to top-level await

nodejs/node#43500

* deps: cherry-pick two libuv fixes

nodejs/node#43950

* src: slim down env-inl.h

nodejs/node#43745

* util: add AggregateError.prototype.errors to inspect output

nodejs/node#43646

* esm: improve performance & tidy tests

nodejs/node#43784

* src: NodeArrayBufferAllocator delegates to v8's allocator

nodejs/node#43594

* chore: update patch indices

* chore: update filenames

* src: refactor IsSupportedAuthenticatedMode

nodejs/node#42368

* src: add --openssl-legacy-provider option

nodejs/node#40478

* lib,src: add source map support for global eval

nodejs/node#43428

* trace_events: trace net connect event

nodejs/node#43903

* deps: update ICU to 71.1

nodejs/node#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()

nodejs/node#43218

* crypto: add CFRG curves to Web Crypto API

nodejs/node#42507

* src: fix memory leak for v8.serialize

nodejs/node#42695

This test does not work for Electron as they do not use V8's
ArrayBufferAllocator.

* buffer: fix atob input validation

nodejs/node#42539

* src: fix ssize_t error from nghttp2.h

nodejs/node#44393

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 khalwa committed Feb 22, 2023
1 parent c62f06a commit a2ca4b7
Show file tree
Hide file tree
Showing 37 changed files with 383 additions and 465 deletions.
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ vars = {
'chromium_version':
'106.0.5216.0',
'node_version':
'v16.16.0',
'v16.17.0',
'nan_version':
'16fa32231e2ccd89d2804b3f765319128b20c4ac',
'squirrel.mac_version':
Expand Down
12 changes: 6 additions & 6 deletions lib/asar/fs-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
};

const { lstat } = fs;
fs.lstat = function (pathArgument: string, options: any, callback: any) {
fs.lstat = (pathArgument: string, options: any, callback: any) => {
const pathInfo = splitPath(pathArgument);
if (typeof options === 'function') {
callback = options;
Expand Down Expand Up @@ -382,10 +382,10 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {

fs.promises.realpath = util.promisify(fs.realpath.native);

const { exists } = fs;
fs.exists = (pathArgument: string, callback: any) => {
const { exists: nativeExists } = fs;
fs.exists = function exists (pathArgument: string, callback: any) {
const pathInfo = splitPath(pathArgument);
if (!pathInfo.isAsar) return exists(pathArgument, callback);
if (!pathInfo.isAsar) return nativeExists(pathArgument, callback);
const { asarPath, filePath } = pathInfo;

const archive = getOrCreateArchive(asarPath);
Expand All @@ -399,9 +399,9 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
nextTick(callback, [pathExists]);
};

fs.exists[util.promisify.custom] = (pathArgument: string) => {
fs.exists[util.promisify.custom] = function exists (pathArgument: string) {
const pathInfo = splitPath(pathArgument);
if (!pathInfo.isAsar) return exists[util.promisify.custom](pathArgument);
if (!pathInfo.isAsar) return nativeExists[util.promisify.custom](pathArgument);
const { asarPath, filePath } = pathInfo;

const archive = getOrCreateArchive(asarPath);
Expand Down
4 changes: 1 addition & 3 deletions patches/node/.patches
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ fix_readbarrier_undefined_symbol_error_on_woa_arm64.patch
fix_crash_caused_by_gethostnamew_on_windows_7.patch
fix_suppress_clang_-wdeprecated-declarations_in_libuv.patch
fix_serdes_test.patch
darwin_remove_eprototype_error_workaround_3405.patch
darwin_translate_eprototype_to_econnreset_3413.patch
darwin_bump_minimum_supported_version_to_10_15_3406.patch
fix_failing_node_js_test_on_outdated.patch
be_compatible_with_cppgc.patch
Expand All @@ -46,4 +44,4 @@ support_v8_sandboxed_pointers.patch
build_ensure_v8_pointer_compression_sandbox_is_enabled_on_64bit.patch
build_ensure_native_module_compilation_fails_if_not_using_a_new.patch
fix_override_createjob_in_node_platform.patch
buffer_fix_atob_input_validation.patch
src_fix_ssize_t_error_from_nghttp2_h.patch
55 changes: 27 additions & 28 deletions patches/node/be_compatible_with_cppgc.patch
Original file line number Diff line number Diff line change
Expand Up @@ -45,53 +45,52 @@ This patch should be upstreamed to Node.

See also: https://source.chromium.org/chromium/chromium/src/+/main:v8/include/v8-cppgc.h;l=70-76;drc=5a758a97032f0b656c3c36a3497560762495501a

diff --git a/src/base_object-inl.h b/src/base_object-inl.h
index bb1e8d4b46bce3bf08f730ac5d43f7113d17ae39..6da0669943fc6465ffc47a1c8c3dadfea6beb1c9 100644
--- a/src/base_object-inl.h
+++ b/src/base_object-inl.h
@@ -32,10 +32,21 @@
diff --git a/src/base_object.h b/src/base_object.h
index 842f763a56d75c55509534e3d44a8080dd283127..b6078fe83c82a5edec0f7652b8c2d1b6c2491ca4 100644
--- a/src/base_object.h
+++ b/src/base_object.h
@@ -40,7 +40,7 @@ class TransferData;

class BaseObject : public MemoryRetainer {
public:
- enum InternalFields { kSlot, kInternalFieldCount };
+ enum InternalFields { kWrapperType, kSlot, kInternalFieldCount };

namespace node {
// Associates this object with `object`. It uses the 0th internal field for
// that, and in particular aborts if there is no such field.
diff --git a/src/env.cc b/src/env.cc
index 22be69ec30a5b8466caacc698c791494891e5dee..cc44d578df9e146aa72f8273c1271d6a3c00d610 100644
--- a/src/env.cc
+++ b/src/env.cc
@@ -2119,11 +2119,20 @@ void Environment::RunWeakRefCleanup() {
isolate()->ClearKeptObjects();
}

+namespace {
+// This just has to be different from the Chromium ones:
+// https://source.chromium.org/chromium/chromium/src/+/main:gin/public/gin_embedders.h;l=18-23;drc=5a758a97032f0b656c3c36a3497560762495501a
+// Otherwise, when Node is loaded in an isolate which uses cppgc, cppgc will
+// misinterpret the data stored in the embedder fields and try to garbage
+// collect them.
+static uint16_t kNodeEmbedderId = 0x90de;
+}
+uint16_t kNodeEmbedderId = 0x90de;
+
BaseObject::BaseObject(Environment* env, v8::Local<v8::Object> object)
// Not really any better place than env.cc at this moment.
BaseObject::BaseObject(Environment* env, Local<Object> object)
: persistent_handle_(env->isolate(), object), env_(env) {
CHECK_EQ(false, object.IsEmpty());
- CHECK_GT(object->InternalFieldCount(), 0);
+ CHECK_GT(object->InternalFieldCount(), BaseObject::kSlot);
+ object->SetAlignedPointerInInternalField(BaseObject::kWrapperType,
+ &kNodeEmbedderId);
object->SetAlignedPointerInInternalField(
BaseObject::kSlot,
static_cast<void*>(this));
@@ -151,7 +162,8 @@ bool BaseObject::IsWeakOrDetached() const {
object->SetAlignedPointerInInternalField(BaseObject::kSlot,
static_cast<void*>(this));
env->AddCleanupHook(DeleteMe, static_cast<void*>(this));
@@ -2177,7 +2186,8 @@ void BaseObject::MakeWeak() {
void BaseObject::LazilyInitializedJSTemplateConstructor(
const v8::FunctionCallbackInfo<v8::Value>& args) {
const FunctionCallbackInfo<Value>& args) {
DCHECK(args.IsConstructCall());
- DCHECK_GT(args.This()->InternalFieldCount(), 0);
+ DCHECK_GT(args.This()->InternalFieldCount(), BaseObject::kSlot);
+ args.This()->SetAlignedPointerInInternalField(BaseObject::kWrapperType, &kNodeEmbedderId);
args.This()->SetAlignedPointerInInternalField(BaseObject::kSlot, nullptr);
}

diff --git a/src/base_object.h b/src/base_object.h
index 1c63da92fd80c042d5ea729bdd70049cae51a141..3b8127e884187b21cebeabb39b60bd3010b62217 100644
--- a/src/base_object.h
+++ b/src/base_object.h
@@ -40,7 +40,7 @@ class TransferData;

class BaseObject : public MemoryRetainer {
public:
- enum InternalFields { kSlot, kInternalFieldCount };
+ enum InternalFields { kWrapperType, kSlot, kInternalFieldCount };

// Associates this object with `object`. It uses the 0th internal field for
// that, and in particular aborts if there is no such field.
89 changes: 0 additions & 89 deletions patches/node/buffer_fix_atob_input_validation.patch

This file was deleted.

29 changes: 19 additions & 10 deletions patches/node/build_add_gn_build_files.patch
Original file line number Diff line number Diff line change
Expand Up @@ -1008,10 +1008,10 @@ index 0000000000000000000000000000000000000000..2c9d2826c85bdd033f1df1d6188df636
+}
diff --git a/filenames.json b/filenames.json
new file mode 100644
index 0000000000000000000000000000000000000000..a2cfdffcd7308b73c5c302ebc4b946c6de1bd518
index 0000000000000000000000000000000000000000..13fd1469ef0aa33853ddc6f31eda5b15f6312138
--- /dev/null
+++ b/filenames.json
@@ -0,0 +1,616 @@
@@ -0,0 +1,625 @@
+// This file is automatically generated by generate_gn_filenames_json.py
+// DO NOT EDIT
+{
Expand Down Expand Up @@ -1147,6 +1147,7 @@ index 0000000000000000000000000000000000000000..a2cfdffcd7308b73c5c302ebc4b946c6
+ "lib/child_process.js",
+ "lib/assert.js",
+ "lib/_tls_wrap.js",
+ "lib/test.js",
+ "lib/http2.js",
+ "lib/inspector.js",
+ "lib/os.js",
Expand Down Expand Up @@ -1242,13 +1243,19 @@ index 0000000000000000000000000000000000000000..a2cfdffcd7308b73c5c302ebc4b946c6
+ "lib/internal/http.js",
+ "lib/internal/buffer.js",
+ "lib/internal/trace_events_async_hooks.js",
+ "lib/internal/v8/startup_snapshot.js",
+ "lib/internal/test_runner/test.js",
+ "lib/internal/test_runner/harness.js",
+ "lib/internal/test_runner/utils.js",
+ "lib/internal/test_runner/tap_stream.js",
+ "lib/internal/crypto/sig.js",
+ "lib/internal/crypto/rsa.js",
+ "lib/internal/crypto/aes.js",
+ "lib/internal/crypto/util.js",
+ "lib/internal/crypto/scrypt.js",
+ "lib/internal/crypto/random.js",
+ "lib/internal/crypto/keys.js",
+ "lib/internal/crypto/cfrg.js",
+ "lib/internal/crypto/x509.js",
+ "lib/internal/crypto/certificate.js",
+ "lib/internal/crypto/ec.js",
Expand All @@ -1260,7 +1267,6 @@ index 0000000000000000000000000000000000000000..a2cfdffcd7308b73c5c302ebc4b946c6
+ "lib/internal/crypto/hash.js",
+ "lib/internal/crypto/pbkdf2.js",
+ "lib/internal/crypto/webcrypto.js",
+ "lib/internal/crypto/dsa.js",
+ "lib/internal/crypto/hashnames.js",
+ "lib/internal/cluster/shared_handle.js",
+ "lib/internal/cluster/round_robin_handle.js",
Expand Down Expand Up @@ -1293,6 +1299,8 @@ index 0000000000000000000000000000000000000000..a2cfdffcd7308b73c5c302ebc4b946c6
+ "lib/internal/util/debuglog.js",
+ "lib/internal/util/inspect.js",
+ "lib/internal/util/iterable_weak_map.js",
+ "lib/internal/util/parse_args/utils.js",
+ "lib/internal/util/parse_args/parse_args.js",
+ "lib/internal/streams/add-abort-signal.js",
+ "lib/internal/streams/compose.js",
+ "lib/internal/streams/duplexify.js",
Expand Down Expand Up @@ -1342,7 +1350,9 @@ index 0000000000000000000000000000000000000000..a2cfdffcd7308b73c5c302ebc4b946c6
+ "lib/internal/main/eval_string.js",
+ "lib/internal/main/check_syntax.js",
+ "lib/internal/main/prof_process.js",
+ "lib/internal/main/test_runner.js",
+ "lib/internal/main/worker_thread.js",
+ "lib/internal/main/mksnapshot.js",
+ "lib/internal/main/inspect.js",
+ "lib/internal/main/eval_stdin.js",
+ "lib/internal/main/run_main_module.js",
Expand All @@ -1351,7 +1361,6 @@ index 0000000000000000000000000000000000000000..a2cfdffcd7308b73c5c302ebc4b946c6
+ "lib/internal/modules/esm/module_job.js",
+ "lib/internal/modules/esm/assert.js",
+ "lib/internal/modules/esm/fetch_module.js",
+ "lib/internal/modules/esm/get_source.js",
+ "lib/internal/modules/esm/translators.js",
+ "lib/internal/modules/esm/resolve.js",
+ "lib/internal/modules/esm/create_dynamic_module.js",
Expand Down Expand Up @@ -1387,6 +1396,7 @@ index 0000000000000000000000000000000000000000..a2cfdffcd7308b73c5c302ebc4b946c6
+ "lib/internal/perf/utils.js",
+ "lib/internal/perf/observe.js",
+ "lib/internal/perf/event_loop_delay.js",
+ "lib/internal/perf/resource_timing.js",
+ "lib/internal/perf/event_loop_utilization.js",
+ "lib/internal/policy/manifest.js",
+ "lib/internal/policy/sri.js",
Expand Down Expand Up @@ -1523,8 +1533,6 @@ index 0000000000000000000000000000000000000000..a2cfdffcd7308b73c5c302ebc4b946c6
+ "src/aliased_buffer.h",
+ "src/aliased_struct.h",
+ "src/aliased_struct-inl.h",
+ "src/allocated_buffer.h",
+ "src/allocated_buffer-inl.h",
+ "src/async_wrap.h",
+ "src/async_wrap-inl.h",
+ "src/base_object.h",
Expand Down Expand Up @@ -1589,6 +1597,7 @@ index 0000000000000000000000000000000000000000..a2cfdffcd7308b73c5c302ebc4b946c6
+ "src/node_revert.h",
+ "src/node_root_certs.h",
+ "src/node_snapshotable.h",
+ "src/node_snapshot_builder.h",
+ "src/node_sockaddr.h",
+ "src/node_sockaddr-inl.h",
+ "src/node_stat_watcher.h",
Expand Down Expand Up @@ -1869,7 +1878,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 0f1a9b52cccba1e54150494a7ee5b28961a8d59d..bb68b2dfef4a693d8a1d0fe056fe696254d12d09 100644
index d79d640b693993ee9db938e857e34629410ca1e4..f7571a5e669c539bfdce14b18acdb778f8570383 100644
--- a/src/node_version.h
+++ b/src/node_version.h
@@ -89,7 +89,10 @@
Expand Down Expand Up @@ -1996,10 +2005,10 @@ index 0000000000000000000000000000000000000000..2a92eccfa582df361f2a889c0d9b32c1
+
+ out_file.writelines(new_contents)
diff --git a/tools/install.py b/tools/install.py
index 8a050dfa7c8b771ceb30fd2b74dc47f3de96834c..ad3bee1660de26d3502c6247f23b091171a6416c 100755
index a6d1f8b3caa8e24148b1930ea109508f8e612735..c80c1b8202ba59bd63340baca36df8bca5e1f81d 100755
--- a/tools/install.py
+++ b/tools/install.py
@@ -172,17 +172,72 @@ def files(action):
@@ -202,17 +202,72 @@ def files(action):
def headers(action):
def wanted_v8_headers(files_arg, dest):
v8_headers = [
Expand Down Expand Up @@ -2082,7 +2091,7 @@ index 8a050dfa7c8b771ceb30fd2b74dc47f3de96834c..ad3bee1660de26d3502c6247f23b0911
files_arg = [name for name in files_arg if name in v8_headers]
action(files_arg, dest)

@@ -209,7 +264,7 @@ def headers(action):
@@ -239,7 +294,7 @@ def headers(action):
if sys.platform.startswith('aix'):
action(['out/Release/node.exp'], 'include/node/')

Expand Down
Loading

0 comments on commit a2ca4b7

Please sign in to comment.