From 9713fa09e75342094e382399be87633246e5437b Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Mon, 12 Aug 2019 17:29:34 -0700 Subject: [PATCH] chore: bump node to v12.8.0 (master) (#19521) * chore: bump node in DEPS to v12.7.0 * chore: update node patches v12.6 to v12.7 Removed patches that are no longer necessary because we've upstreamed few changes already, and 3 way merge others * fix: update build gn patch * chore: bump node in DEPS to v12.8.0 * chore: update node patches v12.7 to v12.8 Removed patches that are no longer necessary because we've upstreamed few changes already, and 3 way merge others * fix: Add patch to revert crypto createhash changes The original node commit contains changes/calls to functions that are not supported in boringssl. * disable node tests * Remove outdated patch, already merged upstream --- DEPS | 2 +- patches/node/.patches | 5 +- patches/node/build_add_gn_build_files.patch | 9 +- ...arn_non_context-aware_native_modules.patch | 10 +- ...de_entrypoint_to_be_a_builtin_module.patch | 8 +- ...on_not_being_set_in_the_electron_env.patch | 2 +- ...vironment_into_createenvironment_and.patch | 10 +- ...xport_environment_knodecontexttagptr.patch | 4 +- ...s_for_low-level_hooks_and_exceptions.patch | 18 +- .../node/feat_initialize_asar_support.patch | 8 +- ...r_enable_lto_and_build_v8_with_gn_in.patch | 2 +- ...fix_build_and_expose_inspector_agent.patch | 8 +- ...ebugoptions_s_constructors_in_header.patch | 4 +- patches/node/fix_export_debugoptions.patch | 10 +- .../fix_export_node_abort_and_assert.patch | 2 +- .../node/fix_expose_traceeventhelper.patch | 20 -- ...se_tracing_tracingcontroller_instead.patch | 6 +- ..._and_options_parser_for_debug_builds.patch | 4 +- ..._apis_are_not_available_in_boringssl.patch | 8 +- ...uptime_offset_in_correct_init_method.patch | 29 -- ...n2bin_padded_for_ossl_s_bn_bn2binpad.patch | 8 +- ..._crypto_add_support_for_rsa-pss_keys.patch | 36 +-- ...efined_version_of_internalmodulestat.patch | 4 +- ..._crashpad_pipe_name_in_child_process.patch | 2 +- .../make_module_globalpaths_a_reference.patch | 4 +- .../pass_all_globals_through_require.patch | 6 +- ...dder_overriding_of_internal_fs_calls.patch | 10 +- ...cess_fork_to_use_execute_script_with.patch | 2 +- ...utlength_option_to_crypto_createhash.patch | 262 ++++++++++++++++++ ..._template_for_the_debugoptionsparser.patch | 32 --- ...node_use_v8_platform_in_node_options.patch | 2 +- ...zecontext_to_allow_existing_contexts.patch | 6 +- ..._first_line_from_the_inspect_options.patch | 21 -- ...e_check_false_in_switch_default_case.patch | 2 +- script/node-disabled-tests.json | 4 + 35 files changed, 365 insertions(+), 205 deletions(-) delete mode 100644 patches/node/fix_expose_traceeventhelper.patch delete mode 100644 patches/node/fix_set_uptime_offset_in_correct_init_method.patch create mode 100644 patches/node/revert_crypto_add_outputlength_option_to_crypto_createhash.patch delete mode 100644 patches/node/src_add_missing_option_parser_template_for_the_debugoptionsparser.patch delete mode 100644 patches/node/src_read_break_node_first_line_from_the_inspect_options.patch diff --git a/DEPS b/DEPS index d05c24ce2aa..8ab6472e76e 100644 --- a/DEPS +++ b/DEPS @@ -12,7 +12,7 @@ vars = { 'chromium_version': '0b543daaf04d9b3f4e4f485738a304e742b2ee7d', 'node_version': - 'v12.6.0', + 'v12.8.0', 'nan_version': '2ee313aaca52e2b478965ac50eb5082520380d1b', diff --git a/patches/node/.patches b/patches/node/.patches index 94f53f55a07..34c5fde3876 100644 --- a/patches/node/.patches +++ b/patches/node/.patches @@ -4,7 +4,6 @@ refactor_alter_child_process_fork_to_use_execute_script_with.patch feat_add_uv_loop_watcher_queue_code.patch feat_initialize_asar_support.patch expose_get_builtin_module_function.patch -fix_expose_traceeventhelper.patch fix_build_and_expose_inspector_agent.patch fix_expose_internalcallbackscope.patch build_add_gn_build_files.patch @@ -29,15 +28,13 @@ build_modify_js2c_py_to_allow_injection_of_original-fs_and_custom_embedder_js.pa refactor_allow_embedder_overriding_of_internal_fs_calls.patch chore_add_ability_to_prevent_warn_non_context-aware_native_modules.patch fsevents_fix_file_event_reporting.patch -src_read_break_node_first_line_from_the_inspect_options.patch chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch inherit_electron_crashpad_pipe_name_in_child_process.patch fixme_revert_crypto_add_support_for_rsa-pss_keys.patch chore_re-add_compileandcall_this_should_be_added_as_a_helper_in.patch -src_add_missing_option_parser_template_for_the_debugoptionsparser.patch src_expose_maybeinitializecontext_to_allow_existing_contexts.patch fix_extern_the_nativemoduleenv_and_options_parser_for_debug_builds.patch chore_read_nobrowserglobals_from_global_not_process.patch chore_split_createenvironment_into_createenvironment_and.patch chore_handle_default_configuration_not_being_set_in_the_electron_env.patch -fix_set_uptime_offset_in_correct_init_method.patch \ No newline at end of file +revert_crypto_add_outputlength_option_to_crypto_createhash.patch diff --git a/patches/node/build_add_gn_build_files.patch b/patches/node/build_add_gn_build_files.patch index 9295dcbb7db..8a6bef5cd54 100644 --- a/patches/node/build_add_gn_build_files.patch +++ b/patches/node/build_add_gn_build_files.patch @@ -882,10 +882,10 @@ index 0000000000000000000000000000000000000000..f13b471d17128468bed06e66bd03a2ea +} diff --git a/filenames.json b/filenames.json new file mode 100644 -index 0000000000000000000000000000000000000000..edb0b215088118f567c5ad5e5969d1eb5ef661a3 +index 0000000000000000000000000000000000000000..be8613d11f9f5b1c6604257edf707792f2119fcb --- /dev/null +++ b/filenames.json -@@ -0,0 +1,443 @@ +@@ -0,0 +1,442 @@ +// This file is automatically generated by generate_gn_filenames_json.py +// DO NOT EDIT +{ @@ -1099,7 +1099,7 @@ index 0000000000000000000000000000000000000000..edb0b215088118f567c5ad5e5969d1eb + "lib/internal/process/report.js", + "lib/internal/process/task_queues.js", + "lib/internal/querystring.js", -+ "lib/internal/readline.js", ++ "lib/internal/readline/utils.js", + "lib/internal/repl.js", + "lib/internal/repl/await.js", + "lib/internal/repl/history.js", @@ -1152,7 +1152,6 @@ index 0000000000000000000000000000000000000000..edb0b215088118f567c5ad5e5969d1eb + "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-bigint/index.js", + "deps/acorn-plugins/acorn-class-fields/index.js", + "deps/acorn-plugins/acorn-numeric-separator/index.js", + "deps/acorn-plugins/acorn-private-class-elements/index.js", @@ -1535,7 +1534,7 @@ index 0000000000000000000000000000000000000000..f3c5c798c0aefcb8cf9b1570a7b4817c + args = rebase_path(inputs + outputs, root_build_dir) +} diff --git a/src/node_version.h b/src/node_version.h -index 46f92e1b83847f6078c46c8ddd0efaae859cc06d..e484042b7b68e7bb5b2e6431bc76bdeea31decaf 100644 +index 2d105483ba10533d992de3265121e6ab9edce2ed..8a8fd5f7fad4a69b65e06d67225a398385d3bbbf 100644 --- a/src/node_version.h +++ b/src/node_version.h @@ -89,7 +89,10 @@ diff --git a/patches/node/chore_add_ability_to_prevent_warn_non_context-aware_native_modules.patch b/patches/node/chore_add_ability_to_prevent_warn_non_context-aware_native_modules.patch index 326f0024d0c..2021bc10435 100644 --- a/patches/node/chore_add_ability_to_prevent_warn_non_context-aware_native_modules.patch +++ b/patches/node/chore_add_ability_to_prevent_warn_non_context-aware_native_modules.patch @@ -5,10 +5,10 @@ Subject: chore: add ability to prevent / warn non context-aware native modules being loaded diff --git a/src/env.h b/src/env.h -index e60f76372a324b83cd054c830fc2d6f9ab2dcae8..63e71fc1fc2b0e95a85f38b58b34eeb290d8f09d 100644 +index 2dd6bdb75f02e2ccb07129996d16df99c0c4ccf2..ecb845803776f5ff6e7eec712ec7a5ebea2e8d0a 100644 --- a/src/env.h +++ b/src/env.h -@@ -849,6 +849,15 @@ class Environment : public MemoryRetainer { +@@ -884,6 +884,15 @@ class Environment : public MemoryRetainer { uint64_t thread_id = kNoThreadId); ~Environment(); @@ -24,7 +24,7 @@ index e60f76372a324b83cd054c830fc2d6f9ab2dcae8..63e71fc1fc2b0e95a85f38b58b34eeb2 void InitializeLibuv(bool start_profiler_idle_notifier); inline const std::vector& exec_argv(); inline const std::vector& argv(); -@@ -1197,6 +1206,9 @@ class Environment : public MemoryRetainer { +@@ -1234,6 +1243,9 @@ class Environment : public MemoryRetainer { inline void ThrowError(v8::Local (*fun)(v8::Local), const char* errmsg); @@ -35,7 +35,7 @@ index e60f76372a324b83cd054c830fc2d6f9ab2dcae8..63e71fc1fc2b0e95a85f38b58b34eeb2 v8::Isolate* const isolate_; IsolateData* const isolate_data_; diff --git a/src/node_binding.cc b/src/node_binding.cc -index 99c2406036e1874af253c61239e7736867813af8..117bc2891118e67ca7b10a33ba7e1fbebc973dbb 100644 +index c51a892e1bcd3df6ea8af952c8200975c7f4ac7e..9a4a7780f4ac1bcc0855cc9e3eed904d5a0b4254 100644 --- a/src/node_binding.cc +++ b/src/node_binding.cc @@ -2,6 +2,7 @@ @@ -46,7 +46,7 @@ index 99c2406036e1874af253c61239e7736867813af8..117bc2891118e67ca7b10a33ba7e1fbe #include "util.h" #if HAVE_OPENSSL -@@ -470,6 +471,13 @@ void DLOpen(const FunctionCallbackInfo& args) { +@@ -463,6 +464,13 @@ void DLOpen(const FunctionCallbackInfo& args) { } if (mp != nullptr) { diff --git a/patches/node/chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch b/patches/node/chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch index 01e9ee0aa23..600daed90ad 100644 --- a/patches/node/chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch +++ b/patches/node/chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch @@ -10,10 +10,10 @@ The default behavior of node is to `path.resolve(firstArg)` to figure out what J Similar to the above, the loader uses `process.argv[1]` to figure out when to break for `--inspect-brk` this updates the logic to use an Electron provided `process._firstFileName` diff --git a/lib/internal/bootstrap/pre_execution.js b/lib/internal/bootstrap/pre_execution.js -index a998b095fb067ab6ca35cc276ac6a9a7c38dcf30..68ca0cefa4cf663cded9155bc4f2f226d807b577 100644 +index 072e614fca05197fb2b259914711033981f6e2f2..dd7b6496e23efe0b73c6c9919c3780abeecdcec3 100644 --- a/lib/internal/bootstrap/pre_execution.js +++ b/lib/internal/bootstrap/pre_execution.js -@@ -70,8 +70,10 @@ function patchProcessObject(expandArgv1) { +@@ -71,8 +71,10 @@ function patchProcessObject(expandArgv1) { if (expandArgv1 && process.argv[1] && !process.argv[1].startsWith('-')) { // Expand process.argv[1] into a full path. @@ -25,10 +25,10 @@ index a998b095fb067ab6ca35cc276ac6a9a7c38dcf30..68ca0cefa4cf663cded9155bc4f2f226 // 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 c975804d847eea5a8d759f79121aa4da61e88dc4..506ce67d553f4e755d56d386666c19f27d1ab694 100644 +index 2a7ffbff213f23536b94664c3ecffa18eb812849..6e73d0b57a11620b1fcec8b9b716b66673438864 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js -@@ -753,6 +753,13 @@ Module.prototype._compile = function(content, filename) { +@@ -845,6 +845,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. diff --git a/patches/node/chore_handle_default_configuration_not_being_set_in_the_electron_env.patch b/patches/node/chore_handle_default_configuration_not_being_set_in_the_electron_env.patch index 28a6b6c1285..a18c6655391 100644 --- a/patches/node/chore_handle_default_configuration_not_being_set_in_the_electron_env.patch +++ b/patches/node/chore_handle_default_configuration_not_being_set_in_the_electron_env.patch @@ -5,7 +5,7 @@ Subject: chore: handle default_configuration not being set in the electron env diff --git a/test/common/index.js b/test/common/index.js -index bbb74e2b988517bddc610084a9ee959eda6912e5..c8487ad94c9f4a9603cee0f2c368a4e119f92bcd 100644 +index 13604d06e14a3612e4d161ebbdda10912a46d3b0..0f1398ed665b66d4fe7778a33ceab5176c086ff4 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -118,7 +118,7 @@ const enoughTestCpu = Array.isArray(cpus) && diff --git a/patches/node/chore_split_createenvironment_into_createenvironment_and.patch b/patches/node/chore_split_createenvironment_into_createenvironment_and.patch index 2438e714fca..efe5d335e29 100644 --- a/patches/node/chore_split_createenvironment_into_createenvironment_and.patch +++ b/patches/node/chore_split_createenvironment_into_createenvironment_and.patch @@ -8,10 +8,10 @@ This allows us to run operations on a created but not yet bootstrapped environment such as setting up an InspectorAgent diff --git a/src/api/environment.cc b/src/api/environment.cc -index 5011774be2c5fee910079790feae747fa1785b87..d5cb74025959ad32a6d2e6a914bf99a2b3d7946f 100644 +index 443f49320b2e6720f932fcfcefdbe6e539594964..4d79af9ec2a7b476c5f86f3882f4fb63afafc53e 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc -@@ -269,7 +269,8 @@ Environment* CreateEnvironment(IsolateData* isolate_data, +@@ -263,7 +263,8 @@ Environment* CreateEnvironment(IsolateData* isolate_data, int argc, const char* const* argv, int exec_argc, @@ -21,7 +21,7 @@ index 5011774be2c5fee910079790feae747fa1785b87..d5cb74025959ad32a6d2e6a914bf99a2 Isolate* isolate = context->GetIsolate(); HandleScope handle_scope(isolate); Context::Scope context_scope(context); -@@ -287,9 +288,16 @@ Environment* CreateEnvironment(IsolateData* isolate_data, +@@ -281,9 +282,16 @@ Environment* CreateEnvironment(IsolateData* isolate_data, Environment::kOwnsProcessState | Environment::kOwnsInspector)); env->InitializeLibuv(per_process::v8_is_profiling); @@ -39,7 +39,7 @@ index 5011774be2c5fee910079790feae747fa1785b87..d5cb74025959ad32a6d2e6a914bf99a2 std::vector> parameters = { env->require_string(), -@@ -302,9 +310,10 @@ Environment* CreateEnvironment(IsolateData* isolate_data, +@@ -296,9 +304,10 @@ Environment* CreateEnvironment(IsolateData* isolate_data, if (ExecuteBootstrapper( env, "internal/bootstrap/environment", ¶meters, &arguments) .IsEmpty()) { @@ -53,7 +53,7 @@ index 5011774be2c5fee910079790feae747fa1785b87..d5cb74025959ad32a6d2e6a914bf99a2 void FreeEnvironment(Environment* env) { diff --git a/src/node.h b/src/node.h -index de007ed97a52c17cff8b8917d25f2383d5bbae6a..cdf96c283dbfb4c763d0b0e21497fc289e28741a 100644 +index c51fb1a6a6e497a091e2ba0b147e3d7b6a4d685c..211f00cca65eeba317a03af36411a19a6befae18 100644 --- a/src/node.h +++ b/src/node.h @@ -330,7 +330,9 @@ NODE_EXTERN Environment* CreateEnvironment(IsolateData* isolate_data, diff --git a/patches/node/export_environment_knodecontexttagptr.patch b/patches/node/export_environment_knodecontexttagptr.patch index c0576339c48..18b111cdefd 100644 --- a/patches/node/export_environment_knodecontexttagptr.patch +++ b/patches/node/export_environment_knodecontexttagptr.patch @@ -5,10 +5,10 @@ Subject: export Environment::kNodeContextTagPtr diff --git a/src/env.h b/src/env.h -index 3d955297920a98fc4f567cf8a12a6cc2267ed402..e60f76372a324b83cd054c830fc2d6f9ab2dcae8 100644 +index 82ed066f9cde4851fa3375d0faffe4bfcf2bf411..2dd6bdb75f02e2ccb07129996d16df99c0c4ccf2 100644 --- a/src/env.h +++ b/src/env.h -@@ -1266,7 +1266,7 @@ class Environment : public MemoryRetainer { +@@ -1304,7 +1304,7 @@ class Environment : public MemoryRetainer { uint64_t thread_id_; std::unordered_set sub_worker_contexts_; diff --git a/patches/node/feat_add_flags_for_low-level_hooks_and_exceptions.patch b/patches/node/feat_add_flags_for_low-level_hooks_and_exceptions.patch index 1a990794c66..9f789113177 100644 --- a/patches/node/feat_add_flags_for_low-level_hooks_and_exceptions.patch +++ b/patches/node/feat_add_flags_for_low-level_hooks_and_exceptions.patch @@ -24,7 +24,7 @@ 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/env.cc b/src/env.cc -index df59eaaa94928fc26d8636bcbabe70c12c83fa04..a10b3db67872ebb24f10ac3bc6e43356a59c2644 100644 +index 257bf78519f32d690ea9cd5b9e21d3d863801c33..89e940cdc478df8a3be7738106a1c739542a7430 100644 --- a/src/env.cc +++ b/src/env.cc @@ -383,6 +383,12 @@ Environment::Environment(IsolateData* isolate_data, @@ -39,9 +39,9 @@ index df59eaaa94928fc26d8636bcbabe70c12c83fa04..a10b3db67872ebb24f10ac3bc6e43356 + } } - CompileFnEntry::CompileFnEntry(Environment* env, uint32_t id) + Environment::~Environment() { diff --git a/src/node.cc b/src/node.cc -index c074ed0dfe1b47611fdcf40537e5e70a2d95f58b..00fb0ed1c9cfbc86a7ec7d1d0ce7789b68d6a1e3 100644 +index 572490730da5854ad1a79670564ad9705c86747b..9b43d7676e5e106318b58bfe443651cc49780068 100644 --- a/src/node.cc +++ b/src/node.cc @@ -27,6 +27,7 @@ @@ -52,7 +52,7 @@ index c074ed0dfe1b47611fdcf40537e5e70a2d95f58b..00fb0ed1c9cfbc86a7ec7d1d0ce7789b #include "node_internals.h" #include "node_main_instance.h" #include "node_metadata.h" -@@ -134,6 +135,9 @@ using v8::Undefined; +@@ -130,6 +131,9 @@ using v8::Undefined; using v8::V8; using v8::Value; @@ -62,7 +62,7 @@ index c074ed0dfe1b47611fdcf40537e5e70a2d95f58b..00fb0ed1c9cfbc86a7ec7d1d0ce7789b namespace per_process { // node_revert.h -@@ -356,6 +360,13 @@ MaybeLocal Environment::RunBootstrapping() { +@@ -352,6 +356,13 @@ MaybeLocal Environment::RunBootstrapping() { CHECK(!has_run_bootstrapping_code()); @@ -76,7 +76,7 @@ index c074ed0dfe1b47611fdcf40537e5e70a2d95f58b..00fb0ed1c9cfbc86a7ec7d1d0ce7789b if (BootstrapInternalLoaders().IsEmpty()) { return MaybeLocal(); } -@@ -736,7 +747,9 @@ int InitializeNodeWithArgs(std::vector* argv, +@@ -741,7 +752,9 @@ int InitializeNodeWithArgs(std::vector* argv, binding::RegisterBuiltinModules(); // Make inherited handles noninheritable. @@ -87,7 +87,7 @@ index c074ed0dfe1b47611fdcf40537e5e70a2d95f58b..00fb0ed1c9cfbc86a7ec7d1d0ce7789b #ifdef NODE_REPORT // Cache the original command line to be -@@ -838,6 +851,9 @@ int InitializeNodeWithArgs(std::vector* argv, +@@ -843,6 +856,9 @@ int InitializeNodeWithArgs(std::vector* argv, } #endif @@ -97,7 +97,7 @@ index c074ed0dfe1b47611fdcf40537e5e70a2d95f58b..00fb0ed1c9cfbc86a7ec7d1d0ce7789b const int exit_code = ProcessGlobalArgs(argv, exec_argv, errors, false); if (exit_code != 0) return exit_code; -@@ -860,6 +876,8 @@ int InitializeNodeWithArgs(std::vector* argv, +@@ -865,6 +881,8 @@ int InitializeNodeWithArgs(std::vector* argv, per_process::metadata.versions.InitializeIntlVersions(); #endif @@ -107,7 +107,7 @@ index c074ed0dfe1b47611fdcf40537e5e70a2d95f58b..00fb0ed1c9cfbc86a7ec7d1d0ce7789b // We should set node_is_initialized here instead of in node::Start, diff --git a/src/node.h b/src/node.h -index 5098dc9c7e77df62b90e4332c6695dfb48b430a0..9df33dfb47e591728c9502fea8152e4344b2b275 100644 +index f78c76023bb667031b46e5fac80028bc5fd5374c..42ad1a5aba3fb57e27a07689768fd0dc8dd37d6d 100644 --- a/src/node.h +++ b/src/node.h @@ -203,6 +203,9 @@ namespace node { diff --git a/patches/node/feat_initialize_asar_support.patch b/patches/node/feat_initialize_asar_support.patch index ddaaec3f1f8..e34f54ce706 100644 --- a/patches/node/feat_initialize_asar_support.patch +++ b/patches/node/feat_initialize_asar_support.patch @@ -5,7 +5,7 @@ Subject: feat: initialize asar support diff --git a/lib/internal/bootstrap/loaders.js b/lib/internal/bootstrap/loaders.js -index 7a98e4c96c87d4738829aadf1969ee90eda3876a..bf63de07613b4d19d95607f404139e587319f11d 100644 +index 2889df4812bb031f1a0debe1eb0b75bd6c846407..0b3b92b33490fe754788a94dedce7533de528acf 100644 --- a/lib/internal/bootstrap/loaders.js +++ b/lib/internal/bootstrap/loaders.js @@ -189,6 +189,8 @@ function nativeModuleRequire(id) { @@ -18,10 +18,10 @@ index 7a98e4c96c87d4738829aadf1969ee90eda3876a..bf63de07613b4d19d95607f404139e58 return NativeModule.map.has(id); }; diff --git a/lib/internal/bootstrap/pre_execution.js b/lib/internal/bootstrap/pre_execution.js -index bbb0786dcd20ec741892b02f96b3c37fec8f1de0..a998b095fb067ab6ca35cc276ac6a9a7c38dcf30 100644 +index 104ebaff320573f3f517d0839eef66a186080da9..072e614fca05197fb2b259914711033981f6e2f2 100644 --- a/lib/internal/bootstrap/pre_execution.js +++ b/lib/internal/bootstrap/pre_execution.js -@@ -51,6 +51,7 @@ function prepareMainThreadExecution(expandArgv1 = false) { +@@ -52,6 +52,7 @@ function prepareMainThreadExecution(expandArgv1 = false) { initializeCJSLoader(); initializeESMLoader(); loadPreloadModules(); @@ -29,7 +29,7 @@ index bbb0786dcd20ec741892b02f96b3c37fec8f1de0..a998b095fb067ab6ca35cc276ac6a9a7 } function patchProcessObject(expandArgv1) { -@@ -393,6 +394,10 @@ function loadPreloadModules() { +@@ -420,6 +421,10 @@ function loadPreloadModules() { } } diff --git a/patches/node/fix_add_default_values_for_enable_lto_and_build_v8_with_gn_in.patch b/patches/node/fix_add_default_values_for_enable_lto_and_build_v8_with_gn_in.patch index 85da675c7b2..fe018e7ad4c 100644 --- a/patches/node/fix_add_default_values_for_enable_lto_and_build_v8_with_gn_in.patch +++ b/patches/node/fix_add_default_values_for_enable_lto_and_build_v8_with_gn_in.patch @@ -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 c106549f67c264b27144faa9c13b1a4cf31db9cb..c0538bad7a0323d609365521ee2feb5a1f22e967 100644 +index b86e5e05d7df9ad472f16735448a53f433620eef..f07e65f719a1a5939997dfcae7bc787ee6391f4d 100644 --- a/common.gypi +++ b/common.gypi @@ -77,6 +77,22 @@ diff --git a/patches/node/fix_build_and_expose_inspector_agent.patch b/patches/node/fix_build_and_expose_inspector_agent.patch index 55a803c6332..d5814ce4be9 100644 --- a/patches/node/fix_build_and_expose_inspector_agent.patch +++ b/patches/node/fix_build_and_expose_inspector_agent.patch @@ -6,7 +6,7 @@ Subject: fix: build and expose inspector agent Node inspector initialization happens in a different start-up function in node.cc, which we don't call in Electron. This allows for us to use the inspector agent in electron/atom/browser/node_debugger.cc diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc -index ceba6a59a83e4d9ec6cc42305cd0715ffbe61489..a2a714e39db999f4293adf8064f7f53b546850e6 100644 +index 2965483dea6244e7123c08c104f399fc023a84e0..b6624300e96daf6041a296fdc1ceeaf579e215cd 100644 --- a/src/inspector_agent.cc +++ b/src/inspector_agent.cc @@ -217,7 +217,7 @@ const int CONTEXT_GROUP_ID = 1; @@ -18,7 +18,7 @@ index ceba6a59a83e4d9ec6cc42305cd0715ffbe61489..a2a714e39db999f4293adf8064f7f53b return result.str(); } -@@ -461,7 +461,7 @@ class NodeInspectorClient : public V8InspectorClient { +@@ -465,7 +465,7 @@ class NodeInspectorClient : public V8InspectorClient { client_ = V8Inspector::create(env->isolate(), this); // TODO(bnoordhuis) Make name configurable from src/node.cc. std::string name = @@ -28,7 +28,7 @@ index ceba6a59a83e4d9ec6cc42305cd0715ffbe61489..a2a714e39db999f4293adf8064f7f53b info.is_default = true; contextCreated(env->context(), info); diff --git a/src/inspector_agent.h b/src/inspector_agent.h -index 5447a68485c2282f0a38821bd5858824275311dd..0722a0fde38ade1d621b020bba0e2680d132fa71 100644 +index 4fb544f85bd1453d0705088dfb5511ae32bacad2..ac9352e3fa953e2f4ac0a032c2aacd7353c2cf71 100644 --- a/src/inspector_agent.h +++ b/src/inspector_agent.h @@ -6,7 +6,9 @@ @@ -51,7 +51,7 @@ index 5447a68485c2282f0a38821bd5858824275311dd..0722a0fde38ade1d621b020bba0e2680 explicit Agent(node::Environment* env); ~Agent(); diff --git a/src/inspector_io.cc b/src/inspector_io.cc -index 91384ca949c2f13e0264811cd76e44743e695bd4..9edefd91be0effbad162ced398558785ad655cf1 100644 +index 76e481c9530d955a841a19d91b34f03bebaaecfb..8b61d73b8d7cc5d84a61b4a683a28ab1865ad71b 100644 --- a/src/inspector_io.cc +++ b/src/inspector_io.cc @@ -13,6 +13,8 @@ diff --git a/patches/node/fix_do_not_define_debugoptions_s_constructors_in_header.patch b/patches/node/fix_do_not_define_debugoptions_s_constructors_in_header.patch index 4e0d5cdce42..fe4cea6e5a2 100644 --- a/patches/node/fix_do_not_define_debugoptions_s_constructors_in_header.patch +++ b/patches/node/fix_do_not_define_debugoptions_s_constructors_in_header.patch @@ -15,7 +15,7 @@ By putting the definitions of constructors into the implementation file, we can avoid this problem. diff --git a/src/node_options.cc b/src/node_options.cc -index 11c910bbd17c8b8e345862e11a24aba7822c31b6..9b9b9324d681d8a55418c7a43a071a6f978750e7 100644 +index f4dc3d7df5a33ce92ca52e901283db5aa9f143b4..b9d6108c5db800465e6c7156ad1c28002c33261b 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -26,6 +26,12 @@ Mutex cli_options_mutex; @@ -32,7 +32,7 @@ index 11c910bbd17c8b8e345862e11a24aba7822c31b6..9b9b9324d681d8a55418c7a43a071a6f #if !NODE_USE_V8_PLATFORM if (inspector_enabled) { diff --git a/src/node_options.h b/src/node_options.h -index 35daba3291c8358a44f9fca53df34b35c5423d15..b8959745f5bd66bb19f3f1d9b1bf45e8a6ebd4f7 100644 +index 5fb23cfda7aebca507174555b78c9a73e837dda0..ce86827024126c6b0d8462c811360057c298ec5b 100644 --- a/src/node_options.h +++ b/src/node_options.h @@ -61,11 +61,11 @@ struct InspectPublishUid { diff --git a/patches/node/fix_export_debugoptions.patch b/patches/node/fix_export_debugoptions.patch index 6463707d698..9618fa25af6 100644 --- a/patches/node/fix_export_debugoptions.patch +++ b/patches/node/fix_export_debugoptions.patch @@ -5,10 +5,10 @@ Subject: fix: export DebugOptions diff --git a/src/node_options.cc b/src/node_options.cc -index 021fc5d70b250b39ac76028b5d384608d51f7248..11c910bbd17c8b8e345862e11a24aba7822c31b6 100644 +index e2a39626b69fd3380febc258fb25efc0cea2a08e..f4dc3d7df5a33ce92ca52e901283db5aa9f143b4 100644 --- a/src/node_options.cc +++ b/src/node_options.cc -@@ -202,11 +202,6 @@ void EnvironmentOptions::CheckOptions(std::vector* errors) { +@@ -204,11 +204,6 @@ void EnvironmentOptions::CheckOptions(std::vector* errors) { namespace options_parser { @@ -21,7 +21,7 @@ index 021fc5d70b250b39ac76028b5d384608d51f7248..11c910bbd17c8b8e345862e11a24aba7 public: EnvironmentOptionsParser(); diff --git a/src/node_options.h b/src/node_options.h -index 34c54511e1bb8bba201994802f7fd53c4217cece..35daba3291c8358a44f9fca53df34b35c5423d15 100644 +index dbd85b2d584be57619fc5c8d019140f67514f427..5fb23cfda7aebca507174555b78c9a73e837dda0 100644 --- a/src/node_options.h +++ b/src/node_options.h @@ -59,7 +59,7 @@ struct InspectPublishUid { @@ -33,7 +33,7 @@ index 34c54511e1bb8bba201994802f7fd53c4217cece..35daba3291c8358a44f9fca53df34b35 public: DebugOptions() = default; DebugOptions(const DebugOptions&) = default; -@@ -236,7 +236,7 @@ class PerProcessOptions : public Options { +@@ -240,7 +240,7 @@ class PerProcessOptions : public Options { namespace options_parser { @@ -42,7 +42,7 @@ index 34c54511e1bb8bba201994802f7fd53c4217cece..35daba3291c8358a44f9fca53df34b35 std::vector* errors); void GetOptions(const v8::FunctionCallbackInfo& args); -@@ -429,6 +429,11 @@ class OptionsParser { +@@ -433,6 +433,11 @@ class OptionsParser { friend void GetOptions(const v8::FunctionCallbackInfo& args); }; diff --git a/patches/node/fix_export_node_abort_and_assert.patch b/patches/node/fix_export_node_abort_and_assert.patch index de6e4642016..2c71b288613 100644 --- a/patches/node/fix_export_node_abort_and_assert.patch +++ b/patches/node/fix_export_node_abort_and_assert.patch @@ -5,7 +5,7 @@ Subject: fix: Export node::Abort and Assert diff --git a/src/node_errors.cc b/src/node_errors.cc -index 298d84b4f362b3b9e9a0e604c7635ac77eaf8925..e0c5eaacffbd1ac7aaa104dd15f5e5de4ed5240b 100644 +index 0214521144c607c084cabc941f006780bcd3cfa2..ea4113aa3b2b431c6d9bbfbf4b20f8ff59cd9182 100644 --- a/src/node_errors.cc +++ b/src/node_errors.cc @@ -242,13 +242,13 @@ void AppendExceptionLine(Environment* env, diff --git a/patches/node/fix_expose_traceeventhelper.patch b/patches/node/fix_expose_traceeventhelper.patch deleted file mode 100644 index 08cf94d4a14..00000000000 --- a/patches/node/fix_expose_traceeventhelper.patch +++ /dev/null @@ -1,20 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shelley Vohr -Date: Mon, 30 Jul 2018 13:08:34 -0700 -Subject: fix: expose TraceEventHelper - -Node required tracing controller to be initialized, otherwise a crash would occur. Changed in concert with https://github.com/electron/electron/commit/0e5b6f93000e4718c9e35332ddbd0f6b76cdd585\#diff-0cdfa12fff513e022fac830c6af9c19a - -diff --git a/src/tracing/trace_event.h b/src/tracing/trace_event.h -index 590cb592fc054f90ffc85052985087db6c3c3463..4a398106d77e5e0f7c16448fa952c637833cfede 100644 ---- a/src/tracing/trace_event.h -+++ b/src/tracing/trace_event.h -@@ -310,7 +310,7 @@ const int kZeroNumArgs = 0; - const decltype(nullptr) kGlobalScope = nullptr; - const uint64_t kNoId = 0; - --class TraceEventHelper { -+class NODE_EXTERN TraceEventHelper { - public: - static TracingController* GetTracingController(); - static Agent* GetAgent(); diff --git a/patches/node/fix_expose_tracing_agent_and_use_tracing_tracingcontroller_instead.patch b/patches/node/fix_expose_tracing_agent_and_use_tracing_tracingcontroller_instead.patch index b2a7e92b77d..d8eb0979ce4 100644 --- a/patches/node/fix_expose_tracing_agent_and_use_tracing_tracingcontroller_instead.patch +++ b/patches/node/fix_expose_tracing_agent_and_use_tracing_tracingcontroller_instead.patch @@ -5,10 +5,10 @@ Subject: fix: expose tracing::Agent and use tracing::TracingController instead of v8::TracingController diff --git a/src/api/environment.cc b/src/api/environment.cc -index 8c1f5aaff2a5e4bbe7b534e0b130b1b50cad1c15..bfd279aa7e7cd4d50b6cffe75d6f8e41c0213acb 100644 +index ac1e513967310aefa50100843c643c788ab5157c..35e8666ef771c56a1bcd441c99d4483a0d3e90bf 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc -@@ -320,6 +320,10 @@ MultiIsolatePlatform* GetMainThreadMultiIsolatePlatform() { +@@ -314,6 +314,10 @@ MultiIsolatePlatform* GetMainThreadMultiIsolatePlatform() { return per_process::v8_platform.Platform(); } @@ -20,7 +20,7 @@ index 8c1f5aaff2a5e4bbe7b534e0b130b1b50cad1c15..bfd279aa7e7cd4d50b6cffe75d6f8e41 int thread_pool_size, node::tracing::TracingController* tracing_controller) { diff --git a/src/node.h b/src/node.h -index 9df33dfb47e591728c9502fea8152e4344b2b275..dca89e212c89df19d0b97d748e3649392fec000c 100644 +index 42ad1a5aba3fb57e27a07689768fd0dc8dd37d6d..a2b47d1cf984ec36994b477b371cdf262191ab9c 100644 --- a/src/node.h +++ b/src/node.h @@ -108,6 +108,7 @@ namespace node { diff --git a/patches/node/fix_extern_the_nativemoduleenv_and_options_parser_for_debug_builds.patch b/patches/node/fix_extern_the_nativemoduleenv_and_options_parser_for_debug_builds.patch index a0074bf1038..2d100d12176 100644 --- a/patches/node/fix_extern_the_nativemoduleenv_and_options_parser_for_debug_builds.patch +++ b/patches/node/fix_extern_the_nativemoduleenv_and_options_parser_for_debug_builds.patch @@ -18,7 +18,7 @@ index b91a5059cd1f19d87e5876c372f3ded60681a5df..f81cf8dfb892a8ddd9084c5d9477b178 static void Initialize(v8::Local target, v8::Local unused, diff --git a/src/node_options.h b/src/node_options.h -index b8959745f5bd66bb19f3f1d9b1bf45e8a6ebd4f7..5ef8476387e71d92ec7936959f8cc8a211490f1b 100644 +index ce86827024126c6b0d8462c811360057c298ec5b..d53307f9589d4487c220526b8e49b6c7fbd29daf 100644 --- a/src/node_options.h +++ b/src/node_options.h @@ -44,7 +44,7 @@ class HostPort { @@ -30,7 +30,7 @@ index b8959745f5bd66bb19f3f1d9b1bf45e8a6ebd4f7..5ef8476387e71d92ec7936959f8cc8a2 public: virtual void CheckOptions(std::vector* errors) {} virtual ~Options() = default; -@@ -436,7 +436,7 @@ class NODE_EXTERN DebugOptionsParser : public OptionsParser { +@@ -440,7 +440,7 @@ class NODE_EXTERN DebugOptionsParser : public OptionsParser { using StringVector = std::vector; template diff --git a/patches/node/fix_key_gen_apis_are_not_available_in_boringssl.patch b/patches/node/fix_key_gen_apis_are_not_available_in_boringssl.patch index 24a49e1d4e2..c70f92ca4a3 100644 --- a/patches/node/fix_key_gen_apis_are_not_available_in_boringssl.patch +++ b/patches/node/fix_key_gen_apis_are_not_available_in_boringssl.patch @@ -6,7 +6,7 @@ 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 300d2b92d7040c831b3178202a725df15191407d..5622ae8a367b017aa4d8a7e6e5892b5caa9bbec3 100644 +index bca482cc9724fef680196a192a6bbd7b4d2e4fde..1cc2372fe2e385e9a9db27e38f0da61d62de2e81 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -290,24 +290,14 @@ Maybe Decorate(Environment* env, Local obj, @@ -62,7 +62,7 @@ index 300d2b92d7040c831b3178202a725df15191407d..5622ae8a367b017aa4d8a7e6e5892b5c default: return Undefined(env()->isolate()); } -@@ -6194,6 +6190,8 @@ class DSAKeyPairGenerationConfig : public KeyPairGenerationConfig { +@@ -6240,6 +6236,8 @@ class DSAKeyPairGenerationConfig : public KeyPairGenerationConfig { if (EVP_PKEY_paramgen_init(param_ctx.get()) <= 0) return nullptr; @@ -71,7 +71,7 @@ index 300d2b92d7040c831b3178202a725df15191407d..5622ae8a367b017aa4d8a7e6e5892b5c if (EVP_PKEY_CTX_set_dsa_paramgen_bits(param_ctx.get(), modulus_bits_) <= 0) return nullptr; -@@ -6213,6 +6211,8 @@ class DSAKeyPairGenerationConfig : public KeyPairGenerationConfig { +@@ -6259,6 +6257,8 @@ class DSAKeyPairGenerationConfig : public KeyPairGenerationConfig { EVPKeyCtxPointer key_ctx(EVP_PKEY_CTX_new(params.get(), nullptr)); return key_ctx; @@ -80,7 +80,7 @@ index 300d2b92d7040c831b3178202a725df15191407d..5622ae8a367b017aa4d8a7e6e5892b5c } private: -@@ -6904,9 +6904,12 @@ void Initialize(Local target, +@@ -6950,9 +6950,12 @@ void Initialize(Local target, env->SetMethod(target, "generateKeyPairEC", GenerateKeyPairEC); env->SetMethod(target, "generateKeyPairNid", GenerateKeyPairNid); NODE_DEFINE_CONSTANT(target, EVP_PKEY_ED25519); diff --git a/patches/node/fix_set_uptime_offset_in_correct_init_method.patch b/patches/node/fix_set_uptime_offset_in_correct_init_method.patch deleted file mode 100644 index 228be379932..00000000000 --- a/patches/node/fix_set_uptime_offset_in_correct_init_method.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Micha Hanselmann -Date: Wed, 24 Jul 2019 11:44:25 -0700 -Subject: fix: set uptime offset in correct init method - -This patch can be removed after 'https://github.com/nodejs/node/pull/28849' landed here. - -diff --git a/src/node.cc b/src/node.cc -index 707579c8254903f5c587fa42711eb5d0184b4112..64f46faa36a7b52d86b257adad6c54b93b894262 100644 ---- a/src/node.cc -+++ b/src/node.cc -@@ -743,6 +743,9 @@ int InitializeNodeWithArgs(std::vector* argv, - // Make sure InitializeNodeWithArgs() is called only once. - CHECK(!init_called.exchange(true)); - -+ // Initialize node_start_time to get relative uptime. -+ per_process::node_start_time = uv_hrtime(); -+ - // Register built-in modules - binding::RegisterBuiltinModules(); - -@@ -929,7 +932,6 @@ void Init(int* argc, - InitializationResult InitializeOncePerProcess(int argc, char** argv) { - atexit(ResetStdio); - PlatformInit(); -- per_process::node_start_time = uv_hrtime(); - - CHECK_GT(argc, 0); - diff --git a/patches/node/fix_use_bssl_bn_bn2bin_padded_for_ossl_s_bn_bn2binpad.patch b/patches/node/fix_use_bssl_bn_bn2bin_padded_for_ossl_s_bn_bn2binpad.patch index add9748025d..1903f0e5cde 100644 --- a/patches/node/fix_use_bssl_bn_bn2bin_padded_for_ossl_s_bn_bn2binpad.patch +++ b/patches/node/fix_use_bssl_bn_bn2bin_padded_for_ossl_s_bn_bn2binpad.patch @@ -6,10 +6,10 @@ Subject: fix: use bssl BN_bn2bin_padded for ossl's BN_bn2binpad Also note that BN_bn2bin_padded returns 1 on success instead of size diff --git a/src/node_crypto.cc b/src/node_crypto.cc -index 590c6d1c374c086e128580d6160ccbd71a7ef227..4933bf7f1bd2cd5e4293e52a241fcfd5fda6b779 100644 +index 91e62f41b3db02bac516e6e91ffb77d5476fb9ad..dd78a59742fc05e938ba2397d3701b2ac8ccfc23 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc -@@ -5408,9 +5408,9 @@ void DiffieHellman::GenerateKeys(const FunctionCallbackInfo& args) { +@@ -5453,9 +5453,9 @@ void DiffieHellman::GenerateKeys(const FunctionCallbackInfo& args) { const int size = BN_num_bytes(pub_key); CHECK_GE(size, 0); AllocatedBuffer data = env->AllocateManaged(size); @@ -22,7 +22,7 @@ index 590c6d1c374c086e128580d6160ccbd71a7ef227..4933bf7f1bd2cd5e4293e52a241fcfd5 args.GetReturnValue().Set(data.ToBuffer().ToLocalChecked()); } -@@ -5430,8 +5430,8 @@ void DiffieHellman::GetField(const FunctionCallbackInfo& args, +@@ -5475,8 +5475,8 @@ void DiffieHellman::GetField(const FunctionCallbackInfo& args, CHECK_GE(size, 0); AllocatedBuffer data = env->AllocateManaged(size); CHECK_EQ( @@ -33,7 +33,7 @@ index 590c6d1c374c086e128580d6160ccbd71a7ef227..4933bf7f1bd2cd5e4293e52a241fcfd5 args.GetReturnValue().Set(data.ToBuffer().ToLocalChecked()); } -@@ -5748,9 +5748,9 @@ void ECDH::GetPrivateKey(const FunctionCallbackInfo& args) { +@@ -5793,9 +5793,9 @@ void ECDH::GetPrivateKey(const FunctionCallbackInfo& args) { const int size = BN_num_bytes(b); AllocatedBuffer out = env->AllocateManaged(size); diff --git a/patches/node/fixme_revert_crypto_add_support_for_rsa-pss_keys.patch b/patches/node/fixme_revert_crypto_add_support_for_rsa-pss_keys.patch index 8cf6642da74..759c53fdabe 100644 --- a/patches/node/fixme_revert_crypto_add_support_for_rsa-pss_keys.patch +++ b/patches/node/fixme_revert_crypto_add_support_for_rsa-pss_keys.patch @@ -110,10 +110,10 @@ index b6a3376e735094f970ef61a52ef9bb6d6101647a..bb70c2305fd44cfea46a8df5e65d1af5 Sign.prototype.sign = function sign(options, encoding) { diff --git a/src/env.h b/src/env.h -index 63e71fc1fc2b0e95a85f38b58b34eeb290d8f09d..1415e32c02c4ffc6e3205ff15bef2006021bb1c2 100644 +index ecb845803776f5ff6e7eec712ec7a5ebea2e8d0a..1516d77be8514ce55d8d21b78a7cd85ead2cb95f 100644 --- a/src/env.h +++ b/src/env.h -@@ -170,7 +170,6 @@ constexpr size_t kFsStatsBufferLength = kFsStatsFieldsNumber * 2; +@@ -173,7 +173,6 @@ constexpr size_t kFsStatsBufferLength = kFsStatsFieldsNumber * 2; V(crypto_x25519_string, "x25519") \ V(crypto_x448_string, "x448") \ V(crypto_rsa_string, "rsa") \ @@ -122,7 +122,7 @@ index 63e71fc1fc2b0e95a85f38b58b34eeb290d8f09d..1415e32c02c4ffc6e3205ff15bef2006 V(data_string, "data") \ V(dest_string, "dest") \ diff --git a/src/node_crypto.cc b/src/node_crypto.cc -index 5622ae8a367b017aa4d8a7e6e5892b5caa9bbec3..87b54447574c9aef094776f9bd9397aa63c7085b 100644 +index 1cc2372fe2e385e9a9db27e38f0da61d62de2e81..cd09cdb3f2244825f6631891b94e61eeb6bc60bf 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -3727,8 +3727,6 @@ Local KeyObject::GetAsymmetricKeyType() const { @@ -134,7 +134,7 @@ index 5622ae8a367b017aa4d8a7e6e5892b5caa9bbec3..87b54447574c9aef094776f9bd9397aa case EVP_PKEY_DSA: return env()->crypto_dsa_string(); case EVP_PKEY_EC: -@@ -4730,14 +4728,13 @@ void SignBase::CheckThrow(SignBase::Error error) { +@@ -4775,14 +4773,13 @@ void SignBase::CheckThrow(SignBase::Error error) { static bool ApplyRSAOptions(const ManagedEVPPKey& pkey, EVP_PKEY_CTX* pkctx, int padding, @@ -153,7 +153,7 @@ index 5622ae8a367b017aa4d8a7e6e5892b5caa9bbec3..87b54447574c9aef094776f9bd9397aa return false; } } -@@ -4788,16 +4785,11 @@ void Sign::SignUpdate(const FunctionCallbackInfo& args) { +@@ -4833,16 +4830,11 @@ void Sign::SignUpdate(const FunctionCallbackInfo& args) { sign->CheckThrow(err); } @@ -171,7 +171,7 @@ index 5622ae8a367b017aa4d8a7e6e5892b5caa9bbec3..87b54447574c9aef094776f9bd9397aa unsigned char m[EVP_MAX_MD_SIZE]; unsigned int m_len; -@@ -4830,7 +4822,7 @@ static AllocatedBuffer Node_SignFinal(Environment* env, +@@ -4875,7 +4867,7 @@ static AllocatedBuffer Node_SignFinal(Environment* env, Sign::SignResult Sign::SignFinal( const ManagedEVPPKey& pkey, int padding, @@ -180,7 +180,7 @@ index 5622ae8a367b017aa4d8a7e6e5892b5caa9bbec3..87b54447574c9aef094776f9bd9397aa if (!mdctx_) return SignResult(kSignNotInitialised); -@@ -4881,17 +4873,11 @@ void Sign::SignFinal(const FunctionCallbackInfo& args) { +@@ -4926,17 +4918,11 @@ void Sign::SignFinal(const FunctionCallbackInfo& args) { if (!key) return; @@ -202,7 +202,7 @@ index 5622ae8a367b017aa4d8a7e6e5892b5caa9bbec3..87b54447574c9aef094776f9bd9397aa SignResult ret = sign->SignFinal( key, -@@ -4952,17 +4938,11 @@ void SignOneShot(const FunctionCallbackInfo& args) { +@@ -4997,17 +4983,11 @@ void SignOneShot(const FunctionCallbackInfo& args) { return CheckThrow(env, SignBase::Error::kSignUnknownDigest); } @@ -224,7 +224,7 @@ index 5622ae8a367b017aa4d8a7e6e5892b5caa9bbec3..87b54447574c9aef094776f9bd9397aa EVP_PKEY_CTX* pkctx = nullptr; EVPMDPointer mdctx(EVP_MD_CTX_new()); -@@ -5040,7 +5020,7 @@ SignBase::Error Verify::VerifyFinal(const ManagedEVPPKey& pkey, +@@ -5085,7 +5065,7 @@ SignBase::Error Verify::VerifyFinal(const ManagedEVPPKey& pkey, const char* sig, int siglen, int padding, @@ -233,7 +233,7 @@ index 5622ae8a367b017aa4d8a7e6e5892b5caa9bbec3..87b54447574c9aef094776f9bd9397aa bool* verify_result) { if (!mdctx_) return kSignNotInitialised; -@@ -5084,17 +5064,11 @@ void Verify::VerifyFinal(const FunctionCallbackInfo& args) { +@@ -5129,17 +5109,11 @@ void Verify::VerifyFinal(const FunctionCallbackInfo& args) { ArrayBufferViewContents hbuf(args[offset]); @@ -255,7 +255,7 @@ index 5622ae8a367b017aa4d8a7e6e5892b5caa9bbec3..87b54447574c9aef094776f9bd9397aa bool verify_result; Error err = verify->VerifyFinal(pkey, hbuf.data(), hbuf.length(), padding, -@@ -5127,17 +5101,11 @@ void VerifyOneShot(const FunctionCallbackInfo& args) { +@@ -5172,17 +5146,11 @@ void VerifyOneShot(const FunctionCallbackInfo& args) { return CheckThrow(env, SignBase::Error::kSignUnknownDigest); } @@ -277,7 +277,7 @@ index 5622ae8a367b017aa4d8a7e6e5892b5caa9bbec3..87b54447574c9aef094776f9bd9397aa EVP_PKEY_CTX* pkctx = nullptr; EVPMDPointer mdctx(EVP_MD_CTX_new()); -@@ -6135,48 +6103,6 @@ class RSAKeyPairGenerationConfig : public KeyPairGenerationConfig { +@@ -6181,48 +6149,6 @@ class RSAKeyPairGenerationConfig : public KeyPairGenerationConfig { const unsigned int exponent_; }; @@ -326,7 +326,7 @@ index 5622ae8a367b017aa4d8a7e6e5892b5caa9bbec3..87b54447574c9aef094776f9bd9397aa class DSAKeyPairGenerationConfig : public KeyPairGenerationConfig { public: DSAKeyPairGenerationConfig(unsigned int modulus_bits, int divisor_bits) -@@ -6410,44 +6336,6 @@ void GenerateKeyPairRSA(const FunctionCallbackInfo& args) { +@@ -6456,44 +6382,6 @@ void GenerateKeyPairRSA(const FunctionCallbackInfo& args) { GenerateKeyPair(args, 2, std::move(config)); } @@ -371,7 +371,7 @@ index 5622ae8a367b017aa4d8a7e6e5892b5caa9bbec3..87b54447574c9aef094776f9bd9397aa void GenerateKeyPairDSA(const FunctionCallbackInfo& args) { CHECK(args[0]->IsUint32()); const uint32_t modulus_bits = args[0].As()->Value(); -@@ -6899,7 +6787,6 @@ void Initialize(Local target, +@@ -6945,7 +6833,6 @@ void Initialize(Local target, env->SetMethod(target, "pbkdf2", PBKDF2); env->SetMethod(target, "generateKeyPairRSA", GenerateKeyPairRSA); @@ -380,10 +380,10 @@ index 5622ae8a367b017aa4d8a7e6e5892b5caa9bbec3..87b54447574c9aef094776f9bd9397aa env->SetMethod(target, "generateKeyPairEC", GenerateKeyPairEC); env->SetMethod(target, "generateKeyPairNid", GenerateKeyPairNid); diff --git a/src/node_crypto.h b/src/node_crypto.h -index 3e337eaddbe490b98aa2f9da2e310c94e4a96bf8..e526325a60feaa345f02e021f7ba1c9e3d8ca602 100644 +index 07ca412e8f7fc6281553ca90a4c3c8c18726c526..04a06affce1de8c567034d084c43b1a016076353 100644 --- a/src/node_crypto.h +++ b/src/node_crypto.h -@@ -657,7 +657,7 @@ class Sign : public SignBase { +@@ -660,7 +660,7 @@ class Sign : public SignBase { SignResult SignFinal( const ManagedEVPPKey& pkey, int padding, @@ -392,7 +392,7 @@ index 3e337eaddbe490b98aa2f9da2e310c94e4a96bf8..e526325a60feaa345f02e021f7ba1c9e protected: static void New(const v8::FunctionCallbackInfo& args); -@@ -678,7 +678,7 @@ class Verify : public SignBase { +@@ -681,7 +681,7 @@ class Verify : public SignBase { const char* sig, int siglen, int padding, @@ -402,7 +402,7 @@ index 3e337eaddbe490b98aa2f9da2e310c94e4a96bf8..e526325a60feaa345f02e021f7ba1c9e protected: diff --git a/test/fixtures/keys/Makefile b/test/fixtures/keys/Makefile -index 226dc67346ef740ae9d622c03271d2761e51e713..492a30f6e43fc8068b8b89da86cdfe6250fe1fe6 100644 +index 824704c7241b0ae58f5b4f2768b429f465aafb9b..28afa6685955b1ad57901c776c268cd3aef7d508 100644 --- a/test/fixtures/keys/Makefile +++ b/test/fixtures/keys/Makefile @@ -61,12 +61,6 @@ all: \ diff --git a/patches/node/fixme_use_redefined_version_of_internalmodulestat.patch b/patches/node/fixme_use_redefined_version_of_internalmodulestat.patch index fffa3407345..d88e462aa05 100644 --- a/patches/node/fixme_use_redefined_version_of_internalmodulestat.patch +++ b/patches/node/fixme_use_redefined_version_of_internalmodulestat.patch @@ -10,10 +10,10 @@ internalModuleStat` in the very beginning of the file holds a reference to a native Node.js implementation of the function. diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js -index b6bef5f0fdb6f60e4baf5fbd647f191a0e290355..2f5385cea51d3456dffb43a852bd2b3cdce9998b 100644 +index 70da676a40feeaa82d3a0ccd1c17882ab5d6edf3..ffc7fb6fd5857b807198d4d26b7b899e63cde4a1 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js -@@ -85,6 +85,8 @@ const relativeResolveCache = Object.create(null); +@@ -93,6 +93,8 @@ const relativeResolveCache = Object.create(null); let requireDepth = 0; let statCache = null; function stat(filename) { diff --git a/patches/node/inherit_electron_crashpad_pipe_name_in_child_process.patch b/patches/node/inherit_electron_crashpad_pipe_name_in_child_process.patch index 573fdba2a1d..51ae6e7ffdf 100644 --- a/patches/node/inherit_electron_crashpad_pipe_name_in_child_process.patch +++ b/patches/node/inherit_electron_crashpad_pipe_name_in_child_process.patch @@ -6,7 +6,7 @@ Subject: Inherit ELECTRON_CRASHPAD_PIPE_NAME in child process This is required for crashReporter to work correctly in node process. diff --git a/lib/child_process.js b/lib/child_process.js -index 2a2e68aaf23116203d756431cafd81c106ed9044..724ac30c5cfc79a01d4fc8c0e5b0a044a7143cd5 100644 +index ec429a082b081f0289507c15aa9ecc5305345ca2..7c231993e60278d3946745cba15c458962556581 100644 --- a/lib/child_process.js +++ b/lib/child_process.js @@ -108,6 +108,10 @@ function fork(modulePath /* , args, options */) { diff --git a/patches/node/make_module_globalpaths_a_reference.patch b/patches/node/make_module_globalpaths_a_reference.patch index c4f58129cc0..cfa1b76fbc7 100644 --- a/patches/node/make_module_globalpaths_a_reference.patch +++ b/patches/node/make_module_globalpaths_a_reference.patch @@ -10,10 +10,10 @@ 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 00bc575b1f7d4b271ccbb342ddbe3c53b7915c30..865e9d13e840351bcf61bec771462fc88ee0a602 100644 +index 95724d4c27f12e4f9c90f70b20d3d7fad3e9f035..2a1a412fe7c55b8046b19860005e89a52ee3b816 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js -@@ -916,8 +916,8 @@ Module._initPaths = function() { +@@ -1008,8 +1008,8 @@ Module._initPaths = function() { modulePaths = paths; diff --git a/patches/node/pass_all_globals_through_require.patch b/patches/node/pass_all_globals_through_require.patch index 48c5a9f7e71..4ea9e318510 100644 --- a/patches/node/pass_all_globals_through_require.patch +++ b/patches/node/pass_all_globals_through_require.patch @@ -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 865e9d13e840351bcf61bec771462fc88ee0a602..b6bef5f0fdb6f60e4baf5fbd647f191a0e290355 100644 +index 2a1a412fe7c55b8046b19860005e89a52ee3b816..70da676a40feeaa82d3a0ccd1c17882ab5d6edf3 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js -@@ -71,6 +71,13 @@ const { +@@ -79,6 +79,13 @@ const { CHAR_COLON } = require('internal/constants'); @@ -23,7 +23,7 @@ index 865e9d13e840351bcf61bec771462fc88ee0a602..b6bef5f0fdb6f60e4baf5fbd647f191a const isWindows = process.platform === 'win32'; const relativeResolveCache = Object.create(null); -@@ -771,10 +778,12 @@ Module.prototype._compile = function(content, filename) { +@@ -863,10 +870,12 @@ Module.prototype._compile = function(content, filename) { if (requireDepth === 0) statCache = new Map(); if (inspectorWrapper) { result = inspectorWrapper(compiledWrapper, thisValue, exports, diff --git a/patches/node/refactor_allow_embedder_overriding_of_internal_fs_calls.patch b/patches/node/refactor_allow_embedder_overriding_of_internal_fs_calls.patch index 51069ac5338..755dc804b92 100644 --- a/patches/node/refactor_allow_embedder_overriding_of_internal_fs_calls.patch +++ b/patches/node/refactor_allow_embedder_overriding_of_internal_fs_calls.patch @@ -20,10 +20,10 @@ index 86b2164bb0d74a531acd0f01da5269642ea574cf..48a38a6b5054c6bf14df82a8cb3c41d4 process.config = JSON.parse(internalBinding('native_module').config); diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js -index 2f5385cea51d3456dffb43a852bd2b3cdce9998b..c975804d847eea5a8d759f79121aa4da61e88dc4 100644 +index ffc7fb6fd5857b807198d4d26b7b899e63cde4a1..2a7ffbff213f23536b94664c3ecffa18eb812849 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js -@@ -31,10 +31,7 @@ const assert = require('internal/assert'); +@@ -37,10 +37,7 @@ const assert = require('internal/assert'); const fs = require('fs'); const internalFS = require('internal/fs/utils'); const path = require('path'); @@ -35,7 +35,7 @@ index 2f5385cea51d3456dffb43a852bd2b3cdce9998b..c975804d847eea5a8d759f79121aa4da const { safeGetenv } = internalBinding('credentials'); const { makeRequireFunction, -@@ -85,14 +82,12 @@ const relativeResolveCache = Object.create(null); +@@ -93,14 +90,12 @@ const relativeResolveCache = Object.create(null); let requireDepth = 0; let statCache = null; function stat(filename) { @@ -51,9 +51,9 @@ index 2f5385cea51d3456dffb43a852bd2b3cdce9998b..c975804d847eea5a8d759f79121aa4da if (statCache !== null) statCache.set(filename, result); return result; } -@@ -199,7 +194,7 @@ function readPackage(requestPath) { - return entry; +@@ -205,7 +200,7 @@ const packageExportsCache = new SafeMap(); + function readPackageRaw(requestPath) { const jsonPath = path.resolve(requestPath, 'package.json'); - const json = internalModuleReadJSON(path.toNamespacedPath(jsonPath)); + const json = internalFsBinding.internalModuleReadJSON(path.toNamespacedPath(jsonPath)); diff --git a/patches/node/refactor_alter_child_process_fork_to_use_execute_script_with.patch b/patches/node/refactor_alter_child_process_fork_to_use_execute_script_with.patch index 34beaf8aa2f..746b9284416 100644 --- a/patches/node/refactor_alter_child_process_fork_to_use_execute_script_with.patch +++ b/patches/node/refactor_alter_child_process_fork_to_use_execute_script_with.patch @@ -7,7 +7,7 @@ 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 0d3785f0d5b9b8a2959e9487500d010796709d7f..2a2e68aaf23116203d756431cafd81c106ed9044 100644 +index 43257e53dfe0319d6c110e94529cbc991c2bcfb3..ec429a082b081f0289507c15aa9ecc5305345ca2 100644 --- a/lib/child_process.js +++ b/lib/child_process.js @@ -102,6 +102,16 @@ function fork(modulePath /* , args, options */) { diff --git a/patches/node/revert_crypto_add_outputlength_option_to_crypto_createhash.patch b/patches/node/revert_crypto_add_outputlength_option_to_crypto_createhash.patch new file mode 100644 index 00000000000..382cde4a2ea --- /dev/null +++ b/patches/node/revert_crypto_add_outputlength_option_to_crypto_createhash.patch @@ -0,0 +1,262 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nitish Sakhawalkar +Date: Mon, 12 Aug 2019 12:54:47 -0700 +Subject: Revert "crypto: add outputLength option to crypto.createHash" + +This reverts commit b7c6ad595b80442e433c6308dc5b80ed641866e0. + +diff --git a/doc/api/crypto.md b/doc/api/crypto.md +index 8132e2975483b8fda95fe4466910dd42f74866cd..9b7aab3009770bb7816493581d82b63b7e19f2f3 100644 +--- a/doc/api/crypto.md ++++ b/doc/api/crypto.md +@@ -1785,10 +1785,6 @@ and description of each available elliptic curve. + ### crypto.createHash(algorithm[, options]) + + * `algorithm` {string} + * `options` {Object} [`stream.transform` options][] +@@ -1796,8 +1792,7 @@ changes: + + Creates and returns a `Hash` object that can be used to generate hash digests + using the given `algorithm`. Optional `options` argument controls stream +-behavior. For XOF hash functions such as `'shake256'`, the `outputLength` option +-can be used to specify the desired output length in bytes. ++behavior. + + The `algorithm` is dependent on the available algorithms supported by the + version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. +diff --git a/lib/internal/crypto/hash.js b/lib/internal/crypto/hash.js +index 38b125e5f22c2dd5220a983d8126bef1feb5462b..a58164802124d30ac0fa2c5b472857fa018d2bfa 100644 +--- a/lib/internal/crypto/hash.js ++++ b/lib/internal/crypto/hash.js +@@ -25,7 +25,7 @@ const { + ERR_CRYPTO_HASH_UPDATE_FAILED, + ERR_INVALID_ARG_TYPE + } = require('internal/errors').codes; +-const { validateString, validateUint32 } = require('internal/validators'); ++const { validateString } = require('internal/validators'); + const { normalizeEncoding } = require('internal/util'); + const { isArrayBufferView } = require('internal/util/types'); + const LazyTransform = require('internal/streams/lazy_transform'); +@@ -36,11 +36,7 @@ function Hash(algorithm, options) { + if (!(this instanceof Hash)) + return new Hash(algorithm, options); + validateString(algorithm, 'algorithm'); +- const xofLen = typeof options === 'object' && options !== null ? +- options.outputLength : undefined; +- if (xofLen !== undefined) +- validateUint32(xofLen, 'options.outputLength'); +- this[kHandle] = new _Hash(algorithm, xofLen); ++ this[kHandle] = new _Hash(algorithm); + this[kState] = { + [kFinalized]: false + }; +diff --git a/src/node_crypto.cc b/src/node_crypto.cc +index cd09cdb3f2244825f6631891b94e61eeb6bc60bf..177de527c634671c571ebe4c2cfdeedc1c423ecc 100644 +--- a/src/node_crypto.cc ++++ b/src/node_crypto.cc +@@ -4563,21 +4563,15 @@ void Hash::New(const FunctionCallbackInfo& args) { + + const node::Utf8Value hash_type(env->isolate(), args[0]); + +- Maybe xof_md_len = Nothing(); +- if (!args[1]->IsUndefined()) { +- CHECK(args[1]->IsUint32()); +- xof_md_len = Just(args[1].As()->Value()); +- } +- + Hash* hash = new Hash(env, args.This()); +- if (!hash->HashInit(*hash_type, xof_md_len)) { ++ if (!hash->HashInit(*hash_type)) { + return ThrowCryptoError(env, ERR_get_error(), + "Digest method not supported"); + } + } + + +-bool Hash::HashInit(const char* hash_type, Maybe xof_md_len) { ++bool Hash::HashInit(const char* hash_type) { + const EVP_MD* md = EVP_get_digestbyname(hash_type); + if (md == nullptr) + return false; +@@ -4586,18 +4580,6 @@ bool Hash::HashInit(const char* hash_type, Maybe xof_md_len) { + mdctx_.reset(); + return false; + } +- +- md_len_ = EVP_MD_size(md); +- if (xof_md_len.IsJust() && xof_md_len.FromJust() != md_len_) { +- // This is a little hack to cause createHash to fail when an incorrect +- // hashSize option was passed for a non-XOF hash function. +- if ((EVP_MD_meth_get_flags(md) & EVP_MD_FLAG_XOF) == 0) { +- EVPerr(EVP_F_EVP_DIGESTFINALXOF, EVP_R_NOT_XOF_OR_INVALID_LENGTH); +- return false; +- } +- md_len_ = xof_md_len.FromJust(); +- } +- + return true; + } + +@@ -4646,40 +4628,13 @@ void Hash::HashDigest(const FunctionCallbackInfo& args) { + encoding = ParseEncoding(env->isolate(), args[0], BUFFER); + } + +- // TODO(tniessen): SHA3_squeeze does not work for zero-length outputs on all +- // platforms and will cause a segmentation fault if called. This workaround +- // causes hash.digest() to correctly return an empty buffer / string. +- // See https://github.com/openssl/openssl/issues/9431. +- if (!hash->has_md_ && hash->md_len_ == 0) { +- hash->has_md_ = true; +- } +- +- if (!hash->has_md_) { ++ if (hash->md_len_ == 0) { + // Some hash algorithms such as SHA3 do not support calling + // EVP_DigestFinal_ex more than once, however, Hash._flush + // and Hash.digest can both be used to retrieve the digest, + // so we need to cache it. + // See https://github.com/nodejs/node/issues/28245. +- +- hash->md_value_ = MallocOpenSSL(hash->md_len_); +- +- size_t default_len = EVP_MD_CTX_size(hash->mdctx_.get()); +- int ret; +- if (hash->md_len_ == default_len) { +- ret = EVP_DigestFinal_ex(hash->mdctx_.get(), hash->md_value_, +- &hash->md_len_); +- } else { +- ret = EVP_DigestFinalXOF(hash->mdctx_.get(), hash->md_value_, +- hash->md_len_); +- } +- +- if (ret != 1) { +- OPENSSL_free(hash->md_value_); +- hash->md_value_ = nullptr; +- return ThrowCryptoError(env, ERR_get_error()); +- } +- +- hash->has_md_ = true; ++ EVP_DigestFinal_ex(hash->mdctx_.get(), hash->md_value_, &hash->md_len_); + } + + Local error; +diff --git a/src/node_crypto.h b/src/node_crypto.h +index 04a06affce1de8c567034d084c43b1a016076353..e526325a60feaa345f02e021f7ba1c9e3d8ca602 100644 +--- a/src/node_crypto.h ++++ b/src/node_crypto.h +@@ -585,7 +585,7 @@ class Hash : public BaseObject { + SET_MEMORY_INFO_NAME(Hash) + SET_SELF_SIZE(Hash) + +- bool HashInit(const char* hash_type, v8::Maybe xof_md_len); ++ bool HashInit(const char* hash_type); + bool HashUpdate(const char* data, int len); + + protected: +@@ -596,21 +596,18 @@ class Hash : public BaseObject { + Hash(Environment* env, v8::Local wrap) + : BaseObject(env, wrap), + mdctx_(nullptr), +- has_md_(false), +- md_value_(nullptr) { ++ md_len_(0) { + MakeWeak(); + } + + ~Hash() override { +- if (md_value_ != nullptr) +- OPENSSL_clear_free(md_value_, md_len_); ++ OPENSSL_cleanse(md_value_, md_len_); + } + + private: + EVPMDPointer mdctx_; +- bool has_md_; ++ unsigned char md_value_[EVP_MAX_MD_SIZE]; + unsigned int md_len_; +- unsigned char* md_value_; + }; + + class SignBase : public BaseObject { +diff --git a/test/parallel/test-crypto-hash.js b/test/parallel/test-crypto-hash.js +index 4d3214adb2db0b31e9172f3f20b056b5f1af3c7d..de15f00bc918aa4a80b02ae0c51957be264eb3c5 100644 +--- a/test/parallel/test-crypto-hash.js ++++ b/test/parallel/test-crypto-hash.js +@@ -185,71 +185,3 @@ common.expectsError( + assert(instance instanceof Hash, 'Hash is expected to return a new instance' + + ' when called without `new`'); + } +- +-// Test XOF hash functions and the outputLength option. +-{ +- // Default outputLengths. +- assert.strictEqual(crypto.createHash('shake128').digest('hex'), +- '7f9c2ba4e88f827d616045507605853e'); +- assert.strictEqual(crypto.createHash('shake128', null).digest('hex'), +- '7f9c2ba4e88f827d616045507605853e'); +- assert.strictEqual(crypto.createHash('shake256').digest('hex'), +- '46b9dd2b0ba88d13233b3feb743eeb24' + +- '3fcd52ea62b81b82b50c27646ed5762f'); +- +- // Short outputLengths. +- assert.strictEqual(crypto.createHash('shake128', { outputLength: 0 }) +- .digest('hex'), +- ''); +- assert.strictEqual(crypto.createHash('shake128', { outputLength: 5 }) +- .digest('hex'), +- '7f9c2ba4e8'); +- assert.strictEqual(crypto.createHash('shake128', { outputLength: 15 }) +- .digest('hex'), +- '7f9c2ba4e88f827d61604550760585'); +- assert.strictEqual(crypto.createHash('shake256', { outputLength: 16 }) +- .digest('hex'), +- '46b9dd2b0ba88d13233b3feb743eeb24'); +- +- // Large outputLengths. +- assert.strictEqual(crypto.createHash('shake128', { outputLength: 128 }) +- .digest('hex'), +- '7f9c2ba4e88f827d616045507605853e' + +- 'd73b8093f6efbc88eb1a6eacfa66ef26' + +- '3cb1eea988004b93103cfb0aeefd2a68' + +- '6e01fa4a58e8a3639ca8a1e3f9ae57e2' + +- '35b8cc873c23dc62b8d260169afa2f75' + +- 'ab916a58d974918835d25e6a435085b2' + +- 'badfd6dfaac359a5efbb7bcc4b59d538' + +- 'df9a04302e10c8bc1cbf1a0b3a5120ea'); +- const superLongHash = crypto.createHash('shake256', { +- outputLength: 1024 * 1024 +- }).update('The message is shorter than the hash!') +- .digest('hex'); +- assert.strictEqual(superLongHash.length, 2 * 1024 * 1024); +- assert.ok(superLongHash.endsWith('193414035ddba77bf7bba97981e656ec')); +- assert.ok(superLongHash.startsWith('a2a28dbc49cfd6e5d6ceea3d03e77748')); +- +- // Non-XOF hash functions should accept valid outputLength options as well. +- assert.strictEqual(crypto.createHash('sha224', { outputLength: 28 }) +- .digest('hex'), +- 'd14a028c2a3a2bc9476102bb288234c4' + +- '15a2b01f828ea62ac5b3e42f'); +- +- // Passing invalid sizes should throw during creation. +- common.expectsError(() => { +- crypto.createHash('sha256', { outputLength: 28 }); +- }, { +- code: 'ERR_OSSL_EVP_NOT_XOF_OR_INVALID_LENGTH' +- }); +- +- for (const outputLength of [null, {}, 'foo', false]) { +- common.expectsError(() => crypto.createHash('sha256', { outputLength }), +- { code: 'ERR_INVALID_ARG_TYPE' }); +- } +- +- for (const outputLength of [-1, .5, Infinity, 2 ** 90]) { +- common.expectsError(() => crypto.createHash('sha256', { outputLength }), +- { code: 'ERR_OUT_OF_RANGE' }); +- } +-} diff --git a/patches/node/src_add_missing_option_parser_template_for_the_debugoptionsparser.patch b/patches/node/src_add_missing_option_parser_template_for_the_debugoptionsparser.patch deleted file mode 100644 index 44d130ed0cd..00000000000 --- a/patches/node/src_add_missing_option_parser_template_for_the_debugoptionsparser.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Samuel Attard -Date: Thu, 4 Jul 2019 15:28:22 -0700 -Subject: src: add missing option parser template for the DebugOptionsParser - -This allows embedders to run `node::options_parser::Parse` for a -`node::DebugOptions`. - -This can be removed once https://github.com/nodejs/node/pull/28543 is -merged and available in our node fork. - -diff --git a/src/node_options.cc b/src/node_options.cc -index e2f20d1b7b5ad4407b5630b163ee1c29a18027ce..01ecbd2c7318f90ec79af7450119d6368ed30d6a 100644 ---- a/src/node_options.cc -+++ b/src/node_options.cc -@@ -232,6 +232,16 @@ class PerProcessOptionsParser : public OptionsParser { - #if HAVE_INSPECTOR - const DebugOptionsParser _dop_instance{}; - const EnvironmentOptionsParser _eop_instance{_dop_instance}; -+ -+template <> -+void Parse( -+ StringVector* const args, StringVector* const exec_args, -+ StringVector* const v8_args, -+ DebugOptions* const options, -+ OptionEnvvarSettings required_env_settings, StringVector* const errors) { -+ _dop_instance.Parse( -+ args, exec_args, v8_args, options, required_env_settings, errors); -+} - #else - const EnvironmentOptionsParser _eop_instance{}; - #endif // HAVE_INSPECTOR diff --git a/patches/node/src_disable_node_use_v8_platform_in_node_options.patch b/patches/node/src_disable_node_use_v8_platform_in_node_options.patch index 8af3423f255..758af2f8135 100644 --- a/patches/node/src_disable_node_use_v8_platform_in_node_options.patch +++ b/patches/node/src_disable_node_use_v8_platform_in_node_options.patch @@ -6,7 +6,7 @@ Subject: src: Disable NODE_USE_V8_PLATFORM in node_options Electron does not set NODE_USE_V8_PLATFORM. If inspector is enabled when NODE_USE_V8_PLATFORM is false, then there's an error. We want to ignore that, use our own v8 platform but still use the node inspector diff --git a/src/node_options.cc b/src/node_options.cc -index 9b9b9324d681d8a55418c7a43a071a6f978750e7..e2f20d1b7b5ad4407b5630b163ee1c29a18027ce 100644 +index b9d6108c5db800465e6c7156ad1c28002c33261b..01dddb979042c098326a8b1ff37397642733f49b 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -33,7 +33,7 @@ DebugOptions& DebugOptions::operator=(const DebugOptions&) = default; diff --git a/patches/node/src_expose_maybeinitializecontext_to_allow_existing_contexts.patch b/patches/node/src_expose_maybeinitializecontext_to_allow_existing_contexts.patch index 31fba3a0005..1b6d310f81d 100644 --- a/patches/node/src_expose_maybeinitializecontext_to_allow_existing_contexts.patch +++ b/patches/node/src_expose_maybeinitializecontext_to_allow_existing_contexts.patch @@ -9,10 +9,10 @@ can still use them in a node Environment now that primordials are initialized and required so early. diff --git a/src/api/environment.cc b/src/api/environment.cc -index bfd279aa7e7cd4d50b6cffe75d6f8e41c0213acb..5011774be2c5fee910079790feae747fa1785b87 100644 +index 35e8666ef771c56a1bcd441c99d4483a0d3e90bf..443f49320b2e6720f932fcfcefdbe6e539594964 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc -@@ -363,6 +363,13 @@ Local NewContext(Isolate* isolate, +@@ -357,6 +357,13 @@ Local NewContext(Isolate* isolate, Local object_template) { auto context = Context::New(isolate, nullptr, object_template); if (context.IsEmpty()) return context; @@ -27,7 +27,7 @@ index bfd279aa7e7cd4d50b6cffe75d6f8e41c0213acb..5011774be2c5fee910079790feae747f context->SetEmbedderData(ContextEmbedderIndex::kAllowWasmCodeGeneration, diff --git a/src/node.h b/src/node.h -index dca89e212c89df19d0b97d748e3649392fec000c..de007ed97a52c17cff8b8917d25f2383d5bbae6a 100644 +index a2b47d1cf984ec36994b477b371cdf262191ab9c..c51fb1a6a6e497a091e2ba0b147e3d7b6a4d685c 100644 --- a/src/node.h +++ b/src/node.h @@ -303,6 +303,14 @@ NODE_EXTERN v8::Local NewContext( diff --git a/patches/node/src_read_break_node_first_line_from_the_inspect_options.patch b/patches/node/src_read_break_node_first_line_from_the_inspect_options.patch deleted file mode 100644 index f0951e6c22b..00000000000 --- a/patches/node/src_read_break_node_first_line_from_the_inspect_options.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Samuel Attard -Date: Sun, 2 Jun 2019 12:43:59 -0700 -Subject: src: read break_node_first_line from the inspect options - -There are cases where the debug_options() on the env are -different to the options that were passed into inspector::Agent. - -diff --git a/src/node.cc b/src/node.cc -index 00fb0ed1c9cfbc86a7ec7d1d0ce7789b68d6a1e3..707579c8254903f5c587fa42711eb5d0184b4112 100644 ---- a/src/node.cc -+++ b/src/node.cc -@@ -256,7 +256,7 @@ int Environment::InitializeInspector( - - profiler::StartProfilers(this); - -- if (options_->debug_options().break_node_first_line) { -+ if (inspector_agent_->options().break_node_first_line) { - inspector_agent_->PauseOnNextJavascriptStatement("Break at bootstrap"); - } - diff --git a/patches/node/src_use_check_false_in_switch_default_case.patch b/patches/node/src_use_check_false_in_switch_default_case.patch index 5d83cfa486c..423065a092d 100644 --- a/patches/node/src_use_check_false_in_switch_default_case.patch +++ b/patches/node/src_use_check_false_in_switch_default_case.patch @@ -6,7 +6,7 @@ Subject: src: use CHECK(false) in switch default case Porting https://github.com/nodejs/node/pull/26502 diff --git a/src/node_crypto.cc b/src/node_crypto.cc -index 4933bf7f1bd2cd5e4293e52a241fcfd5fda6b779..300d2b92d7040c831b3178202a725df15191407d 100644 +index dd78a59742fc05e938ba2397d3701b2ac8ccfc23..bca482cc9724fef680196a192a6bbd7b4d2e4fde 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -3476,7 +3476,7 @@ static ManagedEVPPKey GetPublicOrPrivateKeyFromJs( diff --git a/script/node-disabled-tests.json b/script/node-disabled-tests.json index cf09748523c..077d6988e11 100644 --- a/script/node-disabled-tests.json +++ b/script/node-disabled-tests.json @@ -3,6 +3,10 @@ "parallel/test-async-hooks-promise", "parallel/test-async-hooks-promise-triggerid", "parallel/test-async-hooks-top-level-clearimmediate", + "parallel/test-inspector-async-hook-after-done", + "parallel/test-inspector-workers-flat-list", + "parallel/test-sync-io-option", + "parallel/test-heapdump-async-hooks-init-promise", "parallel/test-bootstrap-modules", "parallel/test-buffer-backing-arraybuffer", "parallel/test-buffer-constructor-node-modules-paths",