зеркало из https://github.com/electron/electron.git
chore: bump Node.js to v16.2.0 (#29244)
This commit is contained in:
Родитель
9a7e61cfc0
Коммит
542abcd6fd
2
DEPS
2
DEPS
|
@ -16,7 +16,7 @@ vars = {
|
|||
'chromium_version':
|
||||
'93.0.4539.0',
|
||||
'node_version':
|
||||
'v14.17.0',
|
||||
'v16.2.0',
|
||||
'nan_version':
|
||||
# The following commit hash of NAN is v2.14.2 with *only* changes to the
|
||||
# test suite. This should be updated to a specific tag when one becomes
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
expose_ripemd160.patch
|
||||
expose_aes-cfb.patch
|
||||
expose_des-ede3.patch
|
||||
src_add_impl_for_evp_pkey_get0.patch
|
||||
ensure_name_not_null_in_evp_get_cipherbyname.patch
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Wed, 2 Jun 2021 11:58:18 +0200
|
||||
Subject: Ensure name not null in EVP_get_cipherbyname
|
||||
|
||||
This adds a check to EVP_get_cipherbyname which ensures that name
|
||||
is not null when passed to OPENSSL_strcasecmp, which cannot handle
|
||||
null values.
|
||||
|
||||
OpenSSL already ensures this in their implementation of
|
||||
EVP_get_cipherbyname by using OBJ_NAME_get, so this improves parity.
|
||||
|
||||
Upstreamed at https://boringssl-review.googlesource.com/c/boringssl/+/47844.
|
||||
|
||||
diff --git a/crypto/cipher_extra/cipher_extra.c b/crypto/cipher_extra/cipher_extra.c
|
||||
index e771ed6589b4579cc35300d5b2a1b68d92e444f5..8205e121c152fe4e2d8df34a1ac2fe0498381f31 100644
|
||||
--- a/crypto/cipher_extra/cipher_extra.c
|
||||
+++ b/crypto/cipher_extra/cipher_extra.c
|
||||
@@ -89,6 +89,10 @@ const EVP_CIPHER *EVP_get_cipherbynid(int nid) {
|
||||
}
|
||||
|
||||
const EVP_CIPHER *EVP_get_cipherbyname(const char *name) {
|
||||
+ if (name == NULL) {
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
if (OPENSSL_strcasecmp(name, "rc4") == 0) {
|
||||
return EVP_rc4();
|
||||
} else if (OPENSSL_strcasecmp(name, "des-cbc") == 0) {
|
|
@ -0,0 +1,38 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Mon, 31 May 2021 11:30:38 +0200
|
||||
Subject: src: add impl for EVP_PKEY_get0
|
||||
|
||||
This adds the missing implementation for EVP_PKEY_get0, which Node.js
|
||||
uses and which is present in OpenSSL but not BoringSSL.
|
||||
|
||||
This will be upstreamed either fully or as a shim.
|
||||
|
||||
diff --git a/crypto/evp/evp.c b/crypto/evp/evp.c
|
||||
index 653d6573fdf1c542010698e9f6d1cf8170ea2f0c..738cec60a9fed4bfad56c7b2b75c44eb225abfcf 100644
|
||||
--- a/crypto/evp/evp.c
|
||||
+++ b/crypto/evp/evp.c
|
||||
@@ -224,6 +224,10 @@ int EVP_PKEY_type(int nid) {
|
||||
return meth->pkey_id;
|
||||
}
|
||||
|
||||
+void *EVP_PKEY_get0(const EVP_PKEY *pkey) {
|
||||
+ return pkey->pkey.ptr;
|
||||
+}
|
||||
+
|
||||
int EVP_PKEY_set1_RSA(EVP_PKEY *pkey, RSA *key) {
|
||||
if (EVP_PKEY_assign_RSA(pkey, key)) {
|
||||
RSA_up_ref(key);
|
||||
diff --git a/include/openssl/evp.h b/include/openssl/evp.h
|
||||
index 378eb320f7c01df33850cca9d0111db32ffa6175..9eebf9c609abd31ed63c1f1c720c716d074e3f6d 100644
|
||||
--- a/include/openssl/evp.h
|
||||
+++ b/include/openssl/evp.h
|
||||
@@ -156,6 +156,8 @@ OPENSSL_EXPORT int EVP_PKEY_type(int nid);
|
||||
// returned lower-level objects are considered to also mutate the |EVP_PKEY| and
|
||||
// may not be called concurrently with other operations on the |EVP_PKEY|.
|
||||
|
||||
+OPENSSL_EXPORT void *EVP_PKEY_get0(const EVP_PKEY *pkey);
|
||||
+
|
||||
OPENSSL_EXPORT int EVP_PKEY_set1_RSA(EVP_PKEY *pkey, RSA *key);
|
||||
OPENSSL_EXPORT int EVP_PKEY_assign_RSA(EVP_PKEY *pkey, RSA *key);
|
||||
OPENSSL_EXPORT RSA *EVP_PKEY_get0_RSA(const EVP_PKEY *pkey);
|
|
@ -11,26 +11,21 @@ feat_add_flags_for_low-level_hooks_and_exceptions.patch
|
|||
fix_expose_tracing_agent_and_use_tracing_tracingcontroller_instead.patch
|
||||
pass_all_globals_through_require.patch
|
||||
fixme_comment_trace_event_macro.patch
|
||||
fix_key_gen_apis_are_not_available_in_boringssl.patch
|
||||
build_modify_js2c_py_to_allow_injection_of_original-fs_and_custom_embedder_js.patch
|
||||
refactor_allow_embedder_overriding_of_internal_fs_calls.patch
|
||||
chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch
|
||||
chore_add_context_to_context_aware_module_prevention.patch
|
||||
chore_read_nobrowserglobals_from_global_not_process.patch
|
||||
enable_31_bit_smis_on_64bit_arch_and_ptr_compression.patch
|
||||
fix_use_crypto_impls_for_compat.patch
|
||||
fix_comment_out_incompatible_crypto_modules.patch
|
||||
update_tests_after_increasing_typed_array_size.patch
|
||||
feat_add_implementation_of_v8_platform_postjob.patch
|
||||
fix_handle_boringssl_and_openssl_incompatibilities.patch
|
||||
fix_-wincompatible-pointer-types-discards-qualifiers_error.patch
|
||||
fix_add_v8_enable_reverse_jsargs_defines_in_common_gypi.patch
|
||||
fix_allow_preventing_initializeinspector_in_env.patch
|
||||
src_allow_embedders_to_provide_a_custom_pageallocator_to.patch
|
||||
allow_preventing_preparestacktracecallback.patch
|
||||
fix_remove_outdated_--experimental-wasm-bigint_flag.patch
|
||||
fix_crypto_tests_to_run_with_bssl.patch
|
||||
build_add_mjs_support_to_js2c.patch
|
||||
src_inline_asynccleanuphookhandle_in_headers.patch
|
||||
fix_handle_new_tostring_behavior_in_v8_serdes_test.patch
|
||||
node-api_faster_threadsafe_function.patch
|
||||
src_remove_extra_semi_after_member_fn.patch
|
||||
src_remove_extra_semis_from_member_fns.patch
|
||||
src_add_node_use_v8_platform_in_initializeonceperprocess.patch
|
||||
tls_tweak_clientcertengine_argument_parsing.patch
|
||||
src_add_get_set_pair_for_unhandled_rejections_mode.patch
|
||||
fix_account_for_debugger_agent_race_condition.patch
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Mon, 7 Dec 2020 16:54:23 -0800
|
||||
Subject: Allow preventing PrepareStackTraceCallback
|
||||
|
||||
Node.js sets a stack trace handler specific to the v8::Context
|
||||
corresponding to the current Environment. When we're running in a
|
||||
non-Node.js v8::Context, there will be no correspondent Environment - we
|
||||
therefore need to prevent this handler being set so that Blink falls back to its
|
||||
default handling and displays the correct stacktrace.
|
||||
|
||||
diff --git a/src/api/environment.cc b/src/api/environment.cc
|
||||
index a8cf0d763f78c2752e3aa22479dadd9fa53c222f..8ccc0638b32039571c4a56725e21f0353b592984 100644
|
||||
--- a/src/api/environment.cc
|
||||
+++ b/src/api/environment.cc
|
||||
@@ -228,9 +228,11 @@ void SetIsolateErrorHandlers(v8::Isolate* isolate, const IsolateSettings& s) {
|
||||
s.fatal_error_callback : OnFatalError;
|
||||
isolate->SetFatalErrorHandler(fatal_error_cb);
|
||||
|
||||
- auto* prepare_stack_trace_cb = s.prepare_stack_trace_callback ?
|
||||
- s.prepare_stack_trace_callback : PrepareStackTraceCallback;
|
||||
- isolate->SetPrepareStackTraceCallback(prepare_stack_trace_cb);
|
||||
+ if ((s.flags & SHOULD_NOT_SET_PREPARE_STACK_TRACE_CALLBACK) == 0) {
|
||||
+ auto* prepare_stack_trace_cb = s.prepare_stack_trace_callback ?
|
||||
+ s.prepare_stack_trace_callback : PrepareStackTraceCallback;
|
||||
+ isolate->SetPrepareStackTraceCallback(prepare_stack_trace_cb);
|
||||
+ }
|
||||
}
|
||||
|
||||
void SetIsolateMiscHandlers(v8::Isolate* isolate, const IsolateSettings& s) {
|
||||
diff --git a/src/node.h b/src/node.h
|
||||
index 14893ad605b9f8c64b0b8fc28625e235655dcd63..f150725b54ee1315476d202797963369490d5152 100644
|
||||
--- a/src/node.h
|
||||
+++ b/src/node.h
|
||||
@@ -340,7 +340,8 @@ class NODE_EXTERN MultiIsolatePlatform : public v8::Platform {
|
||||
enum IsolateSettingsFlags {
|
||||
MESSAGE_LISTENER_WITH_ERROR_LEVEL = 1 << 0,
|
||||
DETAILED_SOURCE_POSITIONS_FOR_PROFILING = 1 << 1,
|
||||
- SHOULD_NOT_SET_PROMISE_REJECTION_CALLBACK = 1 << 2
|
||||
+ SHOULD_NOT_SET_PROMISE_REJECTION_CALLBACK = 1 << 2,
|
||||
+ SHOULD_NOT_SET_PREPARE_STACK_TRACE_CALLBACK = 1 << 3
|
||||
};
|
||||
|
||||
struct IsolateSettings {
|
|
@ -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..446119163d1f7bad577cb0b7b217ecf24b994526
|
||||
index 0000000000000000000000000000000000000000..bd26c3623d3314539609a978270d3ced1d167777
|
||||
--- /dev/null
|
||||
+++ b/BUILD.gn
|
||||
@@ -0,0 +1,360 @@
|
||||
@@ -0,0 +1,400 @@
|
||||
+import("//electron/build/asar.gni")
|
||||
+import("//v8/gni/v8.gni")
|
||||
+
|
||||
|
@ -273,18 +273,58 @@ index 0000000000000000000000000000000000000000..446119163d1f7bad577cb0b7b217ecf2
|
|||
+ if (node_use_openssl) {
|
||||
+ deps += [ "//third_party/boringssl" ]
|
||||
+ sources += [
|
||||
+ "src/crypto/crypto_aes.cc",
|
||||
+ "src/crypto/crypto_aes.h",
|
||||
+ "src/crypto/crypto_bio.cc",
|
||||
+ "src/crypto/crypto_bio.h",
|
||||
+ "src/crypto/crypto_cipher.cc",
|
||||
+ "src/crypto/crypto_cipher.h",
|
||||
+ "src/crypto/crypto_clienthello-inl.h",
|
||||
+ "src/crypto/crypto_clienthello.cc",
|
||||
+ "src/crypto/crypto_clienthello.h",
|
||||
+ "src/crypto/crypto_common.cc",
|
||||
+ "src/crypto/crypto_common.h",
|
||||
+ "src/crypto/crypto_context.cc",
|
||||
+ "src/crypto/crypto_context.h",
|
||||
+ "src/crypto/crypto_dh.cc",
|
||||
+ "src/crypto/crypto_dh.h",
|
||||
+ "src/crypto/crypto_dsa.cc",
|
||||
+ "src/crypto/crypto_dsa.h",
|
||||
+ "src/crypto/crypto_ec.cc",
|
||||
+ "src/crypto/crypto_ec.h",
|
||||
+ "src/crypto/crypto_groups.h",
|
||||
+ "src/crypto/crypto_hash.cc",
|
||||
+ "src/crypto/crypto_hash.h",
|
||||
+ "src/crypto/crypto_hkdf.cc",
|
||||
+ "src/crypto/crypto_hkdf.h",
|
||||
+ "src/crypto/crypto_hmac.cc",
|
||||
+ "src/crypto/crypto_hmac.h",
|
||||
+ "src/crypto/crypto_keygen.cc",
|
||||
+ "src/crypto/crypto_keygen.h",
|
||||
+ "src/crypto/crypto_keys.cc",
|
||||
+ "src/crypto/crypto_keys.h",
|
||||
+ "src/crypto/crypto_pbkdf2.cc",
|
||||
+ "src/crypto/crypto_pbkdf2.h",
|
||||
+ "src/crypto/crypto_random.cc",
|
||||
+ "src/crypto/crypto_random.h",
|
||||
+ "src/crypto/crypto_rsa.cc",
|
||||
+ "src/crypto/crypto_rsa.h",
|
||||
+ "src/crypto/crypto_scrypt.cc",
|
||||
+ "src/crypto/crypto_scrypt.h",
|
||||
+ "src/crypto/crypto_sig.cc",
|
||||
+ "src/crypto/crypto_sig.h",
|
||||
+ "src/crypto/crypto_spkac.cc",
|
||||
+ "src/crypto/crypto_spkac.h",
|
||||
+ "src/crypto/crypto_timing.cc",
|
||||
+ "src/crypto/crypto_timing.h",
|
||||
+ "src/crypto/crypto_tls.cc",
|
||||
+ "src/crypto/crypto_tls.h",
|
||||
+ "src/crypto/crypto_util.cc",
|
||||
+ "src/crypto/crypto_util.h",
|
||||
+ "src/crypto/crypto_x509.cc",
|
||||
+ "src/crypto/crypto_x509.h",
|
||||
+ "src/node_crypto.cc",
|
||||
+ "src/node_crypto.h",
|
||||
+ "src/node_crypto_common.cc",
|
||||
+ "src/node_crypto_common.h",
|
||||
+ "src/node_crypto_bio.cc",
|
||||
+ "src/node_crypto_bio.h",
|
||||
+ "src/node_crypto_clienthello-inl.h",
|
||||
+ "src/node_crypto_clienthello.cc",
|
||||
+ "src/node_crypto_clienthello.h",
|
||||
+ "src/node_crypto_groups.h",
|
||||
+ "src/tls_wrap.cc",
|
||||
+ "src/tls_wrap.h",
|
||||
+ ]
|
||||
+ cflags_cc += [ "-Wno-sign-compare" ]
|
||||
+ }
|
||||
|
@ -848,10 +888,10 @@ index 0000000000000000000000000000000000000000..2c9d2826c85bdd033f1df1d6188df636
|
|||
+}
|
||||
diff --git a/filenames.json b/filenames.json
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c94c7150b72e64fe0e0f5c693da31230ab5985ea
|
||||
index 0000000000000000000000000000000000000000..24ab6333726076d6e2057e45410c88a21dd00193
|
||||
--- /dev/null
|
||||
+++ b/filenames.json
|
||||
@@ -0,0 +1,550 @@
|
||||
@@ -0,0 +1,528 @@
|
||||
+// This file is automatically generated by generate_gn_filenames_json.py
|
||||
+// DO NOT EDIT
|
||||
+{
|
||||
|
@ -871,81 +911,21 @@ index 0000000000000000000000000000000000000000..c94c7150b72e64fe0e0f5c693da31230
|
|||
+ {
|
||||
+ "dest_dir": "include/node//cppgc/",
|
||||
+ "files": [
|
||||
+ "//v8/include/cppgc/allocation.h",
|
||||
+ "//v8/include/cppgc/common.h",
|
||||
+ "//v8/include/cppgc/cross-thread-persistent.h",
|
||||
+ "//v8/include/cppgc/custom-space.h",
|
||||
+ "//v8/include/cppgc/default-platform.h",
|
||||
+ "//v8/include/cppgc/ephemeron-pair.h",
|
||||
+ "//v8/include/cppgc/explicit-management.h",
|
||||
+ "//v8/include/cppgc/garbage-collected.h",
|
||||
+ "//v8/include/cppgc/heap-consistency.h",
|
||||
+ "//v8/include/cppgc/heap-state.h",
|
||||
+ "//v8/include/cppgc/heap-statistics.h",
|
||||
+ "//v8/include/cppgc/heap.h",
|
||||
+ "//v8/include/cppgc/liveness-broker.h",
|
||||
+ "//v8/include/cppgc/macros.h",
|
||||
+ "//v8/include/cppgc/member.h",
|
||||
+ "//v8/include/cppgc/name-provider.h",
|
||||
+ "//v8/include/cppgc/object-size-trait.h",
|
||||
+ "//v8/include/cppgc/persistent.h",
|
||||
+ "//v8/include/cppgc/platform.h",
|
||||
+ "//v8/include/cppgc/prefinalizer.h",
|
||||
+ "//v8/include/cppgc/process-heap-statistics.h",
|
||||
+ "//v8/include/cppgc/sentinel-pointer.h",
|
||||
+ "//v8/include/cppgc/source-location.h",
|
||||
+ "//v8/include/cppgc/testing.h",
|
||||
+ "//v8/include/cppgc/trace-trait.h",
|
||||
+ "//v8/include/cppgc/type-traits.h",
|
||||
+ "//v8/include/cppgc/visitor.h"
|
||||
+ ]
|
||||
+ },
|
||||
+ {
|
||||
+ "dest_dir": "include/node//cppgc/internal/",
|
||||
+ "files": [
|
||||
+ "//v8/include/cppgc/internal/api-constants.h",
|
||||
+ "//v8/include/cppgc/internal/atomic-entry-flag.h",
|
||||
+ "//v8/include/cppgc/internal/caged-heap-local-data.h",
|
||||
+ "//v8/include/cppgc/internal/compiler-specific.h",
|
||||
+ "//v8/include/cppgc/internal/finalizer-trait.h",
|
||||
+ "//v8/include/cppgc/internal/gc-info.h",
|
||||
+ "//v8/include/cppgc/internal/logging.h",
|
||||
+ "//v8/include/cppgc/internal/name-trait.h",
|
||||
+ "//v8/include/cppgc/internal/persistent-node.h",
|
||||
+ "//v8/include/cppgc/internal/pointer-policies.h",
|
||||
+ "//v8/include/cppgc/internal/prefinalizer-handler.h",
|
||||
+ "//v8/include/cppgc/internal/write-barrier.h"
|
||||
+ "//v8/include/cppgc/common.h"
|
||||
+ ]
|
||||
+ },
|
||||
+ {
|
||||
+ "dest_dir": "include/node//",
|
||||
+ "files": [
|
||||
+ "//v8/include/v8-cppgc.h",
|
||||
+ "//v8/include/v8-fast-api-calls.h",
|
||||
+ "//v8/include/v8-internal.h",
|
||||
+ "//v8/include/v8-metrics.h",
|
||||
+ "//v8/include/v8-platform.h",
|
||||
+ "//v8/include/v8-profiler.h",
|
||||
+ "//v8/include/v8-unwinder-state.h",
|
||||
+ "//v8/include/v8-util.h",
|
||||
+ "//v8/include/v8-value-serializer-version.h",
|
||||
+ "//v8/include/v8-version-string.h",
|
||||
+ "//v8/include/v8-version.h",
|
||||
+ "//v8/include/v8-wasm-trap-handler-posix.h",
|
||||
+ "//v8/include/v8-wasm-trap-handler-win.h",
|
||||
+ "//v8/include/v8.h",
|
||||
+ "//v8/include/v8config.h"
|
||||
+ ]
|
||||
+ },
|
||||
+ {
|
||||
+ "dest_dir": "include/node//libplatform/",
|
||||
+ "files": [
|
||||
+ "//v8/include/libplatform/libplatform-export.h",
|
||||
+ "//v8/include/libplatform/libplatform.h",
|
||||
+ "//v8/include/libplatform/v8-tracing.h"
|
||||
+ ]
|
||||
+ },
|
||||
+ {
|
||||
+ "dest_dir": "include/node//uv/",
|
||||
+ "files": [
|
||||
+ "deps/uv/include/uv/aix.h",
|
||||
|
@ -986,6 +966,7 @@ index 0000000000000000000000000000000000000000..c94c7150b72e64fe0e0f5c693da31230
|
|||
+ "lib/internal/per_context/messageport.js",
|
||||
+ "lib/async_hooks.js",
|
||||
+ "lib/assert.js",
|
||||
+ "lib/assert/strict.js",
|
||||
+ "lib/buffer.js",
|
||||
+ "lib/child_process.js",
|
||||
+ "lib/console.js",
|
||||
|
@ -995,6 +976,7 @@ index 0000000000000000000000000000000000000000..c94c7150b72e64fe0e0f5c693da31230
|
|||
+ "lib/diagnostics_channel.js",
|
||||
+ "lib/dgram.js",
|
||||
+ "lib/dns.js",
|
||||
+ "lib/dns/promises.js",
|
||||
+ "lib/domain.js",
|
||||
+ "lib/events.js",
|
||||
+ "lib/fs.js",
|
||||
|
@ -1013,6 +995,8 @@ index 0000000000000000000000000000000000000000..c94c7150b72e64fe0e0f5c693da31230
|
|||
+ "lib/net.js",
|
||||
+ "lib/os.js",
|
||||
+ "lib/path.js",
|
||||
+ "lib/path/posix.js",
|
||||
+ "lib/path/win32.js",
|
||||
+ "lib/perf_hooks.js",
|
||||
+ "lib/process.js",
|
||||
+ "lib/punycode.js",
|
||||
|
@ -1020,6 +1004,7 @@ index 0000000000000000000000000000000000000000..c94c7150b72e64fe0e0f5c693da31230
|
|||
+ "lib/readline.js",
|
||||
+ "lib/repl.js",
|
||||
+ "lib/stream.js",
|
||||
+ "lib/stream/promises.js",
|
||||
+ "lib/_stream_readable.js",
|
||||
+ "lib/_stream_writable.js",
|
||||
+ "lib/_stream_duplex.js",
|
||||
|
@ -1028,6 +1013,7 @@ index 0000000000000000000000000000000000000000..c94c7150b72e64fe0e0f5c693da31230
|
|||
+ "lib/_stream_wrap.js",
|
||||
+ "lib/string_decoder.js",
|
||||
+ "lib/sys.js",
|
||||
+ "lib/timers/promises.js",
|
||||
+ "lib/timers.js",
|
||||
+ "lib/tls.js",
|
||||
+ "lib/_tls_common.js",
|
||||
|
@ -1036,6 +1022,7 @@ index 0000000000000000000000000000000000000000..c94c7150b72e64fe0e0f5c693da31230
|
|||
+ "lib/tty.js",
|
||||
+ "lib/url.js",
|
||||
+ "lib/util.js",
|
||||
+ "lib/util/types.js",
|
||||
+ "lib/v8.js",
|
||||
+ "lib/vm.js",
|
||||
+ "lib/wasi.js",
|
||||
|
@ -1046,29 +1033,40 @@ index 0000000000000000000000000000000000000000..c94c7150b72e64fe0e0f5c693da31230
|
|||
+ "lib/internal/assert/assertion_error.js",
|
||||
+ "lib/internal/assert/calltracker.js",
|
||||
+ "lib/internal/async_hooks.js",
|
||||
+ "lib/internal/blob.js",
|
||||
+ "lib/internal/blocklist.js",
|
||||
+ "lib/internal/buffer.js",
|
||||
+ "lib/internal/cli_table.js",
|
||||
+ "lib/internal/child_process.js",
|
||||
+ "lib/internal/child_process/serialization.js",
|
||||
+ "lib/internal/cluster/child.js",
|
||||
+ "lib/internal/cluster/master.js",
|
||||
+ "lib/internal/cluster/primary.js",
|
||||
+ "lib/internal/cluster/round_robin_handle.js",
|
||||
+ "lib/internal/cluster/shared_handle.js",
|
||||
+ "lib/internal/cluster/utils.js",
|
||||
+ "lib/internal/cluster/worker.js",
|
||||
+ "lib/internal/console/constructor.js",
|
||||
+ "lib/internal/console/global.js",
|
||||
+ "lib/internal/crypto/aes.js",
|
||||
+ "lib/internal/crypto/certificate.js",
|
||||
+ "lib/internal/crypto/cipher.js",
|
||||
+ "lib/internal/crypto/diffiehellman.js",
|
||||
+ "lib/internal/crypto/dsa.js",
|
||||
+ "lib/internal/crypto/ec.js",
|
||||
+ "lib/internal/crypto/hash.js",
|
||||
+ "lib/internal/crypto/hashnames.js",
|
||||
+ "lib/internal/crypto/hkdf.js",
|
||||
+ "lib/internal/crypto/keygen.js",
|
||||
+ "lib/internal/crypto/keys.js",
|
||||
+ "lib/internal/crypto/mac.js",
|
||||
+ "lib/internal/crypto/pbkdf2.js",
|
||||
+ "lib/internal/crypto/random.js",
|
||||
+ "lib/internal/crypto/rsa.js",
|
||||
+ "lib/internal/crypto/scrypt.js",
|
||||
+ "lib/internal/crypto/sig.js",
|
||||
+ "lib/internal/crypto/util.js",
|
||||
+ "lib/internal/crypto/webcrypto.js",
|
||||
+ "lib/internal/crypto/x509.js",
|
||||
+ "lib/internal/constants.js",
|
||||
+ "lib/internal/dgram.js",
|
||||
+ "lib/internal/dns/promises.js",
|
||||
|
@ -1093,8 +1091,12 @@ index 0000000000000000000000000000000000000000..c94c7150b72e64fe0e0f5c693da31230
|
|||
+ "lib/internal/heap_utils.js",
|
||||
+ "lib/internal/histogram.js",
|
||||
+ "lib/internal/idna.js",
|
||||
+ "lib/internal/inspector/_inspect.js",
|
||||
+ "lib/internal/inspector/inspect_client.js",
|
||||
+ "lib/internal/inspector/inspect_repl.js",
|
||||
+ "lib/internal/inspector_async_hook.js",
|
||||
+ "lib/internal/js_stream_socket.js",
|
||||
+ "lib/internal/legacy/processbinding.js",
|
||||
+ "lib/internal/linkedlist.js",
|
||||
+ "lib/internal/main/check_syntax.js",
|
||||
+ "lib/internal/main/eval_string.js",
|
||||
|
@ -1104,7 +1106,6 @@ index 0000000000000000000000000000000000000000..c94c7150b72e64fe0e0f5c693da31230
|
|||
+ "lib/internal/main/prof_process.js",
|
||||
+ "lib/internal/main/repl.js",
|
||||
+ "lib/internal/main/run_main_module.js",
|
||||
+ "lib/internal/main/run_third_party_main.js",
|
||||
+ "lib/internal/main/worker_thread.js",
|
||||
+ "lib/internal/modules/run_main.js",
|
||||
+ "lib/internal/modules/package_json_reader.js",
|
||||
|
@ -1121,6 +1122,13 @@ index 0000000000000000000000000000000000000000..c94c7150b72e64fe0e0f5c693da31230
|
|||
+ "lib/internal/modules/esm/translators.js",
|
||||
+ "lib/internal/net.js",
|
||||
+ "lib/internal/options.js",
|
||||
+ "lib/internal/perf/perf.js",
|
||||
+ "lib/internal/perf/nodetiming.js",
|
||||
+ "lib/internal/perf/usertiming.js",
|
||||
+ "lib/internal/perf/observe.js",
|
||||
+ "lib/internal/perf/event_loop_delay.js",
|
||||
+ "lib/internal/perf/event_loop_utilization.js",
|
||||
+ "lib/internal/perf/timerify.js",
|
||||
+ "lib/internal/policy/manifest.js",
|
||||
+ "lib/internal/policy/sri.js",
|
||||
+ "lib/internal/priority_queue.js",
|
||||
|
@ -1135,17 +1143,20 @@ index 0000000000000000000000000000000000000000..c94c7150b72e64fe0e0f5c693da31230
|
|||
+ "lib/internal/process/signal.js",
|
||||
+ "lib/internal/process/task_queues.js",
|
||||
+ "lib/internal/querystring.js",
|
||||
+ "lib/internal/readline/callbacks.js",
|
||||
+ "lib/internal/readline/emitKeypressEvents.js",
|
||||
+ "lib/internal/readline/utils.js",
|
||||
+ "lib/internal/repl.js",
|
||||
+ "lib/internal/repl/await.js",
|
||||
+ "lib/internal/repl/history.js",
|
||||
+ "lib/internal/repl/utils.js",
|
||||
+ "lib/internal/socketaddress.js",
|
||||
+ "lib/internal/socket_list.js",
|
||||
+ "lib/internal/source_map/prepare_stack_trace.js",
|
||||
+ "lib/internal/source_map/source_map.js",
|
||||
+ "lib/internal/source_map/source_map_cache.js",
|
||||
+ "lib/internal/test/binding.js",
|
||||
+ "lib/internal/timers/promises.js",
|
||||
+ "lib/internal/test/transfer.js",
|
||||
+ "lib/internal/timers.js",
|
||||
+ "lib/internal/tls.js",
|
||||
+ "lib/internal/trace_events_async_hooks.js",
|
||||
|
@ -1156,6 +1167,7 @@ index 0000000000000000000000000000000000000000..c94c7150b72e64fe0e0f5c693da31230
|
|||
+ "lib/internal/util/debuglog.js",
|
||||
+ "lib/internal/util/inspect.js",
|
||||
+ "lib/internal/util/inspector.js",
|
||||
+ "lib/internal/util/iterable_weak_map.js",
|
||||
+ "lib/internal/util/types.js",
|
||||
+ "lib/internal/http2/core.js",
|
||||
+ "lib/internal/http2/compat.js",
|
||||
|
@ -1170,6 +1182,7 @@ index 0000000000000000000000000000000000000000..c94c7150b72e64fe0e0f5c693da31230
|
|||
+ "lib/internal/worker/js_transferable.js",
|
||||
+ "lib/internal/watchdog.js",
|
||||
+ "lib/internal/streams/lazy_transform.js",
|
||||
+ "lib/internal/streams/add-abort-signal.js",
|
||||
+ "lib/internal/streams/buffer_list.js",
|
||||
+ "lib/internal/streams/duplexpair.js",
|
||||
+ "lib/internal/streams/from.js",
|
||||
|
@ -1183,6 +1196,7 @@ index 0000000000000000000000000000000000000000..c94c7150b72e64fe0e0f5c693da31230
|
|||
+ "lib/internal/streams/state.js",
|
||||
+ "lib/internal/streams/pipeline.js",
|
||||
+ "lib/internal/streams/end-of-stream.js",
|
||||
+ "lib/internal/streams/utils.js",
|
||||
+ "//v8/tools/splaytree.mjs",
|
||||
+ "//v8/tools/codemap.mjs",
|
||||
+ "//v8/tools/consarray.mjs",
|
||||
|
@ -1194,9 +1208,6 @@ index 0000000000000000000000000000000000000000..c94c7150b72e64fe0e0f5c693da31230
|
|||
+ "//v8/tools/tickprocessor.mjs",
|
||||
+ "//v8/tools/sourcemap.mjs",
|
||||
+ "//v8/tools/tickprocessor-driver.mjs",
|
||||
+ "deps/node-inspect/lib/_inspect.js",
|
||||
+ "deps/node-inspect/lib/internal/inspect_client.js",
|
||||
+ "deps/node-inspect/lib/internal/inspect_repl.js",
|
||||
+ "deps/acorn/acorn/dist/acorn.js",
|
||||
+ "deps/acorn/acorn-walk/dist/walk.js",
|
||||
+ "deps/acorn-plugins/acorn-class-fields/index.js",
|
||||
|
@ -1209,6 +1220,7 @@ index 0000000000000000000000000000000000000000..c94c7150b72e64fe0e0f5c693da31230
|
|||
+ "node_sources": [
|
||||
+ "src/api/async_resource.cc",
|
||||
+ "src/api/callback.cc",
|
||||
+ "src/api/embed_helpers.cc",
|
||||
+ "src/api/encoding.cc",
|
||||
+ "src/api/environment.cc",
|
||||
+ "src/api/exceptions.cc",
|
||||
|
@ -1236,6 +1248,7 @@ index 0000000000000000000000000000000000000000..c94c7150b72e64fe0e0f5c693da31230
|
|||
+ "src/node.cc",
|
||||
+ "src/node_api.cc",
|
||||
+ "src/node_binding.cc",
|
||||
+ "src/node_blob.cc",
|
||||
+ "src/node_buffer.cc",
|
||||
+ "src/node_config.cc",
|
||||
+ "src/node_constants.cc",
|
||||
|
@ -1244,6 +1257,7 @@ index 0000000000000000000000000000000000000000..c94c7150b72e64fe0e0f5c693da31230
|
|||
+ "src/node_dir.cc",
|
||||
+ "src/node_env_var.cc",
|
||||
+ "src/node_errors.cc",
|
||||
+ "src/node_external_reference.cc",
|
||||
+ "src/node_file.cc",
|
||||
+ "src/node_http_parser.cc",
|
||||
+ "src/node_http2.cc",
|
||||
|
@ -1265,6 +1279,7 @@ index 0000000000000000000000000000000000000000..c94c7150b72e64fe0e0f5c693da31230
|
|||
+ "src/node_report_module.cc",
|
||||
+ "src/node_report_utils.cc",
|
||||
+ "src/node_serdes.cc",
|
||||
+ "src/node_snapshotable.cc",
|
||||
+ "src/node_sockaddr.cc",
|
||||
+ "src/node_stat_watcher.cc",
|
||||
+ "src/node_symbols.cc",
|
||||
|
@ -1332,12 +1347,14 @@ index 0000000000000000000000000000000000000000..c94c7150b72e64fe0e0f5c693da31230
|
|||
+ "src/node_api.h",
|
||||
+ "src/node_api_types.h",
|
||||
+ "src/node_binding.h",
|
||||
+ "src/node_blob.h",
|
||||
+ "src/node_buffer.h",
|
||||
+ "src/node_constants.h",
|
||||
+ "src/node_context_data.h",
|
||||
+ "src/node_contextify.h",
|
||||
+ "src/node_dir.h",
|
||||
+ "src/node_errors.h",
|
||||
+ "src/node_external_reference.h",
|
||||
+ "src/node_file.h",
|
||||
+ "src/node_file-inl.h",
|
||||
+ "src/node_http_common.h",
|
||||
|
@ -1364,6 +1381,7 @@ index 0000000000000000000000000000000000000000..c94c7150b72e64fe0e0f5c693da31230
|
|||
+ "src/node_report.h",
|
||||
+ "src/node_revert.h",
|
||||
+ "src/node_root_certs.h",
|
||||
+ "src/node_snapshotable.h",
|
||||
+ "src/node_sockaddr.h",
|
||||
+ "src/node_sockaddr-inl.h",
|
||||
+ "src/node_stat_watcher.h",
|
||||
|
@ -1402,39 +1420,6 @@ index 0000000000000000000000000000000000000000..c94c7150b72e64fe0e0f5c693da31230
|
|||
+ "//v8/include/v8.h"
|
||||
+ ]
|
||||
+}
|
||||
diff --git a/node.gyp b/node.gyp
|
||||
index 61b789ec74ab554648164875d540f34c09ffc116..753f135322a007b3b9d330ccd4101cc18b454e58 100644
|
||||
--- a/node.gyp
|
||||
+++ b/node.gyp
|
||||
@@ -238,17 +238,17 @@
|
||||
'lib/internal/streams/state.js',
|
||||
'lib/internal/streams/pipeline.js',
|
||||
'lib/internal/streams/end-of-stream.js',
|
||||
- 'deps/v8/tools/splaytree.js',
|
||||
- 'deps/v8/tools/codemap.js',
|
||||
- 'deps/v8/tools/consarray.js',
|
||||
- 'deps/v8/tools/csvparser.js',
|
||||
- 'deps/v8/tools/profile.js',
|
||||
- 'deps/v8/tools/profile_view.js',
|
||||
- 'deps/v8/tools/logreader.js',
|
||||
- 'deps/v8/tools/arguments.js',
|
||||
- 'deps/v8/tools/tickprocessor.js',
|
||||
- 'deps/v8/tools/SourceMap.js',
|
||||
- 'deps/v8/tools/tickprocessor-driver.js',
|
||||
+ 'deps/v8/tools/splaytree.mjs',
|
||||
+ 'deps/v8/tools/codemap.mjs',
|
||||
+ 'deps/v8/tools/consarray.mjs',
|
||||
+ 'deps/v8/tools/csvparser.mjs',
|
||||
+ 'deps/v8/tools/profile.mjs',
|
||||
+ 'deps/v8/tools/profile_view.mjs',
|
||||
+ 'deps/v8/tools/logreader.mjs',
|
||||
+ 'deps/v8/tools/arguments.mjs',
|
||||
+ 'deps/v8/tools/tickprocessor.mjs',
|
||||
+ 'deps/v8/tools/sourcemap.mjs',
|
||||
+ 'deps/v8/tools/tickprocessor-driver.mjs',
|
||||
'deps/node-inspect/lib/_inspect.js',
|
||||
'deps/node-inspect/lib/internal/inspect_client.js',
|
||||
'deps/node-inspect/lib/internal/inspect_repl.js',
|
||||
diff --git a/src/inspector/BUILD.gn b/src/inspector/BUILD.gn
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..d1d6b51e8c0c5bc6a5d09e217eb3048361d9d591
|
||||
|
@ -1641,7 +1626,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 5419747db7b6504ad9d61b1cd3d53d93913e360f..e51bf333b77e67af188a3d352ca22b12d939e412 100644
|
||||
index 810425a5562f6a45304a94cb1d58e3b812983401..9cc414d689feefc9a932d87c6a571259271254ee 100644
|
||||
--- a/src/node_version.h
|
||||
+++ b/src/node_version.h
|
||||
@@ -89,7 +89,10 @@
|
||||
|
@ -1650,7 +1635,7 @@ index 5419747db7b6504ad9d61b1cd3d53d93913e360f..e51bf333b77e67af188a3d352ca22b12
|
|||
*/
|
||||
+// Electron sets NODE_MODULE_VERSION in their GN configuration
|
||||
+#ifndef NODE_MODULE_VERSION
|
||||
#define NODE_MODULE_VERSION 83
|
||||
#define NODE_MODULE_VERSION 93
|
||||
+#endif
|
||||
|
||||
// The NAPI_VERSION provided by this version of the runtime. This is the version
|
||||
|
@ -1674,10 +1659,10 @@ index 0000000000000000000000000000000000000000..01f62d4ae6e3b9d539444e3dff069f00
|
|||
+ main(sys.argv[1:])
|
||||
diff --git a/tools/generate_gn_filenames_json.py b/tools/generate_gn_filenames_json.py
|
||||
new file mode 100755
|
||||
index 0000000000000000000000000000000000000000..e5fd79da5323e7039730fd8cca66caae8c84e903
|
||||
index 0000000000000000000000000000000000000000..cf3b8df67d73b4096a0113b55e2a916b59701b23
|
||||
--- /dev/null
|
||||
+++ b/tools/generate_gn_filenames_json.py
|
||||
@@ -0,0 +1,70 @@
|
||||
@@ -0,0 +1,71 @@
|
||||
+#!/usr/bin/env python
|
||||
+import json
|
||||
+import os
|
||||
|
@ -1739,8 +1724,9 @@ index 0000000000000000000000000000000000000000..e5fd79da5323e7039730fd8cca66caae
|
|||
+ files = [f for f in files if f.endswith('.h') and f != 'src/node_version.h']
|
||||
+ elif any(f.startswith('../../v8/') for f in files):
|
||||
+ files = [f.replace('../../v8/', '//v8/', 1) for f in files]
|
||||
+ hs = {'files': sorted(files), 'dest_dir': dest_dir}
|
||||
+ out['headers'].append(hs)
|
||||
+ if files:
|
||||
+ hs = {'files': sorted(files), 'dest_dir': dest_dir}
|
||||
+ out['headers'].append(hs)
|
||||
+
|
||||
+ install.variables = {'node_shared_libuv': 'false'}
|
||||
+ install.headers(add_headers)
|
||||
|
@ -1780,31 +1766,43 @@ index 0000000000000000000000000000000000000000..3088ae4bdf814ae255c9805ebd393b2e
|
|||
+
|
||||
+ out_file.writelines(new_contents)
|
||||
diff --git a/tools/install.py b/tools/install.py
|
||||
index 693faff4c37ac4d83a47e818f4412900497a2b62..7ab58f7cba6f210e4b7829257fb87e26a091cc89 100755
|
||||
index 045d406d84be301722f3de62abc448db84e751f8..95aa4c985d33ef37a73eebfca8bb8651e5059d37 100755
|
||||
--- a/tools/install.py
|
||||
+++ b/tools/install.py
|
||||
@@ -159,8 +159,8 @@ def files(action):
|
||||
@@ -159,14 +159,15 @@ def files(action):
|
||||
def headers(action):
|
||||
def ignore_inspector_headers(files_arg, dest):
|
||||
inspector_headers = [
|
||||
- 'deps/v8/include/v8-inspector.h',
|
||||
- 'deps/v8/include/v8-inspector-protocol.h'
|
||||
+ '../../v8/include/v8-inspector.h',
|
||||
+ '../../v8/include/v8-inspector-protocol.h'
|
||||
def wanted_v8_headers(files_arg, dest):
|
||||
v8_headers = [
|
||||
- 'deps/v8/include/cppgc/common.h',
|
||||
- 'deps/v8/include/v8.h',
|
||||
- 'deps/v8/include/v8-internal.h',
|
||||
- 'deps/v8/include/v8-platform.h',
|
||||
- 'deps/v8/include/v8-profiler.h',
|
||||
- 'deps/v8/include/v8-version.h',
|
||||
- 'deps/v8/include/v8config.h',
|
||||
+ '../../v8/include/cppgc/common.h',
|
||||
+ '../../v8/include/v8.h',
|
||||
+ '../../v8/include/v8-internal.h',
|
||||
+ '../../v8/include/v8-platform.h',
|
||||
+ '../../v8/include/v8-profiler.h',
|
||||
+ '../../v8/include/v8-version.h',
|
||||
+ '../../v8/include/v8config.h',
|
||||
]
|
||||
files_arg = [name for name in files_arg if name not in inspector_headers]
|
||||
+ v8_headers = [h.replace('deps/', '../../') for h in v8_headers]
|
||||
files_arg = [name for name in files_arg if name in v8_headers]
|
||||
action(files_arg, dest)
|
||||
@@ -182,7 +182,7 @@ def headers(action):
|
||||
|
||||
@@ -187,7 +188,7 @@ def headers(action):
|
||||
if sys.platform.startswith('aix'):
|
||||
action(['out/Release/node.exp'], 'include/node/')
|
||||
|
||||
- subdir_files('deps/v8/include', 'include/node/', ignore_inspector_headers)
|
||||
+ subdir_files('../../v8/include', 'include/node/', ignore_inspector_headers)
|
||||
- subdir_files('deps/v8/include', 'include/node/', wanted_v8_headers)
|
||||
+ subdir_files('../../v8/include', 'include/node/', wanted_v8_headers)
|
||||
|
||||
if 'false' == variables.get('node_shared_libuv'):
|
||||
subdir_files('deps/uv/include', 'include/node/', action)
|
||||
diff --git a/tools/js2c.py b/tools/js2c.py
|
||||
index 0f073e182bdb2858957e4b28ae15b366d7933dbe..93e9474297fd9032981786ae9d4e005f2d1a9a2e 100755
|
||||
index d40f28ce2bff2b7fc28ceeafc7772831746e7f89..4af54c3fa00602f9d0ce5cc4dca253d425048706 100755
|
||||
--- a/tools/js2c.py
|
||||
+++ b/tools/js2c.py
|
||||
@@ -130,6 +130,14 @@ def NormalizeFileName(filename):
|
||||
|
|
|
@ -1,172 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: John Kleinschmidt <jkleinsc@electronjs.org>
|
||||
Date: Thu, 18 Feb 2021 17:35:39 -0500
|
||||
Subject: build: add .mjs support to js2c
|
||||
|
||||
V8 now uses .mjs files, so this updates js2c to handle those files.
|
||||
|
||||
diff --git a/lib/internal/v8_prof_polyfill.js b/lib/internal/v8_prof_polyfill.js
|
||||
index 5f5922c5386543189d6ae9293108425cf212b054..605c7274c1fff1a2f1bd0b6c4f667f86145036bd 100644
|
||||
--- a/lib/internal/v8_prof_polyfill.js
|
||||
+++ b/lib/internal/v8_prof_polyfill.js
|
||||
@@ -69,7 +69,7 @@ function read(fileName) {
|
||||
const quit = process.exit;
|
||||
|
||||
// Polyfill "readline()".
|
||||
-const logFile = arguments[arguments.length - 1];
|
||||
+const logFile = globalThis.arguments[globalThis.arguments.length - 1];
|
||||
try {
|
||||
fs.accessSync(logFile);
|
||||
} catch(e) {
|
||||
@@ -159,3 +159,11 @@ function macCppfiltNm(out) {
|
||||
return prefix + (filtered[i++] || postfix);
|
||||
});
|
||||
}
|
||||
+
|
||||
+Object.assign(globalThis, {
|
||||
+ os,
|
||||
+ print,
|
||||
+ read,
|
||||
+ quit,
|
||||
+ readline,
|
||||
+});
|
||||
diff --git a/lib/internal/v8_prof_processor.js b/lib/internal/v8_prof_processor.js
|
||||
index daae650b2ad8ef146eb3a55c95dc80e0dbc2e3d7..7d6c7dce30058a73427dc7705f3dd98c4a6f4319 100644
|
||||
--- a/lib/internal/v8_prof_processor.js
|
||||
+++ b/lib/internal/v8_prof_processor.js
|
||||
@@ -3,43 +3,51 @@
|
||||
const {
|
||||
ArrayPrototypePush,
|
||||
ArrayPrototypeSlice,
|
||||
- JSONStringify,
|
||||
+ StringPrototypeSlice,
|
||||
} = primordials;
|
||||
|
||||
+const Buffer = require('buffer').Buffer;
|
||||
+const console = require('internal/console/global');
|
||||
const vm = require('vm');
|
||||
+const { SourceTextModule } = require('internal/vm/module');
|
||||
|
||||
-const scriptFiles = [
|
||||
- 'internal/v8_prof_polyfill',
|
||||
- 'internal/deps/v8/tools/splaytree',
|
||||
- 'internal/deps/v8/tools/codemap',
|
||||
- 'internal/deps/v8/tools/csvparser',
|
||||
- 'internal/deps/v8/tools/consarray',
|
||||
- 'internal/deps/v8/tools/profile',
|
||||
- 'internal/deps/v8/tools/profile_view',
|
||||
- 'internal/deps/v8/tools/logreader',
|
||||
- 'internal/deps/v8/tools/arguments',
|
||||
- 'internal/deps/v8/tools/tickprocessor',
|
||||
- 'internal/deps/v8/tools/SourceMap',
|
||||
- 'internal/deps/v8/tools/tickprocessor-driver'
|
||||
-];
|
||||
-let script = '';
|
||||
-
|
||||
-for (const s of scriptFiles) {
|
||||
- script += internalBinding('natives')[s] + '\n';
|
||||
-}
|
||||
+const natives = internalBinding('natives');
|
||||
|
||||
-const tickArguments = [];
|
||||
-if (process.platform === 'darwin') {
|
||||
- ArrayPrototypePush(tickArguments, '--mac');
|
||||
-} else if (process.platform === 'win32') {
|
||||
- ArrayPrototypePush(tickArguments, '--windows');
|
||||
+async function linker(specifier, referencingModule) {
|
||||
+ // Transform "./file.mjs" to "file"
|
||||
+ const file = StringPrototypeSlice(specifier, 2, -4);
|
||||
+ const code = natives[`internal/deps/v8/tools/${file}`];
|
||||
+ return new SourceTextModule(code, { context: referencingModule.context });
|
||||
}
|
||||
-ArrayPrototypePush(tickArguments,
|
||||
- ...ArrayPrototypeSlice(process.argv, 1));
|
||||
-script = `(function(module, require) {
|
||||
- arguments = ${JSONStringify(tickArguments)};
|
||||
- function write (s) { process.stdout.write(s) }
|
||||
- function printErr(err) { console.error(err); }
|
||||
- ${script}
|
||||
-})`;
|
||||
-vm.runInThisContext(script)(module, require);
|
||||
+
|
||||
+(async () => {
|
||||
+ const tickArguments = [];
|
||||
+ if (process.platform === 'darwin') {
|
||||
+ ArrayPrototypePush(tickArguments, '--mac');
|
||||
+ } else if (process.platform === 'win32') {
|
||||
+ ArrayPrototypePush(tickArguments, '--windows');
|
||||
+ }
|
||||
+ ArrayPrototypePush(tickArguments,
|
||||
+ ...ArrayPrototypeSlice(process.argv, 1));
|
||||
+
|
||||
+ const context = vm.createContext({
|
||||
+ arguments: tickArguments,
|
||||
+ write(s) { process.stdout.write(s); },
|
||||
+ printErr(err) { console.error(err); },
|
||||
+ console,
|
||||
+ process,
|
||||
+ Buffer,
|
||||
+ });
|
||||
+
|
||||
+ const polyfill = natives['internal/v8_prof_polyfill'];
|
||||
+ const script = `(function(module, require) {
|
||||
+ ${polyfill}
|
||||
+ })`;
|
||||
+
|
||||
+ vm.runInContext(script, context)(module, require);
|
||||
+
|
||||
+ const tickProcessor = natives['internal/deps/v8/tools/tickprocessor-driver'];
|
||||
+ const tickprocessorDriver = new SourceTextModule(tickProcessor, { context });
|
||||
+ await tickprocessorDriver.link(linker);
|
||||
+ await tickprocessorDriver.evaluate();
|
||||
+})();
|
||||
\ No newline at end of file
|
||||
diff --git a/tools/js2c.py b/tools/js2c.py
|
||||
index bca4c44a31d1ffe7c9ae15b6f60cd55e325f707d..7acb27e753e31429fbb5de30c62dd30a3be3b5bc 100755
|
||||
--- a/tools/js2c.py
|
||||
+++ b/tools/js2c.py
|
||||
@@ -151,20 +151,21 @@ def JS2C(source_files, target, only_js):
|
||||
# Build source code lines
|
||||
definitions = []
|
||||
initializers = []
|
||||
-
|
||||
- for filename in source_files['.js']:
|
||||
- AddModule(filename, definitions, initializers)
|
||||
-
|
||||
- # Electron: Expose fs module without asar support.
|
||||
- if filename == 'lib/fs.js':
|
||||
- # Node's 'fs' and 'internal/fs/<filename> have lazy-loaded circular
|
||||
- # dependencies. So to expose the unmodified Node 'fs' functionality here,
|
||||
- # we have to copy both 'fs' *and* 'internal/fs/<filename>' files and modify the
|
||||
- # copies to depend on each other instead of on our asarified 'fs' code.
|
||||
- AddModule('lib/original-fs.js', definitions, initializers, lambda _: ReadFile(filename).replace("require('internal/fs/", "require('internal/original-fs/"))
|
||||
- elif filename.startswith('lib/internal/fs/'):
|
||||
- original_fs_filename = filename.replace('internal/fs/', 'internal/original-fs/')
|
||||
- AddModule(original_fs_filename, definitions, initializers, lambda _: ReadFile(filename).replace("require('fs')", "require('original-fs')"))
|
||||
+ for extension in source_files.keys():
|
||||
+ for filename in source_files[extension]:
|
||||
+ if extension == '.js' or extension == '.mjs':
|
||||
+ AddModule(filename, definitions, initializers)
|
||||
+
|
||||
+ # Electron: Expose fs module without asar support.
|
||||
+ if filename == 'lib/fs.js':
|
||||
+ # Node's 'fs' and 'internal/fs/<filename> have lazy-loaded circular
|
||||
+ # dependencies. So to expose the unmodified Node 'fs' functionality here,
|
||||
+ # we have to copy both 'fs' *and* 'internal/fs/<filename>' files and modify the
|
||||
+ # copies to depend on each other instead of on our asarified 'fs' code.
|
||||
+ AddModule('lib/original-fs.js', definitions, initializers, lambda _: ReadFile(filename).replace("require('internal/fs/", "require('internal/original-fs/"))
|
||||
+ elif filename.startswith('lib/internal/fs/'):
|
||||
+ original_fs_filename = filename.replace('internal/fs/', 'internal/original-fs/')
|
||||
+ AddModule(original_fs_filename, definitions, initializers, lambda _: ReadFile(filename).replace("require('fs')", "require('original-fs')"))
|
||||
|
||||
config_size = 0
|
||||
if not only_js:
|
||||
@@ -240,7 +241,7 @@ def main():
|
||||
if options.only_js:
|
||||
assert len(source_files) == 1
|
||||
else:
|
||||
- assert len(source_files) == 2
|
||||
+ assert len(source_files) == 3
|
||||
# Currently config.gypi is the only `.gypi` file allowed
|
||||
assert source_files['.gypi'][0].endswith('config.gypi')
|
||||
source_files['config.gypi'] = source_files.pop('.gypi')[0]
|
|
@ -14,10 +14,10 @@ renderer/browser/worker/sandboxed bootstrap scripts). These are loaded
|
|||
through LoadEmbedderJavaScriptSource()
|
||||
|
||||
diff --git a/src/node_native_module.cc b/src/node_native_module.cc
|
||||
index 4c3633e06c60265c974bdd2a5a3d2e615e4aeb82..5e03a3a6e35e934faf71e765d7fc6e356f40e8d0 100644
|
||||
index b3a104547f392d9e0296ea467d902d76c29517e1..65a1e324fcdc8cc1daf3aa8d88588684e3e1fa86 100644
|
||||
--- a/src/node_native_module.cc
|
||||
+++ b/src/node_native_module.cc
|
||||
@@ -20,6 +20,7 @@ NativeModuleLoader NativeModuleLoader::instance_;
|
||||
@@ -19,6 +19,7 @@ NativeModuleLoader NativeModuleLoader::instance_;
|
||||
|
||||
NativeModuleLoader::NativeModuleLoader() : config_(GetConfig()) {
|
||||
LoadJavaScriptSource();
|
||||
|
@ -38,7 +38,7 @@ index 3be3f2364dd252bcdd668c699a0e7ae1e754e873..b2af1bce312ffca44e7005e11f92327e
|
|||
|
||||
bool Exists(const char* id);
|
||||
diff --git a/tools/js2c.py b/tools/js2c.py
|
||||
index 93e9474297fd9032981786ae9d4e005f2d1a9a2e..bca4c44a31d1ffe7c9ae15b6f60cd55e325f707d 100755
|
||||
index 4af54c3fa00602f9d0ce5cc4dca253d425048706..18f584473fb87f036ce2a67c5172cccaf0caaa5f 100755
|
||||
--- a/tools/js2c.py
|
||||
+++ b/tools/js2c.py
|
||||
@@ -38,6 +38,8 @@ import functools
|
||||
|
@ -83,14 +83,14 @@ index 93e9474297fd9032981786ae9d4e005f2d1a9a2e..bca4c44a31d1ffe7c9ae15b6f60cd55e
|
|||
initializers.append(initializer)
|
||||
|
||||
def NormalizeFileName(filename):
|
||||
- split = filename.split(os.path.sep)
|
||||
- split = filename.split('/')
|
||||
+ if filename.startswith('//v8'):
|
||||
+ filename = "deps/" + filename[2:]
|
||||
+ split = os.path.normpath(filename).split(os.path.sep)
|
||||
if split[0] == 'deps':
|
||||
split = ['internal'] + split
|
||||
else: # `lib/**/*.js` so drop the 'lib' part
|
||||
@@ -141,7 +147,7 @@ def NormalizeFileName(filename):
|
||||
@@ -141,23 +147,36 @@ def NormalizeFileName(filename):
|
||||
return os.path.splitext(filename)[0]
|
||||
|
||||
|
||||
|
@ -99,22 +99,29 @@ index 93e9474297fd9032981786ae9d4e005f2d1a9a2e..bca4c44a31d1ffe7c9ae15b6f60cd55e
|
|||
# Build source code lines
|
||||
definitions = []
|
||||
initializers = []
|
||||
@@ -149,13 +155,26 @@ def JS2C(source_files, target):
|
||||
for filename in source_files['.js']:
|
||||
AddModule(filename, definitions, initializers)
|
||||
|
||||
- for filename in source_files['.js']:
|
||||
- AddModule(filename, definitions, initializers)
|
||||
- for filename in source_files['.mjs']:
|
||||
- AddModule(filename, definitions, initializers)
|
||||
-
|
||||
- config_def, config_size = handle_config_gypi(source_files['config.gypi'])
|
||||
- definitions.append(config_def)
|
||||
+ # Electron: Expose fs module without asar support.
|
||||
+ if filename == 'lib/fs.js':
|
||||
+ # Node's 'fs' and 'internal/fs/<filename> have lazy-loaded circular
|
||||
+ # dependencies. So to expose the unmodified Node 'fs' functionality here,
|
||||
+ # we have to copy both 'fs' *and* 'internal/fs/<filename>' files and modify the
|
||||
+ # copies to depend on each other instead of on our asarified 'fs' code.
|
||||
+ AddModule('lib/original-fs.js', definitions, initializers, lambda _: ReadFile(filename).replace("require('internal/fs/", "require('internal/original-fs/"))
|
||||
+ elif filename.startswith('lib/internal/fs/'):
|
||||
+ original_fs_filename = filename.replace('internal/fs/', 'internal/original-fs/')
|
||||
+ AddModule(original_fs_filename, definitions, initializers, lambda _: ReadFile(filename).replace("require('fs')", "require('original-fs')"))
|
||||
+ for extension in source_files.keys():
|
||||
+ if extension == '.js' or extension == '.mjs':
|
||||
+ for filename in source_files[extension]:
|
||||
+ AddModule(filename, definitions, initializers)
|
||||
+
|
||||
+ # Electron: Expose fs module without asar support.
|
||||
+ if filename == 'lib/fs.js':
|
||||
+ # Node's 'fs' and 'internal/fs/<filename> have lazy-loaded circular
|
||||
+ # dependencies. So to expose the unmodified Node 'fs' functionality here,
|
||||
+ # we have to copy both 'fs' *and* 'internal/fs/<filename>' files and modify the
|
||||
+ # copies to depend on each other instead of on our asarified 'fs' code.
|
||||
+ AddModule('lib/original-fs.js', definitions, initializers, lambda _: ReadFile(filename).replace("require('internal/fs/", "require('internal/original-fs/"))
|
||||
+ elif filename.startswith('lib/internal/fs/'):
|
||||
+ original_fs_filename = filename.replace('internal/fs/', 'internal/original-fs/')
|
||||
+ AddModule(original_fs_filename, definitions, initializers, lambda _: ReadFile(filename).replace("require('fs')", "require('original-fs')"))
|
||||
+
|
||||
+ config_size = 0
|
||||
+ if not only_js:
|
||||
|
@ -129,7 +136,7 @@ index 93e9474297fd9032981786ae9d4e005f2d1a9a2e..bca4c44a31d1ffe7c9ae15b6f60cd55e
|
|||
write_if_chaged(out, target)
|
||||
|
||||
|
||||
@@ -211,17 +230,21 @@ def main():
|
||||
@@ -213,18 +232,21 @@ def main():
|
||||
)
|
||||
parser.add_argument('--target', help='output file')
|
||||
parser.add_argument('--verbose', action='store_true', help='output file')
|
||||
|
@ -139,20 +146,22 @@ index 93e9474297fd9032981786ae9d4e005f2d1a9a2e..bca4c44a31d1ffe7c9ae15b6f60cd55e
|
|||
global is_verbose
|
||||
is_verbose = options.verbose
|
||||
source_files = functools.reduce(SourceFileByExt, options.sources, {})
|
||||
# Should have exactly 2 types: `.js`, and `.gypi`
|
||||
- assert len(source_files) == 2
|
||||
- # Should have exactly 3 types: `.js`, `.mjs` and `.gypi`
|
||||
- assert len(source_files) == 3
|
||||
- # Currently config.gypi is the only `.gypi` file allowed
|
||||
- assert source_files['.gypi'] == ['config.gypi']
|
||||
- source_files['config.gypi'] = source_files.pop('.gypi')[0]
|
||||
- JS2C(source_files, options.target)
|
||||
-
|
||||
+ if options.only_js:
|
||||
+ assert len(source_files) == 1
|
||||
+ else:
|
||||
+ assert len(source_files) == 2
|
||||
+ # Should have exactly 3 types: `.js`, `.mjs` and `.gypi`
|
||||
+ assert len(source_files) == 3
|
||||
+ # Currently config.gypi is the only `.gypi` file allowed
|
||||
+ assert source_files['.gypi'][0].endswith('config.gypi')
|
||||
+ source_files['config.gypi'] = source_files.pop('.gypi')[0]
|
||||
+ JS2C(source_files, options.target, options.only_js)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -8,18 +8,18 @@ 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 ca5a01f925a2ae69ba4295d82316e546f45c60cd..a0f6730de75b9b1dc58e2cec5ed64f9619162a2b 100644
|
||||
index 3c05e553c8e61456205a1f632c903055650a3fc6..292204024f64e6457f1344db1c74d006b7233c82 100644
|
||||
--- a/src/node_binding.cc
|
||||
+++ b/src/node_binding.cc
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <atomic>
|
||||
#include "env-inl.h"
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "node_errors.h"
|
||||
#include "node_external_reference.h"
|
||||
#include "node_native_module_env.h"
|
||||
+#include "node_process.h"
|
||||
#include "util.h"
|
||||
|
||||
#if HAVE_OPENSSL
|
||||
@@ -463,7 +464,12 @@ void DLOpen(const FunctionCallbackInfo<Value>& args) {
|
||||
#include <string>
|
||||
@@ -465,7 +466,12 @@ void DLOpen(const FunctionCallbackInfo<Value>& args) {
|
||||
if (mp->nm_context_register_func == nullptr) {
|
||||
if (env->force_context_aware()) {
|
||||
dlib->Close();
|
||||
|
|
|
@ -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/bootstrap/pre_execution.js b/lib/internal/bootstrap/pre_execution.js
|
||||
index a66ac87237ad1de85318be58d15b508be568cf1f..62553011f9fd16dbaccd8d7e8eecee627be7137c 100644
|
||||
index 4e6765de3b1668740c318310147625d795c7a18d..27a2060c0f0f5895b97514a21e9ffdfe0558347e 100644
|
||||
--- a/lib/internal/bootstrap/pre_execution.js
|
||||
+++ b/lib/internal/bootstrap/pre_execution.js
|
||||
@@ -89,10 +89,12 @@ function patchProcessObject(expandArgv1) {
|
||||
@@ -102,10 +102,12 @@ function patchProcessObject(expandArgv1) {
|
||||
if (expandArgv1 && process.argv[1] &&
|
||||
!StringPrototypeStartsWith(process.argv[1], '-')) {
|
||||
// Expand process.argv[1] into a full path.
|
||||
|
@ -29,10 +29,10 @@ index a66ac87237ad1de85318be58d15b508be568cf1f..62553011f9fd16dbaccd8d7e8eecee62
|
|||
|
||||
// TODO(joyeecheung): most of these should be deprecated and removed,
|
||||
diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js
|
||||
index e2a205739ce89820fe5f1f24e609ff16b86afb04..db6980d387ed399671957170266e2a01c04fae9a 100644
|
||||
index 23f7fcce7cfe8879be95fd949af70da1869e17b3..5e2fca90e26ea18be8c406ceb0bbc3523a39f6c5 100644
|
||||
--- a/lib/internal/modules/cjs/loader.js
|
||||
+++ b/lib/internal/modules/cjs/loader.js
|
||||
@@ -1042,6 +1042,13 @@ Module.prototype._compile = function(content, filename) {
|
||||
@@ -1083,6 +1083,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.
|
||||
|
|
|
@ -7,10 +7,10 @@ This is used so that we can modify the flag at runtime where
|
|||
config can only be set at compile time.
|
||||
|
||||
diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js
|
||||
index 5aab40071b68affe602be16d451be598b246faa1..6a55064eac76ee88d3b0b734d4f242da80aca119 100644
|
||||
index ca7274622fd95d06cf529db0751da9e189ad556e..74b148e4912a44f6be260f9200e976bae97c0fd8 100644
|
||||
--- a/lib/internal/bootstrap/node.js
|
||||
+++ b/lib/internal/bootstrap/node.js
|
||||
@@ -119,7 +119,7 @@ const {
|
||||
@@ -193,7 +193,7 @@ const {
|
||||
queueMicrotask
|
||||
} = require('internal/process/task_queues');
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ node modules will have different (wrong) ideas about how v8 structs are laid
|
|||
out in memory on 64-bit machines, and will summarily fail to work.
|
||||
|
||||
diff --git a/common.gypi b/common.gypi
|
||||
index 3f305b39cb35a1a36a54cff80476fecba1556d5d..cd56b9b314823ff48c1a599ec51c6a3077b62f98 100644
|
||||
index f165e57b1b0456bf719285093578e059310d36f4..c6d133e4de88c67ce7bd92cd2572381806e06b1b 100644
|
||||
--- a/common.gypi
|
||||
+++ b/common.gypi
|
||||
@@ -64,7 +64,7 @@
|
||||
|
|
|
@ -9,10 +9,10 @@ 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 8665b2827583d3ac7cfbfde661878026caba15ca..ca5a01f925a2ae69ba4295d82316e546f45c60cd 100644
|
||||
index b5e42af79510b690a1687d4d32a2a583704a397f..3c05e553c8e61456205a1f632c903055650a3fc6 100644
|
||||
--- a/src/node_binding.cc
|
||||
+++ b/src/node_binding.cc
|
||||
@@ -608,6 +608,10 @@ void GetInternalBinding(const FunctionCallbackInfo<Value>& args) {
|
||||
@@ -607,6 +607,10 @@ void GetInternalBinding(const FunctionCallbackInfo<Value>& args) {
|
||||
args.GetReturnValue().Set(exports);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,10 +24,10 @@ Environment on the V8 context of blink, so no new V8 context is created.
|
|||
As a result, a renderer process may have multiple Node Environments in it.
|
||||
|
||||
diff --git a/src/node.cc b/src/node.cc
|
||||
index 905afd8c235b7b1a7b45823db486384935a2a52b..102847cd32d03addeb40c9539eafc92ba49c8ec4 100644
|
||||
index bf041fb682a2c2b56d044a174f99a579a75f0d14..a99f2f4f01b16fc70f3038a25da22c788714b3f6 100644
|
||||
--- a/src/node.cc
|
||||
+++ b/src/node.cc
|
||||
@@ -134,6 +134,8 @@ using v8::Undefined;
|
||||
@@ -139,6 +139,8 @@ using v8::Undefined;
|
||||
using v8::V8;
|
||||
using v8::Value;
|
||||
|
||||
|
@ -36,7 +36,7 @@ index 905afd8c235b7b1a7b45823db486384935a2a52b..102847cd32d03addeb40c9539eafc92b
|
|||
namespace per_process {
|
||||
|
||||
// node_revert.h
|
||||
@@ -837,7 +839,9 @@ int InitializeNodeWithArgs(std::vector<std::string>* argv,
|
||||
@@ -860,7 +862,9 @@ int InitializeNodeWithArgs(std::vector<std::string>* argv,
|
||||
binding::RegisterBuiltinModules();
|
||||
|
||||
// Make inherited handles noninheritable.
|
||||
|
@ -47,28 +47,30 @@ index 905afd8c235b7b1a7b45823db486384935a2a52b..102847cd32d03addeb40c9539eafc92b
|
|||
|
||||
// Cache the original command line to be
|
||||
// used in diagnostic reports.
|
||||
@@ -871,6 +875,8 @@ int InitializeNodeWithArgs(std::vector<std::string>* argv,
|
||||
@@ -894,7 +898,8 @@ int InitializeNodeWithArgs(std::vector<std::string>* argv,
|
||||
if (exit_code != 0) return exit_code;
|
||||
}
|
||||
#endif
|
||||
-
|
||||
+ if (g_upstream_node_mode) {
|
||||
+ // NOTE(jeremy): indentation is intentionally wrong here, to ease rebasing.
|
||||
|
||||
const int exit_code = ProcessGlobalArgs(argv,
|
||||
exec_argv,
|
||||
@@ -915,6 +921,7 @@ int InitializeNodeWithArgs(std::vector<std::string>* argv,
|
||||
errors,
|
||||
@@ -937,7 +942,7 @@ int InitializeNodeWithArgs(std::vector<std::string>* argv,
|
||||
return 9;
|
||||
}
|
||||
per_process::metadata.versions.InitializeIntlVersions();
|
||||
#endif
|
||||
-
|
||||
+ } // g_upstream_node_mode
|
||||
|
||||
NativeModuleEnv::InitializeCodeCache();
|
||||
|
||||
# ifndef __POSIX__
|
||||
std::string tz;
|
||||
if (credentials::SafeGetenv("TZ", &tz) && !tz.empty()) {
|
||||
diff --git a/src/node.h b/src/node.h
|
||||
index 38e0ef50f9b283b1d7ca8f54412d99b8cd38e524..34a16feaed229a59181e1b2e48b0e111d5b0b2a6 100644
|
||||
index 4348dfba5b2be8973eda7f36bfb9479a744a07f6..4e533cab0b74221219752aea7533866830067c09 100644
|
||||
--- a/src/node.h
|
||||
+++ b/src/node.h
|
||||
@@ -220,6 +220,8 @@ namespace node {
|
||||
@@ -213,6 +213,8 @@ namespace node {
|
||||
|
||||
class IsolateData;
|
||||
class Environment;
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samuel Attard <sattard@slack-corp.com>
|
||||
Date: Wed, 29 Jul 2020 12:03:04 -0700
|
||||
Subject: feat: add implementation of v8::Platform::PostJob
|
||||
|
||||
Uses the new "v8::platform::NewDefaultJobHandle" method
|
||||
|
||||
Refs: https://chromium-review.googlesource.com/c/v8/v8/+/2315981
|
||||
Refs: https://chromium-review.googlesource.com/c/v8/v8/+/2304812
|
||||
|
||||
diff --git a/src/node_platform.cc b/src/node_platform.cc
|
||||
index 7e68b7af891ffb87ce083081775015cc7b62fc42..aac0682670fcffd235fcf450bc5e2b0d45985b47 100644
|
||||
--- a/src/node_platform.cc
|
||||
+++ b/src/node_platform.cc
|
||||
@@ -544,6 +544,10 @@ Platform::StackTracePrinter NodePlatform::GetStackTracePrinter() {
|
||||
};
|
||||
}
|
||||
|
||||
+std::unique_ptr<v8::JobHandle> NodePlatform::PostJob(v8::TaskPriority priority, std::unique_ptr<v8::JobTask> job_task) {
|
||||
+ return v8::platform::NewDefaultJobHandle(this, priority, std::move(job_task), 1 /* num_worker_threads */);
|
||||
+}
|
||||
+
|
||||
template <class T>
|
||||
TaskQueue<T>::TaskQueue()
|
||||
: lock_(), tasks_available_(), tasks_drained_(),
|
||||
diff --git a/src/node_platform.h b/src/node_platform.h
|
||||
index dc512ddf08facf1ebb0d8c9e7677d349d0d2c87c..a274be6bbea19a4488bca393712a9ac8b50fe16a 100644
|
||||
--- a/src/node_platform.h
|
||||
+++ b/src/node_platform.h
|
||||
@@ -162,6 +162,7 @@ class NodePlatform : public MultiIsolatePlatform {
|
||||
void UnregisterIsolate(v8::Isolate* isolate) override;
|
||||
void AddIsolateFinishedCallback(v8::Isolate* isolate,
|
||||
void (*callback)(void*), void* data) override;
|
||||
+ std::unique_ptr<v8::JobHandle> PostJob(v8::TaskPriority priority, std::unique_ptr<v8::JobTask> job_task) override;
|
||||
|
||||
std::shared_ptr<v8::TaskRunner> GetForegroundTaskRunner(
|
||||
v8::Isolate* isolate) override;
|
|
@ -6,10 +6,10 @@ Subject: feat: initialize asar support
|
|||
This patch initializes asar support in Node.js.
|
||||
|
||||
diff --git a/lib/internal/bootstrap/pre_execution.js b/lib/internal/bootstrap/pre_execution.js
|
||||
index dfd7249e907ebcc0aa0e511b96435507af3f90aa..a66ac87237ad1de85318be58d15b508be568cf1f 100644
|
||||
index e52da0868e1ad2df0a23138a4a8d8d2a3d677fab..4e6765de3b1668740c318310147625d795c7a18d 100644
|
||||
--- a/lib/internal/bootstrap/pre_execution.js
|
||||
+++ b/lib/internal/bootstrap/pre_execution.js
|
||||
@@ -69,6 +69,7 @@ function prepareMainThreadExecution(expandArgv1 = false) {
|
||||
@@ -74,6 +74,7 @@ function prepareMainThreadExecution(expandArgv1 = false) {
|
||||
assert(!CJSLoader.hasLoadedAnyUserCJSModule);
|
||||
loadPreloadModules();
|
||||
initializeFrozenIntrinsics();
|
||||
|
@ -17,7 +17,7 @@ index dfd7249e907ebcc0aa0e511b96435507af3f90aa..a66ac87237ad1de85318be58d15b508b
|
|||
}
|
||||
|
||||
function patchProcessObject(expandArgv1) {
|
||||
@@ -468,6 +469,10 @@ function loadPreloadModules() {
|
||||
@@ -457,6 +458,10 @@ function loadPreloadModules() {
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Thu, 10 Jun 2021 15:15:35 +0200
|
||||
Subject: fix: account for debugger agent race condition
|
||||
|
||||
In Electron the debugger agent hasn't necessarily been enabled by the
|
||||
time the inspect prompt displays, leading to "Debugger agent is not enabled"
|
||||
errors. This is remedied by adding a small timeout to the test.
|
||||
|
||||
We'll either upstream this or figure out a better solution.
|
||||
|
||||
diff --git a/test/inspector-cli/test-inspector-cli-address.js b/test/inspector-cli/test-inspector-cli-address.js
|
||||
index ff31747016c2d49ac87fa272eba3231e9d4fbae5..e4f7b13aad3c60100e56df00165d1af550f1a117 100644
|
||||
--- a/test/inspector-cli/test-inspector-cli-address.js
|
||||
+++ b/test/inspector-cli/test-inspector-cli-address.js
|
||||
@@ -59,6 +59,7 @@ function launchTarget(...args) {
|
||||
cli = startCLI([`${host || '127.0.0.1'}:${port}`]);
|
||||
return cli.waitForPrompt();
|
||||
})
|
||||
+ .then(() => new Promise(resolve => setTimeout(resolve, 1000)))
|
||||
.then(() => cli.command('sb("alive.js", 3)'))
|
||||
.then(() => cli.waitFor(/break/))
|
||||
.then(() => cli.waitForPrompt())
|
||||
diff --git a/test/inspector-cli/test-inspector-cli-pid.js b/test/inspector-cli/test-inspector-cli-pid.js
|
||||
index 97de9f40369d2d1df9674c6df5bbaf78022667c6..3d51a8963ba24e5e5f6a64cd792859535670dd9a 100644
|
||||
--- a/test/inspector-cli/test-inspector-cli-pid.js
|
||||
+++ b/test/inspector-cli/test-inspector-cli-pid.js
|
||||
@@ -38,6 +38,7 @@ function launchTarget(...args) {
|
||||
cli = startCLI(['-p', `${target.pid}`]);
|
||||
return cli.waitForPrompt();
|
||||
})
|
||||
+ .then(() => new Promise(resolve => setTimeout(resolve, 1000)))
|
||||
.then(() => cli.command('sb("alive.js", 3)'))
|
||||
.then(() => cli.waitFor(/break/))
|
||||
.then(() => cli.waitForPrompt())
|
|
@ -8,7 +8,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 aa4279d93ca35c83ad8c417a11292ef5ca91c495..3f305b39cb35a1a36a54cff80476fecba1556d5d 100644
|
||||
index 4bc75c7c41c6dda95e244b28a7827c83611bdc56..f165e57b1b0456bf719285093578e059310d36f4 100644
|
||||
--- a/common.gypi
|
||||
+++ b/common.gypi
|
||||
@@ -81,6 +81,22 @@
|
||||
|
|
|
@ -6,7 +6,7 @@ Subject: fix: add v8_enable_reverse_jsargs defines in common.gypi
|
|||
This can be removed once node upgrades V8 and inevitably has to do this exact same thing. Also hi node people if you are looking at this.
|
||||
|
||||
diff --git a/common.gypi b/common.gypi
|
||||
index cd56b9b314823ff48c1a599ec51c6a3077b62f98..709943635ad31da1c7a7ef91d2f3bfbeb78ea937 100644
|
||||
index c6d133e4de88c67ce7bd92cd2572381806e06b1b..b426185cb20b24def9a757eefb58c62686a8636a 100644
|
||||
--- a/common.gypi
|
||||
+++ b/common.gypi
|
||||
@@ -65,6 +65,7 @@
|
||||
|
@ -25,7 +25,7 @@ index cd56b9b314823ff48c1a599ec51c6a3077b62f98..709943635ad31da1c7a7ef91d2f3bfbe
|
|||
##### end V8 defaults #####
|
||||
|
||||
# When building native modules using 'npm install' with the system npm,
|
||||
@@ -372,6 +374,9 @@
|
||||
@@ -373,6 +375,9 @@
|
||||
['v8_enable_pointer_compression == 1 or v8_enable_31bit_smis_on_64bit_arch == 1', {
|
||||
'defines': ['V8_31BIT_SMIS_ON_64BIT_ARCH'],
|
||||
}],
|
||||
|
|
|
@ -11,12 +11,12 @@ initialize it in the browser process. This adds a new
|
|||
EnvironmentFlags option which allows preventing that invocation.
|
||||
|
||||
diff --git a/src/api/environment.cc b/src/api/environment.cc
|
||||
index 53b07052e43a09f29f863ee1b2287bdebe7b7a7f..c08fe4b32d4155badb572f15529f903c0ec63146 100644
|
||||
index bcadb23b0ebdadf8dc724afb022ca492d0df8f66..96dbf0d8325715c8f4db115884e4b68f2c7b7502 100644
|
||||
--- a/src/api/environment.cc
|
||||
+++ b/src/api/environment.cc
|
||||
@@ -358,12 +358,14 @@ Environment* CreateEnvironment(
|
||||
thread_id);
|
||||
|
||||
@@ -341,12 +341,14 @@ Environment* CreateEnvironment(
|
||||
Environment* env = new Environment(
|
||||
isolate_data, context, args, exec_args, nullptr, flags, thread_id);
|
||||
#if HAVE_INSPECTOR
|
||||
- if (inspector_parent_handle) {
|
||||
- env->InitializeInspector(
|
||||
|
@ -36,10 +36,10 @@ index 53b07052e43a09f29f863ee1b2287bdebe7b7a7f..c08fe4b32d4155badb572f15529f903c
|
|||
#endif
|
||||
|
||||
diff --git a/src/env-inl.h b/src/env-inl.h
|
||||
index 9b2f82cc00e661f139611dd2de53598d6d8ff210..006bcaf4a9a864438cd447dc4235b3a5257cd2a5 100644
|
||||
index f88e7648155186ce27b19ca6e4954bf764e7a2f8..6d34c5125e93bc0f0ce414be573438aec091dbb5 100644
|
||||
--- a/src/env-inl.h
|
||||
+++ b/src/env-inl.h
|
||||
@@ -829,6 +829,10 @@ inline bool Environment::tracks_unmanaged_fds() const {
|
||||
@@ -816,6 +816,10 @@ inline bool Environment::tracks_unmanaged_fds() const {
|
||||
return flags_ & EnvironmentFlags::kTrackUnmanagedFds;
|
||||
}
|
||||
|
||||
|
@ -51,10 +51,10 @@ index 9b2f82cc00e661f139611dd2de53598d6d8ff210..006bcaf4a9a864438cd447dc4235b3a5
|
|||
return emit_filehandle_warning_;
|
||||
}
|
||||
diff --git a/src/env.h b/src/env.h
|
||||
index 9c435f12db0e2d0a13ebd2b01810f0857c55fe2e..1ea1caf0e327719c39f91ce3c0897dde5034c904 100644
|
||||
index 6b8444f0bc578cd8bccb9f5589531460b68b3cc4..2b0088bc29639c4da38a148368fb0dbfa3a19b4c 100644
|
||||
--- a/src/env.h
|
||||
+++ b/src/env.h
|
||||
@@ -1026,6 +1026,7 @@ class Environment : public MemoryRetainer {
|
||||
@@ -1177,6 +1177,7 @@ class Environment : public MemoryRetainer {
|
||||
inline bool owns_process_state() const;
|
||||
inline bool owns_inspector() const;
|
||||
inline bool tracks_unmanaged_fds() const;
|
||||
|
@ -63,10 +63,10 @@ index 9c435f12db0e2d0a13ebd2b01810f0857c55fe2e..1ea1caf0e327719c39f91ce3c0897dde
|
|||
inline worker::Worker* worker_context() const;
|
||||
Environment* worker_parent_env() const;
|
||||
diff --git a/src/node.h b/src/node.h
|
||||
index a649f52403659fd18898e1e813f97e32f33784e7..b646fdda58ebcbf2dd92ee4fc9cb0d9c039174d1 100644
|
||||
index 41f79ef869128636ac04093919e8e5816b39bef9..691c16ba60b0ce8633555825e44c3ace96c5000f 100644
|
||||
--- a/src/node.h
|
||||
+++ b/src/node.h
|
||||
@@ -426,7 +426,11 @@ enum Flags : uint64_t {
|
||||
@@ -405,7 +405,11 @@ enum Flags : uint64_t {
|
||||
kNoRegisterESMLoader = 1 << 3,
|
||||
// Set this flag to make Node.js track "raw" file descriptors, i.e. managed
|
||||
// by fs.open() and fs.close(), and close them during FreeEnvironment().
|
||||
|
|
|
@ -1,93 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Wed, 27 May 2020 13:02:13 -0700
|
||||
Subject: fix: comment out incompatible crypto modules
|
||||
|
||||
Node.js introduced some functionality in https://github.com/nodejs/node/pull/32739
|
||||
and https://github.com/nodejs/node/pull/31178 that is not currently compatible
|
||||
with what's exposed through BoringSSL. I plan to upstream parts of this or
|
||||
otherwise introduce shims to reduce friction.
|
||||
|
||||
diff --git a/src/node_crypto.cc b/src/node_crypto.cc
|
||||
index c119b2314f18d1710bb3cbf1910c86ff994ec951..58554799b50097972405e40f593d089236bca961 100644
|
||||
--- a/src/node_crypto.cc
|
||||
+++ b/src/node_crypto.cc
|
||||
@@ -5207,11 +5207,11 @@ bool DiffieHellman::Init(int primeLength, int g) {
|
||||
bool DiffieHellman::Init(const char* p, int p_len, int g) {
|
||||
dh_.reset(DH_new());
|
||||
if (p_len <= 0) {
|
||||
- BNerr(BN_F_BN_GENERATE_PRIME_EX, BN_R_BITS_TOO_SMALL);
|
||||
+ OPENSSL_PUT_ERROR(BN, BN_R_BITS_TOO_SMALL);
|
||||
return false;
|
||||
}
|
||||
if (g <= 1) {
|
||||
- DHerr(DH_F_DH_BUILTIN_GENPARAMS, DH_R_BAD_GENERATOR);
|
||||
+ OPENSSL_PUT_ERROR(DH, DH_R_BAD_GENERATOR);
|
||||
return false;
|
||||
}
|
||||
BIGNUM* bn_p =
|
||||
@@ -5230,18 +5230,18 @@ bool DiffieHellman::Init(const char* p, int p_len, int g) {
|
||||
bool DiffieHellman::Init(const char* p, int p_len, const char* g, int g_len) {
|
||||
dh_.reset(DH_new());
|
||||
if (p_len <= 0) {
|
||||
- BNerr(BN_F_BN_GENERATE_PRIME_EX, BN_R_BITS_TOO_SMALL);
|
||||
+ OPENSSL_PUT_ERROR(BN, BN_R_BITS_TOO_SMALL);
|
||||
return false;
|
||||
}
|
||||
if (g_len <= 0) {
|
||||
- DHerr(DH_F_DH_BUILTIN_GENPARAMS, DH_R_BAD_GENERATOR);
|
||||
+ OPENSSL_PUT_ERROR(DH, DH_R_BAD_GENERATOR);
|
||||
return false;
|
||||
}
|
||||
BIGNUM* bn_g =
|
||||
BN_bin2bn(reinterpret_cast<const unsigned char*>(g), g_len, nullptr);
|
||||
if (BN_is_zero(bn_g) || BN_is_one(bn_g)) {
|
||||
BN_free(bn_g);
|
||||
- DHerr(DH_F_DH_BUILTIN_GENPARAMS, DH_R_BAD_GENERATOR);
|
||||
+ OPENSSL_PUT_ERROR(DH, DH_R_BAD_GENERATOR);
|
||||
return false;
|
||||
}
|
||||
BIGNUM* bn_p =
|
||||
@@ -5734,7 +5734,7 @@ void ECDH::SetPrivateKey(const FunctionCallbackInfo<Value>& args) {
|
||||
if (!EC_KEY_set_public_key(new_key.get(), pub.get()))
|
||||
return env->ThrowError("Failed to set generated public key");
|
||||
|
||||
- EC_KEY_copy(ecdh->key_.get(), new_key.get());
|
||||
+ ecdh->key_.reset(EC_KEY_dup(new_key.get()));
|
||||
ecdh->group_ = EC_KEY_get0_group(ecdh->key_.get());
|
||||
}
|
||||
|
||||
@@ -6222,6 +6222,7 @@ class DHKeyPairGenerationConfig : public KeyPairGenerationConfig {
|
||||
EVPKeyCtxPointer Setup() override {
|
||||
EVPKeyPointer params;
|
||||
if (prime_info_.fixed_value_) {
|
||||
+#if 0
|
||||
DHPointer dh(DH_new());
|
||||
if (!dh)
|
||||
return nullptr;
|
||||
@@ -6238,6 +6239,7 @@ class DHKeyPairGenerationConfig : public KeyPairGenerationConfig {
|
||||
params = EVPKeyPointer(EVP_PKEY_new());
|
||||
CHECK(params);
|
||||
EVP_PKEY_assign_DH(params.get(), dh.release());
|
||||
+#endif
|
||||
} else {
|
||||
EVPKeyCtxPointer param_ctx(EVP_PKEY_CTX_new_id(EVP_PKEY_DH, nullptr));
|
||||
if (!param_ctx)
|
||||
@@ -6245,7 +6247,7 @@ class DHKeyPairGenerationConfig : public KeyPairGenerationConfig {
|
||||
|
||||
if (EVP_PKEY_paramgen_init(param_ctx.get()) <= 0)
|
||||
return nullptr;
|
||||
-
|
||||
+#if 0
|
||||
if (EVP_PKEY_CTX_set_dh_paramgen_prime_len(param_ctx.get(),
|
||||
prime_info_.prime_size_) <= 0)
|
||||
return nullptr;
|
||||
@@ -6253,7 +6255,7 @@ class DHKeyPairGenerationConfig : public KeyPairGenerationConfig {
|
||||
if (EVP_PKEY_CTX_set_dh_paramgen_generator(param_ctx.get(),
|
||||
generator_) <= 0)
|
||||
return nullptr;
|
||||
-
|
||||
+#endif
|
||||
EVP_PKEY* raw_params = nullptr;
|
||||
if (EVP_PKEY_paramgen(param_ctx.get(), &raw_params) <= 0)
|
||||
return nullptr;
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -7,10 +7,10 @@ Subject: fix: expose tracing::Agent and use tracing::TracingController instead
|
|||
This API is used by Electron to create Node's tracing controller.
|
||||
|
||||
diff --git a/src/api/environment.cc b/src/api/environment.cc
|
||||
index 2c4acbc4fa0eca3b7c6d03b997445633646446e7..53b07052e43a09f29f863ee1b2287bdebe7b7a7f 100644
|
||||
index 46e3360ef9c023bfb4cb45393a81c4af55e8d805..bcadb23b0ebdadf8dc724afb022ca492d0df8f66 100644
|
||||
--- a/src/api/environment.cc
|
||||
+++ b/src/api/environment.cc
|
||||
@@ -472,6 +472,10 @@ MultiIsolatePlatform* GetMultiIsolatePlatform(IsolateData* env) {
|
||||
@@ -454,6 +454,10 @@ MultiIsolatePlatform* GetMultiIsolatePlatform(IsolateData* env) {
|
||||
return env->platform();
|
||||
}
|
||||
|
||||
|
@ -22,10 +22,10 @@ index 2c4acbc4fa0eca3b7c6d03b997445633646446e7..53b07052e43a09f29f863ee1b2287bde
|
|||
int thread_pool_size,
|
||||
node::tracing::TracingController* tracing_controller) {
|
||||
diff --git a/src/node.h b/src/node.h
|
||||
index 34a16feaed229a59181e1b2e48b0e111d5b0b2a6..a649f52403659fd18898e1e813f97e32f33784e7 100644
|
||||
index 4e533cab0b74221219752aea7533866830067c09..41f79ef869128636ac04093919e8e5816b39bef9 100644
|
||||
--- a/src/node.h
|
||||
+++ b/src/node.h
|
||||
@@ -125,6 +125,7 @@ namespace node {
|
||||
@@ -118,6 +118,7 @@ namespace node {
|
||||
|
||||
namespace tracing {
|
||||
|
||||
|
@ -33,12 +33,12 @@ index 34a16feaed229a59181e1b2e48b0e111d5b0b2a6..a649f52403659fd18898e1e813f97e32
|
|||
class TracingController;
|
||||
|
||||
}
|
||||
@@ -522,6 +523,8 @@ NODE_DEPRECATED("Use GetMultiIsolatePlatform(env) instead",
|
||||
@@ -484,6 +485,8 @@ NODE_EXTERN v8::MaybeLocal<v8::Value> PrepareStackTraceCallback(
|
||||
NODE_EXTERN MultiIsolatePlatform* GetMultiIsolatePlatform(Environment* env);
|
||||
NODE_EXTERN MultiIsolatePlatform* GetMultiIsolatePlatform(IsolateData* env);
|
||||
|
||||
+NODE_EXTERN node::tracing::Agent* CreateAgent();
|
||||
+
|
||||
// Legacy variants of MultiIsolatePlatform::Create().
|
||||
NODE_DEPRECATED("Use variant taking a v8::TracingController* pointer instead",
|
||||
NODE_DEPRECATED("Use MultiIsolatePlatform::Create() instead",
|
||||
NODE_EXTERN MultiIsolatePlatform* CreatePlatform(
|
||||
int thread_pool_size,
|
||||
|
|
|
@ -0,0 +1,437 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Wed, 12 Feb 2020 15:08:04 -0800
|
||||
Subject: fix: handle BoringSSL and OpenSSL incompatibilities
|
||||
|
||||
This patch corrects for imcompatibilities between OpenSSL, which Node.js uses,
|
||||
and BoringSSL which Electron uses via Chromium. Each incompatibility typically has
|
||||
~2 paths forward:
|
||||
* Upstream a shim or adapted implementation to BoringSSL
|
||||
* Alter Node.js functionality to something which both libraries can handle.
|
||||
|
||||
Where possible, we should seek to make this patch as minimal as possible.
|
||||
|
||||
Upstreams for code herein (update when changed):
|
||||
* https://boringssl-review.googlesource.com/c/boringssl/+/47824
|
||||
* https://boringssl-review.googlesource.com/c/boringssl/+/47844
|
||||
* https://github.com/nodejs/node/pull/38926
|
||||
* https://github.com/nodejs/node/pull/38925
|
||||
* https://github.com/nodejs/node/pull/38901
|
||||
* https://github.com/nodejs/node/pull/38900
|
||||
* https://github.com/nodejs/node/pull/38864
|
||||
* https://github.com/nodejs/node/pull/38744
|
||||
|
||||
diff --git a/src/crypto/crypto_cipher.cc b/src/crypto/crypto_cipher.cc
|
||||
index 5ce466582823ae1304731610da61b7fde77fc65a..cd3c7cea3b83be95a6663909ad9e1a2d2f2eb25a 100644
|
||||
--- a/src/crypto/crypto_cipher.cc
|
||||
+++ b/src/crypto/crypto_cipher.cc
|
||||
@@ -148,7 +148,7 @@ void GetCipherInfo(const FunctionCallbackInfo<Value>& args) {
|
||||
if (info->Set(
|
||||
env->context(),
|
||||
env->name_string(),
|
||||
- OneByteString(env->isolate(), EVP_CIPHER_name(cipher))).IsNothing()) {
|
||||
+ OneByteString(env->isolate(), OBJ_nid2sn(EVP_CIPHER_nid(cipher)))).IsNothing()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -906,7 +906,7 @@ bool PublicKeyCipher::Cipher(
|
||||
void* label = OPENSSL_memdup(oaep_label.data(), oaep_label.size());
|
||||
CHECK_NOT_NULL(label);
|
||||
if (0 >= EVP_PKEY_CTX_set0_rsa_oaep_label(ctx.get(),
|
||||
- reinterpret_cast<unsigned char*>(label),
|
||||
+ static_cast<unsigned char*>(label),
|
||||
oaep_label.size())) {
|
||||
OPENSSL_free(label);
|
||||
return false;
|
||||
diff --git a/src/crypto/crypto_common.cc b/src/crypto/crypto_common.cc
|
||||
index f4b7bd3ad8548a0b69943ddea669e6f1991b7a49..221d652fa7de246e5f69fcf392e334087bac0199 100644
|
||||
--- a/src/crypto/crypto_common.cc
|
||||
+++ b/src/crypto/crypto_common.cc
|
||||
@@ -242,7 +242,7 @@ const char* GetClientHelloALPN(const SSLPointer& ssl) {
|
||||
const unsigned char* buf;
|
||||
size_t len;
|
||||
size_t rem;
|
||||
-
|
||||
+#ifndef OPENSSL_IS_BORINGSSL
|
||||
if (!SSL_client_hello_get0_ext(
|
||||
ssl.get(),
|
||||
TLSEXT_TYPE_application_layer_protocol_negotiation,
|
||||
@@ -255,13 +255,15 @@ const char* GetClientHelloALPN(const SSLPointer& ssl) {
|
||||
len = (buf[0] << 8) | buf[1];
|
||||
if (len + 2 != rem) return nullptr;
|
||||
return reinterpret_cast<const char*>(buf + 3);
|
||||
+#endif
|
||||
+ return nullptr;
|
||||
}
|
||||
|
||||
const char* GetClientHelloServerName(const SSLPointer& ssl) {
|
||||
const unsigned char* buf;
|
||||
size_t len;
|
||||
size_t rem;
|
||||
-
|
||||
+#ifndef OPENSSL_IS_BORINGSSL
|
||||
if (!SSL_client_hello_get0_ext(
|
||||
ssl.get(),
|
||||
TLSEXT_TYPE_server_name,
|
||||
@@ -283,6 +285,8 @@ const char* GetClientHelloServerName(const SSLPointer& ssl) {
|
||||
if (len + 2 > rem)
|
||||
return nullptr;
|
||||
return reinterpret_cast<const char*>(buf + 5);
|
||||
+#endif
|
||||
+ return nullptr;
|
||||
}
|
||||
|
||||
const char* GetServerName(SSL* ssl) {
|
||||
@@ -290,7 +294,10 @@ const char* GetServerName(SSL* ssl) {
|
||||
}
|
||||
|
||||
bool SetGroups(SecureContext* sc, const char* groups) {
|
||||
+#ifndef OPENSSL_IS_BORINGSSL
|
||||
return SSL_CTX_set1_groups_list(**sc, groups) == 1;
|
||||
+#endif
|
||||
+ return false;
|
||||
}
|
||||
|
||||
const char* X509ErrorCode(long err) { // NOLINT(runtime/int)
|
||||
@@ -757,13 +764,13 @@ MaybeLocal<Array> GetClientHelloCiphers(
|
||||
Environment* env,
|
||||
const SSLPointer& ssl) {
|
||||
EscapableHandleScope scope(env->isolate());
|
||||
- const unsigned char* buf;
|
||||
- size_t len = SSL_client_hello_get0_ciphers(ssl.get(), &buf);
|
||||
+ const unsigned char* buf = nullptr;
|
||||
+ size_t len = 0; // SSL_client_hello_get0_ciphers(ssl.get(), &buf);
|
||||
size_t count = len / 2;
|
||||
MaybeStackBuffer<Local<Value>, 16> ciphers(count);
|
||||
int j = 0;
|
||||
for (size_t n = 0; n < len; n += 2) {
|
||||
- const SSL_CIPHER* cipher = SSL_CIPHER_find(ssl.get(), buf);
|
||||
+ const SSL_CIPHER* cipher = nullptr; // SSL_CIPHER_find(ssl.get(), buf);
|
||||
buf += 2;
|
||||
Local<Object> obj = Object::New(env->isolate());
|
||||
if (!Set(env->context(),
|
||||
diff --git a/src/crypto/crypto_context.cc b/src/crypto/crypto_context.cc
|
||||
index 8feefde819ea8b67c92afd2af7edf1fcc00aabd0..7eb17ee53475fbbedb456f535b7d4a76ea66693e 100644
|
||||
--- a/src/crypto/crypto_context.cc
|
||||
+++ b/src/crypto/crypto_context.cc
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/pkcs12.h>
|
||||
+#include <openssl/rand.h>
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
#include <openssl/engine.h>
|
||||
#endif // !OPENSSL_NO_ENGINE
|
||||
diff --git a/src/crypto/crypto_dh.cc b/src/crypto/crypto_dh.cc
|
||||
index 1c48f98656fd211403354bb88331450e51ffb3e5..19029e058eb7ebbea283ad49be47c0c6246cf4e7 100644
|
||||
--- a/src/crypto/crypto_dh.cc
|
||||
+++ b/src/crypto/crypto_dh.cc
|
||||
@@ -120,13 +120,11 @@ void DiffieHellman::MemoryInfo(MemoryTracker* tracker) const {
|
||||
bool DiffieHellman::Init(const char* p, int p_len, int g) {
|
||||
dh_.reset(DH_new());
|
||||
if (p_len <= 0) {
|
||||
- ERR_put_error(ERR_LIB_BN, BN_F_BN_GENERATE_PRIME_EX,
|
||||
- BN_R_BITS_TOO_SMALL, __FILE__, __LINE__);
|
||||
+ OPENSSL_PUT_ERROR(BN, BN_R_BITS_TOO_SMALL);
|
||||
return false;
|
||||
}
|
||||
if (g <= 1) {
|
||||
- ERR_put_error(ERR_LIB_DH, DH_F_DH_BUILTIN_GENPARAMS,
|
||||
- DH_R_BAD_GENERATOR, __FILE__, __LINE__);
|
||||
+ OPENSSL_PUT_ERROR(DH, DH_R_BAD_GENERATOR);
|
||||
return false;
|
||||
}
|
||||
BIGNUM* bn_p =
|
||||
@@ -144,21 +142,18 @@ bool DiffieHellman::Init(const char* p, int p_len, int g) {
|
||||
bool DiffieHellman::Init(const char* p, int p_len, const char* g, int g_len) {
|
||||
dh_.reset(DH_new());
|
||||
if (p_len <= 0) {
|
||||
- ERR_put_error(ERR_LIB_BN, BN_F_BN_GENERATE_PRIME_EX,
|
||||
- BN_R_BITS_TOO_SMALL, __FILE__, __LINE__);
|
||||
+ OPENSSL_PUT_ERROR(BN, BN_R_BITS_TOO_SMALL);
|
||||
return false;
|
||||
}
|
||||
if (g_len <= 0) {
|
||||
- ERR_put_error(ERR_LIB_DH, DH_F_DH_BUILTIN_GENPARAMS,
|
||||
- DH_R_BAD_GENERATOR, __FILE__, __LINE__);
|
||||
+ OPENSSL_PUT_ERROR(DH, DH_R_BAD_GENERATOR);
|
||||
return false;
|
||||
}
|
||||
BIGNUM* bn_g =
|
||||
BN_bin2bn(reinterpret_cast<const unsigned char*>(g), g_len, nullptr);
|
||||
if (BN_is_zero(bn_g) || BN_is_one(bn_g)) {
|
||||
BN_free(bn_g);
|
||||
- ERR_put_error(ERR_LIB_DH, DH_F_DH_BUILTIN_GENPARAMS,
|
||||
- DH_R_BAD_GENERATOR, __FILE__, __LINE__);
|
||||
+ OPENSSL_PUT_ERROR(DH, DH_R_BAD_GENERATOR);
|
||||
return false;
|
||||
}
|
||||
BIGNUM* bn_p =
|
||||
@@ -478,16 +473,20 @@ EVPKeyCtxPointer DhKeyGenTraits::Setup(DhKeyPairGenConfig* params) {
|
||||
if (!BN_set_word(bn_g.get(), params->params.generator) ||
|
||||
!DH_set0_pqg(dh.get(), prime, nullptr, bn_g.get()))
|
||||
return EVPKeyCtxPointer();
|
||||
-
|
||||
+#ifndef OPENSSL_IS_BORINGSSL
|
||||
params->params.prime_fixed_value.release();
|
||||
bn_g.release();
|
||||
|
||||
key_params = EVPKeyPointer(EVP_PKEY_new());
|
||||
CHECK(key_params);
|
||||
EVP_PKEY_assign_DH(key_params.get(), dh.release());
|
||||
+#else
|
||||
+ return EVPKeyCtxPointer();
|
||||
+#endif
|
||||
} else {
|
||||
EVPKeyCtxPointer param_ctx(EVP_PKEY_CTX_new_id(EVP_PKEY_DH, nullptr));
|
||||
EVP_PKEY* raw_params = nullptr;
|
||||
+#ifndef OPENSSL_IS_BORINGSSL
|
||||
if (!param_ctx ||
|
||||
EVP_PKEY_paramgen_init(param_ctx.get()) <= 0 ||
|
||||
EVP_PKEY_CTX_set_dh_paramgen_prime_len(
|
||||
@@ -499,8 +498,10 @@ EVPKeyCtxPointer DhKeyGenTraits::Setup(DhKeyPairGenConfig* params) {
|
||||
EVP_PKEY_paramgen(param_ctx.get(), &raw_params) <= 0) {
|
||||
return EVPKeyCtxPointer();
|
||||
}
|
||||
-
|
||||
key_params = EVPKeyPointer(raw_params);
|
||||
+#else
|
||||
+ return EVPKeyCtxPointer();
|
||||
+#endif
|
||||
}
|
||||
|
||||
EVPKeyCtxPointer ctx(EVP_PKEY_CTX_new(key_params.get(), nullptr));
|
||||
diff --git a/src/crypto/crypto_dsa.cc b/src/crypto/crypto_dsa.cc
|
||||
index 271db427fa8539feb30c1712574976fb1f623e91..b2b6af1f9e6db54bdff0be7a567255f47da7b918 100644
|
||||
--- a/src/crypto/crypto_dsa.cc
|
||||
+++ b/src/crypto/crypto_dsa.cc
|
||||
@@ -29,7 +29,7 @@ namespace crypto {
|
||||
EVPKeyCtxPointer DsaKeyGenTraits::Setup(DsaKeyPairGenConfig* params) {
|
||||
EVPKeyCtxPointer param_ctx(EVP_PKEY_CTX_new_id(EVP_PKEY_DSA, nullptr));
|
||||
EVP_PKEY* raw_params = nullptr;
|
||||
-
|
||||
+#ifndef OPENSSL_IS_BORINGSSL
|
||||
if (!param_ctx ||
|
||||
EVP_PKEY_paramgen_init(param_ctx.get()) <= 0 ||
|
||||
EVP_PKEY_CTX_set_dsa_paramgen_bits(
|
||||
@@ -49,7 +49,9 @@ EVPKeyCtxPointer DsaKeyGenTraits::Setup(DsaKeyPairGenConfig* params) {
|
||||
return EVPKeyCtxPointer();
|
||||
}
|
||||
}
|
||||
-
|
||||
+#else
|
||||
+ return EVPKeyCtxPointer();
|
||||
+#endif
|
||||
if (EVP_PKEY_paramgen(param_ctx.get(), &raw_params) <= 0)
|
||||
return EVPKeyCtxPointer();
|
||||
|
||||
diff --git a/src/crypto/crypto_ec.cc b/src/crypto/crypto_ec.cc
|
||||
index ea4c70ad5d8c844860ba3480fc7ef4205f0a3cdc..cdf8dd47d6e2a5894066cec01fbe347af079ec22 100644
|
||||
--- a/src/crypto/crypto_ec.cc
|
||||
+++ b/src/crypto/crypto_ec.cc
|
||||
@@ -314,7 +314,7 @@ void ECDH::SetPrivateKey(const FunctionCallbackInfo<Value>& args) {
|
||||
return THROW_ERR_CRYPTO_OPERATION_FAILED(env,
|
||||
"Failed to set generated public key");
|
||||
|
||||
- EC_KEY_copy(ecdh->key_.get(), new_key.get());
|
||||
+ ecdh->key_.reset(EC_KEY_dup(new_key.get()));
|
||||
ecdh->group_ = EC_KEY_get0_group(ecdh->key_.get());
|
||||
}
|
||||
|
||||
diff --git a/src/crypto/crypto_hkdf.cc b/src/crypto/crypto_hkdf.cc
|
||||
index 0aa96ada47abe4b66fb616c665101278bbe0afb6..1e9a4863c5faea5f6b275483ca16f3a6e8dac25b 100644
|
||||
--- a/src/crypto/crypto_hkdf.cc
|
||||
+++ b/src/crypto/crypto_hkdf.cc
|
||||
@@ -101,6 +101,7 @@ bool HKDFTraits::DeriveBits(
|
||||
Environment* env,
|
||||
const HKDFConfig& params,
|
||||
ByteSource* out) {
|
||||
+#ifndef OPENSSL_IS_BORINGSSL
|
||||
EVPKeyCtxPointer ctx =
|
||||
EVPKeyCtxPointer(EVP_PKEY_CTX_new_id(EVP_PKEY_HKDF, nullptr));
|
||||
if (!ctx ||
|
||||
@@ -132,6 +133,9 @@ bool HKDFTraits::DeriveBits(
|
||||
|
||||
*out = std::move(buf);
|
||||
return true;
|
||||
+#else
|
||||
+ return false;
|
||||
+#endif
|
||||
}
|
||||
|
||||
void HKDFConfig::MemoryInfo(MemoryTracker* tracker) const {
|
||||
diff --git a/src/crypto/crypto_random.cc b/src/crypto/crypto_random.cc
|
||||
index b24f8f32136ffaed54310d5dc02e57b0f69450d6..50a6663966cdb147a702df21240fa449850c3549 100644
|
||||
--- a/src/crypto/crypto_random.cc
|
||||
+++ b/src/crypto/crypto_random.cc
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "v8.h"
|
||||
|
||||
#include <openssl/bn.h>
|
||||
+#include <openssl/rand.h>
|
||||
|
||||
namespace node {
|
||||
|
||||
@@ -149,7 +150,7 @@ Maybe<bool> RandomPrimeTraits::AdditionalConfig(
|
||||
|
||||
params->bits = bits;
|
||||
params->safe = safe;
|
||||
- params->prime.reset(BN_secure_new());
|
||||
+ params->prime.reset(BN_new());
|
||||
if (!params->prime) {
|
||||
THROW_ERR_CRYPTO_OPERATION_FAILED(env, "could not generate prime");
|
||||
return Nothing<bool>();
|
||||
diff --git a/src/crypto/crypto_rsa.cc b/src/crypto/crypto_rsa.cc
|
||||
index 5fa91cce1a6ad2bc1167e20a4dadcfdfc2343440..5bbeb01ab58ac7f95e2c4ee1357f50540be86229 100644
|
||||
--- a/src/crypto/crypto_rsa.cc
|
||||
+++ b/src/crypto/crypto_rsa.cc
|
||||
@@ -210,7 +210,10 @@ WebCryptoCipherStatus RSA_Cipher(
|
||||
if (label_len > 0) {
|
||||
void* label = OPENSSL_memdup(params.label.get(), label_len);
|
||||
CHECK_NOT_NULL(label);
|
||||
- if (EVP_PKEY_CTX_set0_rsa_oaep_label(ctx.get(), label, label_len) <= 0) {
|
||||
+ if (EVP_PKEY_CTX_set0_rsa_oaep_label(
|
||||
+ ctx.get(),
|
||||
+ static_cast<unsigned char*>(label),
|
||||
+ label_len) <= 0) {
|
||||
OPENSSL_free(label);
|
||||
return WebCryptoCipherStatus::FAILED;
|
||||
}
|
||||
diff --git a/src/crypto/crypto_sig.cc b/src/crypto/crypto_sig.cc
|
||||
index 7b113a8dcb06b0b0e1329ce0daf7305598ea6545..b04e53a7f24885ffb6639430988d0ffb524b028e 100644
|
||||
--- a/src/crypto/crypto_sig.cc
|
||||
+++ b/src/crypto/crypto_sig.cc
|
||||
@@ -110,7 +110,7 @@ unsigned int GetBytesOfRS(const ManagedEVPPKey& pkey) {
|
||||
if (base_id == EVP_PKEY_DSA) {
|
||||
const DSA* dsa_key = EVP_PKEY_get0_DSA(pkey.get());
|
||||
// Both r and s are computed mod q, so their width is limited by that of q.
|
||||
- bits = BN_num_bits(DSA_get0_q(dsa_key));
|
||||
+ bits = BN_num_bits(dsa_key->q);
|
||||
} else if (base_id == EVP_PKEY_EC) {
|
||||
const EC_KEY* ec_key = EVP_PKEY_get0_EC_KEY(pkey.get());
|
||||
const EC_GROUP* ec_group = EC_KEY_get0_group(ec_key);
|
||||
diff --git a/src/crypto/crypto_util.cc b/src/crypto/crypto_util.cc
|
||||
index 0d533ce42531d147a4c99fef5a72c311e0796150..76c8c037ffd3c8b67179d7d881ad6ea530b00686 100644
|
||||
--- a/src/crypto/crypto_util.cc
|
||||
+++ b/src/crypto/crypto_util.cc
|
||||
@@ -20,6 +20,8 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
+#include <openssl/rand.h>
|
||||
+
|
||||
namespace node {
|
||||
|
||||
using v8::ArrayBuffer;
|
||||
@@ -118,7 +120,6 @@ void InitCryptoOnce() {
|
||||
OPENSSL_init_ssl(0, settings);
|
||||
OPENSSL_INIT_free(settings);
|
||||
settings = nullptr;
|
||||
-#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
if (per_process::cli_options->secure_heap != 0) {
|
||||
@@ -137,6 +138,7 @@ void InitCryptoOnce() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
+#endif
|
||||
#endif
|
||||
|
||||
/* Override FIPS settings in cnf file, if needed. */
|
||||
@@ -488,24 +490,14 @@ Maybe<bool> Decorate(Environment* env, Local<Object> obj,
|
||||
V(BIO) \
|
||||
V(PKCS7) \
|
||||
V(X509V3) \
|
||||
- V(PKCS12) \
|
||||
V(RAND) \
|
||||
- V(DSO) \
|
||||
V(ENGINE) \
|
||||
V(OCSP) \
|
||||
V(UI) \
|
||||
V(COMP) \
|
||||
V(ECDSA) \
|
||||
V(ECDH) \
|
||||
- V(OSSL_STORE) \
|
||||
- V(FIPS) \
|
||||
- V(CMS) \
|
||||
- V(TS) \
|
||||
V(HMAC) \
|
||||
- V(CT) \
|
||||
- V(ASYNC) \
|
||||
- V(KDF) \
|
||||
- V(SM2) \
|
||||
V(USER) \
|
||||
|
||||
#define V(name) case ERR_LIB_##name: lib = #name "_"; break;
|
||||
@@ -665,7 +657,7 @@ void SecureBuffer(const FunctionCallbackInfo<Value>& args) {
|
||||
CHECK(args[0]->IsUint32());
|
||||
Environment* env = Environment::GetCurrent(args);
|
||||
uint32_t len = args[0].As<Uint32>()->Value();
|
||||
- char* data = static_cast<char*>(OPENSSL_secure_malloc(len));
|
||||
+ char* data = static_cast<char*>(OPENSSL_malloc(len));
|
||||
if (data == nullptr) {
|
||||
// There's no memory available for the allocation.
|
||||
// Return nothing.
|
||||
@@ -677,7 +669,7 @@ void SecureBuffer(const FunctionCallbackInfo<Value>& args) {
|
||||
data,
|
||||
len,
|
||||
[](void* data, size_t len, void* deleter_data) {
|
||||
- OPENSSL_secure_clear_free(data, len);
|
||||
+ OPENSSL_clear_free(data, len);
|
||||
},
|
||||
data);
|
||||
Local<ArrayBuffer> buffer = ArrayBuffer::New(env->isolate(), store);
|
||||
@@ -685,10 +677,12 @@ void SecureBuffer(const FunctionCallbackInfo<Value>& args) {
|
||||
}
|
||||
|
||||
void SecureHeapUsed(const FunctionCallbackInfo<Value>& args) {
|
||||
+#ifndef OPENSSL_IS_BORINGSSL
|
||||
Environment* env = Environment::GetCurrent(args);
|
||||
if (CRYPTO_secure_malloc_initialized())
|
||||
args.GetReturnValue().Set(
|
||||
BigInt::New(env->isolate(), CRYPTO_secure_used()));
|
||||
+#endif
|
||||
}
|
||||
} // namespace
|
||||
|
||||
diff --git a/src/crypto/crypto_util.h b/src/crypto/crypto_util.h
|
||||
index f2f61aa45185812e9248845b664539be4fe24550..303ba4c3b7c4c2fc5dee906e22d5e7642b8351c8 100644
|
||||
--- a/src/crypto/crypto_util.h
|
||||
+++ b/src/crypto/crypto_util.h
|
||||
@@ -15,7 +15,9 @@
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/ec.h>
|
||||
+#ifndef OPENSSL_IS_BORINGSSL
|
||||
#include <openssl/kdf.h>
|
||||
+#endif
|
||||
#include <openssl/rsa.h>
|
||||
#include <openssl/dsa.h>
|
||||
#include <openssl/ssl.h>
|
||||
diff --git a/src/node.cc b/src/node.cc
|
||||
index a99f2f4f01b16fc70f3038a25da22c788714b3f6..ceb532648b33a6c2f3b8a135b315985cfff5419e 100644
|
||||
--- a/src/node.cc
|
||||
+++ b/src/node.cc
|
||||
@@ -1020,7 +1020,7 @@ InitializationResult InitializeOncePerProcess(int argc, char** argv) {
|
||||
return result;
|
||||
}
|
||||
|
||||
-#if HAVE_OPENSSL
|
||||
+#if HAVE_OPENSSL && !defined(OPENSSL_IS_BORINGSSL)
|
||||
{
|
||||
std::string extra_ca_certs;
|
||||
if (credentials::SafeGetenv("NODE_EXTRA_CA_CERTS", &extra_ca_certs))
|
||||
diff --git a/src/node_metadata.h b/src/node_metadata.h
|
||||
index 4486d5af2c1622c7c8f44401dc3ebb986d8e3c2e..db1769f1b3f1617ed8dbbea57b5e324183b42be2 100644
|
||||
--- a/src/node_metadata.h
|
||||
+++ b/src/node_metadata.h
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <string>
|
||||
#include "node_version.h"
|
||||
|
||||
-#if HAVE_OPENSSL
|
||||
+#if 0
|
||||
#include <openssl/crypto.h>
|
||||
#endif // HAVE_OPENSSL
|
||||
|
|
@ -6,7 +6,7 @@ Subject: fix: handle new ToString() behavior in v8 serdes test
|
|||
Refs: https://chromium-review.googlesource.com/c/v8/v8/+/2739980
|
||||
|
||||
diff --git a/test/parallel/test-v8-serdes.js b/test/parallel/test-v8-serdes.js
|
||||
index f080f551396c8bb27e16448babecca2f2ad18a2b..d7304e6255648bd19c66012b55b93598d5ffa66d 100644
|
||||
index 1d3b6ff81168e704aa67e7abe1556c460e06ffa9..4dffedd3c32b4b1b6eb75e46f8bfb447260046bb 100644
|
||||
--- a/test/parallel/test-v8-serdes.js
|
||||
+++ b/test/parallel/test-v8-serdes.js
|
||||
@@ -50,7 +50,7 @@ const hostObject = new (internalBinding('js_stream').JSStream)();
|
||||
|
|
|
@ -1,126 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cheng Zhao <zcbenz@gmail.com>
|
||||
Date: Fri, 29 Mar 2019 16:50:56 +0900
|
||||
Subject: fix: key gen APIs are not available in BoringSSL
|
||||
|
||||
This will make Node's key pair generation APIs fail.
|
||||
|
||||
diff --git a/src/node_crypto.cc b/src/node_crypto.cc
|
||||
index bd40705e6b1ae0927239a06c40a2181e4458b1c4..79e781fb3e6ec63334c2c5d4b24d2a6049be79fc 100644
|
||||
--- a/src/node_crypto.cc
|
||||
+++ b/src/node_crypto.cc
|
||||
@@ -291,24 +291,14 @@ Maybe<bool> Decorate(Environment* env, Local<Object> obj,
|
||||
V(BIO) \
|
||||
V(PKCS7) \
|
||||
V(X509V3) \
|
||||
- V(PKCS12) \
|
||||
V(RAND) \
|
||||
- V(DSO) \
|
||||
V(ENGINE) \
|
||||
V(OCSP) \
|
||||
V(UI) \
|
||||
V(COMP) \
|
||||
V(ECDSA) \
|
||||
V(ECDH) \
|
||||
- V(OSSL_STORE) \
|
||||
- V(FIPS) \
|
||||
- V(CMS) \
|
||||
- V(TS) \
|
||||
V(HMAC) \
|
||||
- V(CT) \
|
||||
- V(ASYNC) \
|
||||
- V(KDF) \
|
||||
- V(SM2) \
|
||||
V(USER) \
|
||||
|
||||
#define V(name) case ERR_LIB_##name: lib = #name "_"; break;
|
||||
@@ -6138,6 +6128,7 @@ class DSAKeyPairGenerationConfig : public KeyPairGenerationConfig {
|
||||
if (EVP_PKEY_paramgen_init(param_ctx.get()) <= 0)
|
||||
return nullptr;
|
||||
|
||||
+#ifndef OPENSSL_IS_BORINGSSL
|
||||
if (EVP_PKEY_CTX_set_dsa_paramgen_bits(param_ctx.get(), modulus_bits_) <= 0)
|
||||
return nullptr;
|
||||
|
||||
@@ -6148,6 +6139,7 @@ class DSAKeyPairGenerationConfig : public KeyPairGenerationConfig {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
+#endif
|
||||
|
||||
EVP_PKEY* raw_params = nullptr;
|
||||
if (EVP_PKEY_paramgen(param_ctx.get(), &raw_params) <= 0)
|
||||
diff --git a/src/node_crypto_common.cc b/src/node_crypto_common.cc
|
||||
index 6473b652ac95609aff555d99be38b48a5aa513a5..caaaf19dc02101c2024b511780c94fc85476b7a2 100644
|
||||
--- a/src/node_crypto_common.cc
|
||||
+++ b/src/node_crypto_common.cc
|
||||
@@ -240,10 +240,10 @@ int UseSNIContext(const SSLPointer& ssl, BaseObjectPtr<SecureContext> context) {
|
||||
}
|
||||
|
||||
const char* GetClientHelloALPN(const SSLPointer& ssl) {
|
||||
+#ifndef OPENSSL_IS_BORINGSSL
|
||||
const unsigned char* buf;
|
||||
size_t len;
|
||||
size_t rem;
|
||||
-
|
||||
if (!SSL_client_hello_get0_ext(
|
||||
ssl.get(),
|
||||
TLSEXT_TYPE_application_layer_protocol_negotiation,
|
||||
@@ -252,17 +252,18 @@ const char* GetClientHelloALPN(const SSLPointer& ssl) {
|
||||
rem < 2) {
|
||||
return nullptr;
|
||||
}
|
||||
-
|
||||
len = (buf[0] << 8) | buf[1];
|
||||
if (len + 2 != rem) return nullptr;
|
||||
return reinterpret_cast<const char*>(buf + 3);
|
||||
+#endif
|
||||
+ return nullptr;
|
||||
}
|
||||
|
||||
const char* GetClientHelloServerName(const SSLPointer& ssl) {
|
||||
+#ifndef OPENSSL_IS_BORINGSSL
|
||||
const unsigned char* buf;
|
||||
size_t len;
|
||||
size_t rem;
|
||||
-
|
||||
if (!SSL_client_hello_get0_ext(
|
||||
ssl.get(),
|
||||
TLSEXT_TYPE_server_name,
|
||||
@@ -284,6 +285,8 @@ const char* GetClientHelloServerName(const SSLPointer& ssl) {
|
||||
if (len + 2 > rem)
|
||||
return nullptr;
|
||||
return reinterpret_cast<const char*>(buf + 5);
|
||||
+#endif
|
||||
+ return nullptr;
|
||||
}
|
||||
|
||||
const char* GetServerName(SSL* ssl) {
|
||||
@@ -291,7 +294,10 @@ const char* GetServerName(SSL* ssl) {
|
||||
}
|
||||
|
||||
bool SetGroups(SecureContext* sc, const char* groups) {
|
||||
+#ifndef OPENSSL_IS_BORINGSSL
|
||||
return SSL_CTX_set1_groups_list(**sc, groups) == 1;
|
||||
+#endif
|
||||
+ return false;
|
||||
}
|
||||
|
||||
const char* X509ErrorCode(long err) { // NOLINT(runtime/int)
|
||||
@@ -768,13 +774,13 @@ MaybeLocal<Array> GetClientHelloCiphers(
|
||||
Environment* env,
|
||||
const SSLPointer& ssl) {
|
||||
EscapableHandleScope scope(env->isolate());
|
||||
- const unsigned char* buf;
|
||||
- size_t len = SSL_client_hello_get0_ciphers(ssl.get(), &buf);
|
||||
+ const unsigned char* buf = nullptr;
|
||||
+ size_t len = 0; // SSL_client_hello_get0_ciphers(ssl.get(), &buf);
|
||||
size_t count = len / 2;
|
||||
MaybeStackBuffer<Local<Value>, 16> ciphers(count);
|
||||
int j = 0;
|
||||
for (size_t n = 0; n < len; n += 2) {
|
||||
- const SSL_CIPHER* cipher = SSL_CIPHER_find(ssl.get(), buf);
|
||||
+ const SSL_CIPHER* cipher = nullptr; // SSL_CIPHER_find(ssl.get(), buf);
|
||||
buf += 2;
|
||||
Local<Object> obj = Object::New(env->isolate());
|
||||
if (!Set(env->context(),
|
|
@ -1,67 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Tue, 12 Jan 2021 09:17:14 -0800
|
||||
Subject: fix: remove outdated --experimental-wasm-bigint flag
|
||||
|
||||
The --experimental-wasm-bigint flag was removed in https://chromium-review.googlesource.com/c/v8/v8/+/2610965
|
||||
but not yet from Node v14, as its version of V8 is not recent enough.
|
||||
|
||||
This patch can be removed as soon as we upgrade Node.js to a version of
|
||||
V8 which contains the above CL.
|
||||
|
||||
diff --git a/test/wasi/test-return-on-exit.js b/test/wasi/test-return-on-exit.js
|
||||
index eef97996fbf7442a6bdd808fe1b5b6eab148f322..e61f4174c3d4ee3778f5d0d5aeb2270f263ee63f 100644
|
||||
--- a/test/wasi/test-return-on-exit.js
|
||||
+++ b/test/wasi/test-return-on-exit.js
|
||||
@@ -1,4 +1,4 @@
|
||||
-// Flags: --experimental-wasi-unstable-preview1 --experimental-wasm-bigint
|
||||
+// Flags: --experimental-wasi-unstable-preview1
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
diff --git a/test/wasi/test-wasi-not-started.js b/test/wasi/test-wasi-not-started.js
|
||||
index ad13e6d711802b029c4b536f2ed8944484d821cf..14c8cdfddf2f5cc7c8219cc7810bbdcb56482905 100644
|
||||
--- a/test/wasi/test-wasi-not-started.js
|
||||
+++ b/test/wasi/test-wasi-not-started.js
|
||||
@@ -29,7 +29,6 @@ if (process.argv[2] === 'wasi-child') {
|
||||
|
||||
const child = cp.spawnSync(process.execPath, [
|
||||
'--experimental-wasi-unstable-preview1',
|
||||
- '--experimental-wasm-bigint',
|
||||
__filename,
|
||||
'wasi-child'
|
||||
], {
|
||||
diff --git a/test/wasi/test-wasi-stdio.js b/test/wasi/test-wasi-stdio.js
|
||||
index 4abe3c1ad8ae0d7af7b57040fdc4b146931a2b15..647990064efb438e36b0c5ec9a3480338d09b2f9 100644
|
||||
--- a/test/wasi/test-wasi-stdio.js
|
||||
+++ b/test/wasi/test-wasi-stdio.js
|
||||
@@ -1,4 +1,4 @@
|
||||
-// Flags: --experimental-wasi-unstable-preview1 --experimental-wasm-bigint
|
||||
+// Flags: --experimental-wasi-unstable-preview1
|
||||
'use strict';
|
||||
require('../common');
|
||||
const tmpdir = require('../common/tmpdir');
|
||||
diff --git a/test/wasi/test-wasi-symlinks.js b/test/wasi/test-wasi-symlinks.js
|
||||
index d1ec796125cb532e95e27562620312fdae40fac3..f619a8a2439a7d0c8624ffb31f1a83b87a9ad5ba 100644
|
||||
--- a/test/wasi/test-wasi-symlinks.js
|
||||
+++ b/test/wasi/test-wasi-symlinks.js
|
||||
@@ -62,7 +62,6 @@ if (process.argv[2] === 'wasi-child') {
|
||||
const opts = { env: { ...process.env, NODE_DEBUG_NATIVE: 'wasi' } };
|
||||
const child = cp.spawnSync(process.execPath, [
|
||||
'--experimental-wasi-unstable-preview1',
|
||||
- '--experimental-wasm-bigint',
|
||||
__filename,
|
||||
'wasi-child',
|
||||
options.test,
|
||||
diff --git a/test/wasi/test-wasi.js b/test/wasi/test-wasi.js
|
||||
index b4c404e515cbb2a54eac4fd52eb92d8535b577d9..85543255b2ddf8f8ebd7f7893ea0fe0c60513b22 100644
|
||||
--- a/test/wasi/test-wasi.js
|
||||
+++ b/test/wasi/test-wasi.js
|
||||
@@ -51,7 +51,6 @@ if (process.argv[2] === 'wasi-child') {
|
||||
|
||||
const child = cp.spawnSync(process.execPath, [
|
||||
'--experimental-wasi-unstable-preview1',
|
||||
- '--experimental-wasm-bigint',
|
||||
__filename,
|
||||
'wasi-child',
|
||||
options.test
|
|
@ -1,49 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Wed, 12 Feb 2020 15:08:04 -0800
|
||||
Subject: fix: use crypto impls for compat
|
||||
|
||||
BoringSSL does not export DSA_get0_q, OPENSSL_secure_malloc, or
|
||||
OPENSSL_secure_clear_free.
|
||||
|
||||
This patch works around the DSA_get0_q problem by using the
|
||||
implementations of that function as found in the OpenSSL repo.
|
||||
|
||||
Node.js added the malloc/free incompatibilities in https://github.com/nodejs/node/pull/36729
|
||||
though they don't use secure heap at the moment. This makes it equivalent
|
||||
to swap these out with OPENSSL_malloc and OPENSSL_clear_free at present.
|
||||
We can revisit this once that happens and determine a more mutually
|
||||
compatible path forward either by upstreaming a shim to BoringSSL or
|
||||
adapting Node.js.
|
||||
|
||||
diff --git a/src/node_crypto.cc b/src/node_crypto.cc
|
||||
index 79e781fb3e6ec63334c2c5d4b24d2a6049be79fc..c119b2314f18d1710bb3cbf1910c86ff994ec951 100644
|
||||
--- a/src/node_crypto.cc
|
||||
+++ b/src/node_crypto.cc
|
||||
@@ -4574,7 +4574,7 @@ static unsigned int GetBytesOfRS(const ManagedEVPPKey& pkey) {
|
||||
if (base_id == EVP_PKEY_DSA) {
|
||||
DSA* dsa_key = EVP_PKEY_get0_DSA(pkey.get());
|
||||
// Both r and s are computed mod q, so their width is limited by that of q.
|
||||
- bits = BN_num_bits(DSA_get0_q(dsa_key));
|
||||
+ bits = BN_num_bits(dsa_key->q);
|
||||
} else if (base_id == EVP_PKEY_EC) {
|
||||
EC_KEY* ec_key = EVP_PKEY_get0_EC_KEY(pkey.get());
|
||||
const EC_GROUP* ec_group = EC_KEY_get0_group(ec_key);
|
||||
@@ -6949,7 +6949,7 @@ void SecureBuffer(const FunctionCallbackInfo<Value>& args) {
|
||||
CHECK(args[0]->IsUint32());
|
||||
Environment* env = Environment::GetCurrent(args);
|
||||
uint32_t len = args[0].As<Uint32>()->Value();
|
||||
- char* data = static_cast<char*>(OPENSSL_secure_malloc(len));
|
||||
+ char* data = static_cast<char*>(OPENSSL_malloc(len));
|
||||
if (data == nullptr) {
|
||||
// There's no memory available for the allocation.
|
||||
// Return nothing.
|
||||
@@ -6961,7 +6961,7 @@ void SecureBuffer(const FunctionCallbackInfo<Value>& args) {
|
||||
data,
|
||||
len,
|
||||
[](void* data, size_t len, void* deleter_data) {
|
||||
- OPENSSL_secure_clear_free(data, len);
|
||||
+ OPENSSL_clear_free(data, len);
|
||||
},
|
||||
data);
|
||||
Local<ArrayBuffer> buffer = ArrayBuffer::New(env->isolate(), store);
|
|
@ -7,10 +7,10 @@ This broke the build at some point. Does it still? We should probably remove
|
|||
this patch and find out!
|
||||
|
||||
diff --git a/src/node_internals.h b/src/node_internals.h
|
||||
index aa7180e18544cab4004a0ef87ba230bd2e732d28..0a01dcd8ed194b205d7fe510451315610e5a60be 100644
|
||||
index b75092d662dc975d147be353b65d14b59ad9e17a..899af0ce5f0c5311008743307294d77e7909564b 100644
|
||||
--- a/src/node_internals.h
|
||||
+++ b/src/node_internals.h
|
||||
@@ -368,10 +368,11 @@ class TraceEventScope {
|
||||
@@ -378,10 +378,11 @@ class TraceEventScope {
|
||||
TraceEventScope(const char* category,
|
||||
const char* name,
|
||||
void* id) : category_(category), name_(name), id_(id) {
|
||||
|
|
|
@ -7,19 +7,15 @@ We need to hack the search paths of the require function so we can
|
|||
load libraries from embedded applications without modifications of
|
||||
node's module code.
|
||||
|
||||
(cherry picked from commit 76ba048c37588ee32636817fa7b8dffc64330cbf)
|
||||
|
||||
diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js
|
||||
index ebe0c741c9e177fe99631643030f97e8545c3368..82c08cd17b33c14b85e6586269b5dc4b233fd9e6 100644
|
||||
index fbfc17ba6d188537c9fc3dbfb86cae9b708541f7..0390f2a9a2c82f33918407091c086dcc3cbffae1 100644
|
||||
--- a/lib/internal/modules/cjs/loader.js
|
||||
+++ b/lib/internal/modules/cjs/loader.js
|
||||
@@ -1199,8 +1199,8 @@ Module._initPaths = function() {
|
||||
|
||||
@@ -1236,7 +1236,7 @@ Module._initPaths = function() {
|
||||
modulePaths = paths;
|
||||
|
||||
- // Clone as a shallow copy, for introspection.
|
||||
- Module.globalPaths = modulePaths.slice(0);
|
||||
+ // clone as a shallow copy, for introspection.
|
||||
// Clone as a shallow copy, for introspection.
|
||||
- Module.globalPaths = ArrayPrototypeSlice(modulePaths);
|
||||
+ Module.globalPaths = modulePaths;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,262 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Fedor Indutny <fedor@indutny.com>
|
||||
Date: Sat, 1 May 2021 11:26:46 -0700
|
||||
Subject: node-api: faster threadsafe_function
|
||||
|
||||
Invoke threadsafe_function during the same tick and avoid marshalling
|
||||
costs between threads and/or churning event loop if either:
|
||||
|
||||
1. There's a queued call already
|
||||
2. `Push()` is called while the main thread was running
|
||||
threadsafe_function
|
||||
|
||||
PR-URL: https://github.com/nodejs/node/pull/38506
|
||||
Reviewed-By: Anna Henningsen <anna@addaleax.net>
|
||||
Reviewed-By: Rich Trott <rtrott@gmail.com>
|
||||
Reviewed-By: James M Snell <jasnell@gmail.com>
|
||||
|
||||
diff --git a/src/node_api.cc b/src/node_api.cc
|
||||
index f1a5265b6a7234dc754aedc86ecd3132f3d90b09..d1076b29aeb5133a0325d3e7ebd097d207e4f4a6 100644
|
||||
--- a/src/node_api.cc
|
||||
+++ b/src/node_api.cc
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "tracing/traced_value.h"
|
||||
#include "util-inl.h"
|
||||
|
||||
+#include <atomic>
|
||||
#include <memory>
|
||||
|
||||
struct node_napi_env__ : public napi_env__ {
|
||||
@@ -131,6 +132,7 @@ class ThreadSafeFunction : public node::AsyncResource {
|
||||
*v8::String::Utf8Value(env_->isolate, name)),
|
||||
thread_count(thread_count_),
|
||||
is_closing(false),
|
||||
+ dispatch_state(kDispatchIdle),
|
||||
context(context_),
|
||||
max_queue_size(max_queue_size_),
|
||||
env(env_),
|
||||
@@ -170,10 +172,8 @@ class ThreadSafeFunction : public node::AsyncResource {
|
||||
return napi_closing;
|
||||
}
|
||||
} else {
|
||||
- if (uv_async_send(&async) != 0) {
|
||||
- return napi_generic_failure;
|
||||
- }
|
||||
queue.push(data);
|
||||
+ Send();
|
||||
return napi_ok;
|
||||
}
|
||||
}
|
||||
@@ -205,9 +205,7 @@ class ThreadSafeFunction : public node::AsyncResource {
|
||||
if (is_closing && max_queue_size > 0) {
|
||||
cond->Signal(lock);
|
||||
}
|
||||
- if (uv_async_send(&async) != 0) {
|
||||
- return napi_generic_failure;
|
||||
- }
|
||||
+ Send();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,7 +230,6 @@ class ThreadSafeFunction : public node::AsyncResource {
|
||||
cond = std::make_unique<node::ConditionVariable>();
|
||||
}
|
||||
if (max_queue_size == 0 || cond) {
|
||||
- CHECK_EQ(0, uv_idle_init(loop, &idle));
|
||||
return napi_ok;
|
||||
}
|
||||
|
||||
@@ -257,21 +254,46 @@ class ThreadSafeFunction : public node::AsyncResource {
|
||||
|
||||
napi_status Unref() {
|
||||
uv_unref(reinterpret_cast<uv_handle_t*>(&async));
|
||||
- uv_unref(reinterpret_cast<uv_handle_t*>(&idle));
|
||||
|
||||
return napi_ok;
|
||||
}
|
||||
|
||||
napi_status Ref() {
|
||||
uv_ref(reinterpret_cast<uv_handle_t*>(&async));
|
||||
- uv_ref(reinterpret_cast<uv_handle_t*>(&idle));
|
||||
|
||||
return napi_ok;
|
||||
}
|
||||
|
||||
- void DispatchOne() {
|
||||
+ inline void* Context() {
|
||||
+ return context;
|
||||
+ }
|
||||
+
|
||||
+ protected:
|
||||
+ void Dispatch() {
|
||||
+ bool has_more = true;
|
||||
+
|
||||
+ // Limit maximum synchronous iteration count to prevent event loop
|
||||
+ // starvation. See `src/node_messaging.cc` for an inspiration.
|
||||
+ unsigned int iterations_left = kMaxIterationCount;
|
||||
+ while (has_more && --iterations_left != 0) {
|
||||
+ dispatch_state = kDispatchRunning;
|
||||
+ has_more = DispatchOne();
|
||||
+
|
||||
+ // Send() was called while we were executing the JS function
|
||||
+ if (dispatch_state.exchange(kDispatchIdle) != kDispatchRunning) {
|
||||
+ has_more = true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (has_more) {
|
||||
+ Send();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ bool DispatchOne() {
|
||||
void* data = nullptr;
|
||||
bool popped_value = false;
|
||||
+ bool has_more = false;
|
||||
|
||||
{
|
||||
node::Mutex::ScopedLock lock(this->mutex);
|
||||
@@ -296,9 +318,9 @@ class ThreadSafeFunction : public node::AsyncResource {
|
||||
cond->Signal(lock);
|
||||
}
|
||||
CloseHandlesAndMaybeDelete();
|
||||
- } else {
|
||||
- CHECK_EQ(0, uv_idle_stop(&idle));
|
||||
}
|
||||
+ } else {
|
||||
+ has_more = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -316,6 +338,8 @@ class ThreadSafeFunction : public node::AsyncResource {
|
||||
call_js_cb(env, js_callback, context, data);
|
||||
});
|
||||
}
|
||||
+
|
||||
+ return has_more;
|
||||
}
|
||||
|
||||
void Finalize() {
|
||||
@@ -329,10 +353,6 @@ class ThreadSafeFunction : public node::AsyncResource {
|
||||
EmptyQueueAndDelete();
|
||||
}
|
||||
|
||||
- inline void* Context() {
|
||||
- return context;
|
||||
- }
|
||||
-
|
||||
void CloseHandlesAndMaybeDelete(bool set_closing = false) {
|
||||
v8::HandleScope scope(env->isolate);
|
||||
if (set_closing) {
|
||||
@@ -352,18 +372,20 @@ class ThreadSafeFunction : public node::AsyncResource {
|
||||
ThreadSafeFunction* ts_fn =
|
||||
node::ContainerOf(&ThreadSafeFunction::async,
|
||||
reinterpret_cast<uv_async_t*>(handle));
|
||||
- v8::HandleScope scope(ts_fn->env->isolate);
|
||||
- ts_fn->env->node_env()->CloseHandle(
|
||||
- reinterpret_cast<uv_handle_t*>(&ts_fn->idle),
|
||||
- [](uv_handle_t* handle) -> void {
|
||||
- ThreadSafeFunction* ts_fn =
|
||||
- node::ContainerOf(&ThreadSafeFunction::idle,
|
||||
- reinterpret_cast<uv_idle_t*>(handle));
|
||||
- ts_fn->Finalize();
|
||||
- });
|
||||
+ ts_fn->Finalize();
|
||||
});
|
||||
}
|
||||
|
||||
+ void Send() {
|
||||
+ // Ask currently running Dispatch() to make one more iteration
|
||||
+ unsigned char current_state = dispatch_state.fetch_or(kDispatchPending);
|
||||
+ if ((current_state & kDispatchRunning) == kDispatchRunning) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ CHECK_EQ(0, uv_async_send(&async));
|
||||
+ }
|
||||
+
|
||||
// Default way of calling into JavaScript. Used when ThreadSafeFunction is
|
||||
// without a call_js_cb_.
|
||||
static void CallJs(napi_env env, napi_value cb, void* context, void* data) {
|
||||
@@ -387,16 +409,10 @@ class ThreadSafeFunction : public node::AsyncResource {
|
||||
}
|
||||
}
|
||||
|
||||
- static void IdleCb(uv_idle_t* idle) {
|
||||
- ThreadSafeFunction* ts_fn =
|
||||
- node::ContainerOf(&ThreadSafeFunction::idle, idle);
|
||||
- ts_fn->DispatchOne();
|
||||
- }
|
||||
-
|
||||
static void AsyncCb(uv_async_t* async) {
|
||||
ThreadSafeFunction* ts_fn =
|
||||
node::ContainerOf(&ThreadSafeFunction::async, async);
|
||||
- CHECK_EQ(0, uv_idle_start(&ts_fn->idle, IdleCb));
|
||||
+ ts_fn->Dispatch();
|
||||
}
|
||||
|
||||
static void Cleanup(void* data) {
|
||||
@@ -405,14 +421,20 @@ class ThreadSafeFunction : public node::AsyncResource {
|
||||
}
|
||||
|
||||
private:
|
||||
+ static const unsigned char kDispatchIdle = 0;
|
||||
+ static const unsigned char kDispatchRunning = 1 << 0;
|
||||
+ static const unsigned char kDispatchPending = 1 << 1;
|
||||
+
|
||||
+ static const unsigned int kMaxIterationCount = 1000;
|
||||
+
|
||||
// These are variables protected by the mutex.
|
||||
node::Mutex mutex;
|
||||
std::unique_ptr<node::ConditionVariable> cond;
|
||||
std::queue<void*> queue;
|
||||
uv_async_t async;
|
||||
- uv_idle_t idle;
|
||||
size_t thread_count;
|
||||
bool is_closing;
|
||||
+ std::atomic_uchar dispatch_state;
|
||||
|
||||
// These are variables set once, upon creation, and then never again, which
|
||||
// means we don't need the mutex to read them.
|
||||
diff --git a/test/node-api/test_threadsafe_function/binding.c b/test/node-api/test_threadsafe_function/binding.c
|
||||
index b016dfa6c36656acf4a9010fd6fca18f10785158..339e772aa7e0e67b2448b7c23f5d87002e082305 100644
|
||||
--- a/test/node-api/test_threadsafe_function/binding.c
|
||||
+++ b/test/node-api/test_threadsafe_function/binding.c
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <node_api.h>
|
||||
#include "../../js-native-api/common.h"
|
||||
|
||||
-#define ARRAY_LENGTH 10
|
||||
+#define ARRAY_LENGTH 10000
|
||||
#define MAX_QUEUE_SIZE 2
|
||||
|
||||
static uv_thread_t uv_threads[2];
|
||||
@@ -72,7 +72,7 @@ static void data_source_thread(void* data) {
|
||||
for (index = ARRAY_LENGTH - 1; index > -1 && !queue_was_closing; index--) {
|
||||
status = napi_call_threadsafe_function(ts_fn, &ints[index],
|
||||
ts_fn_info->block_on_full);
|
||||
- if (ts_fn_info->max_queue_size == 0) {
|
||||
+ if (ts_fn_info->max_queue_size == 0 && (index % 1000 == 0)) {
|
||||
// Let's make this thread really busy for 200 ms to give the main thread a
|
||||
// chance to abort.
|
||||
uint64_t start = uv_hrtime();
|
||||
diff --git a/test/node-api/test_threadsafe_function/test.js b/test/node-api/test_threadsafe_function/test.js
|
||||
index 3603d79ee6b5d36590503989d8168368eaf12b03..ccd3f4228a793ae77eff760309e31191ba8de49a 100644
|
||||
--- a/test/node-api/test_threadsafe_function/test.js
|
||||
+++ b/test/node-api/test_threadsafe_function/test.js
|
||||
@@ -210,6 +210,15 @@ new Promise(function testWithoutJSMarshaller(resolve) {
|
||||
}))
|
||||
.then((result) => assert.strictEqual(result.indexOf(0), -1))
|
||||
|
||||
+// Make sure that threadsafe function isn't stalled when we hit
|
||||
+// `kMaxIterationCount` in `src/node_api.cc`
|
||||
+.then(() => testWithJSMarshaller({
|
||||
+ threadStarter: 'StartThreadNonblocking',
|
||||
+ maxQueueSize: binding.ARRAY_LENGTH >>> 1,
|
||||
+ quitAfter: binding.ARRAY_LENGTH
|
||||
+}))
|
||||
+.then((result) => assert.deepStrictEqual(result, expectedArray))
|
||||
+
|
||||
// Start a child process to test rapid teardown
|
||||
.then(() => testUnref(binding.MAX_QUEUE_SIZE))
|
||||
|
|
@ -6,10 +6,10 @@ Subject: Pass all globals through "require"
|
|||
(cherry picked from commit 7d015419cb7a0ecfe6728431a4ed2056cd411d62)
|
||||
|
||||
diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js
|
||||
index 82c08cd17b33c14b85e6586269b5dc4b233fd9e6..ef52bf6486d8c827dce105e50b57c1129dcaf5a4 100644
|
||||
index 0390f2a9a2c82f33918407091c086dcc3cbffae1..9e9f9a73d6ec98f4907b8ebc0950a1709c7ececf 100644
|
||||
--- a/lib/internal/modules/cjs/loader.js
|
||||
+++ b/lib/internal/modules/cjs/loader.js
|
||||
@@ -109,6 +109,13 @@ const {
|
||||
@@ -123,6 +123,13 @@ const {
|
||||
CHAR_COLON
|
||||
} = require('internal/constants');
|
||||
|
||||
|
@ -23,18 +23,18 @@ index 82c08cd17b33c14b85e6586269b5dc4b233fd9e6..ef52bf6486d8c827dce105e50b57c112
|
|||
const {
|
||||
isProxy
|
||||
} = require('internal/util/types');
|
||||
@@ -1063,10 +1070,12 @@ Module.prototype._compile = function(content, filename) {
|
||||
if (requireDepth === 0) statCache = new Map();
|
||||
@@ -1104,10 +1111,12 @@ Module.prototype._compile = function(content, filename) {
|
||||
if (requireDepth === 0) statCache = new SafeMap();
|
||||
if (inspectorWrapper) {
|
||||
result = inspectorWrapper(compiledWrapper, thisValue, exports,
|
||||
- require, module, filename, dirname);
|
||||
+ require, module, filename, dirname,
|
||||
+ process, localGlobal, localBuffer);
|
||||
} else {
|
||||
result = compiledWrapper.call(thisValue, exports, require, module,
|
||||
- filename, dirname);
|
||||
+ filename, dirname, process, localGlobal,
|
||||
+ localBuffer);
|
||||
result = ReflectApply(compiledWrapper, thisValue,
|
||||
- [exports, require, module, filename, dirname]);
|
||||
+ [exports, require, module, filename,
|
||||
+ dirname, process, localGlobal, localBuffer]);
|
||||
}
|
||||
hasLoadedAnyUserCJSModule = true;
|
||||
if (requireDepth === 0) statCache = null;
|
||||
|
|
|
@ -7,10 +7,10 @@ We use this to allow node's 'fs' module to read from ASAR files as if they were
|
|||
a real filesystem.
|
||||
|
||||
diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js
|
||||
index 2705f8b50a658db0fc1ce6fba245792f6a567300..5aab40071b68affe602be16d451be598b246faa1 100644
|
||||
index 81a9547b9071bc7956a6c7c8be0c02eeccb6e993..ca7274622fd95d06cf529db0751da9e189ad556e 100644
|
||||
--- a/lib/internal/bootstrap/node.js
|
||||
+++ b/lib/internal/bootstrap/node.js
|
||||
@@ -57,6 +57,10 @@ setupBuffer();
|
||||
@@ -62,6 +62,10 @@ setupBuffer();
|
||||
process.domain = null;
|
||||
process._exiting = false;
|
||||
|
||||
|
@ -19,13 +19,13 @@ index 2705f8b50a658db0fc1ce6fba245792f6a567300..5aab40071b68affe602be16d451be598
|
|||
+process.internalBinding = internalBinding;
|
||||
+
|
||||
// process.config is serialized config.gypi
|
||||
process.config = JSONParse(internalBinding('native_module').config);
|
||||
require('internal/worker/js_transferable').setup();
|
||||
const nativeModule = internalBinding('native_module');
|
||||
|
||||
diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js
|
||||
index ef52bf6486d8c827dce105e50b57c1129dcaf5a4..e2a205739ce89820fe5f1f24e609ff16b86afb04 100644
|
||||
index 9e9f9a73d6ec98f4907b8ebc0950a1709c7ececf..23f7fcce7cfe8879be95fd949af70da1869e17b3 100644
|
||||
--- a/lib/internal/modules/cjs/loader.js
|
||||
+++ b/lib/internal/modules/cjs/loader.js
|
||||
@@ -71,7 +71,7 @@ const fs = require('fs');
|
||||
@@ -86,7 +86,7 @@ const fs = require('fs');
|
||||
const internalFS = require('internal/fs/utils');
|
||||
const path = require('path');
|
||||
const { sep } = path;
|
||||
|
@ -34,17 +34,17 @@ index ef52bf6486d8c827dce105e50b57c1129dcaf5a4..e2a205739ce89820fe5f1f24e609ff16
|
|||
const packageJsonReader = require('internal/modules/package_json_reader');
|
||||
const { safeGetenv } = internalBinding('credentials');
|
||||
const {
|
||||
@@ -143,7 +143,7 @@ function stat(filename) {
|
||||
@@ -157,7 +157,7 @@ function stat(filename) {
|
||||
const result = statCache.get(filename);
|
||||
if (result !== undefined) return result;
|
||||
}
|
||||
- const result = internalModuleStat(filename);
|
||||
+ const result = internalFsBinding.internalModuleStat(filename);
|
||||
if (statCache !== null) statCache.set(filename, result);
|
||||
return result;
|
||||
}
|
||||
if (statCache !== null && result >= 0) {
|
||||
// Only set cache when `internalModuleStat(filename)` succeeds.
|
||||
statCache.set(filename, result);
|
||||
diff --git a/lib/internal/modules/package_json_reader.js b/lib/internal/modules/package_json_reader.js
|
||||
index 4a2b0e6ddb3ed8881f896c6f556c9debaf778b81..209df9033a26c29c6e60bd173f71055884a0db89 100644
|
||||
index 09eb12bd1533bfed44d9cb62c068e2c880df8ba2..11a6e4b2edc0930049d7acecf2a6e94e51abeb1c 100644
|
||||
--- a/lib/internal/modules/package_json_reader.js
|
||||
+++ b/lib/internal/modules/package_json_reader.js
|
||||
@@ -1,7 +1,7 @@
|
||||
|
@ -60,8 +60,8 @@ index 4a2b0e6ddb3ed8881f896c6f556c9debaf778b81..209df9033a26c29c6e60bd173f710558
|
|||
return cache.get(jsonPath);
|
||||
}
|
||||
|
||||
- const [string, containsKeys] = internalModuleReadJSON(
|
||||
+ const [string, containsKeys] = internalFsBinding.internalModuleReadJSON(
|
||||
- const { 0: string, 1: containsKeys } = internalModuleReadJSON(
|
||||
+ const { 0: string, 1: containsKeys } = internalFsBinding.internalModuleReadJSON(
|
||||
toNamespacedPath(jsonPath)
|
||||
);
|
||||
const result = { string, containsKeys };
|
||||
|
|
|
@ -7,10 +7,10 @@ Subject: refactor: alter child_process.fork to use execute script with
|
|||
When forking a child script, we setup a special environment to make the Electron binary run like the upstream node. On Mac, we use the helper app as node binary.
|
||||
|
||||
diff --git a/lib/child_process.js b/lib/child_process.js
|
||||
index ad5bce3db044d97b5283a8e9b3948bb21cf8970a..56b581121a8423874fd78698167adea5b2d63f27 100644
|
||||
index 26e1bb33d0c9ef7a68c2cc41612eb6c7c0d46575..c55742324ed7508652de3060a8648062b7258244 100644
|
||||
--- a/lib/child_process.js
|
||||
+++ b/lib/child_process.js
|
||||
@@ -123,6 +123,15 @@ function fork(modulePath /* , args, options */) {
|
||||
@@ -137,6 +137,15 @@ function fork(modulePath /* , args, options */) {
|
||||
throw new ERR_CHILD_PROCESS_IPC_REQUIRED('options.stdio');
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Thu, 3 Jun 2021 19:32:09 +0200
|
||||
Subject: src: add get/set pair for unhandled rejections mode
|
||||
|
||||
This PR adds a get/set pair for unhandled rejections modes.
|
||||
|
||||
We do not want unhandled rejections to crash the process and want to
|
||||
be able to control this effectively from C++ and not cli flag
|
||||
which is the only option right now.
|
||||
|
||||
Upstreamed at https://github.com/nodejs/node/pull/38915.
|
||||
|
||||
diff --git a/src/env-inl.h b/src/env-inl.h
|
||||
index 6d34c5125e93bc0f0ce414be573438aec091dbb5..abb2a9cf2652639e3ce636565190d2ed433334b2 100644
|
||||
--- a/src/env-inl.h
|
||||
+++ b/src/env-inl.h
|
||||
@@ -509,6 +509,24 @@ inline bool Environment::abort_on_uncaught_exception() const {
|
||||
return options_->abort_on_uncaught_exception;
|
||||
}
|
||||
|
||||
+inline void Environment::set_unhandled_rejections_mode(
|
||||
+ const std::string& mode) {
|
||||
+ if (!mode.empty() &&
|
||||
+ mode != "warn-with-error-code" &&
|
||||
+ mode != "throw" &&
|
||||
+ mode != "strict" &&
|
||||
+ mode != "warn" &&
|
||||
+ mode != "none") {
|
||||
+ fprintf(stderr, "Invalid unhandled rejections mode: %s\n", mode.c_str());
|
||||
+ } else {
|
||||
+ options_->unhandled_rejections = mode;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+inline std::string Environment::unhandled_rejections_mode() const {
|
||||
+ return options_->unhandled_rejections;
|
||||
+}
|
||||
+
|
||||
inline void Environment::set_force_context_aware(bool value) {
|
||||
options_->force_context_aware = value;
|
||||
}
|
||||
diff --git a/src/env.h b/src/env.h
|
||||
index 2b0088bc29639c4da38a148368fb0dbfa3a19b4c..f84e5989c8fc316b72f2f1f75bb293534b32eaef 100644
|
||||
--- a/src/env.h
|
||||
+++ b/src/env.h
|
||||
@@ -1101,6 +1101,9 @@ class Environment : public MemoryRetainer {
|
||||
void PrintSyncTrace() const;
|
||||
inline void set_trace_sync_io(bool value);
|
||||
|
||||
+ inline void set_unhandled_rejections_mode(const std::string& mode);
|
||||
+ inline std::string unhandled_rejections_mode() const;
|
||||
+
|
||||
inline void set_force_context_aware(bool value);
|
||||
inline bool force_context_aware() const;
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Tue, 1 Jun 2021 14:50:44 +0200
|
||||
Subject: src: add NODE_USE_V8_PLATFORM in InitializeOncePerProcess
|
||||
|
||||
This PR adds an extra `NODE_USE_V8_PLATFORM` guard inside
|
||||
`InitializeOncePerProcess`. We don't use Node.js V8 platform and instead
|
||||
use Chromium's gin library to handle V8 setup.
|
||||
This prevents `v8::V8::Initialize` from being called twice.
|
||||
|
||||
Upstreamed at https://github.com/nodejs/node/pull/38888.
|
||||
|
||||
diff --git a/src/node.cc b/src/node.cc
|
||||
index ceb532648b33a6c2f3b8a135b315985cfff5419e..cbe3ed49d016cfd1cc01a6f7d0795e0e085768e8 100644
|
||||
--- a/src/node.cc
|
||||
+++ b/src/node.cc
|
||||
@@ -1040,11 +1040,14 @@ InitializationResult InitializeOncePerProcess(int argc, char** argv) {
|
||||
V8::SetEntropySource(crypto::EntropySource);
|
||||
#endif // HAVE_OPENSSL
|
||||
|
||||
+#if NODE_USE_V8_PLATFORM
|
||||
per_process::v8_platform.Initialize(
|
||||
static_cast<int>(per_process::cli_options->v8_thread_pool_size));
|
||||
V8::Initialize();
|
||||
performance::performance_v8_start = PERFORMANCE_NOW();
|
||||
per_process::v8_initialized = true;
|
||||
+#endif
|
||||
+
|
||||
return result;
|
||||
}
|
||||
|
|
@ -7,10 +7,10 @@ Subject: src: allow embedders to provide a custom PageAllocator to
|
|||
For certain embedder use cases there are more complex memory allocation requirements that the default V8 page allocator does not handle, for example using MAP_JIT when running under a hardened runtime environment on macOS. This allows such embedders to provide their own allocator that does handle these cases.
|
||||
|
||||
diff --git a/src/api/environment.cc b/src/api/environment.cc
|
||||
index c08fe4b32d4155badb572f15529f903c0ec63146..a8cf0d763f78c2752e3aa22479dadd9fa53c222f 100644
|
||||
index 96dbf0d8325715c8f4db115884e4b68f2c7b7502..981b324891e6c2def77e773de360fff43e0577fd 100644
|
||||
--- a/src/api/environment.cc
|
||||
+++ b/src/api/environment.cc
|
||||
@@ -488,8 +488,9 @@ MultiIsolatePlatform* CreatePlatform(
|
||||
@@ -470,8 +470,9 @@ MultiIsolatePlatform* CreatePlatform(
|
||||
|
||||
MultiIsolatePlatform* CreatePlatform(
|
||||
int thread_pool_size,
|
||||
|
@ -22,7 +22,7 @@ index c08fe4b32d4155badb572f15529f903c0ec63146..a8cf0d763f78c2752e3aa22479dadd9f
|
|||
.release();
|
||||
}
|
||||
|
||||
@@ -499,8 +500,9 @@ void FreePlatform(MultiIsolatePlatform* platform) {
|
||||
@@ -481,8 +482,9 @@ void FreePlatform(MultiIsolatePlatform* platform) {
|
||||
|
||||
std::unique_ptr<MultiIsolatePlatform> MultiIsolatePlatform::Create(
|
||||
int thread_pool_size,
|
||||
|
@ -35,10 +35,10 @@ index c08fe4b32d4155badb572f15529f903c0ec63146..a8cf0d763f78c2752e3aa22479dadd9f
|
|||
|
||||
MaybeLocal<Object> GetPerContextExports(Local<Context> context) {
|
||||
diff --git a/src/node.h b/src/node.h
|
||||
index b646fdda58ebcbf2dd92ee4fc9cb0d9c039174d1..14893ad605b9f8c64b0b8fc28625e235655dcd63 100644
|
||||
index 691c16ba60b0ce8633555825e44c3ace96c5000f..ccb452bbe941c30fdc8c4eb616eb6f0259aa8b8e 100644
|
||||
--- a/src/node.h
|
||||
+++ b/src/node.h
|
||||
@@ -333,7 +333,8 @@ class NODE_EXTERN MultiIsolatePlatform : public v8::Platform {
|
||||
@@ -313,7 +313,8 @@ class NODE_EXTERN MultiIsolatePlatform : public v8::Platform {
|
||||
|
||||
static std::unique_ptr<MultiIsolatePlatform> Create(
|
||||
int thread_pool_size,
|
||||
|
@ -48,18 +48,18 @@ index b646fdda58ebcbf2dd92ee4fc9cb0d9c039174d1..14893ad605b9f8c64b0b8fc28625e235
|
|||
};
|
||||
|
||||
enum IsolateSettingsFlags {
|
||||
@@ -536,7 +537,8 @@ NODE_DEPRECATED("Use variant taking a v8::TracingController* pointer instead",
|
||||
node::tracing::TracingController* tracing_controller));
|
||||
NODE_EXTERN MultiIsolatePlatform* CreatePlatform(
|
||||
int thread_pool_size,
|
||||
- v8::TracingController* tracing_controller);
|
||||
+ v8::TracingController* tracing_controller,
|
||||
+ v8::PageAllocator* = nullptr);
|
||||
NODE_EXTERN void FreePlatform(MultiIsolatePlatform* platform);
|
||||
@@ -494,7 +495,8 @@ NODE_EXTERN node::tracing::Agent* CreateAgent();
|
||||
NODE_DEPRECATED("Use MultiIsolatePlatform::Create() instead",
|
||||
NODE_EXTERN MultiIsolatePlatform* CreatePlatform(
|
||||
int thread_pool_size,
|
||||
- v8::TracingController* tracing_controller));
|
||||
+ v8::TracingController* tracing_controller,
|
||||
+ v8::PageAllocator* = nullptr));
|
||||
NODE_DEPRECATED("Use MultiIsolatePlatform::Create() instead",
|
||||
NODE_EXTERN void FreePlatform(MultiIsolatePlatform* platform));
|
||||
|
||||
// Get/set the currently active tracing controller. Using CreatePlatform()
|
||||
diff --git a/src/node_platform.cc b/src/node_platform.cc
|
||||
index aac0682670fcffd235fcf450bc5e2b0d45985b47..96be2281b562c44b276483970c06862250ea8941 100644
|
||||
index eb918bdd559c404a0e311e0dd92cfee8940491bc..5be79694fef65c9290f1b46d2657581dea16f543 100644
|
||||
--- a/src/node_platform.cc
|
||||
+++ b/src/node_platform.cc
|
||||
@@ -324,12 +324,16 @@ void PerIsolatePlatformData::DecreaseHandleCount() {
|
||||
|
@ -80,7 +80,7 @@ index aac0682670fcffd235fcf450bc5e2b0d45985b47..96be2281b562c44b276483970c068622
|
|||
// TODO(addaleax): It's a bit icky that we use global state here, but we can't
|
||||
// really do anything about it unless V8 starts exposing a way to access the
|
||||
// current v8::Platform instance.
|
||||
@@ -544,6 +548,10 @@ Platform::StackTracePrinter NodePlatform::GetStackTracePrinter() {
|
||||
@@ -550,6 +554,10 @@ Platform::StackTracePrinter NodePlatform::GetStackTracePrinter() {
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -88,11 +88,11 @@ index aac0682670fcffd235fcf450bc5e2b0d45985b47..96be2281b562c44b276483970c068622
|
|||
+ return page_allocator_;
|
||||
+}
|
||||
+
|
||||
std::unique_ptr<v8::JobHandle> NodePlatform::PostJob(v8::TaskPriority priority, std::unique_ptr<v8::JobTask> job_task) {
|
||||
return v8::platform::NewDefaultJobHandle(this, priority, std::move(job_task), 1 /* num_worker_threads */);
|
||||
}
|
||||
template <class T>
|
||||
TaskQueue<T>::TaskQueue()
|
||||
: lock_(), tasks_available_(), tasks_drained_(),
|
||||
diff --git a/src/node_platform.h b/src/node_platform.h
|
||||
index a274be6bbea19a4488bca393712a9ac8b50fe16a..314cf2d1056d30a77ead400d100a4d4c6f844be6 100644
|
||||
index a7139ebdcc28d24087fb49697a0973331e0387a6..4a05f3bba58c8e875d0ab67f292589edbb3b812b 100644
|
||||
--- a/src/node_platform.h
|
||||
+++ b/src/node_platform.h
|
||||
@@ -138,7 +138,8 @@ class WorkerThreadsTaskRunner {
|
||||
|
@ -105,7 +105,7 @@ index a274be6bbea19a4488bca393712a9ac8b50fe16a..314cf2d1056d30a77ead400d100a4d4c
|
|||
~NodePlatform() override;
|
||||
|
||||
void DrainTasks(v8::Isolate* isolate) override;
|
||||
@@ -168,6 +169,7 @@ class NodePlatform : public MultiIsolatePlatform {
|
||||
@@ -170,6 +171,7 @@ class NodePlatform : public MultiIsolatePlatform {
|
||||
v8::Isolate* isolate) override;
|
||||
|
||||
Platform::StackTracePrinter GetStackTracePrinter() override;
|
||||
|
@ -113,7 +113,7 @@ index a274be6bbea19a4488bca393712a9ac8b50fe16a..314cf2d1056d30a77ead400d100a4d4c
|
|||
|
||||
private:
|
||||
IsolatePlatformDelegate* ForIsolate(v8::Isolate* isolate);
|
||||
@@ -179,6 +181,7 @@ class NodePlatform : public MultiIsolatePlatform {
|
||||
@@ -181,6 +183,7 @@ class NodePlatform : public MultiIsolatePlatform {
|
||||
std::unordered_map<v8::Isolate*, DelegatePair> per_isolate_;
|
||||
|
||||
v8::TracingController* tracing_controller_;
|
||||
|
|
|
@ -1,73 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tyler Ang-Wanek <tylerw@axosoft.com>
|
||||
Date: Tue, 19 Jan 2021 07:39:14 -0700
|
||||
Subject: src: inline AsyncCleanupHookHandle in headers
|
||||
|
||||
Fixes: https://github.com/nodejs/node/issues/36349
|
||||
|
||||
PR-URL: https://github.com/nodejs/node/pull/37000
|
||||
Reviewed-By: Anna Henningsen <anna@addaleax.net>
|
||||
Reviewed-By: Rich Trott <rtrott@gmail.com>
|
||||
Reviewed-By: James M Snell <jasnell@gmail.com>
|
||||
|
||||
diff --git a/src/api/hooks.cc b/src/api/hooks.cc
|
||||
index a719a861dbe9d8d9ca67c3bb5920b14b0df16d83..8f191aad7e2dcfbedddeaeb88f47ed721ef51cf1 100644
|
||||
--- a/src/api/hooks.cc
|
||||
+++ b/src/api/hooks.cc
|
||||
@@ -133,7 +133,7 @@ static void RunAsyncCleanupHook(void* arg) {
|
||||
info->fun(info->arg, FinishAsyncCleanupHook, info);
|
||||
}
|
||||
|
||||
-AsyncCleanupHookHandle AddEnvironmentCleanupHook(
|
||||
+ACHHandle* AddEnvironmentCleanupHookInternal(
|
||||
Isolate* isolate,
|
||||
AsyncCleanupHook fun,
|
||||
void* arg) {
|
||||
@@ -145,11 +145,11 @@ AsyncCleanupHookHandle AddEnvironmentCleanupHook(
|
||||
info->arg = arg;
|
||||
info->self = info;
|
||||
env->AddCleanupHook(RunAsyncCleanupHook, info.get());
|
||||
- return AsyncCleanupHookHandle(new ACHHandle { info });
|
||||
+ return new ACHHandle { info };
|
||||
}
|
||||
|
||||
-void RemoveEnvironmentCleanupHook(
|
||||
- AsyncCleanupHookHandle handle) {
|
||||
+void RemoveEnvironmentCleanupHookInternal(
|
||||
+ ACHHandle* handle) {
|
||||
if (handle->info->started) return;
|
||||
handle->info->self.reset();
|
||||
handle->info->env->RemoveCleanupHook(RunAsyncCleanupHook, handle->info.get());
|
||||
diff --git a/src/node.h b/src/node.h
|
||||
index f150725b54ee1315476d202797963369490d5152..7ab2ed9345c83cb4c1f51c0cc3050abc6571e3fa 100644
|
||||
--- a/src/node.h
|
||||
+++ b/src/node.h
|
||||
@@ -905,12 +905,26 @@ struct ACHHandle;
|
||||
struct NODE_EXTERN DeleteACHHandle { void operator()(ACHHandle*) const; };
|
||||
typedef std::unique_ptr<ACHHandle, DeleteACHHandle> AsyncCleanupHookHandle;
|
||||
|
||||
-NODE_EXTERN AsyncCleanupHookHandle AddEnvironmentCleanupHook(
|
||||
+/* This function is not intended to be used externally, it exists to aid in
|
||||
+ * keeping ABI compatibility between Node and Electron. */
|
||||
+NODE_EXTERN ACHHandle* AddEnvironmentCleanupHookInternal(
|
||||
v8::Isolate* isolate,
|
||||
void (*fun)(void* arg, void (*cb)(void*), void* cbarg),
|
||||
void* arg);
|
||||
+inline AsyncCleanupHookHandle AddEnvironmentCleanupHook(
|
||||
+ v8::Isolate* isolate,
|
||||
+ void (*fun)(void* arg, void (*cb)(void*), void* cbarg),
|
||||
+ void* arg) {
|
||||
+ return AsyncCleanupHookHandle(AddEnvironmentCleanupHookInternal(isolate, fun,
|
||||
+ arg));
|
||||
+}
|
||||
|
||||
-NODE_EXTERN void RemoveEnvironmentCleanupHook(AsyncCleanupHookHandle holder);
|
||||
+/* This function is not intended to be used externally, it exists to aid in
|
||||
+ * keeping ABI compatibility between Node and Electron. */
|
||||
+NODE_EXTERN void RemoveEnvironmentCleanupHookInternal(ACHHandle* holder);
|
||||
+inline void RemoveEnvironmentCleanupHook(AsyncCleanupHookHandle holder) {
|
||||
+ RemoveEnvironmentCleanupHookInternal(holder.get());
|
||||
+}
|
||||
|
||||
/* Returns the id of the current execution context. If the return value is
|
||||
* zero then no execution has been set. This will happen if the user handles
|
|
@ -1,38 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Fri, 14 May 2021 13:55:28 +0200
|
||||
Subject: src: remove extra semi after member fn
|
||||
|
||||
This was added in https://github.com/nodejs/node/pull/34186 and
|
||||
https://github.com/nodejs/node/pull/38172.
|
||||
|
||||
Fix upstreamed at https://github.com/nodejs/node/pull/38686.
|
||||
|
||||
diff --git a/src/cares_wrap.h b/src/cares_wrap.h
|
||||
index bceafcb8b7f46b8044c69716e7241d2fa065ee5c..20d350a76321e8414508083c2037ad8c238c940b 100644
|
||||
--- a/src/cares_wrap.h
|
||||
+++ b/src/cares_wrap.h
|
||||
@@ -141,8 +141,8 @@ struct NodeAresTask final : public MemoryRetainer {
|
||||
uv_poll_t poll_watcher;
|
||||
|
||||
inline void MemoryInfo(MemoryTracker* trakcer) const override;
|
||||
- SET_MEMORY_INFO_NAME(NodeAresTask);
|
||||
- SET_SELF_SIZE(NodeAresTask);
|
||||
+ SET_MEMORY_INFO_NAME(NodeAresTask)
|
||||
+ SET_SELF_SIZE(NodeAresTask)
|
||||
|
||||
struct Hash {
|
||||
inline size_t operator()(NodeAresTask* a) const {
|
||||
diff --git a/src/timer_wrap.h b/src/timer_wrap.h
|
||||
index b2c20bf24d8746b5bc33ac2e55f20cd303dff269..dbc23b442bea39d4556a21bb7f365dd68239095d 100644
|
||||
--- a/src/timer_wrap.h
|
||||
+++ b/src/timer_wrap.h
|
||||
@@ -32,7 +32,7 @@ class TimerWrap final : public MemoryRetainer {
|
||||
void Ref();
|
||||
void Unref();
|
||||
|
||||
- SET_NO_MEMORY_INFO();
|
||||
+ SET_NO_MEMORY_INFO()
|
||||
SET_MEMORY_INFO_NAME(TimerWrap)
|
||||
SET_SELF_SIZE(TimerWrap)
|
||||
|
|
@ -0,0 +1,336 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Thu, 20 May 2021 11:33:53 +0200
|
||||
Subject: src: remove extra semis from member fns
|
||||
|
||||
Refs https://github.com/nodejs/node/pull/37917 and https://github.com/nodejs/node/pull/36811
|
||||
|
||||
Upstreamed at https://github.com/nodejs/node/pull/38744
|
||||
|
||||
diff --git a/src/crypto/crypto_aes.h b/src/crypto/crypto_aes.h
|
||||
index a5e37409548e69ed4766eeec7e6c1bf919af10bc..d6eefffb4a846cb5827d655f93fd0f571ef15541 100644
|
||||
--- a/src/crypto/crypto_aes.h
|
||||
+++ b/src/crypto/crypto_aes.h
|
||||
@@ -52,8 +52,8 @@ struct AESCipherConfig final : public MemoryRetainer {
|
||||
AESCipherConfig& operator=(AESCipherConfig&& other) noexcept;
|
||||
|
||||
void MemoryInfo(MemoryTracker* tracker) const override;
|
||||
- SET_MEMORY_INFO_NAME(AESCipherConfig);
|
||||
- SET_SELF_SIZE(AESCipherConfig);
|
||||
+ SET_MEMORY_INFO_NAME(AESCipherConfig)
|
||||
+ SET_SELF_SIZE(AESCipherConfig)
|
||||
};
|
||||
|
||||
struct AESCipherTraits final {
|
||||
diff --git a/src/crypto/crypto_dh.h b/src/crypto/crypto_dh.h
|
||||
index 7c69afb0a46ab419d63f063e2e898c71e60657f2..fecbf41070bda4a1d6bb6b43e339d01605e81406 100644
|
||||
--- a/src/crypto/crypto_dh.h
|
||||
+++ b/src/crypto/crypto_dh.h
|
||||
@@ -114,9 +114,9 @@ using DHKeyExportJob = KeyExportJob<DHKeyExportTraits>;
|
||||
struct DHBitsConfig final : public MemoryRetainer {
|
||||
std::shared_ptr<KeyObjectData> private_key;
|
||||
std::shared_ptr<KeyObjectData> public_key;
|
||||
- SET_NO_MEMORY_INFO();
|
||||
- SET_MEMORY_INFO_NAME(DHBitsConfig);
|
||||
- SET_SELF_SIZE(DHBitsConfig);
|
||||
+ SET_NO_MEMORY_INFO()
|
||||
+ SET_MEMORY_INFO_NAME(DHBitsConfig)
|
||||
+ SET_SELF_SIZE(DHBitsConfig)
|
||||
};
|
||||
|
||||
struct DHBitsTraits final {
|
||||
diff --git a/src/crypto/crypto_dsa.h b/src/crypto/crypto_dsa.h
|
||||
index 3f241b33ba06cf43c60514aec18d3b60f2141c6d..647b4d9004e8cbbab20bcb6b8f93a2e0fbb5b45f 100644
|
||||
--- a/src/crypto/crypto_dsa.h
|
||||
+++ b/src/crypto/crypto_dsa.h
|
||||
@@ -16,8 +16,8 @@ struct DsaKeyPairParams final : public MemoryRetainer {
|
||||
unsigned int modulus_bits;
|
||||
int divisor_bits;
|
||||
SET_NO_MEMORY_INFO()
|
||||
- SET_MEMORY_INFO_NAME(DsaKeyPairParams);
|
||||
- SET_SELF_SIZE(DsaKeyPairParams);
|
||||
+ SET_MEMORY_INFO_NAME(DsaKeyPairParams)
|
||||
+ SET_SELF_SIZE(DsaKeyPairParams)
|
||||
};
|
||||
|
||||
using DsaKeyPairGenConfig = KeyPairGenConfig<DsaKeyPairParams>;
|
||||
@@ -38,9 +38,9 @@ struct DsaKeyGenTraits final {
|
||||
using DsaKeyPairGenJob = KeyGenJob<KeyPairGenTraits<DsaKeyGenTraits>>;
|
||||
|
||||
struct DSAKeyExportConfig final : public MemoryRetainer {
|
||||
- SET_NO_MEMORY_INFO();
|
||||
- SET_MEMORY_INFO_NAME(DSAKeyExportConfig);
|
||||
- SET_SELF_SIZE(DSAKeyExportConfig);
|
||||
+ SET_NO_MEMORY_INFO()
|
||||
+ SET_MEMORY_INFO_NAME(DSAKeyExportConfig)
|
||||
+ SET_SELF_SIZE(DSAKeyExportConfig)
|
||||
};
|
||||
|
||||
struct DSAKeyExportTraits final {
|
||||
diff --git a/src/crypto/crypto_ec.h b/src/crypto/crypto_ec.h
|
||||
index 444fca58d497795bdb15876654705f79e6c93b75..317ee877a12b6b0267a86c75dd9325309011400d 100644
|
||||
--- a/src/crypto/crypto_ec.h
|
||||
+++ b/src/crypto/crypto_ec.h
|
||||
@@ -60,8 +60,8 @@ struct ECDHBitsConfig final : public MemoryRetainer {
|
||||
std::shared_ptr<KeyObjectData> public_;
|
||||
|
||||
void MemoryInfo(MemoryTracker* tracker) const override;
|
||||
- SET_MEMORY_INFO_NAME(ECDHBitsConfig);
|
||||
- SET_SELF_SIZE(ECDHBitsConfig);
|
||||
+ SET_MEMORY_INFO_NAME(ECDHBitsConfig)
|
||||
+ SET_SELF_SIZE(ECDHBitsConfig)
|
||||
};
|
||||
|
||||
struct ECDHBitsTraits final {
|
||||
diff --git a/src/crypto/crypto_hash.h b/src/crypto/crypto_hash.h
|
||||
index b2ecce0c5b8501ad3f168758fda1194b64bacf13..9f004d1dda6ea55923d26040c47efd7885879cbc 100644
|
||||
--- a/src/crypto/crypto_hash.h
|
||||
+++ b/src/crypto/crypto_hash.h
|
||||
@@ -52,8 +52,8 @@ struct HashConfig final : public MemoryRetainer {
|
||||
HashConfig& operator=(HashConfig&& other) noexcept;
|
||||
|
||||
void MemoryInfo(MemoryTracker* tracker) const override;
|
||||
- SET_MEMORY_INFO_NAME(HashConfig);
|
||||
- SET_SELF_SIZE(HashConfig);
|
||||
+ SET_MEMORY_INFO_NAME(HashConfig)
|
||||
+ SET_SELF_SIZE(HashConfig)
|
||||
};
|
||||
|
||||
struct HashTraits final {
|
||||
diff --git a/src/crypto/crypto_hkdf.h b/src/crypto/crypto_hkdf.h
|
||||
index 06774bcde97378261e6c4a1658964a4d69b9b19d..666aad65474a2ee0610c597226f5874c7c30aa1a 100644
|
||||
--- a/src/crypto/crypto_hkdf.h
|
||||
+++ b/src/crypto/crypto_hkdf.h
|
||||
@@ -29,8 +29,8 @@ struct HKDFConfig final : public MemoryRetainer {
|
||||
HKDFConfig& operator=(HKDFConfig&& other) noexcept;
|
||||
|
||||
void MemoryInfo(MemoryTracker* tracker) const override;
|
||||
- SET_MEMORY_INFO_NAME(HKDFConfig);
|
||||
- SET_SELF_SIZE(HKDFConfig);
|
||||
+ SET_MEMORY_INFO_NAME(HKDFConfig)
|
||||
+ SET_SELF_SIZE(HKDFConfig)
|
||||
};
|
||||
|
||||
struct HKDFTraits final {
|
||||
diff --git a/src/crypto/crypto_hmac.h b/src/crypto/crypto_hmac.h
|
||||
index fd7dba2ed8a09839296ca2e35346076fb445af30..d7427ce883c2e17c55a96da1b7b6f69a4c5e192a 100644
|
||||
--- a/src/crypto/crypto_hmac.h
|
||||
+++ b/src/crypto/crypto_hmac.h
|
||||
@@ -54,8 +54,8 @@ struct HmacConfig final : public MemoryRetainer {
|
||||
HmacConfig& operator=(HmacConfig&& other) noexcept;
|
||||
|
||||
void MemoryInfo(MemoryTracker* tracker) const override;
|
||||
- SET_MEMORY_INFO_NAME(HmacConfig);
|
||||
- SET_SELF_SIZE(HmacConfig);
|
||||
+ SET_MEMORY_INFO_NAME(HmacConfig)
|
||||
+ SET_SELF_SIZE(HmacConfig)
|
||||
};
|
||||
|
||||
struct HmacTraits final {
|
||||
diff --git a/src/crypto/crypto_keygen.h b/src/crypto/crypto_keygen.h
|
||||
index 3dcbd2f0cecfd1d576222de6de5be6ee65699fff..532bcdb80c78cf3e77d6bdeb36e1fc985e198b6d 100644
|
||||
--- a/src/crypto/crypto_keygen.h
|
||||
+++ b/src/crypto/crypto_keygen.h
|
||||
@@ -112,7 +112,7 @@ class KeyGenJob final : public CryptoJob<KeyGenTraits> {
|
||||
return v8::Just(errors->ToException(env).ToLocal(err));
|
||||
}
|
||||
|
||||
- SET_SELF_SIZE(KeyGenJob);
|
||||
+ SET_SELF_SIZE(KeyGenJob)
|
||||
|
||||
private:
|
||||
KeyGenJobStatus status_ = KeyGenJobStatus::FAILED;
|
||||
diff --git a/src/crypto/crypto_keys.h b/src/crypto/crypto_keys.h
|
||||
index 98e497a5b220c799ac05df6788b3006d2df5dd14..3662b3a3b8688b1921bdc50bda87f5088308881b 100644
|
||||
--- a/src/crypto/crypto_keys.h
|
||||
+++ b/src/crypto/crypto_keys.h
|
||||
@@ -149,8 +149,8 @@ class KeyObjectData : public MemoryRetainer {
|
||||
size_t GetSymmetricKeySize() const;
|
||||
|
||||
void MemoryInfo(MemoryTracker* tracker) const override;
|
||||
- SET_MEMORY_INFO_NAME(KeyObjectData);
|
||||
- SET_SELF_SIZE(KeyObjectData);
|
||||
+ SET_MEMORY_INFO_NAME(KeyObjectData)
|
||||
+ SET_SELF_SIZE(KeyObjectData)
|
||||
|
||||
private:
|
||||
explicit KeyObjectData(ByteSource symmetric_key);
|
||||
diff --git a/src/crypto/crypto_pbkdf2.h b/src/crypto/crypto_pbkdf2.h
|
||||
index 42b95627e0da624d538429019f90b8f6ee02b0fb..6fda7cd3101002561ff98736b8a7a77cc2cee998 100644
|
||||
--- a/src/crypto/crypto_pbkdf2.h
|
||||
+++ b/src/crypto/crypto_pbkdf2.h
|
||||
@@ -39,8 +39,8 @@ struct PBKDF2Config final : public MemoryRetainer {
|
||||
PBKDF2Config& operator=(PBKDF2Config&& other) noexcept;
|
||||
|
||||
void MemoryInfo(MemoryTracker* tracker) const override;
|
||||
- SET_MEMORY_INFO_NAME(PBKDF2Config);
|
||||
- SET_SELF_SIZE(PBKDF2Config);
|
||||
+ SET_MEMORY_INFO_NAME(PBKDF2Config)
|
||||
+ SET_SELF_SIZE(PBKDF2Config)
|
||||
};
|
||||
|
||||
struct PBKDF2Traits final {
|
||||
diff --git a/src/crypto/crypto_random.h b/src/crypto/crypto_random.h
|
||||
index 1a2a88dc2920ff452eef488dc55a253da49319ed..c9a827f6171e15b5af08cd91d4cbc4ac77f1e202 100644
|
||||
--- a/src/crypto/crypto_random.h
|
||||
+++ b/src/crypto/crypto_random.h
|
||||
@@ -16,9 +16,9 @@ namespace crypto {
|
||||
struct RandomBytesConfig final : public MemoryRetainer {
|
||||
unsigned char* buffer;
|
||||
size_t size;
|
||||
- SET_NO_MEMORY_INFO();
|
||||
- SET_MEMORY_INFO_NAME(RandomBytesConfig);
|
||||
- SET_SELF_SIZE(RandomBytesConfig);
|
||||
+ SET_NO_MEMORY_INFO()
|
||||
+ SET_MEMORY_INFO_NAME(RandomBytesConfig)
|
||||
+ SET_SELF_SIZE(RandomBytesConfig)
|
||||
};
|
||||
|
||||
struct RandomBytesTraits final {
|
||||
@@ -54,8 +54,8 @@ struct RandomPrimeConfig final : public MemoryRetainer {
|
||||
int bits;
|
||||
bool safe;
|
||||
void MemoryInfo(MemoryTracker* tracker) const override;
|
||||
- SET_MEMORY_INFO_NAME(RandomPrimeConfig);
|
||||
- SET_SELF_SIZE(RandomPrimeConfig);
|
||||
+ SET_MEMORY_INFO_NAME(RandomPrimeConfig)
|
||||
+ SET_SELF_SIZE(RandomPrimeConfig)
|
||||
};
|
||||
|
||||
struct RandomPrimeTraits final {
|
||||
@@ -89,8 +89,8 @@ struct CheckPrimeConfig final : public MemoryRetainer {
|
||||
int checks = 1;
|
||||
|
||||
void MemoryInfo(MemoryTracker* tracker) const override;
|
||||
- SET_MEMORY_INFO_NAME(CheckPrimeConfig);
|
||||
- SET_SELF_SIZE(CheckPrimeConfig);
|
||||
+ SET_MEMORY_INFO_NAME(CheckPrimeConfig)
|
||||
+ SET_SELF_SIZE(CheckPrimeConfig)
|
||||
};
|
||||
|
||||
struct CheckPrimeTraits final {
|
||||
diff --git a/src/crypto/crypto_rsa.h b/src/crypto/crypto_rsa.h
|
||||
index acc233ccbb36d28dcda2578987e285ae4f394a8e..eea53815f04e22d573885295c18182f7d85b8e7e 100644
|
||||
--- a/src/crypto/crypto_rsa.h
|
||||
+++ b/src/crypto/crypto_rsa.h
|
||||
@@ -31,8 +31,8 @@ struct RsaKeyPairParams final : public MemoryRetainer {
|
||||
int saltlen = 0;
|
||||
|
||||
SET_NO_MEMORY_INFO()
|
||||
- SET_MEMORY_INFO_NAME(RsaKeyPairParams);
|
||||
- SET_SELF_SIZE(RsaKeyPairParams);
|
||||
+ SET_MEMORY_INFO_NAME(RsaKeyPairParams)
|
||||
+ SET_SELF_SIZE(RsaKeyPairParams)
|
||||
};
|
||||
|
||||
using RsaKeyPairGenConfig = KeyPairGenConfig<RsaKeyPairParams>;
|
||||
@@ -88,8 +88,8 @@ struct RSACipherConfig final : public MemoryRetainer {
|
||||
RSACipherConfig(RSACipherConfig&& other) noexcept;
|
||||
|
||||
void MemoryInfo(MemoryTracker* tracker) const override;
|
||||
- SET_MEMORY_INFO_NAME(RSACipherConfig);
|
||||
- SET_SELF_SIZE(RSACipherConfig);
|
||||
+ SET_MEMORY_INFO_NAME(RSACipherConfig)
|
||||
+ SET_SELF_SIZE(RSACipherConfig)
|
||||
};
|
||||
|
||||
struct RSACipherTraits final {
|
||||
diff --git a/src/crypto/crypto_scrypt.h b/src/crypto/crypto_scrypt.h
|
||||
index b51d6c194ad67a0512460c241413d6cae2617e38..4ca888e31d4e523b7cc0a7a8a2204d772a2c0a16 100644
|
||||
--- a/src/crypto/crypto_scrypt.h
|
||||
+++ b/src/crypto/crypto_scrypt.h
|
||||
@@ -41,8 +41,8 @@ struct ScryptConfig final : public MemoryRetainer {
|
||||
ScryptConfig& operator=(ScryptConfig&& other) noexcept;
|
||||
|
||||
void MemoryInfo(MemoryTracker* tracker) const override;
|
||||
- SET_MEMORY_INFO_NAME(ScryptConfig);
|
||||
- SET_SELF_SIZE(ScryptConfig);
|
||||
+ SET_MEMORY_INFO_NAME(ScryptConfig)
|
||||
+ SET_SELF_SIZE(ScryptConfig)
|
||||
};
|
||||
|
||||
struct ScryptTraits final {
|
||||
diff --git a/src/crypto/crypto_sig.h b/src/crypto/crypto_sig.h
|
||||
index fa44811c3ee44d102947f77708047de97ba0b44f..5f9104fc5d3c007f56f2450719584b90dfbc7bdd 100644
|
||||
--- a/src/crypto/crypto_sig.h
|
||||
+++ b/src/crypto/crypto_sig.h
|
||||
@@ -127,8 +127,8 @@ struct SignConfiguration final : public MemoryRetainer {
|
||||
SignConfiguration& operator=(SignConfiguration&& other) noexcept;
|
||||
|
||||
void MemoryInfo(MemoryTracker* tracker) const override;
|
||||
- SET_MEMORY_INFO_NAME(SignConfiguration);
|
||||
- SET_SELF_SIZE(SignConfiguration);
|
||||
+ SET_MEMORY_INFO_NAME(SignConfiguration)
|
||||
+ SET_SELF_SIZE(SignConfiguration)
|
||||
};
|
||||
|
||||
struct SignTraits final {
|
||||
diff --git a/src/crypto/crypto_util.h b/src/crypto/crypto_util.h
|
||||
index 303ba4c3b7c4c2fc5dee906e22d5e7642b8351c8..1fe961a99b3f115c1381f3641d718a21988e9659 100644
|
||||
--- a/src/crypto/crypto_util.h
|
||||
+++ b/src/crypto/crypto_util.h
|
||||
@@ -190,8 +190,8 @@ struct CryptoErrorStore final : public MemoryRetainer {
|
||||
v8::Local<v8::String> exception_string = v8::Local<v8::String>()) const;
|
||||
|
||||
SET_NO_MEMORY_INFO()
|
||||
- SET_MEMORY_INFO_NAME(CryptoErrorStore);
|
||||
- SET_SELF_SIZE(CryptoErrorStore);
|
||||
+ SET_MEMORY_INFO_NAME(CryptoErrorStore)
|
||||
+ SET_SELF_SIZE(CryptoErrorStore)
|
||||
|
||||
private:
|
||||
std::vector<std::string> errors_;
|
||||
@@ -504,7 +504,7 @@ class DeriveBitsJob final : public CryptoJob<DeriveBitsTraits> {
|
||||
return v8::Just(errors->ToException(env).ToLocal(err));
|
||||
}
|
||||
|
||||
- SET_SELF_SIZE(DeriveBitsJob);
|
||||
+ SET_SELF_SIZE(DeriveBitsJob)
|
||||
void MemoryInfo(MemoryTracker* tracker) const override {
|
||||
tracker->TrackFieldWithSize("out", out_.size());
|
||||
CryptoJob<DeriveBitsTraits>::MemoryInfo(tracker);
|
||||
diff --git a/src/crypto/crypto_x509.h b/src/crypto/crypto_x509.h
|
||||
index 3bebc8e37d158bfe0bc214a4be2db89c823247d4..05bfb6e7cb3e2046f621c0bbdeee01210fa2ec12 100644
|
||||
--- a/src/crypto/crypto_x509.h
|
||||
+++ b/src/crypto/crypto_x509.h
|
||||
@@ -98,8 +98,8 @@ class X509Certificate : public BaseObject {
|
||||
X509* get() { return cert_->get(); }
|
||||
|
||||
void MemoryInfo(MemoryTracker* tracker) const override;
|
||||
- SET_MEMORY_INFO_NAME(X509Certificate);
|
||||
- SET_SELF_SIZE(X509Certificate);
|
||||
+ SET_MEMORY_INFO_NAME(X509Certificate)
|
||||
+ SET_SELF_SIZE(X509Certificate)
|
||||
|
||||
class X509CertificateTransferData : public worker::TransferData {
|
||||
public:
|
||||
diff --git a/src/node_blob.h b/src/node_blob.h
|
||||
index 965f65390bdd41cb872f86b3d6f5faacb6af85af..9d6178996c8fd59c6b4f348072aa58ba9f9d925b 100644
|
||||
--- a/src/node_blob.h
|
||||
+++ b/src/node_blob.h
|
||||
@@ -46,8 +46,8 @@ class Blob : public BaseObject {
|
||||
}
|
||||
|
||||
void MemoryInfo(MemoryTracker* tracker) const override;
|
||||
- SET_MEMORY_INFO_NAME(Blob);
|
||||
- SET_SELF_SIZE(Blob);
|
||||
+ SET_MEMORY_INFO_NAME(Blob)
|
||||
+ SET_SELF_SIZE(Blob)
|
||||
|
||||
// Copies the contents of the Blob into an ArrayBuffer.
|
||||
v8::MaybeLocal<v8::Value> GetArrayBuffer(Environment* env);
|
||||
diff --git a/src/node_sockaddr.h b/src/node_sockaddr.h
|
||||
index 704fe0c5116f8f95884325b0b49c731009869112..8add38b465e324942801785f9fb94a81fc612547 100644
|
||||
--- a/src/node_sockaddr.h
|
||||
+++ b/src/node_sockaddr.h
|
||||
@@ -173,8 +173,8 @@ class SocketAddressBase : public BaseObject {
|
||||
}
|
||||
|
||||
void MemoryInfo(MemoryTracker* tracker) const override;
|
||||
- SET_MEMORY_INFO_NAME(SocketAddressBase);
|
||||
- SET_SELF_SIZE(SocketAddressBase);
|
||||
+ SET_MEMORY_INFO_NAME(SocketAddressBase)
|
||||
+ SET_SELF_SIZE(SocketAddressBase)
|
||||
|
||||
TransferMode GetTransferMode() const override {
|
||||
return TransferMode::kCloneable;
|
|
@ -0,0 +1,38 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Wed, 2 Jun 2021 11:19:45 +0200
|
||||
Subject: tls: tweak clientCertEngine argument parsing
|
||||
|
||||
This PR slightly tweaks the argument parsing within configSecureContext.
|
||||
BoringSSL defines OPENSSL_NO_ENGINE and jasnell@35274cb changed behavior
|
||||
so that if a bad clientCertEngine argument is passed,
|
||||
ERR_CRYPTO_CUSTOM_ENGINE_NOT_SUPPORTED() will be thrown before
|
||||
ERR_INVALID_ARG_TYPE.
|
||||
|
||||
Upstreamed at https://github.com/nodejs/node/pull/38900.
|
||||
|
||||
diff --git a/lib/internal/tls.js b/lib/internal/tls.js
|
||||
index 0ebecb57c887798e2475b84b1783721806d4a7d1..40d511a25c5d4bcfb3802a692fa0059f7497b584 100644
|
||||
--- a/lib/internal/tls.js
|
||||
+++ b/lib/internal/tls.js
|
||||
@@ -305,15 +305,15 @@ function configSecureContext(context, options = {}, name = 'options') {
|
||||
}
|
||||
}
|
||||
|
||||
- if (clientCertEngine !== undefined) {
|
||||
+ if (typeof clientCertEngine === 'string') {
|
||||
if (typeof context.setClientCertEngine !== 'function')
|
||||
throw new ERR_CRYPTO_CUSTOM_ENGINE_NOT_SUPPORTED();
|
||||
- if (typeof clientCertEngine !== 'string') {
|
||||
- throw new ERR_INVALID_ARG_TYPE(`${name}.clientCertEngine`,
|
||||
+ else
|
||||
+ context.setClientCertEngine(clientCertEngine);
|
||||
+ } else if (clientCertEngine !== undefined) {
|
||||
+ throw new ERR_INVALID_ARG_TYPE(`${name}.clientCertEngine`,
|
||||
['string', 'null', 'undefined'],
|
||||
clientCertEngine);
|
||||
- }
|
||||
- context.setClientCertEngine(clientCertEngine);
|
||||
}
|
||||
|
||||
if (ticketKeys !== undefined) {
|
|
@ -1,50 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Kim-Anh Tran <kimanh@chromium.org>
|
||||
Date: Fri, 19 Jun 2020 11:29:45 +0200
|
||||
Subject: Update tests after increasing typed array size
|
||||
|
||||
Refs https://github.com/v8/node/pull/114
|
||||
|
||||
diff --git a/test/parallel/test-buffer-alloc.js b/test/parallel/test-buffer-alloc.js
|
||||
index 070a3803802e56ec7736791559ec7d7204625754..9f626c0683ae74ae984496c77d0b73c9b4c7b872 100644
|
||||
--- a/test/parallel/test-buffer-alloc.js
|
||||
+++ b/test/parallel/test-buffer-alloc.js
|
||||
@@ -8,8 +8,8 @@ const SlowBuffer = require('buffer').SlowBuffer;
|
||||
// Verify the maximum Uint8Array size. There is no concrete limit by spec. The
|
||||
// internal limits should be updated if this fails.
|
||||
assert.throws(
|
||||
- () => new Uint8Array(2 ** 32),
|
||||
- { message: 'Invalid typed array length: 4294967296' }
|
||||
+ () => new Uint8Array(2 ** 32 + 1),
|
||||
+ { message: 'Invalid typed array length: 4294967297' }
|
||||
);
|
||||
|
||||
const b = Buffer.allocUnsafe(1024);
|
||||
diff --git a/test/parallel/test-buffer-over-max-length.js b/test/parallel/test-buffer-over-max-length.js
|
||||
index b04f89aae0344c008dff4c737aac96f53d6f7e17..ddbd93ddb088deb53304cb06d8fcdc59214dbc31 100644
|
||||
--- a/test/parallel/test-buffer-over-max-length.js
|
||||
+++ b/test/parallel/test-buffer-over-max-length.js
|
||||
@@ -12,11 +12,11 @@ const bufferMaxSizeMsg = {
|
||||
message: /^The value "[^"]*" is invalid for option "size"$/
|
||||
};
|
||||
|
||||
-assert.throws(() => Buffer((-1 >>> 0) + 1), bufferMaxSizeMsg);
|
||||
-assert.throws(() => SlowBuffer((-1 >>> 0) + 1), bufferMaxSizeMsg);
|
||||
-assert.throws(() => Buffer.alloc((-1 >>> 0) + 1), bufferMaxSizeMsg);
|
||||
-assert.throws(() => Buffer.allocUnsafe((-1 >>> 0) + 1), bufferMaxSizeMsg);
|
||||
-assert.throws(() => Buffer.allocUnsafeSlow((-1 >>> 0) + 1), bufferMaxSizeMsg);
|
||||
+assert.throws(() => Buffer((-1 >>> 0) + 2), bufferMaxSizeMsg);
|
||||
+assert.throws(() => SlowBuffer((-1 >>> 0) + 2), bufferMaxSizeMsg);
|
||||
+assert.throws(() => Buffer.alloc((-1 >>> 0) + 2), bufferMaxSizeMsg);
|
||||
+assert.throws(() => Buffer.allocUnsafe((-1 >>> 0) + 2), bufferMaxSizeMsg);
|
||||
+assert.throws(() => Buffer.allocUnsafeSlow((-1 >>> 0) + 2), bufferMaxSizeMsg);
|
||||
|
||||
assert.throws(() => Buffer(kMaxLength + 1), bufferMaxSizeMsg);
|
||||
assert.throws(() => SlowBuffer(kMaxLength + 1), bufferMaxSizeMsg);
|
||||
@@ -25,5 +25,5 @@ assert.throws(() => Buffer.allocUnsafe(kMaxLength + 1), bufferMaxSizeMsg);
|
||||
assert.throws(() => Buffer.allocUnsafeSlow(kMaxLength + 1), bufferMaxSizeMsg);
|
||||
|
||||
// issue GH-4331
|
||||
-assert.throws(() => Buffer.allocUnsafe(0x100000000), bufferMaxSizeMsg);
|
||||
+assert.throws(() => Buffer.allocUnsafe(0x100000001), bufferMaxSizeMsg);
|
||||
assert.throws(() => Buffer.allocUnsafe(0xFFFFFFFFF), bufferMaxSizeMsg);
|
|
@ -12,15 +12,20 @@
|
|||
"parallel/test-buffer-constructor-node-modules-paths",
|
||||
"parallel/test-buffer-constructor-outside-node-modules",
|
||||
"parallel/test-child-process-fork-exec-path",
|
||||
"parallel/test-child-process-stdio-overlapped",
|
||||
"parallel/test-cli-node-print-help",
|
||||
"parallel/test-code-cache",
|
||||
"parallel/test-crypto-aes-wrap",
|
||||
"parallel/test-crypto-authenticated-stream",
|
||||
"parallel/test-crypto-async-sign-verify",
|
||||
"parallel/test-crypto-certificate",
|
||||
"parallel/test-crypto-des3-wrap",
|
||||
"parallel/test-crypto-dh-stateless",
|
||||
"parallel/test-crypto-ecb",
|
||||
"parallel/test-crypto-engine",
|
||||
"parallel/test-crypto-fips",
|
||||
"parallel/test-crypto-hkdf.js",
|
||||
"parallel/test-crypto-secure-heap",
|
||||
"parallel/test-debug-args",
|
||||
"parallel/test-debug-usage",
|
||||
"parallel/test-debugger-pid",
|
||||
|
@ -29,7 +34,6 @@
|
|||
"parallel/test-finalization-group-error",
|
||||
"parallel/test-freeze-intrinsics",
|
||||
"parallel/test-fs-utimes-y2K38",
|
||||
"parallel/test-fs-write-sigxfsz",
|
||||
"parallel/test-gc-tls-external-memory",
|
||||
"parallel/test-http2-clean-output",
|
||||
"parallel/test-http2-reset-flood",
|
||||
|
@ -39,7 +43,6 @@
|
|||
"parallel/test-inspector-multisession-ws",
|
||||
"parallel/test-inspector-port-zero-cluster",
|
||||
"parallel/test-inspector-tracing-domain",
|
||||
"parallel/test-inspector-tracing-domain",
|
||||
"parallel/test-inspector-vm-global-accessors-getter-sideeffect",
|
||||
"parallel/test-inspector-vm-global-accessors-sideeffects",
|
||||
"parallel/test-module-loading-globalpaths",
|
||||
|
@ -76,6 +79,7 @@
|
|||
"parallel/test-tls-client-mindhsize",
|
||||
"parallel/test-tls-client-reject",
|
||||
"parallel/test-tls-client-renegotiation-13",
|
||||
"parallel/test-tls-cnnic-whitelist",
|
||||
"parallel/test-tls-disable-renegotiation",
|
||||
"parallel/test-tls-empty-sni-context",
|
||||
"parallel/test-tls-env-bad-extra-ca",
|
||||
|
@ -109,7 +113,6 @@
|
|||
"parallel/test-tls-socket-failed-handshake-emits-error",
|
||||
"parallel/test-tls-ticket",
|
||||
"parallel/test-tls-ticket-cluster",
|
||||
"parallel/test-tls-write-error",
|
||||
"parallel/test-trace-events-all",
|
||||
"parallel/test-trace-events-async-hooks",
|
||||
"parallel/test-trace-events-binding",
|
||||
|
@ -136,6 +139,16 @@
|
|||
"parallel/test-vm-parse-abort-on-uncaught-exception",
|
||||
"parallel/test-vm-sigint-existing-handler",
|
||||
"parallel/test-vm-timeout",
|
||||
"parallel/test-webcrypto-derivebits-hkdf",
|
||||
"parallel/test-webcrypto-derivebits-node-dh",
|
||||
"parallel/test-webcrypto-ed25519-ed448",
|
||||
"parallel/test-webcrypto-encrypt-decrypt",
|
||||
"parallel/test-webcrypto-encrypt-decrypt-rsa",
|
||||
"parallel/test-webcrypto-rsa-pss-params",
|
||||
"parallel/test-webcrypto-x25519-x448",
|
||||
"parallel/test-webcrypto-sign-verify-node-dsa",
|
||||
"parallel/test-webcrypto-keygen",
|
||||
"parallel/test-webcrypto-encrypt-decrypt-aes",
|
||||
"parallel/test-whatwg-encoding-custom-textdecoder",
|
||||
"parallel/test-worker-message-channel",
|
||||
"parallel/test-worker-message-port",
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace {
|
|||
|
||||
// Initialize Node.js cli options to pass to Node.js
|
||||
// See https://nodejs.org/api/cli.html#cli_options
|
||||
void SetNodeCliFlags() {
|
||||
int SetNodeCliFlags() {
|
||||
// Options that are unilaterally disallowed
|
||||
const std::unordered_set<base::StringPiece, base::StringPieceHash>
|
||||
disallowed = {"--openssl-config", "--use-bundled-ca", "--use-openssl-ca",
|
||||
|
@ -74,6 +74,10 @@ void SetNodeCliFlags() {
|
|||
if (disallowed.count(stripped) != 0) {
|
||||
LOG(ERROR) << "The Node.js cli flag " << stripped
|
||||
<< " is not supported in Electron";
|
||||
// Node.js returns 9 from ProcessGlobalArgs for any errors encountered
|
||||
// when setting up cli flags and env vars. Since we're outlawing these
|
||||
// flags (making them errors) return 9 here for consistency.
|
||||
return 9;
|
||||
} else {
|
||||
args.push_back(option);
|
||||
}
|
||||
|
@ -83,7 +87,8 @@ void SetNodeCliFlags() {
|
|||
|
||||
// Node.js itself will output parsing errors to
|
||||
// console so we don't need to handle that ourselves
|
||||
ProcessGlobalArgs(&args, nullptr, &errors, node::kDisallowedInEnvironment);
|
||||
return ProcessGlobalArgs(&args, nullptr, &errors,
|
||||
node::kDisallowedInEnvironment);
|
||||
}
|
||||
|
||||
#if defined(MAS_BUILD)
|
||||
|
@ -156,7 +161,6 @@ int NodeMain(int argc, char* argv[]) {
|
|||
int exit_code = 1;
|
||||
{
|
||||
// Feed gin::PerIsolateData with a task runner.
|
||||
argv = uv_setup_args(argc, argv);
|
||||
uv_loop_t* loop = uv_default_loop();
|
||||
auto uv_task_runner = base::MakeRefCounted<UvTaskRunner>(loop);
|
||||
base::ThreadTaskRunnerHandle handle(uv_task_runner);
|
||||
|
@ -170,11 +174,15 @@ int NodeMain(int argc, char* argv[]) {
|
|||
NodeBindings::RegisterBuiltinModules();
|
||||
|
||||
// Parse and set Node.js cli flags.
|
||||
SetNodeCliFlags();
|
||||
int flags_exit_code = SetNodeCliFlags();
|
||||
if (flags_exit_code != 0)
|
||||
exit(flags_exit_code);
|
||||
|
||||
int exec_argc;
|
||||
const char** exec_argv;
|
||||
node::Init(&argc, const_cast<const char**>(argv), &exec_argc, &exec_argv);
|
||||
node::InitializationResult result =
|
||||
node::InitializeOncePerProcess(argc, argv);
|
||||
|
||||
if (result.early_return)
|
||||
exit(result.exit_code);
|
||||
|
||||
gin::V8Initializer::LoadV8Snapshot(
|
||||
gin::V8Initializer::V8SnapshotFileType::kWithAdditionalContext);
|
||||
|
@ -201,11 +209,8 @@ int NodeMain(int argc, char* argv[]) {
|
|||
isolate_data = node::CreateIsolateData(isolate, loop, gin_env.platform());
|
||||
CHECK_NE(nullptr, isolate_data);
|
||||
|
||||
std::vector<std::string> args(argv, argv + argc); // NOLINT
|
||||
std::vector<std::string> exec_args(exec_argv,
|
||||
exec_argv + exec_argc); // NOLINT
|
||||
env = node::CreateEnvironment(isolate_data, gin_env.context(), args,
|
||||
exec_args);
|
||||
env = node::CreateEnvironment(isolate_data, gin_env.context(),
|
||||
result.args, result.exec_args);
|
||||
CHECK_NOT_NULL(env);
|
||||
|
||||
node::IsolateSettings is;
|
||||
|
@ -240,7 +245,7 @@ int NodeMain(int argc, char* argv[]) {
|
|||
}
|
||||
|
||||
v8::HandleScope scope(isolate);
|
||||
node::LoadEnvironment(env);
|
||||
node::LoadEnvironment(env, node::StartExecutionCallback{});
|
||||
|
||||
env->set_trace_sync_io(env->options()->trace_sync_io);
|
||||
|
||||
|
|
|
@ -247,6 +247,9 @@ void ElectronBrowserMainParts::PostEarlyInitialization() {
|
|||
|
||||
env->set_trace_sync_io(env->options()->trace_sync_io);
|
||||
|
||||
// We do not want to crash the main process on unhandled rejections.
|
||||
env->set_unhandled_rejections_mode("warn");
|
||||
|
||||
// Add Electron extended APIs.
|
||||
electron_bindings_->BindTo(js_env_->isolate(), env->process_object());
|
||||
|
||||
|
|
|
@ -168,7 +168,6 @@ JavascriptEnvironment::~JavascriptEnvironment() {
|
|||
isolate_->Exit();
|
||||
g_isolate = nullptr;
|
||||
|
||||
platform_->CancelPendingDelayedTasks(isolate_);
|
||||
platform_->UnregisterIsolate(isolate_);
|
||||
}
|
||||
|
||||
|
|
|
@ -362,13 +362,11 @@ void NodeBindings::Initialize() {
|
|||
|
||||
int exit_code = node::InitializeNodeWithArgs(&argv, &exec_argv, &errors);
|
||||
|
||||
for (const std::string& error : errors) {
|
||||
for (const std::string& error : errors)
|
||||
fprintf(stderr, "%s: %s\n", argv[0].c_str(), error.c_str());
|
||||
}
|
||||
|
||||
if (exit_code != 0) {
|
||||
if (exit_code != 0)
|
||||
exit(exit_code);
|
||||
}
|
||||
|
||||
#if defined(OS_WIN)
|
||||
// uv_init overrides error mode to suppress the default crash dialog, bring
|
||||
|
@ -518,7 +516,7 @@ node::Environment* NodeBindings::CreateEnvironment(
|
|||
}
|
||||
|
||||
void NodeBindings::LoadEnvironment(node::Environment* env) {
|
||||
node::LoadEnvironment(env);
|
||||
node::LoadEnvironment(env, node::StartExecutionCallback{});
|
||||
gin_helper::EmitEvent(env->isolate(), env->process_object(), "loaded");
|
||||
}
|
||||
|
||||
|
|
|
@ -113,6 +113,9 @@ void ElectronRendererClient::DidCreateScriptContext(
|
|||
// any non-context aware native module
|
||||
env->set_force_context_aware(true);
|
||||
|
||||
// We do not want to crash the renderer process on unhandled rejections.
|
||||
env->set_unhandled_rejections_mode("warn");
|
||||
|
||||
environments_.insert(env);
|
||||
|
||||
// Add Electron extended APIs.
|
||||
|
|
|
@ -5,6 +5,7 @@ describe('bundled @types/node', () => {
|
|||
expect(require('../npm/package.json').dependencies).to.have.property('@types/node');
|
||||
const range = require('../npm/package.json').dependencies['@types/node'];
|
||||
expect(range).to.match(/^\^.+/, 'should allow any type dep in a major range');
|
||||
expect(range.slice(1).split('.')[0]).to.equal(process.versions.node.split('.')[0]);
|
||||
// TODO(codebytere): re-enable after https://github.com/DefinitelyTyped/DefinitelyTyped/pull/52594 is merged.
|
||||
// expect(range.slice(1).split('.')[0]).to.equal(process.versions.node.split('.')[0]);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1686,6 +1686,7 @@ describe('asar package', function () {
|
|||
|
||||
it('can recursively delete a directory with an asar file in it', () => {
|
||||
const deleteDir = path.join(asarDir, 'deleteme');
|
||||
fs.mkdirSync(deleteDir);
|
||||
|
||||
originalFs.rmdirSync(deleteDir, { recursive: true });
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче