build: revert bump Node.js to v22.9.0 (#44596)

* Revert "chore: bump Node.js to v22.9.0 (#44281)"

This reverts commit c63d0d61e7.

* chore: update patches
This commit is contained in:
Keeley Hammond 2024-11-07 19:20:50 -08:00 коммит произвёл GitHub
Родитель 4b57a8fb1a
Коммит f9a04012b9
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
74 изменённых файлов: 3997 добавлений и 1439 удалений

Просмотреть файл

@ -176,7 +176,7 @@ jobs:
if [ "${{ inputs.is-asan }}" == "true" ]; then
cd ..
ASAN_SYMBOLIZE="$PWD/tools/valgrind/asan/asan_symbolize.py --executable-path=$PWD/out/Default/electron"
export ASAN_OPTIONS="symbolize=0 handle_abort=1 detect_container_overflow=0"
export ASAN_OPTIONS="symbolize=0 handle_abort=1"
export G_SLICE=always-malloc
export NSS_DISABLE_ARENA_FREE_LIST=1
export NSS_DISABLE_UNLOAD=1

Просмотреть файл

@ -9,7 +9,7 @@ import("//pdf/features.gni")
import("//ppapi/buildflags/buildflags.gni")
import("//printing/buildflags/buildflags.gni")
import("//testing/test.gni")
import("//third_party/electron_node/node.gni")
import("//third_party/electron_node/electron_node.gni")
import("//third_party/ffmpeg/ffmpeg_options.gni")
import("//tools/generate_library_loader/generate_library_loader.gni")
import("//tools/grit/grit_rule.gni")
@ -408,7 +408,7 @@ action("electron_generate_node_defines") {
source_set("electron_lib") {
configs += [
"//v8:external_startup_data",
"//third_party/electron_node:node_external_config",
"//third_party/electron_node:node_internals",
]
public_configs = [
@ -483,7 +483,7 @@ source_set("electron_lib") {
"//third_party/blink/public:blink_devtools_inspector_resources",
"//third_party/blink/public/platform/media",
"//third_party/boringssl",
"//third_party/electron_node:libnode",
"//third_party/electron_node:node_lib",
"//third_party/inspector_protocol:crdtp",
"//third_party/leveldatabase",
"//third_party/libyuv",
@ -868,7 +868,7 @@ if (is_mac) {
":electron_framework_resources",
":electron_swiftshader_library",
":electron_xibs",
"//third_party/electron_node:libnode",
"//third_party/electron_node:node_lib",
]
if (!is_mas_build) {
deps += [ ":electron_crashpad_helper" ]
@ -1192,7 +1192,7 @@ if (is_mac) {
"//components/crash/core/app",
"//content:sandbox_helper_win",
"//electron/buildflags",
"//third_party/electron_node:libnode",
"//third_party/electron_node:node_lib",
"//ui/strings",
]

2
DEPS
Просмотреть файл

@ -4,7 +4,7 @@ vars = {
'chromium_version':
'132.0.6820.0',
'node_version':
'v22.9.0',
'v20.18.0',
'nan_version':
'e14bdcd1f72d62bca1d541b66da43130384ec213',
'squirrel.mac_version':

Просмотреть файл

@ -42,7 +42,7 @@ safe.
The only way to load a native module safely for now, is to make sure the app
loads no native modules after the Web Workers get started.
```js
```js @ts-expect-error=[1]
process.dlopen = () => {
throw new Error('Load native module is not safe')
}

Просмотреть файл

@ -841,27 +841,6 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
return files;
};
const modBinding = internalBinding('modules');
const { readPackageJSON } = modBinding;
internalBinding('modules').readPackageJSON = (
jsonPath: string,
isESM: boolean,
base: undefined | string,
specifier: undefined | string
) => {
const pathInfo = splitPath(jsonPath);
if (!pathInfo.isAsar) return readPackageJSON(jsonPath, isESM, base, specifier);
const { asarPath, filePath } = pathInfo;
const archive = getOrCreateArchive(asarPath);
if (!archive) return undefined;
const realPath = archive.copyFileOut(filePath);
if (!realPath) return undefined;
return readPackageJSON(realPath, isESM, base, specifier);
};
const binding = internalBinding('fs');
const { internalModuleReadJSON, kUsePromises } = binding;
internalBinding('fs').internalModuleReadJSON = (pathArgument: string) => {

Просмотреть файл

@ -9,7 +9,7 @@
},
"dependencies": {
"@electron/get": "^2.0.0",
"@types/node": "^22.7.7",
"@types/node": "^20.9.0",
"extract-zip": "^2.0.1"
},
"engines": {

Просмотреть файл

@ -14,7 +14,7 @@
"@octokit/rest": "^20.0.2",
"@primer/octicons": "^10.0.0",
"@types/minimist": "^1.2.5",
"@types/node": "^22.7.7",
"@types/node": "^20.9.0",
"@types/semver": "^7.5.8",
"@types/stream-json": "^1.7.7",
"@types/temp": "^0.9.4",

Просмотреть файл

@ -6,34 +6,15 @@ Subject: build: allow electron to use exec_script
This is similar to the //build usecase so we're OK adding ourselves here
diff --git a/.gn b/.gn
index 44a11ec90ec9b67cf22b6d529c6843e6b6af12bc..3e880eed02ca57db10d734d6a7566e0a977433a5 100644
index 44a11ec90ec9b67cf22b6d529c6843e6b6af12bc..783dd77dcdf92ec32cc6594b739eab9738f3e3ba 100644
--- a/.gn
+++ b/.gn
@@ -172,4 +172,27 @@ exec_script_whitelist =
@@ -172,4 +172,8 @@ exec_script_whitelist =
"//tools/grit/grit_rule.gni",
"//tools/gritsettings/BUILD.gn",
+
+ "//electron/BUILD.gn",
+ "//third_party/electron_node/deps/ada/unofficial.gni",
+ "//third_party/electron_node/deps/base64/BUILD.gn",
+ "//third_party/electron_node/deps/base64/unofficial.gni",
+ "//third_party/electron_node/node.gni",
+ "//third_party/electron_node/unofficial.gni",
+ "//third_party/electron_node/deps/brotli/unofficial.gni",
+ "//third_party/electron_node/deps/cares/unofficial.gni",
+ "//third_party/electron_node/deps/googletest/unofficial.gni",
+ "//third_party/electron_node/deps/histogram/unofficial.gni",
+ "//third_party/electron_node/deps/llhttp/unofficial.gni",
+ "//third_party/electron_node/deps/nbytes/unofficial.gni",
+ "//third_party/electron_node/deps/ncrypto/unofficial.gni",
+ "//third_party/electron_node/deps/nghttp2/unofficial.gni",
+ "//third_party/electron_node/deps/ngtcp2/unofficial.gni",
+ "//third_party/electron_node/deps/openssl/unofficial.gni",
+ "//third_party/electron_node/deps/simdutf/unofficial.gni",
+ "//third_party/electron_node/deps/simdjson/unofficial.gni",
+ "//third_party/electron_node/deps/sqlite/unofficial.gni",
+ "//third_party/electron_node/deps/uv/unofficial.gni",
+ "//third_party/electron_node/deps/uvwasi/unofficial.gni",
+ "//third_party/electron_node/src/inspector/unofficial.gni",
]

Просмотреть файл

@ -11,6 +11,5 @@
{ "patch_dir": "src/electron/patches/Mantle", "repo": "src/third_party/squirrel.mac/vendor/Mantle" },
{ "patch_dir": "src/electron/patches/ReactiveObjC", "repo": "src/third_party/squirrel.mac/vendor/ReactiveObjC" },
{ "patch_dir": "src/electron/patches/webrtc", "repo": "src/third_party/webrtc" },
{ "patch_dir": "src/electron/patches/reclient-configs", "repo": "src/third_party/engflow-reclient-configs" },
{ "patch_dir": "src/electron/patches/sqlite", "repo": "src/third_party/sqlite/src" }
{ "patch_dir": "src/electron/patches/reclient-configs", "repo": "src/third_party/engflow-reclient-configs" }
]

Просмотреть файл

@ -21,25 +21,37 @@ enable_crashpad_linux_node_processes.patch
fix_lazyload_fs_in_esm_loaders_to_apply_asar_patches.patch
chore_expose_importmoduledynamically_and.patch
test_formally_mark_some_tests_as_flaky.patch
fix_adapt_debugger_tests_for_upstream_v8_changes.patch
chore_remove_--no-harmony-atomics_related_code.patch
fix_account_for_createexternalizablestring_v8_global.patch
fix_do_not_resolve_electron_entrypoints.patch
ci_ensure_node_tests_set_electron_run_as_node.patch
fix_assert_module_in_the_renderer_process.patch
fix_add_trusted_space_and_trusted_lo_space_to_the_v8_heap.patch
win_process_avoid_assert_after_spawning_store_app_4152.patch
chore_remove_use_of_deprecated_kmaxlength.patch
src_update_default_v8_platform_to_override_functions_with_location.patch
fix_capture_embedder_exceptions_before_entering_v8.patch
spec_add_iterator_to_global_intrinsics.patch
test_make_test-node-output-v8-warning_generic.patch
test_match_wpt_streams_transferable_transform-stream-members_any_js.patch
fix_revert_src_lb_reducing_c_calls_of_esm_legacy_main_resolve.patch
deprecate_vector_v8_local_in_v8.patch
fix_remove_deprecated_errno_constants.patch
build_enable_perfetto.patch
fix_add_source_location_for_v8_task_runner.patch
cherry-pick_src_remove_calls_to_recently_deprecated_v8_apis.patch
src_do_not_use_deprecated_v8_api.patch
src_use_new_v8_api_to_define_stream_accessor.patch
src_remove_dependency_on_wrapper-descriptor-based_cppheap.patch
test_update_v8-stats_test_for_v8_12_6.patch
src_do_not_use_soon-to-be-deprecated_v8_api.patch
fix_add_property_query_interceptors.patch
src_stop_using_deprecated_fields_of_fastapicallbackoptions.patch
src_use_supported_api_to_get_stalled_tla_messages.patch
build_don_t_redefine_win32_lean_and_mean.patch
build_compile_with_c_20_support.patch
add_v8_taskpirority_to_foreground_task_runner_signature.patch
cli_remove_deprecated_v8_flag.patch
build_restore_clang_as_default_compiler_on_macos.patch
fix_-wextra-semi_errors_in_nghttp2_helper_h.patch
fix_remove_harmony-import-assertions_from_node_cc.patch
win_almost_fix_race_detecting_esrch_in_uv_kill.patch
chore_disable_deprecation_ftbfs_in_simdjson_header.patch
esm_drop_support_for_import_assertions.patch

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -10,19 +10,28 @@ V8 requires C++20 support as of https://chromium-review.googlesource.com/c/v8/v8
This can be removed when Electron upgrades to a version of Node.js containing the required V8 version.
diff --git a/common.gypi b/common.gypi
index 74616453e2e047acbb9e25f2f93ebeab06011669..bce15fc4a8b3f2fa0b5a588e6a2b28d2b8b6ac45 100644
index bdf1a1f33f3ea09d933757c7fee87c563cc833ab..2eb62610db2f0ebf68fa9a55ffba98291ecfe451 100644
--- a/common.gypi
+++ b/common.gypi
@@ -518,7 +518,7 @@
'-fno-rtti',
'-fno-exceptions',
'-fno-strict-aliasing',
- '-std=gnu++17',
+ '-std=gnu++20',
@@ -305,7 +305,7 @@
'VCCLCompilerTool': {
'AdditionalOptions': [
'/Zc:__cplusplus',
- '-std:c++17'
+ '-std:c++20'
],
'BufferSecurityCheck': 'true',
'DebugInformationFormat': 1, # /Z7 embed info in .obj files
@@ -487,7 +487,7 @@
}],
[ 'OS in "linux freebsd openbsd solaris android aix os400 cloudabi"', {
'cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter', ],
- 'cflags_cc': [ '-fno-rtti', '-fno-exceptions', '-std=gnu++17' ],
+ 'cflags_cc': [ '-fno-rtti', '-fno-exceptions', '-std=gnu++20' ],
'defines': [ '__STDC_FORMAT_MACROS' ],
'ldflags': [ '-rdynamic' ],
@@ -688,7 +688,7 @@
'target_conditions': [
@@ -658,7 +658,7 @@
['clang==1', {
'xcode_settings': {
'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',

Просмотреть файл

@ -12,19 +12,6 @@ adding associated guards there should be relatively small.
We should upstream this as it will eventually impact Node.js as well.
diff --git a/filenames.json b/filenames.json
index 5af3886d8d3d74d31249a4d79030a8373b8dad52..8ab04d0b1b58454c6ea21f33870f9557f3a57b56 100644
--- a/filenames.json
+++ b/filenames.json
@@ -739,8 +739,6 @@
"src/tcp_wrap.h",
"src/timers.h",
"src/tracing/agent.h",
- "src/tracing/node_trace_buffer.h",
- "src/tracing/node_trace_writer.h",
"src/tracing/trace_event.h",
"src/tracing/trace_event_common.h",
"src/tracing/traced_value.h",
diff --git a/lib/internal/constants.js b/lib/internal/constants.js
index 8d7204f6cb48f783adc4d1c1eb2de0c83b7fffe2..a154559a56bf383d3c26af523c9bb07b564ef600 100644
--- a/lib/internal/constants.js
@ -76,62 +63,11 @@ index 251f51ec454f9cba4023b8b6729241ee753aac13..1de8cac6e3953ce9cab9db03530da327
}
module.exports = {
diff --git a/node.gyp b/node.gyp
index 11474953b186c7b3ec2edb0539f34572e6c551b7..eeaaef8a06cdc2d17e89f9c719f9922e6e04ce92 100644
--- a/node.gyp
+++ b/node.gyp
@@ -174,7 +174,6 @@
'src/timers.cc',
'src/timer_wrap.cc',
'src/tracing/agent.cc',
- 'src/tracing/node_trace_buffer.cc',
'src/tracing/node_trace_writer.cc',
'src/tracing/trace_event.cc',
'src/tracing/traced_value.cc',
@@ -302,7 +301,6 @@
'src/tcp_wrap.h',
'src/timers.h',
'src/tracing/agent.h',
- 'src/tracing/node_trace_buffer.h',
'src/tracing/node_trace_writer.h',
'src/tracing/trace_event.h',
'src/tracing/trace_event_common.h',
diff --git a/src/inspector/tracing_agent.cc b/src/inspector/tracing_agent.cc
index e7b6d3b3ea63bdc80e569f56209e958b4fcde328..b52d5b1c7293539315626cd67f794cce4cfd1760 100644
--- a/src/inspector/tracing_agent.cc
+++ b/src/inspector/tracing_agent.cc
@@ -84,14 +84,14 @@ class InspectorTraceWriter : public node::tracing::AsyncTraceWriter {
explicit InspectorTraceWriter(int frontend_object_id,
std::shared_ptr<MainThreadHandle> main_thread)
: frontend_object_id_(frontend_object_id), main_thread_(main_thread) {}
-
+#ifndef V8_USE_PERFETTO
void AppendTraceEvent(
v8::platform::tracing::TraceObject* trace_event) override {
if (!json_writer_)
json_writer_.reset(TraceWriter::CreateJSONTraceWriter(stream_, "value"));
json_writer_->AppendTraceEvent(trace_event);
}
-
+#endif
void Flush(bool) override {
if (!json_writer_)
return;
diff --git a/src/tracing/agent.cc b/src/tracing/agent.cc
index 7ce59674356f9743438350949be42fa7ead2afbe..30bff4272ed8eb5146e3b73a4849c187177fc3bd 100644
index 7ce59674356f9743438350949be42fa7ead2afbe..c5fedc3be86a77730c57321b9c73cc8e94a001d7 100644
--- a/src/tracing/agent.cc
+++ b/src/tracing/agent.cc
@@ -2,7 +2,9 @@
#include <string>
#include "trace_event.h"
+#ifndef V8_USE_PERFETTO
#include "tracing/node_trace_buffer.h"
+#endif
#include "debug_utils-inl.h"
#include "env-inl.h"
@@ -50,7 +52,9 @@ using v8::platform::tracing::TraceWriter;
@@ -50,7 +50,9 @@ using v8::platform::tracing::TraceWriter;
using std::string;
Agent::Agent() : tracing_controller_(new TracingController()) {
@ -141,7 +77,7 @@ index 7ce59674356f9743438350949be42fa7ead2afbe..30bff4272ed8eb5146e3b73a4849c187
CHECK_EQ(uv_loop_init(&tracing_loop_), 0);
CHECK_EQ(uv_async_init(&tracing_loop_,
@@ -86,10 +90,14 @@ Agent::~Agent() {
@@ -86,10 +88,14 @@ Agent::~Agent() {
void Agent::Start() {
if (started_)
return;
@ -157,7 +93,7 @@ index 7ce59674356f9743438350949be42fa7ead2afbe..30bff4272ed8eb5146e3b73a4849c187
// This thread should be created *after* async handles are created
// (within NodeTraceWriter and NodeTraceBuffer constructors).
@@ -143,8 +151,10 @@ void Agent::StopTracing() {
@@ -143,8 +149,10 @@ void Agent::StopTracing() {
return;
// Perform final Flush on TraceBuffer. We don't want the tracing controller
// to flush the buffer again on destruction of the V8::Platform.
@ -169,7 +105,7 @@ index 7ce59674356f9743438350949be42fa7ead2afbe..30bff4272ed8eb5146e3b73a4849c187
started_ = false;
// Thread should finish when the tracing loop is stopped.
@@ -202,6 +212,7 @@ std::string Agent::GetEnabledCategories() const {
@@ -202,6 +210,7 @@ std::string Agent::GetEnabledCategories() const {
return categories;
}
@ -177,7 +113,7 @@ index 7ce59674356f9743438350949be42fa7ead2afbe..30bff4272ed8eb5146e3b73a4849c187
void Agent::AppendTraceEvent(TraceObject* trace_event) {
for (const auto& id_writer : writers_)
id_writer.second->AppendTraceEvent(trace_event);
@@ -211,18 +222,21 @@ void Agent::AddMetadataEvent(std::unique_ptr<TraceObject> event) {
@@ -211,18 +220,21 @@ void Agent::AddMetadataEvent(std::unique_ptr<TraceObject> event) {
Mutex::ScopedLock lock(metadata_events_mutex_);
metadata_events_.push_back(std::move(event));
}
@ -200,7 +136,7 @@ index 7ce59674356f9743438350949be42fa7ead2afbe..30bff4272ed8eb5146e3b73a4849c187
void TracingController::AddMetadataEvent(
const unsigned char* category_group_enabled,
const char* name,
@@ -246,6 +260,6 @@ void TracingController::AddMetadataEvent(
@@ -246,6 +258,6 @@ void TracingController::AddMetadataEvent(
if (node_agent != nullptr)
node_agent->AddMetadataEvent(std::move(trace_event));
}
@ -262,20 +198,26 @@ index b542a849fe8da7e8bbbcca7067b73dc32b18d6d3..059ce6f6ea17199ead09c6c13bcc680f
};
void AgentWriterHandle::reset() {
diff --git a/src/tracing/node_trace_buffer.h b/src/tracing/node_trace_buffer.h
index 18e4f43efaae3a60b924e697918867e604513194..7cbaf01235750138c680c8ec2ed5d206d638f8b6 100644
--- a/src/tracing/node_trace_buffer.h
+++ b/src/tracing/node_trace_buffer.h
@@ -42,7 +42,9 @@ class InternalTraceBuffer {
bool flushing_;
size_t max_chunks_;
Agent* agent_;
diff --git a/src/tracing/node_trace_buffer.cc b/src/tracing/node_trace_buffer.cc
index e187a1d78c81972b69cd4e03f7079cdb727956ad..3256c6326a08c6cafd83f1e49e3350193e813b51 100644
--- a/src/tracing/node_trace_buffer.cc
+++ b/src/tracing/node_trace_buffer.cc
@@ -55,6 +55,7 @@ TraceObject* InternalTraceBuffer::GetEventByHandle(uint64_t handle) {
}
void InternalTraceBuffer::Flush(bool blocking) {
+#ifndef V8_USE_PERFETTO
std::vector<std::unique_ptr<TraceBufferChunk>> chunks_;
{
Mutex::ScopedLock scoped_lock(mutex_);
if (total_chunks_ > 0) {
@@ -75,6 +76,7 @@ void InternalTraceBuffer::Flush(bool blocking) {
flushing_ = false;
}
}
+#endif
size_t total_chunks_ = 0;
uint32_t current_chunk_seq_ = 1;
uint32_t id_;
agent_->Flush(blocking);
}
diff --git a/src/tracing/node_trace_writer.cc b/src/tracing/node_trace_writer.cc
index 8f053efe93324b9acbb4e85f7b974b4f7712e200..e331ed5567caa39ade90ce28cea69f1d10533812 100644
--- a/src/tracing/node_trace_writer.cc

Просмотреть файл

@ -7,7 +7,7 @@ Subject: build: ensure native module compilation fails if not using a new
This should not be upstreamed, it is a quality-of-life patch for downstream module builders.
diff --git a/common.gypi b/common.gypi
index 229cb96c1385c597138719f2b01f78bd54ad44ab..74616453e2e047acbb9e25f2f93ebeab06011669 100644
index 697b8bba6a55358924d6986f2eb347a99ff73889..bdf1a1f33f3ea09d933757c7fee87c563cc833ab 100644
--- a/common.gypi
+++ b/common.gypi
@@ -86,6 +86,8 @@
@ -19,7 +19,7 @@ index 229cb96c1385c597138719f2b01f78bd54ad44ab..74616453e2e047acbb9e25f2f93ebeab
##### end V8 defaults #####
# When building native modules using 'npm install' with the system npm,
@@ -291,6 +293,7 @@
@@ -285,6 +287,7 @@
# Defines these mostly for node-gyp to pickup.
'defines': [
'_GLIBCXX_USE_CXX11_ABI=1',
@ -27,7 +27,7 @@ index 229cb96c1385c597138719f2b01f78bd54ad44ab..74616453e2e047acbb9e25f2f93ebeab
],
# Forcibly disable -Werror. We support a wide range of compilers, it's
@@ -437,6 +440,11 @@
@@ -414,6 +417,11 @@
}],
],
}],
@ -40,19 +40,19 @@ index 229cb96c1385c597138719f2b01f78bd54ad44ab..74616453e2e047acbb9e25f2f93ebeab
# list in v8/BUILD.gn.
['v8_enable_v8_checks == 1', {
diff --git a/configure.py b/configure.py
index d03db1970fd7a1629a7a7719a5ff267402ab4a66..ce055fb5dfc84c75c486b99f01fea6b9531ff54b 100755
index a6f66c41f75bffcfaf75d4415c694300b7624136..7ca0762fe3590fef7b88ba684de44d99aaecace4 100755
--- a/configure.py
+++ b/configure.py
@@ -1634,6 +1634,7 @@ def configure_library(lib, output, pkgname=None):
def configure_v8(o, configs):
set_configuration_variable(configs, 'v8_enable_v8_checks', release=1, debug=0)
@@ -1585,6 +1585,7 @@ def configure_library(lib, output, pkgname=None):
def configure_v8(o):
+ o['variables']['using_electron_config_gypi'] = 1
o['variables']['v8_enable_webassembly'] = 0 if options.v8_lite_mode else 1
o['variables']['v8_enable_javascript_promise_hooks'] = 1
o['variables']['v8_enable_lite_mode'] = 1 if options.v8_lite_mode else 0
diff --git a/src/node.h b/src/node.h
index 0fec9477fd0f2a3c2aa68284131c510b0da0e025..c16204ad2a4787eeffe61eedda254d3a5509df8c 100644
index 4f2eb9d0aab88b70c86339e750799080e980d7da..df3fb3372d6357b5d77b4f683e309b8483998128 100644
--- a/src/node.h
+++ b/src/node.h
@@ -22,6 +22,12 @@

Просмотреть файл

@ -34,10 +34,10 @@ index f5ecc15159f457cd0b8069c0427b7c758c916c4e..c9ce67391f321989b0af48159b4da3ab
let kResistStopPropagation;
diff --git a/src/node_builtins.cc b/src/node_builtins.cc
index 48d29a0d05538cd1d992f3f086d826e78d0d8882..8987234c2d08449242b5fd037ed314b725bc42a5 100644
index c7ae7759595bfc7fdc31dab174a7514ddd8345e7..4bf80aa6cc6385dc376fd0a3538efc27fe5bd0a2 100644
--- a/src/node_builtins.cc
+++ b/src/node_builtins.cc
@@ -34,6 +34,7 @@ using v8::Value;
@@ -35,6 +35,7 @@ using v8::Value;
BuiltinLoader::BuiltinLoader()
: config_(GetConfig()), code_cache_(std::make_shared<BuiltinCodeCache>()) {
LoadJavaScriptSource();

Просмотреть файл

@ -11,7 +11,7 @@ node-gyp will use the result of `process.config` that reflects the environment
in which the binary got built.
diff --git a/common.gypi b/common.gypi
index bce15fc4a8b3f2fa0b5a588e6a2b28d2b8b6ac45..289ab5d282e93c795eafb5fb992c3bbc4790a687 100644
index 2eb62610db2f0ebf68fa9a55ffba98291ecfe451..3ec08ee144b586d05c4e49c2251416734cbc02c5 100644
--- a/common.gypi
+++ b/common.gypi
@@ -125,6 +125,7 @@

Просмотреть файл

@ -0,0 +1,182 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Adam Klein <adamk@chromium.org>
Date: Wed, 15 May 2024 09:16:00 +0200
Subject: cherry-pick: src: remove calls to recently deprecated V8 APIs
Node.js Commit: a6d54f179d997497a95c18456bef6bc3ee15e2c4
Node.js PR: https://github.com/nodejs/node/pull/52996
V8 API Removal CL: https://chromium-review.googlesource.com/c/v8/v8/+/5539888
This patch is slightly modified from the original commit in order to
resolve conflicts due to the base commit difference between the Node.js
PR and the current upgrade roll.
This patch is expected to be deleted once we catch up with a Node.js
upgrade that includes the original Node.js commit above.
diff --git a/src/module_wrap.cc b/src/module_wrap.cc
index ff658ec88e5161cd66536ee6e95dba675b16eccc..9bbb8ab908d8d992abb43254860d51f57f56387b 100644
--- a/src/module_wrap.cc
+++ b/src/module_wrap.cc
@@ -202,8 +202,7 @@ void ModuleWrap::New(const FunctionCallbackInfo<Value>& args) {
}
Local<String> source_text = args[2].As<String>();
- ScriptOrigin origin(isolate,
- url,
+ ScriptOrigin origin(url,
line_offset,
column_offset,
true, // is cross origin
@@ -464,7 +463,6 @@ void ModuleWrap::Evaluate(const FunctionCallbackInfo<Value>& args) {
ShouldNotAbortOnUncaughtScope no_abort_scope(realm->env());
TryCatchScope try_catch(realm->env());
- Isolate::SafeForTerminationScope safe_for_termination(isolate);
bool timed_out = false;
bool received_signal = false;
diff --git a/src/node_builtins.cc b/src/node_builtins.cc
index 4bf80aa6cc6385dc376fd0a3538efc27fe5bd0a2..3e37aa8b0c9696cceb3f3cfab9721f38c74a2fba 100644
--- a/src/node_builtins.cc
+++ b/src/node_builtins.cc
@@ -267,7 +267,7 @@ MaybeLocal<Function> BuiltinLoader::LookupAndCompileInternal(
std::string filename_s = std::string("node:") + id;
Local<String> filename =
OneByteString(isolate, filename_s.c_str(), filename_s.size());
- ScriptOrigin origin(isolate, filename, 0, 0, true);
+ ScriptOrigin origin(filename, 0, 0, true);
BuiltinCodeCacheData cached_data{};
{
diff --git a/src/node_contextify.cc b/src/node_contextify.cc
index 6456d87d4202c013aafe071adbac06852b3ae2c1..28ba7dbe66a44a43c39e3d75edf0be9513bcf732 100644
--- a/src/node_contextify.cc
+++ b/src/node_contextify.cc
@@ -877,16 +877,15 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
host_defined_options->Set(
isolate, loader::HostDefinedOptions::kID, id_symbol);
- ScriptOrigin origin(isolate,
- filename,
- line_offset, // line offset
- column_offset, // column offset
- true, // is cross origin
- -1, // script id
- Local<Value>(), // source map URL
- false, // is opaque (?)
- false, // is WASM
- false, // is ES Module
+ ScriptOrigin origin(filename,
+ line_offset, // line offset
+ column_offset, // column offset
+ true, // is cross origin
+ -1, // script id
+ Local<Value>(), // source map URL
+ false, // is opaque (?)
+ false, // is WASM
+ false, // is ES Module
host_defined_options);
ScriptCompiler::Source source(code, origin, cached_data);
ScriptCompiler::CompileOptions compile_options =
@@ -998,7 +997,7 @@ MaybeLocal<Function> CompileFunction(Local<Context> context,
Local<String> filename,
Local<String> content,
std::vector<Local<String>>* parameters) {
- ScriptOrigin script_origin(context->GetIsolate(), filename, 0, 0, true);
+ ScriptOrigin script_origin(filename, 0, 0, true);
ScriptCompiler::Source script_source(content, script_origin);
return ScriptCompiler::CompileFunction(context,
@@ -1108,7 +1107,6 @@ bool ContextifyScript::EvalMachine(Local<Context> context,
}
TryCatchScope try_catch(env);
- Isolate::SafeForTerminationScope safe_for_termination(env->isolate());
ContextifyScript* wrapped_script;
ASSIGN_OR_RETURN_UNWRAP(&wrapped_script, args.This(), false);
Local<UnboundScript> unbound_script =
@@ -1286,8 +1284,7 @@ void ContextifyContext::CompileFunction(
Local<PrimitiveArray> host_defined_options =
GetHostDefinedOptions(isolate, id_symbol);
ScriptCompiler::Source source =
- GetCommonJSSourceInstance(isolate,
- code,
+ GetCommonJSSourceInstance(code,
filename,
line_offset,
column_offset,
@@ -1342,15 +1339,13 @@ void ContextifyContext::CompileFunction(
}
ScriptCompiler::Source ContextifyContext::GetCommonJSSourceInstance(
- Isolate* isolate,
Local<String> code,
Local<String> filename,
int line_offset,
int column_offset,
Local<PrimitiveArray> host_defined_options,
ScriptCompiler::CachedData* cached_data) {
- ScriptOrigin origin(isolate,
- filename,
+ ScriptOrigin origin(filename,
line_offset, // line offset
column_offset, // column offset
true, // is cross origin
@@ -1528,7 +1523,7 @@ void ContextifyContext::ContainsModuleSyntax(
Local<PrimitiveArray> host_defined_options =
GetHostDefinedOptions(isolate, id_symbol);
ScriptCompiler::Source source = GetCommonJSSourceInstance(
- isolate, code, filename, 0, 0, host_defined_options, nullptr);
+ code, filename, 0, 0, host_defined_options, nullptr);
ScriptCompiler::CompileOptions options = GetCompileOptions(source);
std::vector<Local<String>> params = GetCJSParameters(env->isolate_data());
@@ -1576,7 +1571,7 @@ void ContextifyContext::ContainsModuleSyntax(
code,
String::NewFromUtf8(isolate, "})();").ToLocalChecked());
ScriptCompiler::Source wrapped_source = GetCommonJSSourceInstance(
- isolate, code, filename, 0, 0, host_defined_options, nullptr);
+ code, filename, 0, 0, host_defined_options, nullptr);
std::ignore = ScriptCompiler::CompileFunction(
context,
&wrapped_source,
@@ -1629,8 +1624,7 @@ static void CompileFunctionForCJSLoader(
Local<Symbol> symbol = env->vm_dynamic_import_default_internal();
Local<PrimitiveArray> hdo = GetHostDefinedOptions(isolate, symbol);
- ScriptOrigin origin(isolate,
- filename,
+ ScriptOrigin origin(filename,
0, // line offset
0, // column offset
true, // is cross origin
diff --git a/src/node_contextify.h b/src/node_contextify.h
index 517e3f44d324900222e1da961a4cd60bbb4a85f9..10715c7eb07715cc11e49734bd54747dad95f6a4 100644
--- a/src/node_contextify.h
+++ b/src/node_contextify.h
@@ -99,7 +99,6 @@ class ContextifyContext : public BaseObject {
v8::Local<v8::Symbol> id_symbol,
const errors::TryCatchScope& try_catch);
static v8::ScriptCompiler::Source GetCommonJSSourceInstance(
- v8::Isolate* isolate,
v8::Local<v8::String> code,
v8::Local<v8::String> filename,
int line_offset,
diff --git a/test/cctest/test_environment.cc b/test/cctest/test_environment.cc
index 64e38c83006a004ebc3519a5e9f8b04263244514..14e82cc80ff73084fb43b2ef07febfd2667a0abc 100644
--- a/test/cctest/test_environment.cc
+++ b/test/cctest/test_environment.cc
@@ -620,12 +620,9 @@ TEST_F(EnvironmentTest, SetImmediateMicrotasks) {
#ifndef _WIN32 // No SIGINT on Windows.
TEST_F(NodeZeroIsolateTestFixture, CtrlCWithOnlySafeTerminationTest) {
- // We need to go through the whole setup dance here because we want to
- // set only_terminate_in_safe_scope.
// Allocate and initialize Isolate.
v8::Isolate::CreateParams create_params;
create_params.array_buffer_allocator = allocator.get();
- create_params.only_terminate_in_safe_scope = true;
v8::Isolate* isolate = v8::Isolate::Allocate();
CHECK_NOT_NULL(isolate);
platform->RegisterIsolate(isolate, &current_loop);

Просмотреть файл

@ -8,7 +8,7 @@ modules from being used in the renderer process. This should be upstreamed as
a customizable error message.
diff --git a/src/node_binding.cc b/src/node_binding.cc
index b5c0a93d83ab4d4f6792d0eb648e7198de874bcf..0fd01987c29b06b91944d18266ba67994c1fac45 100644
index 4e750be66452de47040e3a46555c062dfccf7807..5e1caeee18e447cc76b980df712521cf8b60e8da 100644
--- a/src/node_binding.cc
+++ b/src/node_binding.cc
@@ -4,6 +4,7 @@
@ -19,7 +19,7 @@ index b5c0a93d83ab4d4f6792d0eb648e7198de874bcf..0fd01987c29b06b91944d18266ba6799
#include "util.h"
#include <string>
@@ -495,7 +496,12 @@ void DLOpen(const FunctionCallbackInfo<Value>& args) {
@@ -483,7 +484,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/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js
index d49941881e6cfd8647a6d44a57e0daaf1c874702..f696fb263b356a76b87cd4b6c4b1a0fd60a84afd 100644
index 364469160af5e348f8890417de16a63c0d1dca67..75d5f58fe02fa8cfa7716ffaf761d567ab403a2c 100644
--- a/lib/internal/modules/cjs/loader.js
+++ b/lib/internal/modules/cjs/loader.js
@@ -1518,6 +1518,13 @@ Module.prototype._compile = function(content, filename, format) {
@@ -1441,6 +1441,13 @@ Module.prototype._compile = function(content, filename, loadAsESM = false) {
if (getOptionValue('--inspect-brk') && process._eval == null) {
if (!resolvedArgv) {
// We enter the repl if we're not given a filename argument.
@ -26,10 +26,10 @@ index d49941881e6cfd8647a6d44a57e0daaf1c874702..f696fb263b356a76b87cd4b6c4b1a0fd
try {
resolvedArgv = Module._resolveFilename(process.argv[1], null, false);
diff --git a/lib/internal/process/pre_execution.js b/lib/internal/process/pre_execution.js
index cb96fd1bc4fcdce750ce241ee5f47f2ae39cfdc6..c46b270109697f7cc1683f8f9f463575e5040216 100644
index ea7afd52fab1cf3fde1674be1429a00562b714c0..02cfc8b3328fedb6306abf6c738bea772c674458 100644
--- a/lib/internal/process/pre_execution.js
+++ b/lib/internal/process/pre_execution.js
@@ -243,12 +243,14 @@ function patchProcessObject(expandArgv1) {
@@ -247,12 +247,14 @@ function patchProcessObject(expandArgv1) {
if (expandArgv1 && process.argv[1] &&
!StringPrototypeStartsWith(process.argv[1], '-')) {
// Expand process.argv[1] into a full path.

Просмотреть файл

@ -1,60 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Charles Kerr <charles@charleskerr.com>
Date: Mon, 4 Nov 2024 17:40:17 -0600
Subject: chore: disable deprecation ftbfs in simdjson header
Without this patch, building with simdjson fails with
> error: identifier '_padded' preceded by whitespace in a literal operator
> declaration is deprecated [-Werror,-Wdeprecated-literal-operator]
This patch can be removed once this is fixed upstream in simdjson.
diff --git a/deps/simdjson/simdjson.h b/deps/simdjson/simdjson.h
index ddb6f2e4e0a6edd23d5e16db07bc4bb18974d4aa..533dfea4d5fd3c7f6f7fdf0ea525479b11634fd3 100644
--- a/deps/simdjson/simdjson.h
+++ b/deps/simdjson/simdjson.h
@@ -3650,12 +3650,17 @@ inline std::ostream& operator<<(std::ostream& out, simdjson_result<padded_string
} // namespace simdjson
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-literal-operator"
+
// This is deliberately outside of simdjson so that people get it without having to use the namespace
inline simdjson::padded_string operator "" _padded(const char *str, size_t len);
#ifdef __cpp_char8_t
inline simdjson::padded_string operator "" _padded(const char8_t *str, size_t len);
#endif
+#pragma clang diagnostic pop
+
namespace simdjson {
namespace internal {
@@ -4033,6 +4038,9 @@ inline simdjson_result<padded_string> padded_string::load(std::string_view filen
} // namespace simdjson
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-literal-operator"
+
inline simdjson::padded_string operator "" _padded(const char *str, size_t len) {
return simdjson::padded_string(str, len);
}
@@ -4041,6 +4049,8 @@ inline simdjson::padded_string operator "" _padded(const char8_t *str, size_t le
return simdjson::padded_string(reinterpret_cast<const char8_t *>(str), len);
}
#endif
+#pragma clang diagnostic pop
+
#endif // SIMDJSON_PADDED_STRING_INL_H
/* end file simdjson/padded_string-inl.h */
/* skipped duplicate #include "simdjson/padded_string_view.h" */
@@ -118280,4 +118290,4 @@ namespace simdjson {
/* end file simdjson/ondemand.h */
#endif // SIMDJSON_H
-/* end file simdjson.h */
+/* end file simdjson.h */
\ No newline at end of file

Просмотреть файл

@ -11,7 +11,7 @@ its own blended handler between Node and Blink.
Not upstreamable.
diff --git a/lib/internal/modules/esm/utils.js b/lib/internal/modules/esm/utils.js
index d393d4336a0c1e681e4f6b4e5c7cf2bcc5fc287e..807cb5172e0c2178b6c20e81f8175141d3a0284f 100644
index 150816057129c147c13ce044474f341581679f34..dd8627653265e22f55e67ec4a47641b20fba6c9d 100644
--- a/lib/internal/modules/esm/utils.js
+++ b/lib/internal/modules/esm/utils.js
@@ -30,7 +30,7 @@ const {
@ -40,10 +40,10 @@ index d393d4336a0c1e681e4f6b4e5c7cf2bcc5fc287e..807cb5172e0c2178b6c20e81f8175141
/**
diff --git a/src/module_wrap.cc b/src/module_wrap.cc
index 48b61e8b7600701c4992a98ff802614ce915faee..4e9835e502a8d078a448aa4253f37de0f49f4854 100644
index eea74bed4bb8a980f99a9a1404c9a2df203ca09c..e862b51293135995c527c32aa3c3579780d7831c 100644
--- a/src/module_wrap.cc
+++ b/src/module_wrap.cc
@@ -813,7 +813,7 @@ MaybeLocal<Module> ModuleWrap::ResolveModuleCallback(
@@ -752,7 +752,7 @@ MaybeLocal<Module> ModuleWrap::ResolveModuleCallback(
return module->module_.Get(isolate);
}
@ -52,7 +52,7 @@ index 48b61e8b7600701c4992a98ff802614ce915faee..4e9835e502a8d078a448aa4253f37de0
Local<Context> context,
Local<v8::Data> host_defined_options,
Local<Value> resource_name,
@@ -878,12 +878,13 @@ void ModuleWrap::SetImportModuleDynamicallyCallback(
@@ -817,12 +817,13 @@ void ModuleWrap::SetImportModuleDynamicallyCallback(
Realm* realm = Realm::GetCurrent(args);
HandleScope handle_scope(isolate);
@ -68,7 +68,7 @@ index 48b61e8b7600701c4992a98ff802614ce915faee..4e9835e502a8d078a448aa4253f37de0
}
void ModuleWrap::HostInitializeImportMetaObjectCallback(
@@ -925,13 +926,14 @@ void ModuleWrap::SetInitializeImportMetaObjectCallback(
@@ -864,13 +865,14 @@ void ModuleWrap::SetInitializeImportMetaObjectCallback(
Realm* realm = Realm::GetCurrent(args);
Isolate* isolate = realm->isolate();
@ -87,18 +87,18 @@ index 48b61e8b7600701c4992a98ff802614ce915faee..4e9835e502a8d078a448aa4253f37de0
MaybeLocal<Value> ModuleWrap::SyntheticModuleEvaluationStepsCallback(
diff --git a/src/module_wrap.h b/src/module_wrap.h
index 83b5793013cbc453cf92c0a006fc7be3c06ad276..90353954bc497cb4ae413dc134850f8abb4efc7c 100644
index 45a338b38e01c824f69ea59ee286130c67e9eddf..99bb079df11696fc3ba5e6bcca7e7a42818fe3d1 100644
--- a/src/module_wrap.h
+++ b/src/module_wrap.h
@@ -8,6 +8,7 @@
#include <unordered_map>
@@ -7,6 +7,7 @@
#include <string>
#include <vector>
#include "base_object.h"
+#include "node.h"
#include "v8-script.h"
namespace node {
@@ -33,7 +34,14 @@ enum HostDefinedOptions : int {
@@ -31,7 +32,14 @@ enum HostDefinedOptions : int {
kLength = 9,
};
@ -114,20 +114,20 @@ index 83b5793013cbc453cf92c0a006fc7be3c06ad276..90353954bc497cb4ae413dc134850f8a
public:
enum InternalFields {
kModuleSlot = BaseObject::kInternalFieldCount,
@@ -91,6 +99,8 @@ class ModuleWrap : public BaseObject {
static void CreateRequiredModuleFacade(
const v8::FunctionCallbackInfo<v8::Value>& args);
@@ -68,6 +76,8 @@ class ModuleWrap : public BaseObject {
return true;
}
+ static ModuleWrap* GetFromModule(node::Environment*, v8::Local<v8::Module>);
+
private:
ModuleWrap(Realm* realm,
v8::Local<v8::Object> object,
@@ -129,7 +139,6 @@ class ModuleWrap : public BaseObject {
@@ -110,7 +120,6 @@ class ModuleWrap : public BaseObject {
v8::Local<v8::String> specifier,
v8::Local<v8::FixedArray> import_attributes,
v8::Local<v8::Module> referrer);
- static ModuleWrap* GetFromModule(node::Environment*, v8::Local<v8::Module>);
v8::Global<v8::Module> module_;
std::unordered_map<std::string, v8::Global<v8::Object>> resolve_cache_;
std::unordered_map<std::string, v8::Global<v8::Promise>> resolve_cache_;

Просмотреть файл

@ -0,0 +1,52 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shelley Vohr <shelley.vohr@gmail.com>
Date: Wed, 19 Apr 2023 14:13:23 +0200
Subject: chore: remove --no-harmony-atomics related code
This was removed in https://chromium-review.googlesource.com/c/v8/v8/+/4416459.
This patch can be removed when Node.js upgrades to a version of V8 containing
the above CL.
diff --git a/lib/.eslintrc.yaml b/lib/.eslintrc.yaml
index 74e867ace6207751a96b4da03802b50b620dbd7b..53ceabeb58f56ebd27e60fd49c362d26e361e6d8 100644
--- a/lib/.eslintrc.yaml
+++ b/lib/.eslintrc.yaml
@@ -30,10 +30,6 @@ rules:
message: Use `const { AbortController } = require('internal/abort_controller');` instead of the global.
- name: AbortSignal
message: Use `const { AbortSignal } = require('internal/abort_controller');` instead of the global.
- # Atomics is not available in primordials because it can be
- # disabled with --no-harmony-atomics CLI flag.
- - name: Atomics
- message: Use `const { Atomics } = globalThis;` instead of the global.
- name: Blob
message: Use `const { Blob } = require('buffer');` instead of the global.
- name: BroadcastChannel
diff --git a/lib/internal/main/worker_thread.js b/lib/internal/main/worker_thread.js
index 30f7a5f79e50fdeb4e1775a0e56dafa4c6908898..f7250985277c4127425ef36dff566c1fe06603e2 100644
--- a/lib/internal/main/worker_thread.js
+++ b/lib/internal/main/worker_thread.js
@@ -112,7 +112,7 @@ port.on('message', (message) => {
require('internal/worker').assignEnvironmentData(environmentData);
- if (SharedArrayBuffer !== undefined && Atomics !== undefined) {
+ if (SharedArrayBuffer !== undefined) {
// The counter is only passed to the workers created by the main thread,
// not to workers created by other workers.
let cachedCwd = '';
diff --git a/lib/internal/worker.js b/lib/internal/worker.js
index 401bc43550ea7f19847dfd588e3fba0507243905..560f69c6c2de2bd976bcd62cd7ac9c770b838446 100644
--- a/lib/internal/worker.js
+++ b/lib/internal/worker.js
@@ -101,8 +101,7 @@ let cwdCounter;
const environmentData = new SafeMap();
// SharedArrayBuffers can be disabled with --no-harmony-sharedarraybuffer.
-// Atomics can be disabled with --no-harmony-atomics.
-if (isMainThread && SharedArrayBuffer !== undefined && Atomics !== undefined) {
+if (isMainThread && SharedArrayBuffer !== undefined) {
cwdCounter = new Uint32Array(new SharedArrayBuffer(4));
const originalChdir = process.chdir;
process.chdir = function(path) {

Просмотреть файл

@ -0,0 +1,35 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Charles Kerr <charles@charleskerr.com>
Date: Tue, 17 Oct 2023 10:58:41 -0500
Subject: chore: remove use of deprecated kMaxLength
https://chromium-review.googlesource.com/c/v8/v8/+/4935412
This patch can be removed when upstream moves to kMaxByteLength
diff --git a/src/node_buffer.h b/src/node_buffer.h
index 606a6f5caa3b11b6d2a9068ed2fd65800530a5eb..080dcce21da05ccea398d8a856deb397b1ac8b07 100644
--- a/src/node_buffer.h
+++ b/src/node_buffer.h
@@ -29,7 +29,7 @@ namespace node {
namespace Buffer {
-static const size_t kMaxLength = v8::TypedArray::kMaxLength;
+static const size_t kMaxLength = v8::TypedArray::kMaxByteLength;
typedef void (*FreeCallback)(char* data, void* hint);
diff --git a/src/node_errors.h b/src/node_errors.h
index 1662491bac44311421eeb7ee35bb47c025162abf..a62b18e832986ee38d93b412b36020a2c22255a9 100644
--- a/src/node_errors.h
+++ b/src/node_errors.h
@@ -230,7 +230,7 @@ inline v8::Local<v8::Object> ERR_BUFFER_TOO_LARGE(v8::Isolate* isolate) {
char message[128];
snprintf(message, sizeof(message),
"Cannot create a Buffer larger than 0x%zx bytes",
- v8::TypedArray::kMaxLength);
+ v8::TypedArray::kMaxByteLength);
return ERR_BUFFER_TOO_LARGE(isolate, message);
}

Просмотреть файл

@ -7,6 +7,53 @@ Some node tests / test fixtures spawn other tests that clobber env,
which causes the `ELECTRON_RUN_AS_NODE` variable to be lost. This patch
re-injects it.
diff --git a/test/fixtures/errors/promise_unhandled_warn_with_error.snapshot b/test/fixtures/errors/promise_unhandled_warn_with_error.snapshot
index d7f1aa2f72007f6f70b6b66b81913f39e5678d2f..e091b1575954f5dc82a05a5d200ee028e053f616 100644
--- a/test/fixtures/errors/promise_unhandled_warn_with_error.snapshot
+++ b/test/fixtures/errors/promise_unhandled_warn_with_error.snapshot
@@ -6,5 +6,5 @@
at *
at *
at *
-(Use `node --trace-warnings ...` to show where the warning was created)
+(Use `* --trace-warnings ...` to show where the warning was created)
(node:*) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https:*nodejs.org*api*cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
diff --git a/test/fixtures/errors/throw_error_with_getter_throw.snapshot b/test/fixtures/errors/throw_error_with_getter_throw.snapshot
index 30bbb336a22aaffbd63333f297eb598a8f501d75..1786f96f19856cdc43e0e86c8271a845e337359f 100644
--- a/test/fixtures/errors/throw_error_with_getter_throw.snapshot
+++ b/test/fixtures/errors/throw_error_with_getter_throw.snapshot
@@ -3,6 +3,6 @@
throw { * eslint-disable-line no-throw-literal
^
[object Object]
-(Use `node --trace-uncaught ...` to show where the exception was thrown)
+(Use `* --trace-uncaught ...` to show where the exception was thrown)
Node.js *
diff --git a/test/fixtures/errors/throw_null.snapshot b/test/fixtures/errors/throw_null.snapshot
index 88494ec6832205b30e7ae159708112a45494834c..1a1191ca9ced90936b764c32c1c334cce114b46e 100644
--- a/test/fixtures/errors/throw_null.snapshot
+++ b/test/fixtures/errors/throw_null.snapshot
@@ -3,6 +3,6 @@
throw null;
^
null
-(Use `node --trace-uncaught ...` to show where the exception was thrown)
+(Use `* --trace-uncaught ...` to show where the exception was thrown)
Node.js *
diff --git a/test/fixtures/errors/throw_undefined.snapshot b/test/fixtures/errors/throw_undefined.snapshot
index baae7384453373f3a005b4f85abb702a4c165f98..b6b6060b17839f3452aa915c12bd5174b7585414 100644
--- a/test/fixtures/errors/throw_undefined.snapshot
+++ b/test/fixtures/errors/throw_undefined.snapshot
@@ -3,6 +3,6 @@
throw undefined;
^
undefined
-(Use `node --trace-uncaught ...` to show where the exception was thrown)
+(Use `* --trace-uncaught ...` to show where the exception was thrown)
Node.js *
diff --git a/test/fixtures/test-runner/output/arbitrary-output-colored.js b/test/fixtures/test-runner/output/arbitrary-output-colored.js
index af23e674cb361ed81dafa22670d5633559cd1144..1dd59990cb7cdba8aecf4f499ee6b92e7cd41b30 100644
--- a/test/fixtures/test-runner/output/arbitrary-output-colored.js
@ -20,3 +67,32 @@ index af23e674cb361ed81dafa22670d5633559cd1144..1dd59990cb7cdba8aecf4f499ee6b92e
+ await once(spawn(process.execPath, ['-r', reset, '--test', test], { stdio: 'inherit', env: { ELECTRON_RUN_AS_NODE: 1 }}), 'exit');
+ await once(spawn(process.execPath, ['-r', reset, '--test', '--test-reporter', 'tap', test], { stdio: 'inherit', env: { ELECTRON_RUN_AS_NODE: 1 } }), 'exit');
})().then(common.mustCall());
diff --git a/test/parallel/test-node-output-errors.mjs b/test/parallel/test-node-output-errors.mjs
index 84f20a77dda367fe1ada8d616c7b6813d39efd43..9bebb256776c5be155a8de07abbe4284bc8dad8a 100644
--- a/test/parallel/test-node-output-errors.mjs
+++ b/test/parallel/test-node-output-errors.mjs
@@ -3,6 +3,7 @@ import * as fixtures from '../common/fixtures.mjs';
import * as snapshot from '../common/assertSnapshot.js';
import * as os from 'node:os';
import { describe, it } from 'node:test';
+import { basename } from 'node:path';
import { pathToFileURL } from 'node:url';
const skipForceColors =
@@ -20,13 +21,15 @@ function replaceForceColorsStackTrace(str) {
describe('errors output', { concurrency: true }, () => {
function normalize(str) {
+ const baseName = basename(process.argv0 || 'node', '.exe');
return str.replaceAll(snapshot.replaceWindowsPaths(process.cwd()), '')
.replaceAll(pathToFileURL(process.cwd()).pathname, '')
.replaceAll('//', '*')
.replaceAll(/\/(\w)/g, '*$1')
.replaceAll('*test*', '*')
.replaceAll('*fixtures*errors*', '*')
- .replaceAll('file:**', 'file:*/');
+ .replaceAll('file:**', 'file:*/')
+ .replaceAll(`${baseName} --`, '* --');
}
function normalizeNoNumbers(str) {

Просмотреть файл

@ -18,10 +18,10 @@ Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
diff --git a/doc/api/cli.md b/doc/api/cli.md
index 0cfed4a4a91a3d3fb5aee6c9a4db3405ba836565..61d980a12fcf7c799e726e1462c65ce478a8ed0c 100644
index ed0a43306e87962cf0e756d9e059ec5c08ad674b..7ada2802b2590e78fa5b9847935866b743cf94ed 100644
--- a/doc/api/cli.md
+++ b/doc/api/cli.md
@@ -3151,7 +3151,6 @@ V8 options that are allowed are:
@@ -2868,7 +2868,6 @@ V8 options that are allowed are:
* `--disallow-code-generation-from-strings`
* `--enable-etw-stack-walking`
* `--expose-gc`
@ -30,10 +30,10 @@ index 0cfed4a4a91a3d3fb5aee6c9a4db3405ba836565..61d980a12fcf7c799e726e1462c65ce4
* `--jitless`
* `--max-old-space-size`
diff --git a/src/node_options.cc b/src/node_options.cc
index 4b3f7751db2871c8ce76b197a84a2417097030ea..21e53e1053fe2e4194d91b27a726d3a1306b1683 100644
index 4e3c82e9528b04fd1a0cc99d30fb885e4b224bc9..38e173f72b446aa2db07f676b6ece26247bbf56b 100644
--- a/src/node_options.cc
+++ b/src/node_options.cc
@@ -922,11 +922,6 @@ PerIsolateOptionsParser::PerIsolateOptionsParser(
@@ -866,11 +866,6 @@ PerIsolateOptionsParser::PerIsolateOptionsParser(
"disallow eval and friends",
V8Option{},
kAllowedInEnvvar);
@ -46,7 +46,7 @@ index 4b3f7751db2871c8ce76b197a84a2417097030ea..21e53e1053fe2e4194d91b27a726d3a1
"disable runtime allocation of executable memory",
V8Option{},
diff --git a/test/parallel/test-cli-node-options.js b/test/parallel/test-cli-node-options.js
index e898a81af09ca6852ddc866310e5b8e0dc82971b..22d5a342df5d55f065383a6ebe1aebe59dc0f8d2 100644
index 8d614e607177cdd922fef65a85a2ccdcf54116c0..146df3a21a0551e910c46248d2fd97dde8896164 100644
--- a/test/parallel/test-cli-node-options.js
+++ b/test/parallel/test-cli-node-options.js
@@ -70,7 +70,6 @@ if (common.hasCrypto) {

Просмотреть файл

@ -0,0 +1,25 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shelley Vohr <shelley.vohr@gmail.com>
Date: Sun, 10 Mar 2024 16:59:30 +0100
Subject: Deprecate vector<v8::Local> in v8
Adapts for changes in https://chromium-review.googlesource.com/c/v8/v8/+/4866222.
This patch can be removed when Electron upgrades to a version of Node.js that
contains the above CL.
diff --git a/src/module_wrap.cc b/src/module_wrap.cc
index e862b51293135995c527c32aa3c3579780d7831c..ff658ec88e5161cd66536ee6e95dba675b16eccc 100644
--- a/src/module_wrap.cc
+++ b/src/module_wrap.cc
@@ -186,7 +186,9 @@ void ModuleWrap::New(const FunctionCallbackInfo<Value>& args) {
export_names[i] = export_name_val.As<String>();
}
- module = Module::CreateSyntheticModule(isolate, url, export_names,
+
+ module = Module::CreateSyntheticModule(isolate, url,
+ v8::MemorySpan<const Local<String>>(export_names.begin(), export_names.end()),
SyntheticModuleEvaluationStepsCallback);
} else {
ScriptCompiler::CachedData* cached_data = nullptr;

Просмотреть файл

@ -8,7 +8,7 @@ to child processes spawned with `ELECTRON_RUN_AS_NODE` which is used
by the crashpad client to connect with the handler process.
diff --git a/lib/child_process.js b/lib/child_process.js
index 580a441a803bdd0b57871c0cdd8af576f11609b1..755712d24219de7ffe491957d941df7c8cf7baad 100644
index 48870b35ad0f3411f2d509b12d92a9e0d20046f9..e7ef454d2d71207ae7b2788a437b82bf7732716e 100644
--- a/lib/child_process.js
+++ b/lib/child_process.js
@@ -61,6 +61,7 @@ let debug = require('internal/util/debuglog').debuglog(
@ -19,7 +19,7 @@ index 580a441a803bdd0b57871c0cdd8af576f11609b1..755712d24219de7ffe491957d941df7c
const {
AbortError,
@@ -153,7 +154,6 @@ function fork(modulePath, args = [], options) {
@@ -154,7 +155,6 @@ function fork(modulePath, args = [], options) {
ArrayPrototypeSplice(execArgv, index - 1, 2);
}
}
@ -27,7 +27,7 @@ index 580a441a803bdd0b57871c0cdd8af576f11609b1..755712d24219de7ffe491957d941df7c
args = [...execArgv, modulePath, ...args];
if (typeof options.stdio === 'string') {
@@ -617,6 +617,22 @@ function normalizeSpawnArguments(file, args, options) {
@@ -618,6 +618,22 @@ function normalizeSpawnArguments(file, args, options) {
'options.windowsVerbatimArguments');
}
@ -50,7 +50,7 @@ index 580a441a803bdd0b57871c0cdd8af576f11609b1..755712d24219de7ffe491957d941df7c
if (options.shell) {
validateArgumentNullCheck(options.shell, 'options.shell');
const command = ArrayPrototypeJoin([file, ...args], ' ');
@@ -650,7 +666,6 @@ function normalizeSpawnArguments(file, args, options) {
@@ -651,7 +667,6 @@ function normalizeSpawnArguments(file, args, options) {
ArrayPrototypeUnshift(args, file);
}

Просмотреть файл

@ -0,0 +1,53 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= <hello@nicr.dev>
Date: Fri, 19 Apr 2024 02:01:24 +0200
Subject: esm: drop support for import assertions
This patch removes support for the `assert` keyword
for import attributes. It was an old variant of the
proposal that was only shipped in V8 and no other
engine, and that has then been replaced by the `with`
keyword.
Chrome is planning to remove support for `assert`
in version 126, which will be released in June.
Node.js already supports the `with` keyword for
import attributes, and this patch does not change that.
PR-URL: https://github.com/nodejs/node/pull/52104
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
(cherry picked from commit 25c79f333104d1feb0d84794d5bcdb4227177c9b)
esm: remove --no-import-harmony-assertions
It is off by default now.
PR-URL: https://github.com/nodejs/node/pull/54890
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
(cherry picked from commit 8fd90938f923ef2a04bb3ebb08b89568fe6fd4ee)
diff --git a/src/node.cc b/src/node.cc
index 9f6f8e53abd7e447d88c187c447431a0d96cd150..4415f18ecbd84c1f41e0febbf2446fb636242d58 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -778,12 +778,6 @@ static ExitCode ProcessGlobalArgsInternal(std::vector<std::string>* args,
return ExitCode::kInvalidCommandLineArgument2;
}
- // TODO(aduh95): remove this when the harmony-import-assertions flag
- // is removed in V8.
- if (std::find(v8_args.begin(), v8_args.end(),
- "--no-harmony-import-assertions") == v8_args.end()) {
- v8_args.emplace_back("--harmony-import-assertions");
- }
// TODO(aduh95): remove this when the harmony-import-attributes flag
// is removed in V8.
if (std::find(v8_args.begin(),

Просмотреть файл

@ -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 c2ef9b36d5b2967c798c123b6cbbd099b15c2791..b5c0a93d83ab4d4f6792d0eb648e7198de874bcf 100644
index 6b0297d8984ccb34b8d0019fedd1307d48cf49f8..4e750be66452de47040e3a46555c062dfccf7807 100644
--- a/src/node_binding.cc
+++ b/src/node_binding.cc
@@ -653,6 +653,10 @@ void GetInternalBinding(const FunctionCallbackInfo<Value>& args) {
@@ -641,6 +641,10 @@ void GetInternalBinding(const FunctionCallbackInfo<Value>& args) {
args.GetReturnValue().Set(exports);
}
@ -24,10 +24,10 @@ index c2ef9b36d5b2967c798c123b6cbbd099b15c2791..b5c0a93d83ab4d4f6792d0eb648e7198
Environment* env = Environment::GetCurrent(args);
diff --git a/src/node_binding.h b/src/node_binding.h
index eb1364cb01a2bea52bce768056e73b0f3a86ae35..d421a2773403e7b22fcca2fcf8275ef2d9654c55 100644
index 7256bf2bbcf73214a25e61156305cc212b6f2451..d129981ad8588376eeee61155964062f624695d6 100644
--- a/src/node_binding.h
+++ b/src/node_binding.h
@@ -146,6 +146,8 @@ void GetInternalBinding(const v8::FunctionCallbackInfo<v8::Value>& args);
@@ -137,6 +137,8 @@ void GetInternalBinding(const v8::FunctionCallbackInfo<v8::Value>& args);
void GetLinkedBinding(const v8::FunctionCallbackInfo<v8::Value>& args);
void DLOpen(const v8::FunctionCallbackInfo<v8::Value>& args);

Просмотреть файл

@ -26,7 +26,7 @@ index 0f5ddfb3ca21b7e5b38d0a4ce4b9e77387597199..ba815202fb157aa82859ec0518523cf6
.. c:function:: int uv_loop_close(uv_loop_t* loop)
diff --git a/deps/uv/include/uv.h b/deps/uv/include/uv.h
index a62b3fa69b1087847f37c7093954e19a07959b74..7f48b7daa87d1a5b14bc6f641b60f21263fa5ec3 100644
index 02397dd0fdd43d51f86c0dde9a62046702f12bdb..3375600023e39ddacf62cc17deb4f206db942084 100644
--- a/deps/uv/include/uv.h
+++ b/deps/uv/include/uv.h
@@ -260,7 +260,8 @@ typedef struct uv_metrics_s uv_metrics_t;
@ -101,10 +101,10 @@ index 0ff2669e30a628dbb2df9e28ba14b38cf14114e5..117190ef26338944b78dbed7380c631d
static int uv__async_start(uv_loop_t* loop) {
int pipefd[2];
diff --git a/deps/uv/src/unix/core.c b/deps/uv/src/unix/core.c
index 965e7f775250cf9899266bc3aaf62eda69367264..45b3dec662b093a61af356e431416530b35343d2 100644
index 25c5181f370e94983e8a5f797f02f7a8dc207e00..f4d9059796d2c65339a5d48ecb273b09d9364d21 100644
--- a/deps/uv/src/unix/core.c
+++ b/deps/uv/src/unix/core.c
@@ -927,6 +927,9 @@ void uv__io_start(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
@@ -926,6 +926,9 @@ void uv__io_start(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
loop->watchers[w->fd] = w;
loop->nfds++;
}
@ -114,7 +114,7 @@ index 965e7f775250cf9899266bc3aaf62eda69367264..45b3dec662b093a61af356e431416530
}
@@ -958,6 +961,9 @@ void uv__io_stop(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
@@ -957,6 +960,9 @@ void uv__io_stop(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
}
else if (uv__queue_empty(&w->watcher_queue))
uv__queue_insert_tail(&loop->watcher_queue, &w->watcher_queue);
@ -124,7 +124,7 @@ index 965e7f775250cf9899266bc3aaf62eda69367264..45b3dec662b093a61af356e431416530
}
@@ -974,6 +980,9 @@ void uv__io_close(uv_loop_t* loop, uv__io_t* w) {
@@ -973,6 +979,9 @@ void uv__io_close(uv_loop_t* loop, uv__io_t* w) {
void uv__io_feed(uv_loop_t* loop, uv__io_t* w) {
if (uv__queue_empty(&w->pending_queue))
uv__queue_insert_tail(&loop->pending_queue, &w->pending_queue);
@ -241,7 +241,7 @@ index e9885a0f1ff3890a8d957c8793e22b01cedc0e97..ae3d09878253fe7169ad7b74b3faea02
return -1;
}
diff --git a/deps/uv/test/test-embed.c b/deps/uv/test/test-embed.c
index 6e9917239aa5626dd56fffd6eb2469d3e63224bf..b0da9d1cddc69428e9fb3379d1338cf893ab93d2 100644
index bbe56e176db17a502d7f3864ba529212f553590a..b0da9d1cddc69428e9fb3379d1338cf893ab93d2 100644
--- a/deps/uv/test/test-embed.c
+++ b/deps/uv/test/test-embed.c
@@ -25,54 +25,184 @@
@ -278,7 +278,7 @@ index 6e9917239aa5626dd56fffd6eb2469d3e63224bf..b0da9d1cddc69428e9fb3379d1338cf8
-static void thread_main(void* arg) {
- ASSERT_LE(0, uv_barrier_wait(&barrier));
- uv_sleep(250);
- ASSERT_OK(uv_async_send(&async));
- ASSERT_EQ(0, uv_async_send(&async));
-}
+static uv_timer_t main_timer;
+static int main_timer_called;
@ -333,9 +333,9 @@ index 6e9917239aa5626dd56fffd6eb2469d3e63224bf..b0da9d1cddc69428e9fb3379d1338cf8
- uv_loop_t* loop;
-
- loop = uv_default_loop();
- ASSERT_OK(uv_async_init(loop, &async, async_cb));
- ASSERT_OK(uv_barrier_init(&barrier, 2));
- ASSERT_OK(uv_thread_create(&thread, thread_main, NULL));
- ASSERT_EQ(0, uv_async_init(loop, &async, async_cb));
- ASSERT_EQ(0, uv_barrier_init(&barrier, 2));
- ASSERT_EQ(0, uv_thread_create(&thread, thread_main, NULL));
- ASSERT_LE(0, uv_barrier_wait(&barrier));
-
- while (uv_loop_alive(loop)) {
@ -457,7 +457,7 @@ index 6e9917239aa5626dd56fffd6eb2469d3e63224bf..b0da9d1cddc69428e9fb3379d1338cf8
+ uv_timer_init(&external_loop, &external_timer);
+ uv_timer_start(&external_timer, external_timer_cb, 100, 0);
- ASSERT_OK(uv_thread_join(&thread));
- ASSERT_EQ(0, uv_thread_join(&thread));
- uv_barrier_destroy(&barrier);
+ run_loop();
+ ASSERT_EQ(main_timer_called, 1);
@ -465,10 +465,10 @@ index 6e9917239aa5626dd56fffd6eb2469d3e63224bf..b0da9d1cddc69428e9fb3379d1338cf8
MAKE_VALGRIND_HAPPY(loop);
return 0;
diff --git a/deps/uv/test/test-list.h b/deps/uv/test/test-list.h
index d30f02faa8515ca3a995490d53f2e85fda11c6a2..a392f5e3d701b0d973db2bbc6553977ce55a8775 100644
index 78ff9c2d1621676feab5d357609970cdf1ba5864..204160f324ad1a80c9b042e62c4bedcb745666ba 100644
--- a/deps/uv/test/test-list.h
+++ b/deps/uv/test/test-list.h
@@ -276,6 +276,7 @@ TEST_DECLARE (process_priority)
@@ -273,6 +273,7 @@ TEST_DECLARE (process_priority)
TEST_DECLARE (has_ref)
TEST_DECLARE (active)
TEST_DECLARE (embed)
@ -476,7 +476,7 @@ index d30f02faa8515ca3a995490d53f2e85fda11c6a2..a392f5e3d701b0d973db2bbc6553977c
TEST_DECLARE (async)
TEST_DECLARE (async_null_cb)
TEST_DECLARE (eintr_handling)
@@ -906,6 +907,7 @@ TASK_LIST_START
@@ -894,6 +895,7 @@ TASK_LIST_START
TEST_ENTRY (active)
TEST_ENTRY (embed)

Просмотреть файл

@ -1,60 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shelley Vohr <shelley.vohr@gmail.com>
Date: Wed, 16 Oct 2024 16:09:37 +0200
Subject: fix: -Wextra-semi errors in nghttp2_helper.h
Introduced in https://github.com/nodejs/node/pull/52966
Upstreamed in https://github.com/nghttp2/nghttp2/pull/2258
diff --git a/deps/nghttp2/lib/nghttp2_helper.h b/deps/nghttp2/lib/nghttp2_helper.h
index 89b0d4f535db795cd1df582475c02b2f4d1ac98f..f5de6290dab0e17ae3aff10230dd8ad7414f9631 100644
--- a/deps/nghttp2/lib/nghttp2_helper.h
+++ b/deps/nghttp2/lib/nghttp2_helper.h
@@ -38,28 +38,28 @@
#define nghttp2_max_def(SUFFIX, T) \
static inline T nghttp2_max_##SUFFIX(T a, T b) { return a < b ? b : a; }
-nghttp2_max_def(int8, int8_t);
-nghttp2_max_def(int16, int16_t);
-nghttp2_max_def(int32, int32_t);
-nghttp2_max_def(int64, int64_t);
-nghttp2_max_def(uint8, uint8_t);
-nghttp2_max_def(uint16, uint16_t);
-nghttp2_max_def(uint32, uint32_t);
-nghttp2_max_def(uint64, uint64_t);
-nghttp2_max_def(size, size_t);
+nghttp2_max_def(int8, int8_t)
+nghttp2_max_def(int16, int16_t)
+nghttp2_max_def(int32, int32_t)
+nghttp2_max_def(int64, int64_t)
+nghttp2_max_def(uint8, uint8_t)
+nghttp2_max_def(uint16, uint16_t)
+nghttp2_max_def(uint32, uint32_t)
+nghttp2_max_def(uint64, uint64_t)
+nghttp2_max_def(size, size_t)
#define nghttp2_min_def(SUFFIX, T) \
static inline T nghttp2_min_##SUFFIX(T a, T b) { return a < b ? a : b; }
-nghttp2_min_def(int8, int8_t);
-nghttp2_min_def(int16, int16_t);
-nghttp2_min_def(int32, int32_t);
-nghttp2_min_def(int64, int64_t);
-nghttp2_min_def(uint8, uint8_t);
-nghttp2_min_def(uint16, uint16_t);
-nghttp2_min_def(uint32, uint32_t);
-nghttp2_min_def(uint64, uint64_t);
-nghttp2_min_def(size, size_t);
+nghttp2_min_def(int8, int8_t)
+nghttp2_min_def(int16, int16_t)
+nghttp2_min_def(int32, int32_t)
+nghttp2_min_def(int64, int64_t)
+nghttp2_min_def(uint8, uint8_t)
+nghttp2_min_def(uint16, uint16_t)
+nghttp2_min_def(uint32, uint32_t)
+nghttp2_min_def(uint64, uint64_t)
+nghttp2_min_def(size, size_t)
#define lstreq(A, B, N) ((sizeof((A)) - 1) == (N) && memcmp((A), (B), (N)) == 0)

Просмотреть файл

@ -0,0 +1,23 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shelley Vohr <shelley.vohr@gmail.com>
Date: Tue, 23 May 2023 18:21:17 +0200
Subject: fix: account for createExternalizableString V8 global
Introduced in https://chromium-review.googlesource.com/c/v8/v8/+/4531903.
This patch can be removed when Node.js upgrades to a version of V8 with the above
CL - they'll need to make the same change.
diff --git a/test/parallel/test-fs-write.js b/test/parallel/test-fs-write.js
index 59b83f531cf0a60f960d0096aea70854f45bd629..9dcc35987a4757ea090e81c7de38a6af5bc3182f 100644
--- a/test/parallel/test-fs-write.js
+++ b/test/parallel/test-fs-write.js
@@ -38,7 +38,7 @@ const constants = fs.constants;
const { externalizeString, isOneByteString } = global;
// Account for extra globals exposed by --expose_externalize_string.
-common.allowGlobals(externalizeString, isOneByteString, global.x);
+common.allowGlobals(createExternalizableString, externalizeString, isOneByteString, global.x);
{
const expected = 'ümlaut sechzig'; // Must be a unique string.

Просмотреть файл

@ -0,0 +1,82 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shelley Vohr <shelley.vohr@gmail.com>
Date: Wed, 29 Mar 2023 09:55:47 +0200
Subject: fix: adapt debugger tests for upstream v8 changes
Updates debugger tests to conform to changes in https://chromium-review.googlesource.com/c/v8/v8/+/4290476
This can be removed when Node.js updates to at least V8 11.4.
diff --git a/test/common/debugger.js b/test/common/debugger.js
index 4aff5b9a0f74d99f8f605b68631f820e282091ab..d5d77fc7c648ddb45225f04c6cf23f9816b2186d 100644
--- a/test/common/debugger.js
+++ b/test/common/debugger.js
@@ -4,7 +4,7 @@ const spawn = require('child_process').spawn;
const BREAK_MESSAGE = new RegExp('(?:' + [
'assert', 'break', 'break on start', 'debugCommand',
- 'exception', 'other', 'promiseRejection',
+ 'exception', 'other', 'promiseRejection', 'step',
].join('|') + ') in', 'i');
let TIMEOUT = common.platformTimeout(5000);
@@ -121,13 +121,13 @@ function startCLI(args, flags = [], spawnOpts = {}) {
get breakInfo() {
const output = this.output;
const breakMatch =
- output.match(/break (?:on start )?in ([^\n]+):(\d+)\n/i);
+ output.match(/(step |break (?:on start )?)in ([^\n]+):(\d+)\n/i);
if (breakMatch === null) {
throw new Error(
`Could not find breakpoint info in ${JSON.stringify(output)}`);
}
- return { filename: breakMatch[1], line: +breakMatch[2] };
+ return { filename: breakMatch[2], line: +breakMatch[3] };
},
ctrlC() {
diff --git a/test/parallel/test-debugger-break.js b/test/parallel/test-debugger-break.js
index 65b4355cfe7bc25464626cca6f1c3b0de1dd9a45..8e3a290321a2e70304859eb57a2056c3a70af0f6 100644
--- a/test/parallel/test-debugger-break.js
+++ b/test/parallel/test-debugger-break.js
@@ -27,7 +27,7 @@ const cli = startCLI(['--port=0', script]);
await cli.stepCommand('n');
assert.ok(
- cli.output.includes(`break in ${script}:2`),
+ cli.output.includes(`step in ${script}:2`),
'pauses in next line of the script');
assert.match(
cli.output,
@@ -36,7 +36,7 @@ const cli = startCLI(['--port=0', script]);
await cli.stepCommand('next');
assert.ok(
- cli.output.includes(`break in ${script}:3`),
+ cli.output.includes(`step in ${script}:3`),
'pauses in next line of the script');
assert.match(
cli.output,
@@ -89,7 +89,7 @@ const cli = startCLI(['--port=0', script]);
await cli.stepCommand('');
assert.match(
cli.output,
- /break in node:timers/,
+ /step in node:timers/,
'entered timers.js');
await cli.stepCommand('cont');
diff --git a/test/parallel/test-debugger-run-after-quit-restart.js b/test/parallel/test-debugger-run-after-quit-restart.js
index 2c56f7227aed69d781392ce2f3f40e489e3501f2..0e1048699206dcc77696974e097e97de6b217811 100644
--- a/test/parallel/test-debugger-run-after-quit-restart.js
+++ b/test/parallel/test-debugger-run-after-quit-restart.js
@@ -25,7 +25,7 @@ const path = require('path');
.then(() => cli.stepCommand('n'))
.then(() => {
assert.ok(
- cli.output.includes(`break in ${script}:2`),
+ cli.output.includes(`step in ${script}:2`),
'steps to the 2nd line'
);
})

Просмотреть файл

@ -7,7 +7,7 @@ common.gypi is a file that's included in the node header bundle, despite
the fact that we do not build node with gyp.
diff --git a/common.gypi b/common.gypi
index a97e77860e151f5126515d65ef99b34aa7301f76..229cb96c1385c597138719f2b01f78bd54ad44ab 100644
index 1ece4f5e494533ea0fa25e0d35143fe424dbf70b..697b8bba6a55358924d6986f2eb347a99ff73889 100644
--- a/common.gypi
+++ b/common.gypi
@@ -88,6 +88,23 @@

Просмотреть файл

@ -0,0 +1,574 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: VerteDinde <vertedinde@electronjs.org>
Date: Mon, 24 Jun 2024 21:48:40 -0700
Subject: fix: add property query interceptors
This commit cherry-picks an upstream interceptor API change
from node-v8/canary to accomodate V8's upstream changes to old
interceptor APIs.
Node PR: https://github.com/nodejs/node-v8/commit/d1f18b0bf16efbc1e54ba04a54735ce4683cb936
CL: https://chromium-review.googlesource.com/c/v8/v8/+/5630388
This patch can be removed when the node change is incorporated into main.
diff --git a/src/node_contextify.cc b/src/node_contextify.cc
index 28ba7dbe66a44a43c39e3d75edf0be9513bcf732..0401b968916e5f45d148281c74b7e465e11439b8 100644
--- a/src/node_contextify.cc
+++ b/src/node_contextify.cc
@@ -49,6 +49,7 @@ using v8::FunctionTemplate;
using v8::HandleScope;
using v8::IndexedPropertyHandlerConfiguration;
using v8::Int32;
+using v8::Intercepted;
using v8::Isolate;
using v8::Just;
using v8::Local;
@@ -484,14 +485,15 @@ bool ContextifyContext::IsStillInitializing(const ContextifyContext* ctx) {
}
// static
-void ContextifyContext::PropertyGetterCallback(
- Local<Name> property,
- const PropertyCallbackInfo<Value>& args) {
+Intercepted ContextifyContext::PropertyGetterCallback(
+ Local<Name> property, const PropertyCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args);
ContextifyContext* ctx = ContextifyContext::Get(args);
// Still initializing
- if (IsStillInitializing(ctx)) return;
+ if (IsStillInitializing(ctx)) {
+ return Intercepted::kNo;
+ }
Local<Context> context = ctx->context();
Local<Object> sandbox = ctx->sandbox();
@@ -515,18 +517,22 @@ void ContextifyContext::PropertyGetterCallback(
rv = ctx->global_proxy();
args.GetReturnValue().Set(rv);
+ return Intercepted::kYes;
}
+ return Intercepted::kNo;
}
// static
-void ContextifyContext::PropertySetterCallback(
+Intercepted ContextifyContext::PropertySetterCallback(
Local<Name> property,
Local<Value> value,
- const PropertyCallbackInfo<Value>& args) {
+ const PropertyCallbackInfo<void>& args) {
ContextifyContext* ctx = ContextifyContext::Get(args);
// Still initializing
- if (IsStillInitializing(ctx)) return;
+ if (IsStillInitializing(ctx)) {
+ return Intercepted::kNo;
+ }
Local<Context> context = ctx->context();
PropertyAttribute attributes = PropertyAttribute::None;
@@ -544,8 +550,9 @@ void ContextifyContext::PropertySetterCallback(
(static_cast<int>(attributes) &
static_cast<int>(PropertyAttribute::ReadOnly));
- if (read_only)
- return;
+ if (read_only) {
+ return Intercepted::kNo;
+ }
// true for x = 5
// false for this.x = 5
@@ -564,11 +571,16 @@ void ContextifyContext::PropertySetterCallback(
bool is_declared = is_declared_on_global_proxy || is_declared_on_sandbox;
if (!is_declared && args.ShouldThrowOnError() && is_contextual_store &&
- !is_function)
- return;
+ !is_function) {
+ return Intercepted::kNo;
+ }
- if (!is_declared && property->IsSymbol()) return;
- if (ctx->sandbox()->Set(context, property, value).IsNothing()) return;
+ if (!is_declared && property->IsSymbol()) {
+ return Intercepted::kNo;
+ }
+ if (ctx->sandbox()->Set(context, property, value).IsNothing()) {
+ return Intercepted::kNo;
+ }
Local<Value> desc;
if (is_declared_on_sandbox &&
@@ -582,19 +594,23 @@ void ContextifyContext::PropertySetterCallback(
// We have to specify the return value for any contextual or get/set
// property
if (desc_obj->HasOwnProperty(context, env->get_string()).FromMaybe(false) ||
- desc_obj->HasOwnProperty(context, env->set_string()).FromMaybe(false))
+ desc_obj->HasOwnProperty(context, env->set_string()).FromMaybe(false)) {
args.GetReturnValue().Set(value);
+ return Intercepted::kYes;
+ }
}
+ return Intercepted::kNo;
}
// static
-void ContextifyContext::PropertyDescriptorCallback(
- Local<Name> property,
- const PropertyCallbackInfo<Value>& args) {
+Intercepted ContextifyContext::PropertyDescriptorCallback(
+ Local<Name> property, const PropertyCallbackInfo<Value>& args) {
ContextifyContext* ctx = ContextifyContext::Get(args);
// Still initializing
- if (IsStillInitializing(ctx)) return;
+ if (IsStillInitializing(ctx)) {
+ return Intercepted::kNo;
+ }
Local<Context> context = ctx->context();
@@ -604,19 +620,23 @@ void ContextifyContext::PropertyDescriptorCallback(
Local<Value> desc;
if (sandbox->GetOwnPropertyDescriptor(context, property).ToLocal(&desc)) {
args.GetReturnValue().Set(desc);
+ return Intercepted::kYes;
}
}
+ return Intercepted::kNo;
}
// static
-void ContextifyContext::PropertyDefinerCallback(
+Intercepted ContextifyContext::PropertyDefinerCallback(
Local<Name> property,
const PropertyDescriptor& desc,
- const PropertyCallbackInfo<Value>& args) {
+ const PropertyCallbackInfo<void>& args) {
ContextifyContext* ctx = ContextifyContext::Get(args);
// Still initializing
- if (IsStillInitializing(ctx)) return;
+ if (IsStillInitializing(ctx)) {
+ return Intercepted::kNo;
+ }
Local<Context> context = ctx->context();
Isolate* isolate = context->GetIsolate();
@@ -635,7 +655,7 @@ void ContextifyContext::PropertyDefinerCallback(
// If the property is set on the global as neither writable nor
// configurable, don't change it on the global or sandbox.
if (is_declared && read_only && dont_delete) {
- return;
+ return Intercepted::kNo;
}
Local<Object> sandbox = ctx->sandbox();
@@ -658,6 +678,9 @@ void ContextifyContext::PropertyDefinerCallback(
desc.has_set() ? desc.set() : Undefined(isolate).As<Value>());
define_prop_on_sandbox(&desc_for_sandbox);
+ // TODO(https://github.com/nodejs/node/issues/52634): this should return
+ // kYes to behave according to the expected semantics.
+ return Intercepted::kNo;
} else {
Local<Value> value =
desc.has_value() ? desc.value() : Undefined(isolate).As<Value>();
@@ -669,26 +692,32 @@ void ContextifyContext::PropertyDefinerCallback(
PropertyDescriptor desc_for_sandbox(value);
define_prop_on_sandbox(&desc_for_sandbox);
}
+ // TODO(https://github.com/nodejs/node/issues/52634): this should return
+ // kYes to behave according to the expected semantics.
+ return Intercepted::kNo;
}
}
// static
-void ContextifyContext::PropertyDeleterCallback(
- Local<Name> property,
- const PropertyCallbackInfo<Boolean>& args) {
+Intercepted ContextifyContext::PropertyDeleterCallback(
+ Local<Name> property, const PropertyCallbackInfo<Boolean>& args) {
ContextifyContext* ctx = ContextifyContext::Get(args);
// Still initializing
- if (IsStillInitializing(ctx)) return;
+ if (IsStillInitializing(ctx)) {
+ return Intercepted::kNo;
+ }
Maybe<bool> success = ctx->sandbox()->Delete(ctx->context(), property);
- if (success.FromMaybe(false))
- return;
+ if (success.FromMaybe(false)) {
+ return Intercepted::kNo;
+ }
// Delete failed on the sandbox, intercept and do not delete on
// the global object.
args.GetReturnValue().Set(false);
+ return Intercepted::kYes;
}
// static
@@ -708,76 +737,84 @@ void ContextifyContext::PropertyEnumeratorCallback(
}
// static
-void ContextifyContext::IndexedPropertyGetterCallback(
- uint32_t index,
- const PropertyCallbackInfo<Value>& args) {
+Intercepted ContextifyContext::IndexedPropertyGetterCallback(
+ uint32_t index, const PropertyCallbackInfo<Value>& args) {
ContextifyContext* ctx = ContextifyContext::Get(args);
// Still initializing
- if (IsStillInitializing(ctx)) return;
+ if (IsStillInitializing(ctx)) {
+ return Intercepted::kNo;
+ }
- ContextifyContext::PropertyGetterCallback(
+ return ContextifyContext::PropertyGetterCallback(
Uint32ToName(ctx->context(), index), args);
}
-
-void ContextifyContext::IndexedPropertySetterCallback(
+Intercepted ContextifyContext::IndexedPropertySetterCallback(
uint32_t index,
Local<Value> value,
- const PropertyCallbackInfo<Value>& args) {
+ const PropertyCallbackInfo<void>& args) {
ContextifyContext* ctx = ContextifyContext::Get(args);
// Still initializing
- if (IsStillInitializing(ctx)) return;
+ if (IsStillInitializing(ctx)) {
+ return Intercepted::kNo;
+ }
- ContextifyContext::PropertySetterCallback(
+ return ContextifyContext::PropertySetterCallback(
Uint32ToName(ctx->context(), index), value, args);
}
// static
-void ContextifyContext::IndexedPropertyDescriptorCallback(
- uint32_t index,
- const PropertyCallbackInfo<Value>& args) {
+Intercepted ContextifyContext::IndexedPropertyDescriptorCallback(
+ uint32_t index, const PropertyCallbackInfo<Value>& args) {
ContextifyContext* ctx = ContextifyContext::Get(args);
// Still initializing
- if (IsStillInitializing(ctx)) return;
+ if (IsStillInitializing(ctx)) {
+ return Intercepted::kNo;
+ }
- ContextifyContext::PropertyDescriptorCallback(
+ return ContextifyContext::PropertyDescriptorCallback(
Uint32ToName(ctx->context(), index), args);
}
-void ContextifyContext::IndexedPropertyDefinerCallback(
+Intercepted ContextifyContext::IndexedPropertyDefinerCallback(
uint32_t index,
const PropertyDescriptor& desc,
- const PropertyCallbackInfo<Value>& args) {
+ const PropertyCallbackInfo<void>& args) {
ContextifyContext* ctx = ContextifyContext::Get(args);
// Still initializing
- if (IsStillInitializing(ctx)) return;
+ if (IsStillInitializing(ctx)) {
+ return Intercepted::kNo;
+ }
- ContextifyContext::PropertyDefinerCallback(
+ return ContextifyContext::PropertyDefinerCallback(
Uint32ToName(ctx->context(), index), desc, args);
}
// static
-void ContextifyContext::IndexedPropertyDeleterCallback(
- uint32_t index,
- const PropertyCallbackInfo<Boolean>& args) {
+Intercepted ContextifyContext::IndexedPropertyDeleterCallback(
+ uint32_t index, const PropertyCallbackInfo<Boolean>& args) {
ContextifyContext* ctx = ContextifyContext::Get(args);
// Still initializing
- if (IsStillInitializing(ctx)) return;
+ if (IsStillInitializing(ctx)) {
+ return Intercepted::kNo;
+ }
Maybe<bool> success = ctx->sandbox()->Delete(ctx->context(), index);
- if (success.FromMaybe(false))
- return;
+ if (success.FromMaybe(false)) {
+ return Intercepted::kNo;
+ }
// Delete failed on the sandbox, intercept and do not delete on
// the global object.
args.GetReturnValue().Set(false);
+ return Intercepted::kYes;
}
void ContextifyScript::CreatePerIsolateProperties(
diff --git a/src/node_contextify.h b/src/node_contextify.h
index 10715c7eb07715cc11e49734bd54747dad95f6a4..49b9fabb399aed962e0d29e784a25ca4e9780a8f 100644
--- a/src/node_contextify.h
+++ b/src/node_contextify.h
@@ -111,42 +111,39 @@ class ContextifyContext : public BaseObject {
const v8::FunctionCallbackInfo<v8::Value>& args);
static void WeakCallback(
const v8::WeakCallbackInfo<ContextifyContext>& data);
- static void PropertyGetterCallback(
+ static v8::Intercepted PropertyGetterCallback(
v8::Local<v8::Name> property,
const v8::PropertyCallbackInfo<v8::Value>& args);
- static void PropertySetterCallback(
+ static v8::Intercepted PropertySetterCallback(
v8::Local<v8::Name> property,
v8::Local<v8::Value> value,
- const v8::PropertyCallbackInfo<v8::Value>& args);
- static void PropertyDescriptorCallback(
+ const v8::PropertyCallbackInfo<void>& args);
+ static v8::Intercepted PropertyDescriptorCallback(
v8::Local<v8::Name> property,
const v8::PropertyCallbackInfo<v8::Value>& args);
- static void PropertyDefinerCallback(
+ static v8::Intercepted PropertyDefinerCallback(
v8::Local<v8::Name> property,
const v8::PropertyDescriptor& desc,
- const v8::PropertyCallbackInfo<v8::Value>& args);
- static void PropertyDeleterCallback(
+ const v8::PropertyCallbackInfo<void>& args);
+ static v8::Intercepted PropertyDeleterCallback(
v8::Local<v8::Name> property,
const v8::PropertyCallbackInfo<v8::Boolean>& args);
static void PropertyEnumeratorCallback(
const v8::PropertyCallbackInfo<v8::Array>& args);
- static void IndexedPropertyGetterCallback(
- uint32_t index,
- const v8::PropertyCallbackInfo<v8::Value>& args);
- static void IndexedPropertySetterCallback(
+ static v8::Intercepted IndexedPropertyGetterCallback(
+ uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& args);
+ static v8::Intercepted IndexedPropertySetterCallback(
uint32_t index,
v8::Local<v8::Value> value,
- const v8::PropertyCallbackInfo<v8::Value>& args);
- static void IndexedPropertyDescriptorCallback(
- uint32_t index,
- const v8::PropertyCallbackInfo<v8::Value>& args);
- static void IndexedPropertyDefinerCallback(
+ const v8::PropertyCallbackInfo<void>& args);
+ static v8::Intercepted IndexedPropertyDescriptorCallback(
+ uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& args);
+ static v8::Intercepted IndexedPropertyDefinerCallback(
uint32_t index,
const v8::PropertyDescriptor& desc,
- const v8::PropertyCallbackInfo<v8::Value>& args);
- static void IndexedPropertyDeleterCallback(
- uint32_t index,
- const v8::PropertyCallbackInfo<v8::Boolean>& args);
+ const v8::PropertyCallbackInfo<void>& args);
+ static v8::Intercepted IndexedPropertyDeleterCallback(
+ uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean>& args);
v8::Global<v8::Context> context_;
std::unique_ptr<v8::MicrotaskQueue> microtask_queue_;
diff --git a/src/node_env_var.cc b/src/node_env_var.cc
index bce7ae07214ddf970a530db29ed6970e14b7a5ed..85f82180d48d6cfd7738cd7b1e504f23b38153e8 100644
--- a/src/node_env_var.cc
+++ b/src/node_env_var.cc
@@ -16,6 +16,7 @@ using v8::DontEnum;
using v8::FunctionTemplate;
using v8::HandleScope;
using v8::Integer;
+using v8::Intercepted;
using v8::Isolate;
using v8::Just;
using v8::Local;
@@ -336,24 +337,27 @@ Maybe<bool> KVStore::AssignToObject(v8::Isolate* isolate,
return Just(true);
}
-static void EnvGetter(Local<Name> property,
- const PropertyCallbackInfo<Value>& info) {
+static Intercepted EnvGetter(Local<Name> property,
+ const PropertyCallbackInfo<Value>& info) {
Environment* env = Environment::GetCurrent(info);
CHECK(env->has_run_bootstrapping_code());
if (property->IsSymbol()) {
- return info.GetReturnValue().SetUndefined();
+ info.GetReturnValue().SetUndefined();
+ return Intercepted::kYes;
}
CHECK(property->IsString());
MaybeLocal<String> value_string =
env->env_vars()->Get(env->isolate(), property.As<String>());
if (!value_string.IsEmpty()) {
info.GetReturnValue().Set(value_string.ToLocalChecked());
+ return Intercepted::kYes;
}
+ return Intercepted::kNo;
}
-static void EnvSetter(Local<Name> property,
- Local<Value> value,
- const PropertyCallbackInfo<Value>& info) {
+static Intercepted EnvSetter(Local<Name> property,
+ Local<Value> value,
+ const PropertyCallbackInfo<void>& info) {
Environment* env = Environment::GetCurrent(info);
CHECK(env->has_run_bootstrapping_code());
// calling env->EmitProcessEnvWarning() sets a variable indicating that
@@ -369,35 +373,40 @@ static void EnvSetter(Local<Name> property,
"the "
"value to a string before setting process.env with it.",
"DEP0104")
- .IsNothing())
- return;
+ .IsNothing()) {
+ return Intercepted::kNo;
+ }
}
Local<String> key;
Local<String> value_string;
if (!property->ToString(env->context()).ToLocal(&key) ||
!value->ToString(env->context()).ToLocal(&value_string)) {
- return;
+ return Intercepted::kNo;
}
env->env_vars()->Set(env->isolate(), key, value_string);
- // Whether it worked or not, always return value.
- info.GetReturnValue().Set(value);
+ return Intercepted::kYes;
}
-static void EnvQuery(Local<Name> property,
- const PropertyCallbackInfo<Integer>& info) {
+static Intercepted EnvQuery(Local<Name> property,
+ const PropertyCallbackInfo<Integer>& info) {
Environment* env = Environment::GetCurrent(info);
CHECK(env->has_run_bootstrapping_code());
if (property->IsString()) {
int32_t rc = env->env_vars()->Query(env->isolate(), property.As<String>());
- if (rc != -1) info.GetReturnValue().Set(rc);
+ if (rc != -1) {
+ // Return attributes for the property.
+ info.GetReturnValue().Set(v8::None);
+ return Intercepted::kYes;
+ }
}
+ return Intercepted::kNo;
}
-static void EnvDeleter(Local<Name> property,
- const PropertyCallbackInfo<Boolean>& info) {
+static Intercepted EnvDeleter(Local<Name> property,
+ const PropertyCallbackInfo<Boolean>& info) {
Environment* env = Environment::GetCurrent(info);
CHECK(env->has_run_bootstrapping_code());
if (property->IsString()) {
@@ -407,6 +416,7 @@ static void EnvDeleter(Local<Name> property,
// process.env never has non-configurable properties, so always
// return true like the tc39 delete operator.
info.GetReturnValue().Set(true);
+ return Intercepted::kYes;
}
static void EnvEnumerator(const PropertyCallbackInfo<Array>& info) {
@@ -417,9 +427,9 @@ static void EnvEnumerator(const PropertyCallbackInfo<Array>& info) {
env->env_vars()->Enumerate(env->isolate()));
}
-static void EnvDefiner(Local<Name> property,
- const PropertyDescriptor& desc,
- const PropertyCallbackInfo<Value>& info) {
+static Intercepted EnvDefiner(Local<Name> property,
+ const PropertyDescriptor& desc,
+ const PropertyCallbackInfo<void>& info) {
Environment* env = Environment::GetCurrent(info);
if (desc.has_value()) {
if (!desc.has_writable() ||
@@ -430,6 +440,7 @@ static void EnvDefiner(Local<Name> property,
"configurable, writable,"
" and enumerable "
"data descriptor");
+ return Intercepted::kYes;
} else if (!desc.configurable() ||
!desc.enumerable() ||
!desc.writable()) {
@@ -438,6 +449,7 @@ static void EnvDefiner(Local<Name> property,
"configurable, writable,"
" and enumerable "
"data descriptor");
+ return Intercepted::kYes;
} else {
return EnvSetter(property, desc.value(), info);
}
@@ -447,12 +459,14 @@ static void EnvDefiner(Local<Name> property,
"'process.env' does not accept an"
" accessor(getter/setter)"
" descriptor");
+ return Intercepted::kYes;
} else {
THROW_ERR_INVALID_OBJECT_DEFINE_PROPERTY(env,
"'process.env' only accepts a "
"configurable, writable,"
" and enumerable "
"data descriptor");
+ return Intercepted::kYes;
}
}
diff --git a/src/node_external_reference.h b/src/node_external_reference.h
index c4aba23510872d66b58a1adc88cdd1ee85a86cfe..6d9988810b951771064de523bc20aaf389a9c08a 100644
--- a/src/node_external_reference.h
+++ b/src/node_external_reference.h
@@ -66,16 +66,17 @@ class ExternalReferenceRegistry {
V(v8::FunctionCallback) \
V(v8::AccessorNameGetterCallback) \
V(v8::AccessorNameSetterCallback) \
- V(v8::GenericNamedPropertyDefinerCallback) \
- V(v8::GenericNamedPropertyDeleterCallback) \
- V(v8::GenericNamedPropertyEnumeratorCallback) \
- V(v8::GenericNamedPropertyQueryCallback) \
- V(v8::GenericNamedPropertySetterCallback) \
- V(v8::IndexedPropertySetterCallback) \
- V(v8::IndexedPropertyDefinerCallback) \
- V(v8::IndexedPropertyDeleterCallback) \
- V(v8::IndexedPropertyQueryCallback) \
- V(v8::IndexedPropertyDescriptorCallback) \
+ V(v8::NamedPropertyGetterCallback) \
+ V(v8::NamedPropertyDefinerCallback) \
+ V(v8::NamedPropertyDeleterCallback) \
+ V(v8::NamedPropertyEnumeratorCallback) \
+ V(v8::NamedPropertyQueryCallback) \
+ V(v8::NamedPropertySetterCallback) \
+ V(v8::IndexedPropertyGetterCallbackV2) \
+ V(v8::IndexedPropertySetterCallbackV2) \
+ V(v8::IndexedPropertyDefinerCallbackV2) \
+ V(v8::IndexedPropertyDeleterCallbackV2) \
+ V(v8::IndexedPropertyQueryCallbackV2) \
V(const v8::String::ExternalStringResourceBase*)
#define V(ExternalReferenceType) \

Просмотреть файл

@ -0,0 +1,23 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shelley Vohr <shelley.vohr@gmail.com>
Date: Tue, 12 Sep 2023 11:08:18 +0200
Subject: fix: Add TRUSTED_SPACE and TRUSTED_LO_SPACE to the V8 heap
Added by V8 in https://chromium-review.googlesource.com/c/v8/v8/+/4791643
This patch can be removed when Node.js upgrades to a version of V8 that
includes this change.
diff --git a/test/parallel/test-v8-stats.js b/test/parallel/test-v8-stats.js
index dd774267910aa0920ed077dd5bd5cfed93aab6cb..2366cbf716c11851bb3a759dce5db47d616516dc 100644
--- a/test/parallel/test-v8-stats.js
+++ b/test/parallel/test-v8-stats.js
@@ -48,6 +48,8 @@ const expectedHeapSpaces = [
'read_only_space',
'shared_large_object_space',
'shared_space',
+ 'trusted_large_object_space',
+ 'trusted_space'
];
const heapSpaceStatistics = v8.getHeapSpaceStatistics();
const actualHeapSpaceNames = heapSpaceStatistics.map((s) => s.space_name);

Просмотреть файл

@ -44,7 +44,7 @@ index 59b5a16f1309a5e4055bccfdb7a529045ad30402..bfdaf6211466a01b64b7942f7b16c480
let filename = call.getFileName();
const line = call.getLineNumber() - 1;
diff --git a/src/api/environment.cc b/src/api/environment.cc
index f59abcb21d64b910d8d42eb23c03109f62558813..1b6613d1de8c89c8271066a652afd1024988362d 100644
index b9098d102b40adad7fafcc331ac62870617019b9..cb9269a31e073caf86164aa39c0640370ade60fd 100644
--- a/src/api/environment.cc
+++ b/src/api/environment.cc
@@ -244,6 +244,9 @@ void SetIsolateErrorHandlers(v8::Isolate* isolate, const IsolateSettings& s) {
@ -58,10 +58,10 @@ index f59abcb21d64b910d8d42eb23c03109f62558813..1b6613d1de8c89c8271066a652afd102
}
diff --git a/src/node_options.cc b/src/node_options.cc
index 29630fcccc3bd9d24ad6aec64bef2fedfc3c4031..4b3f7751db2871c8ce76b197a84a2417097030ea 100644
index 818baf611fcab7838a339f3ea137467653e270d0..4e3c82e9528b04fd1a0cc99d30fb885e4b224bc9 100644
--- a/src/node_options.cc
+++ b/src/node_options.cc
@@ -1464,14 +1464,16 @@ void GetEmbedderOptions(const FunctionCallbackInfo<Value>& args) {
@@ -1405,14 +1405,16 @@ void GetEmbedderOptions(const FunctionCallbackInfo<Value>& args) {
}
Isolate* isolate = args.GetIsolate();

Просмотреть файл

@ -10,7 +10,7 @@ in the nodejs test suite. Need to be followed-up with upstream
on the broader change as there maybe other callsites.
diff --git a/src/handle_wrap.cc b/src/handle_wrap.cc
index 70db7ddbeab5963f1bdf6cb05ee2763d76011cec..6ffe2a2ad01f33ff68c6646df330ec3ac7781a19 100644
index be02d4aaa04685cbd6a9ecfe082e38f179129ab5..277748a30bd97ae816d9ba1f2d73851a29b81010 100644
--- a/src/handle_wrap.cc
+++ b/src/handle_wrap.cc
@@ -148,6 +148,9 @@ void HandleWrap::OnClose(uv_handle_t* handle) {
@ -21,5 +21,62 @@ index 70db7ddbeab5963f1bdf6cb05ee2763d76011cec..6ffe2a2ad01f33ff68c6646df330ec3a
+ return;
+
if (!wrap->persistent().IsEmpty() &&
wrap->object()
->Has(env->context(), env->handle_onclose_symbol())
wrap->object()->Has(env->context(), env->handle_onclose_symbol())
.FromMaybe(false)) {
diff --git a/src/node_contextify.cc b/src/node_contextify.cc
index 8951cd378a9025f58fada47cf96f686d14639f95..6456d87d4202c013aafe071adbac06852b3ae2c1 100644
--- a/src/node_contextify.cc
+++ b/src/node_contextify.cc
@@ -487,6 +487,7 @@ bool ContextifyContext::IsStillInitializing(const ContextifyContext* ctx) {
void ContextifyContext::PropertyGetterCallback(
Local<Name> property,
const PropertyCallbackInfo<Value>& args) {
+ Environment* env = Environment::GetCurrent(args);
ContextifyContext* ctx = ContextifyContext::Get(args);
// Still initializing
@@ -494,6 +495,8 @@ void ContextifyContext::PropertyGetterCallback(
Local<Context> context = ctx->context();
Local<Object> sandbox = ctx->sandbox();
+
+ TryCatchScope try_catch(env);
MaybeLocal<Value> maybe_rv =
sandbox->GetRealNamedProperty(context, property);
if (maybe_rv.IsEmpty()) {
@@ -503,6 +506,11 @@ void ContextifyContext::PropertyGetterCallback(
Local<Value> rv;
if (maybe_rv.ToLocal(&rv)) {
+ if (try_catch.HasCaught() &&
+ !try_catch.HasTerminated()) {
+ try_catch.ReThrow();
+ }
+
if (rv == sandbox)
rv = ctx->global_proxy();
diff --git a/src/node_messaging.cc b/src/node_messaging.cc
index e7d2bfbafef13f04a73dcbefe7d6e90b37b904d1..31b870c5f003b62b848c00d6032ed98eb829778d 100644
--- a/src/node_messaging.cc
+++ b/src/node_messaging.cc
@@ -907,7 +907,7 @@ Maybe<bool> MessagePort::PostMessage(Environment* env,
const TransferList& transfer_v) {
Isolate* isolate = env->isolate();
Local<Object> obj = object(isolate);
-
+ TryCatchScope try_catch(env);
std::shared_ptr<Message> msg = std::make_shared<Message>();
// Per spec, we need to both check if transfer list has the source port, and
@@ -915,6 +915,10 @@ Maybe<bool> MessagePort::PostMessage(Environment* env,
Maybe<bool> serialization_maybe =
msg->Serialize(env, context, message_v, transfer_v, obj);
+ if (try_catch.HasCaught() &&
+ !try_catch.HasTerminated()) {
+ try_catch.ReThrow();
+ }
if (data_ == nullptr) {
return serialization_maybe;
}

Просмотреть файл

@ -10,50 +10,15 @@ This should be upstreamed in some form, though it may need to be tweaked
before it's acceptable to upstream, as this patch comments out a couple
of tests that upstream probably cares about.
diff --git a/test/common/index.js b/test/common/index.js
index 172cdb6b049824539a9850789e0e7c5baf613367..c29abc18191aec78ad8eb810093a9a4ef9e854e4 100644
--- a/test/common/index.js
+++ b/test/common/index.js
@@ -65,6 +65,8 @@ const opensslVersionNumber = (major = 0, minor = 0, patch = 0) => {
return (major << 28) | (minor << 20) | (patch << 4);
};
+const openSSLIsBoringSSL = process.versions.openssl === '0.0.0';
+
let OPENSSL_VERSION_NUMBER;
const hasOpenSSL = (major = 0, minor = 0, patch = 0) => {
if (!hasCrypto) return false;
@@ -996,6 +998,7 @@ const common = {
mustNotMutateObjectDeep,
mustSucceed,
nodeProcessAborted,
+ openSSLIsBoringSSL,
PIPE,
parseTestFlags,
platformTimeout,
diff --git a/test/parallel/test-buffer-tostring-range.js b/test/parallel/test-buffer-tostring-range.js
index d033cd204b3200cdd736b581abe027d6e46e4ff3..73fec107a36c3db4af6f492137d0ca174f2d0547 100644
--- a/test/parallel/test-buffer-tostring-range.js
+++ b/test/parallel/test-buffer-tostring-range.js
@@ -102,7 +102,8 @@ assert.throws(() => {
// Must not throw when start and end are within kMaxLength
// Cannot test on 32bit machine as we are testing the case
// when start and end are above the threshold
-common.skipIf32Bits();
+if (!common.openSSLIsBoringSSL) {
const threshold = 0xFFFFFFFF;
const largeBuffer = Buffer.alloc(threshold + 20);
largeBuffer.toString('utf8', threshold, threshold + 20);
+}
diff --git a/test/parallel/test-crypto-async-sign-verify.js b/test/parallel/test-crypto-async-sign-verify.js
index 4e3c32fdcd23fbe3e74bd5e624b739d224689f33..29149838ca76986928c7649a5f60a0f5e22a0705 100644
index 4e3c32fdcd23fbe3e74bd5e624b739d224689f33..19d65aae7fa8ec9f9b907733ead17a208ed47909 100644
--- a/test/parallel/test-crypto-async-sign-verify.js
+++ b/test/parallel/test-crypto-async-sign-verify.js
@@ -88,6 +88,7 @@ test('rsa_public.pem', 'rsa_private.pem', 'sha256', false,
// ED25519
test('ed25519_public.pem', 'ed25519_private.pem', undefined, true);
// ED448
+if (!common.openSSLIsBoringSSL) {
+/*
test('ed448_public.pem', 'ed448_private.pem', undefined, true);
// ECDSA w/ der signature encoding
@ -61,10 +26,145 @@ index 4e3c32fdcd23fbe3e74bd5e624b739d224689f33..29149838ca76986928c7649a5f60a0f5
// DSA w/ ieee-p1363 signature encoding
test('dsa_public.pem', 'dsa_private.pem', 'sha256', false,
{ dsaEncoding: 'ieee-p1363' });
+}
+*/
// Test Parallel Execution w/ KeyObject is threadsafe in openssl3
{
diff --git a/test/parallel/test-crypto-authenticated.js b/test/parallel/test-crypto-authenticated.js
index 59dd3b69c4bdf6dbd7b5e4f03df74caac551d459..1e0f9ce4c979683530afdf83ac3dc095acad2eb8 100644
--- a/test/parallel/test-crypto-authenticated.js
+++ b/test/parallel/test-crypto-authenticated.js
@@ -48,7 +48,9 @@ const errMessages = {
const ciphers = crypto.getCiphers();
const expectedWarnings = common.hasFipsCrypto ?
- [] : [
+ [] : !ciphers.includes('aes-192-ccm') ? [
+ ['Use Cipheriv for counter mode of aes-192-gcm'],
+ ] : [
['Use Cipheriv for counter mode of aes-192-gcm'],
['Use Cipheriv for counter mode of aes-192-ccm'],
['Use Cipheriv for counter mode of aes-192-ccm'],
@@ -315,7 +317,9 @@ for (const test of TEST_CASES) {
// Test that create(De|C)ipher(iv)? throws if the mode is CCM and an invalid
// authentication tag length has been specified.
-{
+if (!ciphers.includes('aes-256-ccm')) {
+ common.printSkipMessage(`unsupported aes-256-ccm test`);
+} else {
for (const authTagLength of [-1, true, false, NaN, 5.5]) {
assert.throws(() => {
crypto.createCipheriv('aes-256-ccm',
@@ -403,6 +407,10 @@ for (const test of TEST_CASES) {
// authentication tag has been specified.
{
for (const mode of ['ccm', 'ocb']) {
+ if (!ciphers.includes(`aes-256-${mode}`)) {
+ common.printSkipMessage(`unsupported aes-256-${mode} test`);
+ continue;
+ }
assert.throws(() => {
crypto.createCipheriv(`aes-256-${mode}`,
'FxLKsqdmv0E9xrQhp0b1ZgI0K7JFZJM8',
@@ -437,7 +445,9 @@ for (const test of TEST_CASES) {
}
// Test that setAAD throws if an invalid plaintext length has been specified.
-{
+if (!ciphers.includes('aes-256-ccm')) {
+ common.printSkipMessage(`unsupported aes-256-ccm test`);
+} else {
const cipher = crypto.createCipheriv('aes-256-ccm',
'FxLKsqdmv0E9xrQhp0b1ZgI0K7JFZJM8',
'qkuZpJWCewa6S',
@@ -458,7 +468,9 @@ for (const test of TEST_CASES) {
}
// Test that setAAD and update throw if the plaintext is too long.
-{
+if (!ciphers.includes('aes-256-ccm')) {
+ common.printSkipMessage(`unsupported aes-256-ccm test`);
+} else {
for (const ivLength of [13, 12]) {
const maxMessageSize = (1 << (8 * (15 - ivLength))) - 1;
const key = 'FxLKsqdmv0E9xrQhp0b1ZgI0K7JFZJM8';
@@ -489,7 +501,9 @@ for (const test of TEST_CASES) {
// Test that setAAD throws if the mode is CCM and the plaintext length has not
// been specified.
-{
+if (!ciphers.includes('aes-256-ccm')) {
+ common.printSkipMessage(`unsupported aes-256-ccm test`);
+} else {
assert.throws(() => {
const cipher = crypto.createCipheriv('aes-256-ccm',
'FxLKsqdmv0E9xrQhp0b1ZgI0K7JFZJM8',
@@ -514,7 +528,9 @@ for (const test of TEST_CASES) {
}
// Test that final() throws in CCM mode when no authentication tag is provided.
-{
+if (!ciphers.includes('aes-128-ccm')) {
+ common.printSkipMessage(`unsupported aes-256-ccm test`);
+} else {
if (!common.hasFipsCrypto) {
const key = Buffer.from('1ed2233fa2223ef5d7df08546049406c', 'hex');
const iv = Buffer.from('7305220bca40d4c90e1791e9', 'hex');
@@ -546,7 +562,9 @@ for (const test of TEST_CASES) {
}
// Test that an IV length of 11 does not overflow max_message_size_.
-{
+if (!ciphers.includes('aes-128-ccm')) {
+ common.printSkipMessage(`unsupported aes-128-ccm test`);
+} else {
const key = 'x'.repeat(16);
const iv = Buffer.from('112233445566778899aabb', 'hex');
const options = { authTagLength: 8 };
@@ -563,6 +581,10 @@ for (const test of TEST_CASES) {
const iv = Buffer.from('0123456789ab', 'utf8');
for (const mode of ['gcm', 'ocb']) {
+ if (!ciphers.includes(`aes-128-${mode}`)) {
+ common.printSkipMessage(`unsupported aes-128-${mode} test`);
+ continue;
+ }
for (const authTagLength of mode === 'gcm' ? [undefined, 8] : [8]) {
const cipher = crypto.createCipheriv(`aes-128-${mode}`, key, iv, {
authTagLength
@@ -597,6 +619,10 @@ for (const test of TEST_CASES) {
const opts = { authTagLength: 8 };
for (const mode of ['gcm', 'ccm', 'ocb']) {
+ if (!ciphers.includes(`aes-128-${mode}`)) {
+ common.printSkipMessage(`unsupported aes-128-${mode} test`);
+ continue;
+ }
const cipher = crypto.createCipheriv(`aes-128-${mode}`, key, iv, opts);
const ciphertext = Buffer.concat([cipher.update(plain), cipher.final()]);
const tag = cipher.getAuthTag();
@@ -619,7 +645,9 @@ for (const test of TEST_CASES) {
// Test chacha20-poly1305 rejects invalid IV lengths of 13, 14, 15, and 16 (a
// length of 17 or greater was already rejected).
// - https://www.openssl.org/news/secadv/20190306.txt
-{
+if (!ciphers.includes('chacha20-poly1305')) {
+ common.printSkipMessage(`unsupported chacha20-poly1305 test`);
+} else {
// Valid extracted from TEST_CASES, check that it detects IV tampering.
const valid = {
algo: 'chacha20-poly1305',
@@ -664,6 +692,9 @@ for (const test of TEST_CASES) {
{
// CCM cipher without data should not crash, see https://github.com/nodejs/node/issues/38035.
+ common.printSkipMessage(`unsupported aes-128-ccm test`);
+ return;
+
const algo = 'aes-128-ccm';
const key = Buffer.alloc(16);
const iv = Buffer.alloc(12);
diff --git a/test/parallel/test-crypto-certificate.js b/test/parallel/test-crypto-certificate.js
index 4a5f1f149fe6c739f7f1d2ee17df6e61a942d621..b3287f428ce6b3fde11d449c601a57ff5e3843f9 100644
--- a/test/parallel/test-crypto-certificate.js
@ -94,6 +194,115 @@ index 4a5f1f149fe6c739f7f1d2ee17df6e61a942d621..b3287f428ce6b3fde11d449c601a57ff
}
{
diff --git a/test/parallel/test-crypto-cipher-decipher.js b/test/parallel/test-crypto-cipher-decipher.js
index 35514afbea92562a81c163b1e4d918b4ab609f71..13098e1acf12c309f2ed6f6143a2c2eeb8a2763d 100644
--- a/test/parallel/test-crypto-cipher-decipher.js
+++ b/test/parallel/test-crypto-cipher-decipher.js
@@ -22,7 +22,7 @@ common.expectWarning({
function testCipher1(key) {
// Test encryption and decryption
const plaintext = 'Keep this a secret? No! Tell everyone about node.js!';
- const cipher = crypto.createCipher('aes192', key);
+ const cipher = crypto.createCipher('aes-192-cbc', key);
// Encrypt plaintext which is in utf8 format
// to a ciphertext which will be in hex
@@ -30,7 +30,7 @@ function testCipher1(key) {
// Only use binary or hex, not base64.
ciph += cipher.final('hex');
- const decipher = crypto.createDecipher('aes192', key);
+ const decipher = crypto.createDecipher('aes-192-cbc', key);
let txt = decipher.update(ciph, 'hex', 'utf8');
txt += decipher.final('utf8');
@@ -40,11 +40,11 @@ function testCipher1(key) {
// NB: In real life, it's not guaranteed that you can get all of it
// in a single read() like this. But in this case, we know it's
// quite small, so there's no harm.
- const cStream = crypto.createCipher('aes192', key);
+ const cStream = crypto.createCipher('aes-192-cbc', key);
cStream.end(plaintext);
ciph = cStream.read();
- const dStream = crypto.createDecipher('aes192', key);
+ const dStream = crypto.createDecipher('aes-192-cbc', key);
dStream.end(ciph);
txt = dStream.read().toString('utf8');
@@ -59,14 +59,14 @@ function testCipher2(key) {
'32|RmVZZkFUVmpRRkp0TmJaUm56ZU9qcnJkaXNNWVNpTTU*|iXmckfRWZBGWWELw' +
'eCBsThSsfUHLeRe0KCsK8ooHgxie0zOINpXxfZi/oNG7uq9JWFVCk70gfzQH8ZUJ' +
'jAfaFg**';
- const cipher = crypto.createCipher('aes256', key);
+ const cipher = crypto.createCipher('aes-256-cbc', key);
// Encrypt plaintext which is in utf8 format to a ciphertext which will be in
// Base64.
let ciph = cipher.update(plaintext, 'utf8', 'base64');
ciph += cipher.final('base64');
- const decipher = crypto.createDecipher('aes256', key);
+ const decipher = crypto.createDecipher('aes-256-cbc', key);
let txt = decipher.update(ciph, 'base64', 'utf8');
txt += decipher.final('utf8');
@@ -170,7 +170,7 @@ testCipher2(Buffer.from('0123456789abcdef'));
// Regression test for https://github.com/nodejs/node-v0.x-archive/issues/5482:
// string to Cipher#update() should not assert.
{
- const c = crypto.createCipher('aes192', '0123456789abcdef');
+ const c = crypto.createCipher('aes-192-cbc', '0123456789abcdef');
c.update('update');
c.final();
}
@@ -178,15 +178,15 @@ testCipher2(Buffer.from('0123456789abcdef'));
// https://github.com/nodejs/node-v0.x-archive/issues/5655 regression tests,
// 'utf-8' and 'utf8' are identical.
{
- let c = crypto.createCipher('aes192', '0123456789abcdef');
+ let c = crypto.createCipher('aes-192-cbc', '0123456789abcdef');
c.update('update', ''); // Defaults to "utf8".
c.final('utf-8'); // Should not throw.
- c = crypto.createCipher('aes192', '0123456789abcdef');
+ c = crypto.createCipher('aes-192-cbc', '0123456789abcdef');
c.update('update', 'utf8');
c.final('utf-8'); // Should not throw.
- c = crypto.createCipher('aes192', '0123456789abcdef');
+ c = crypto.createCipher('aes-192-cbc', '0123456789abcdef');
c.update('update', 'utf-8');
c.final('utf8'); // Should not throw.
}
@@ -195,23 +195,23 @@ testCipher2(Buffer.from('0123456789abcdef'));
{
const key = '0123456789abcdef';
const plaintext = 'Top secret!!!';
- const c = crypto.createCipher('aes192', key);
+ const c = crypto.createCipher('aes-192-cbc', key);
let ciph = c.update(plaintext, 'utf16le', 'base64');
ciph += c.final('base64');
- let decipher = crypto.createDecipher('aes192', key);
+ let decipher = crypto.createDecipher('aes-192-cbc', key);
let txt;
txt = decipher.update(ciph, 'base64', 'ucs2');
txt += decipher.final('ucs2');
assert.strictEqual(txt, plaintext);
- decipher = crypto.createDecipher('aes192', key);
+ decipher = crypto.createDecipher('aes-192-cbc', key);
txt = decipher.update(ciph, 'base64', 'ucs-2');
txt += decipher.final('ucs-2');
assert.strictEqual(txt, plaintext);
- decipher = crypto.createDecipher('aes192', key);
+ decipher = crypto.createDecipher('aes-192-cbc', key);
txt = decipher.update(ciph, 'base64', 'utf-16le');
txt += decipher.final('utf-16le');
assert.strictEqual(txt, plaintext);
diff --git a/test/parallel/test-crypto-cipheriv-decipheriv.js b/test/parallel/test-crypto-cipheriv-decipheriv.js
index 3e3632203af72c54f2795d8de0cf345862a043bb..a066bbb803d41d9d1f26a02e41115b71233988d6 100644
--- a/test/parallel/test-crypto-cipheriv-decipheriv.js
@ -109,6 +318,21 @@ index 3e3632203af72c54f2795d8de0cf345862a043bb..a066bbb803d41d9d1f26a02e41115b71
// Test encryption and decryption with explicit key and iv.
// AES Key Wrap test vector comes from RFC3394
const plaintext = Buffer.from('00112233445566778899AABBCCDDEEFF', 'hex');
diff --git a/test/parallel/test-crypto-classes.js b/test/parallel/test-crypto-classes.js
index dd073274aef765e8f1e403aa2c8baf9694b521cb..fc6339e040debe61ecc61a3eb5b26823b102f1ff 100644
--- a/test/parallel/test-crypto-classes.js
+++ b/test/parallel/test-crypto-classes.js
@@ -22,8 +22,8 @@ const TEST_CASES = {
};
if (!common.hasFipsCrypto) {
- TEST_CASES.Cipher = ['aes192', 'secret'];
- TEST_CASES.Decipher = ['aes192', 'secret'];
+ TEST_CASES.Cipher = ['aes-192-cbc', 'secret'];
+ TEST_CASES.Decipher = ['aes-192-cbc', 'secret'];
TEST_CASES.DiffieHellman = [common.hasOpenSSL3 ? 1024 : 256];
}
diff --git a/test/parallel/test-crypto-dh-curves.js b/test/parallel/test-crypto-dh-curves.js
index 81a469c226c261564dee1e0b06b6571b18a41f1f..58b66045dba4201b7ebedd78b129420ffc316051 100644
--- a/test/parallel/test-crypto-dh-curves.js
@ -157,7 +381,7 @@ index fcf1922bcdba733af6c22f142db4f7b099947757..9f72ae4e41a113e752f40795103c2af5
assert.throws(() => crypto.createDiffieHellman('abcdef', g), ex);
assert.throws(() => crypto.createDiffieHellman('abcdef', 'hex', g), ex);
diff --git a/test/parallel/test-crypto-dh.js b/test/parallel/test-crypto-dh.js
index 9ebe14011eed223994e0901bc22dcc582b4b0739..e78f90eb76380916ce7098fb517c83a954edb053 100644
index 8ae0a002fec0944737d2c6ae73fc8956e41beb50..5b37236a6c2f1ec1761d8143c8ea6a7e2a837a7a 100644
--- a/test/parallel/test-crypto-dh.js
+++ b/test/parallel/test-crypto-dh.js
@@ -55,18 +55,17 @@ const crypto = require('crypto');
@ -187,21 +411,13 @@ index 9ebe14011eed223994e0901bc22dcc582b4b0739..e78f90eb76380916ce7098fb517c83a9
};
}
@@ -93,17 +92,23 @@ const crypto = require('crypto');
dh3.computeSecret('');
}, { message: common.hasOpenSSL3 && !hasOpenSSL3WithNewErrorMessage ?
'Unspecified validation error' :
- 'Supplied key is too small' });
+ 'Supplied key is invalid' });
}
}
@@ -100,10 +99,16 @@ const crypto = require('crypto');
// Through a fluke of history, g=0 defaults to DH_GENERATOR (2).
{
const g = 0;
- crypto.createDiffieHellman('abcdef', g);
+ assert.throws(() => crypto.createDiffieHellman('abcdef', g), {
+ code: /ERR_CRYPTO_OPERATION_FAILED/,
+ code: /INVALID_PARAMETERS/,
+ name: 'Error'
+ });
crypto.createDiffieHellman('abcdef', 'hex', g);
@ -210,28 +426,28 @@ index 9ebe14011eed223994e0901bc22dcc582b4b0739..e78f90eb76380916ce7098fb517c83a9
{
- crypto.createDiffieHellman('abcdef', Buffer.from([2])); // OK
+ assert.throws(() => crypto.createDiffieHellman('abcdef', Buffer.from([2])), {
+ code: /ERR_CRYPTO_OPERATION_FAILED/,
+ code: /INVALID_PARAMETERS/,
+ name: 'Error'
+ });
}
diff --git a/test/parallel/test-crypto-getcipherinfo.js b/test/parallel/test-crypto-getcipherinfo.js
index 64b79fc36ccf4d38f763fcd8c1930473c82cefd7..1c6717ebd46497384b9b13174b65894ca89e7f2d 100644
index 64b79fc36ccf4d38f763fcd8c1930473c82cefd7..892490fc7dd8da09f8aa10a20bec69385c0fee28 100644
--- a/test/parallel/test-crypto-getcipherinfo.js
+++ b/test/parallel/test-crypto-getcipherinfo.js
@@ -62,9 +62,13 @@ assert(getCipherInfo('aes-128-cbc', { ivLength: 16 }));
assert(!getCipherInfo('aes-128-ccm', { ivLength: 1 }));
assert(!getCipherInfo('aes-128-ccm', { ivLength: 14 }));
+if (!common.openSSLIsBoringSSL) {
+/*
for (let n = 7; n <= 13; n++)
assert(getCipherInfo('aes-128-ccm', { ivLength: n }));
+}
+*/
assert(!getCipherInfo('aes-128-ocb', { ivLength: 16 }));
+if (!common.openSSLIsBoringSSL) {
+/*
for (let n = 1; n < 16; n++)
assert(getCipherInfo('aes-128-ocb', { ivLength: n }));
+}
+*/
\ No newline at end of file
diff --git a/test/parallel/test-crypto-hash-stream-pipe.js b/test/parallel/test-crypto-hash-stream-pipe.js
index d22281abbd5c3cab3aaa3ac494301fa6b4a8a968..5f0c6a4aed2e868a1a1049212edf218791cd6868 100644
@ -255,7 +471,7 @@ index d22281abbd5c3cab3aaa3ac494301fa6b4a8a968..5f0c6a4aed2e868a1a1049212edf2187
s.pipe(h).on('data', common.mustCall(function(c) {
assert.strictEqual(c, expect);
diff --git a/test/parallel/test-crypto-hash.js b/test/parallel/test-crypto-hash.js
index 83218c105a4596e0ae0381136f176bb8d759899e..afb3c8c592d2a8e2a053fd44f455af06c592a85e 100644
index af2146982c7a3bf7bd7527f44e4b17a3b605026e..f6b91f675cfea367c608892dee078b565814f2dd 100644
--- a/test/parallel/test-crypto-hash.js
+++ b/test/parallel/test-crypto-hash.js
@@ -182,6 +182,7 @@ assert.throws(
@ -333,7 +549,7 @@ index 1785f5eef3d202976666081d09850ed744d83446..e88227a215ba4f7fa196f7642ae694a5
});
diff --git a/test/parallel/test-crypto-rsa-dsa.js b/test/parallel/test-crypto-rsa-dsa.js
index 5f4fafdfffbf726b7cb39c472baa3df25c9794cf..d52376da2cddd90adcdf8a9b7dcd03e348d9f2b4 100644
index 5f4fafdfffbf726b7cb39c472baa3df25c9794cf..73bb53b0405b20f51b13326cc70e52755c674366 100644
--- a/test/parallel/test-crypto-rsa-dsa.js
+++ b/test/parallel/test-crypto-rsa-dsa.js
@@ -28,12 +28,11 @@ const dsaPkcs8KeyPem = fixtures.readKey('dsa_private_pkcs8.pem');
@ -364,25 +580,22 @@ index 5f4fafdfffbf726b7cb39c472baa3df25c9794cf..d52376da2cddd90adcdf8a9b7dcd03e3
if (!process.config.variables.node_shared_openssl) {
assert.throws(() => {
crypto.privateDecrypt({
@@ -466,10 +466,10 @@ assert.throws(() => {
@@ -466,7 +466,7 @@ assert.throws(() => {
assert.strictEqual(verify2.verify(publicKey, signature, 'hex'), true);
}
-
+/*
//
// Test DSA signing and verification
//
+if (!common.openSSLIsBoringSSL) {
{
const input = 'I AM THE WALRUS';
@@ -541,3 +541,4 @@ const input = 'I AM THE WALRUS';
assert.strictEqual(verify.verify(dsaPubPem, signature, 'hex'), true);
}
+}
+*/
diff --git a/test/parallel/test-crypto-scrypt.js b/test/parallel/test-crypto-scrypt.js
index 338a19b0e88ad6f08d2f6b6a5d38b9980996ce11..a4ee215575d072450ba66c558ddca88bfb23d85f 100644
index 61bd65fc92678c24baa3c0eb9ffb1ead64ace70b..cb690351696a811210b9d990ee4cde3cfb2a3446 100644
--- a/test/parallel/test-crypto-scrypt.js
+++ b/test/parallel/test-crypto-scrypt.js
@@ -178,7 +178,7 @@ for (const options of bad) {
@ -395,19 +608,26 @@ index 338a19b0e88ad6f08d2f6b6a5d38b9980996ce11..a4ee215575d072450ba66c558ddca88b
};
assert.throws(() => crypto.scrypt('pass', 'salt', 1, options, () => {}),
diff --git a/test/parallel/test-crypto-sign-verify.js b/test/parallel/test-crypto-sign-verify.js
index 9dd586a1a1f9a00d9bb0af5b0532e81e7b96a5ce..a37e6d50914345829c8260a97949cee7d17ab676 100644
index 9dd586a1a1f9a00d9bb0af5b0532e81e7b96a5ce..1a0d0cfc09fb61d65472723ba54e1d0be69b5c68 100644
--- a/test/parallel/test-crypto-sign-verify.js
+++ b/test/parallel/test-crypto-sign-verify.js
@@ -29,7 +29,7 @@ const keySize = 2048;
@@ -28,6 +28,7 @@ const keySize = 2048;
'instance when called without `new`');
}
+/*
// Test handling of exceptional conditions
-{
+if (!common.openSSLIsBoringSSL) {
{
const library = {
configurable: true,
set() {
@@ -341,15 +341,17 @@ assert.throws(
@@ -68,6 +69,7 @@ const keySize = 2048;
delete Object.prototype.opensslErrorStack;
}
+*/
assert.throws(
() => crypto.createVerify('SHA256').verify({
@@ -341,15 +343,17 @@ assert.throws(
padding: crypto.constants.RSA_PKCS1_OAEP_PADDING
});
}, common.hasOpenSSL3 ? {
@ -429,7 +649,7 @@ index 9dd586a1a1f9a00d9bb0af5b0532e81e7b96a5ce..a37e6d50914345829c8260a97949cee7
});
}
@@ -419,10 +421,12 @@ assert.throws(
@@ -419,10 +423,12 @@ assert.throws(
public: fixtures.readKey('ed25519_public.pem', 'ascii'),
algo: null,
sigLen: 64 },
@ -442,7 +662,7 @@ index 9dd586a1a1f9a00d9bb0af5b0532e81e7b96a5ce..a37e6d50914345829c8260a97949cee7
{ private: fixtures.readKey('rsa_private_2048.pem', 'ascii'),
public: fixtures.readKey('rsa_public_2048.pem', 'ascii'),
algo: 'sha1',
@@ -493,7 +497,7 @@ assert.throws(
@@ -493,7 +499,7 @@ assert.throws(
{
const data = Buffer.from('Hello world');
@ -556,10 +776,10 @@ index 89a7521544f7051edc1779138551bbad1972b3fb..91df6acc65d4003999f29f0fa5f63905
}
+*/
diff --git a/test/parallel/test-crypto.js b/test/parallel/test-crypto.js
index 4271121881379b6c6892e89e520345f77e4181df..6c87a1ac687aa37d4ba245d1b6fc746a5f1eeffc 100644
index a8ceb169de2b3de73f062083c42292babc673e73..8fb950d0814e5014faf5c1ef576b65795857da1b 100644
--- a/test/parallel/test-crypto.js
+++ b/test/parallel/test-crypto.js
@@ -61,7 +61,7 @@ assert.throws(() => {
@@ -67,7 +67,7 @@ assert.throws(() => {
// Throws general Error, so there is no opensslErrorStack property.
return err instanceof Error &&
err.name === 'Error' &&
@ -568,7 +788,7 @@ index 4271121881379b6c6892e89e520345f77e4181df..6c87a1ac687aa37d4ba245d1b6fc746a
!('opensslErrorStack' in err);
});
@@ -71,7 +71,7 @@ assert.throws(() => {
@@ -77,7 +77,7 @@ assert.throws(() => {
// Throws general Error, so there is no opensslErrorStack property.
return err instanceof Error &&
err.name === 'Error' &&
@ -577,7 +797,7 @@ index 4271121881379b6c6892e89e520345f77e4181df..6c87a1ac687aa37d4ba245d1b6fc746a
!('opensslErrorStack' in err);
});
@@ -81,7 +81,7 @@ assert.throws(() => {
@@ -87,7 +87,7 @@ assert.throws(() => {
// Throws general Error, so there is no opensslErrorStack property.
return err instanceof Error &&
err.name === 'Error' &&
@ -586,7 +806,7 @@ index 4271121881379b6c6892e89e520345f77e4181df..6c87a1ac687aa37d4ba245d1b6fc746a
!('opensslErrorStack' in err);
});
@@ -144,8 +144,6 @@ assert(crypto.getHashes().includes('sha1'));
@@ -150,8 +150,6 @@ assert(crypto.getHashes().includes('sha1'));
assert(crypto.getHashes().includes('sha256'));
assert(!crypto.getHashes().includes('SHA1'));
assert(!crypto.getHashes().includes('SHA256'));
@ -595,7 +815,16 @@ index 4271121881379b6c6892e89e520345f77e4181df..6c87a1ac687aa37d4ba245d1b6fc746a
validateList(crypto.getHashes());
// Make sure all of the hashes are supported by OpenSSL
for (const algo of crypto.getHashes())
@@ -195,7 +193,7 @@ assert.throws(
@@ -188,7 +186,7 @@ const encodingError = {
// hex input that's not a power of two should throw, not assert in C++ land.
['createCipher', 'createDecipher'].forEach((funcName) => {
assert.throws(
- () => crypto[funcName]('aes192', 'test').update('0', 'hex'),
+ () => crypto[funcName]('aes-192-cbc', 'test').update('0', 'hex'),
(error) => {
assert.ok(!('opensslErrorStack' in error));
if (common.hasFipsCrypto) {
@@ -219,7 +217,7 @@ assert.throws(
return true;
}
);
@ -604,7 +833,7 @@ index 4271121881379b6c6892e89e520345f77e4181df..6c87a1ac687aa37d4ba245d1b6fc746a
assert.throws(() => {
const priv = [
'-----BEGIN RSA PRIVATE KEY-----',
@@ -208,6 +206,7 @@ assert.throws(() => {
@@ -232,6 +230,7 @@ assert.throws(() => {
].join('\n');
crypto.createSign('SHA256').update('test').sign(priv);
}, (err) => {
@ -612,7 +841,7 @@ index 4271121881379b6c6892e89e520345f77e4181df..6c87a1ac687aa37d4ba245d1b6fc746a
if (!common.hasOpenSSL3)
assert.ok(!('opensslErrorStack' in err));
assert.throws(() => { throw err; }, common.hasOpenSSL3 ? {
@@ -216,10 +215,10 @@ assert.throws(() => {
@@ -240,10 +239,10 @@ assert.throws(() => {
library: 'rsa routines',
} : {
name: 'Error',
@ -627,7 +856,7 @@ index 4271121881379b6c6892e89e520345f77e4181df..6c87a1ac687aa37d4ba245d1b6fc746a
code: 'ERR_OSSL_RSA_DIGEST_TOO_BIG_FOR_RSA_KEY'
});
return true;
@@ -252,7 +251,7 @@ if (!common.hasOpenSSL3) {
@@ -276,7 +275,7 @@ if (!common.hasOpenSSL3) {
return true;
});
}
@ -725,62 +954,56 @@ index b06f2fa2c53ea72f9a66f0d002dd9281d0259a0f..864fffeebfad75d95416fd47efdea7f2
const server = https.createServer(opts, (req, res) => {
diff --git a/test/parallel/test-webcrypto-derivebits.js b/test/parallel/test-webcrypto-derivebits.js
index eb09bc24f0cb8244b05987e3a7c1d203360d3a38..011990db171faa708c5211f6ab9ae1ac0e0ab90e 100644
index eb09bc24f0cb8244b05987e3a7c1d203360d3a38..da891fffa29d5666d91e4445e54c43e3688b870a 100644
--- a/test/parallel/test-webcrypto-derivebits.js
+++ b/test/parallel/test-webcrypto-derivebits.js
@@ -101,8 +101,9 @@ const { subtle } = globalThis.crypto;
@@ -101,6 +101,7 @@ const { subtle } = globalThis.crypto;
tests.then(common.mustCall());
}
+
+/*
// Test X25519 and X448 bit derivation
-{
+if (!common.openSSLIsBoringSSL) {
{
async function test(name) {
const [alice, bob] = await Promise.all([
subtle.generateKey({ name }, true, ['deriveBits']),
@@ -126,3 +127,4 @@ const { subtle } = globalThis.crypto;
test('X25519').then(common.mustCall());
test('X448').then(common.mustCall());
}
+
+*/
diff --git a/test/parallel/test-webcrypto-derivekey.js b/test/parallel/test-webcrypto-derivekey.js
index 558d37d90d5796b30101d1b512c9df3e7661d0db..f42bf8f4be0b439dd7e7c8d0f6f8a41e01588870 100644
index 558d37d90d5796b30101d1b512c9df3e7661d0db..c18f9670b10cb84c6902391f20e0ff75729cc960 100644
--- a/test/parallel/test-webcrypto-derivekey.js
+++ b/test/parallel/test-webcrypto-derivekey.js
@@ -176,7 +176,7 @@ const { KeyObject } = require('crypto');
@@ -175,6 +175,7 @@ const { KeyObject } = require('crypto');
})().then(common.mustCall());
}
+/*
// Test X25519 and X448 key derivation
-{
+if (!common.openSSLIsBoringSSL) {
{
async function test(name) {
const [alice, bob] = await Promise.all([
subtle.generateKey({ name }, true, ['deriveKey']),
@@ -209,3 +210,4 @@ const { KeyObject } = require('crypto');
test('X25519').then(common.mustCall());
test('X448').then(common.mustCall());
}
+*/
diff --git a/test/parallel/test-webcrypto-sign-verify.js b/test/parallel/test-webcrypto-sign-verify.js
index de736102bdcb71a5560c95f7041537f25026aed4..12d7fa39446c196bdf1479dbe74c9ee8ab02f949 100644
index de736102bdcb71a5560c95f7041537f25026aed4..638fdf0d798f3309528c63f0f8598f3df5528339 100644
--- a/test/parallel/test-webcrypto-sign-verify.js
+++ b/test/parallel/test-webcrypto-sign-verify.js
@@ -105,8 +105,9 @@ const { subtle } = globalThis.crypto;
@@ -105,6 +105,7 @@ const { subtle } = globalThis.crypto;
test('hello world').then(common.mustCall());
}
+
+/*
// Test Sign/Verify Ed25519
-{
+if (!common.openSSLIsBoringSSL) {
{
async function test(data) {
const ec = new TextEncoder();
const { publicKey, privateKey } = await subtle.generateKey({
@@ -126,7 +127,7 @@ const { subtle } = globalThis.crypto;
}
@@ -144,3 +145,4 @@ const { subtle } = globalThis.crypto;
// Test Sign/Verify Ed448
-{
+if (!common.openSSLIsBoringSSL) {
async function test(data) {
const ec = new TextEncoder();
const { publicKey, privateKey } = await subtle.generateKey({
test('hello world').then(common.mustCall());
}
+*/
diff --git a/test/parallel/test-webcrypto-wrap-unwrap.js b/test/parallel/test-webcrypto-wrap-unwrap.js
index d1ca571af4be713082d32093bfb8a65f2aef9800..57b8df2ce18df58ff54b2d828af67e3c2e082fe0 100644
--- a/test/parallel/test-webcrypto-wrap-unwrap.js

Просмотреть файл

@ -6,10 +6,10 @@ Subject: fix: do not resolve electron entrypoints
This wastes fs cycles and can result in strange behavior if this path actually exists on disk
diff --git a/lib/internal/modules/esm/load.js b/lib/internal/modules/esm/load.js
index 463e76cb1abc0c2fdddba4db2ca2e00f7c591e12..d7bc3c35c77b5bf9ec122b38248d0cf1f4d2a548 100644
index 22248b753c14960122f1d6b9bfe6b89fdb8d2010..9d245a04fbcb98dcd1c61e60f7cfe528bd1c8af0 100644
--- a/lib/internal/modules/esm/load.js
+++ b/lib/internal/modules/esm/load.js
@@ -111,7 +111,7 @@ async function defaultLoad(url, context = kEmptyObject) {
@@ -132,7 +132,7 @@ async function defaultLoad(url, context = kEmptyObject) {
source = null;
format ??= 'builtin';
} else if (format !== 'commonjs' || defaultType === 'module') {
@ -19,10 +19,10 @@ index 463e76cb1abc0c2fdddba4db2ca2e00f7c591e12..d7bc3c35c77b5bf9ec122b38248d0cf1
context = { __proto__: context, source };
}
diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js
index 06b31af80ebbfbf35ec787a94f345775eb512ebf..deca5aa4b8829ba9921440fcb5c285a10e40c8f0 100644
index f3dfc69cd2cdec50bc3b3f7cb2d63349812d87dd..b6f2d7194cb75ecc8c47869761c63184707ade40 100644
--- a/lib/internal/modules/esm/translators.js
+++ b/lib/internal/modules/esm/translators.js
@@ -354,6 +354,9 @@ function cjsPreparseModuleExports(filename, source) {
@@ -375,6 +375,9 @@ function cjsPreparseModuleExports(filename, source) {
if (module && module[kModuleExportNames] !== undefined) {
return { module, exportNames: module[kModuleExportNames] };
}
@ -33,7 +33,7 @@ index 06b31af80ebbfbf35ec787a94f345775eb512ebf..deca5aa4b8829ba9921440fcb5c285a1
if (!loaded) {
module = new CJSModule(filename);
diff --git a/lib/internal/modules/run_main.js b/lib/internal/modules/run_main.js
index 1e1a1ea46fc6c1b43cad4038ab0d9cdf21d6ba3d..95e2fa5479ea31559fdb5a2e03515f243b231b75 100644
index ca401044c0178c46db9b439b27c440a5d7924c84..dc1a682f0a3cf1ba1095c60bf6a6ca992d6043b3 100644
--- a/lib/internal/modules/run_main.js
+++ b/lib/internal/modules/run_main.js
@@ -2,6 +2,7 @@
@ -41,10 +41,10 @@ index 1e1a1ea46fc6c1b43cad4038ab0d9cdf21d6ba3d..95e2fa5479ea31559fdb5a2e03515f24
const {
StringPrototypeEndsWith,
+ StringPrototypeStartsWith,
globalThis,
} = primordials;
@@ -26,6 +27,13 @@ const {
const { containsModuleSyntax } = internalBinding('contextify');
@@ -22,6 +23,13 @@ const {
* @param {string} main - Entry point path
*/
function resolveMainPath(main) {
@ -58,7 +58,7 @@ index 1e1a1ea46fc6c1b43cad4038ab0d9cdf21d6ba3d..95e2fa5479ea31559fdb5a2e03515f24
const defaultType = getOptionValue('--experimental-default-type');
/** @type {string} */
let mainPath;
@@ -63,6 +71,13 @@ function resolveMainPath(main) {
@@ -59,6 +67,13 @@ function resolveMainPath(main) {
* @param {string} mainPath - Absolute path to the main entry point
*/
function shouldUseESMLoader(mainPath) {

Просмотреть файл

@ -6,22 +6,22 @@ Subject: fix: expose the built-in electron module via the ESM loader
This allows usage of `import { app } from 'electron'` and `import('electron')` natively in the browser + non-sandboxed renderer
diff --git a/lib/internal/modules/esm/get_format.js b/lib/internal/modules/esm/get_format.js
index a89446df710a941390c15171fea63c551776fc93..912f03bfa96c3aa12bfa6e709746642452568bb7 100644
index 1fe5564545dbc86d7f2968274a25ee1579bcbf28..b876af21a0e97ae06dc344d9f78c8f5c7e403d43 100644
--- a/lib/internal/modules/esm/get_format.js
+++ b/lib/internal/modules/esm/get_format.js
@@ -26,6 +26,7 @@ const protocolHandlers = {
'data:': getDataProtocolModuleFormat,
'file:': getFileProtocolModuleFormat,
@@ -31,6 +31,7 @@ const protocolHandlers = {
'http:': getHttpProtocolModuleFormat,
'https:': getHttpProtocolModuleFormat,
'node:'() { return 'builtin'; },
+ 'electron:'() { return 'electron'; },
};
/**
diff --git a/lib/internal/modules/esm/load.js b/lib/internal/modules/esm/load.js
index 8b157f0f461c7b92c567fffe4d99357dbc09aee7..605e812d515fc467001e4ab88fc15b4af3fd4aa2 100644
index 7b77af35a1dfebf6ad45ace521f1a55b5fa18293..ac24cf305bd5995ad13b37ee36f9e1fe3589c5d7 100644
--- a/lib/internal/modules/esm/load.js
+++ b/lib/internal/modules/esm/load.js
@@ -121,7 +121,7 @@ async function defaultLoad(url, context = kEmptyObject) {
@@ -142,7 +142,7 @@ async function defaultLoad(url, context = kEmptyObject) {
// Now that we have the source for the module, run `defaultGetFormat` to detect its format.
format = await defaultGetFormat(urlInstance, context);
@ -30,35 +30,37 @@ index 8b157f0f461c7b92c567fffe4d99357dbc09aee7..605e812d515fc467001e4ab88fc15b4a
// For backward compatibility reasons, we need to discard the source in
// order for the CJS loader to re-fetch it.
source = null;
@@ -218,12 +218,13 @@ function throwIfUnsupportedURLScheme(parsed) {
@@ -234,6 +234,7 @@ function throwIfUnsupportedURLScheme(parsed, experimentalNetworkImports) {
protocol !== 'file:' &&
protocol !== 'data:' &&
protocol !== 'node:' &&
+ protocol !== 'electron:' &&
(
protocol !== 'https:' &&
protocol !== 'http:'
!experimentalNetworkImports ||
(
@@ -242,7 +243,7 @@ function throwIfUnsupportedURLScheme(parsed, experimentalNetworkImports) {
)
)
) {
- const schemes = ['file', 'data', 'node'];
+ const schemes = ['file', 'data', 'node', 'electron'];
throw new ERR_UNSUPPORTED_ESM_URL_SCHEME(parsed, schemes);
}
}
if (experimentalNetworkImports) {
ArrayPrototypePush(schemes, 'https', 'http');
}
diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js
index 1fbbb6773c9479128408fa1f27cf19f1a7786ba6..f05c6f99c0037193c5802024be46a967d6cf47a0 100644
index e73a8ad60a13925d6773c32cead8d04ec9d96ee7..52cdb7d5e14a18ed7b1b65e429729cf47dce3f98 100644
--- a/lib/internal/modules/esm/resolve.js
+++ b/lib/internal/modules/esm/resolve.js
@@ -772,6 +772,8 @@ function parsePackageName(specifier, base) {
return { packageName, packageSubpath, isScoped };
@@ -741,6 +741,8 @@ function packageImportsResolve(name, base, conditions) {
throw importNotDefined(name, packageJSONUrl, base);
}
+const electronTypes = ['electron', 'electron/main', 'electron/common', 'electron/renderer'];
+
/**
* Resolves a package specifier to a URL.
* @param {string} specifier - The package specifier to resolve.
@@ -785,6 +787,11 @@ function packageResolve(specifier, base, conditions) {
* Returns the package type for a given URL.
* @param {URL} url - The URL to get the package type for.
@@ -801,6 +803,11 @@ function packageResolve(specifier, base, conditions) {
return new URL('node:' + specifier);
}
@ -71,10 +73,10 @@ index 1fbbb6773c9479128408fa1f27cf19f1a7786ba6..f05c6f99c0037193c5802024be46a967
parsePackageName(specifier, base);
diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js
index 8f88214f558c52ef26000fb0e1ef4d391327e84e..d182eedf5e96039e0029d36e51f40b75c6fb2a39 100644
index 8f4b6b25d8889686d00613fd9821b0aa822a946a..89ca269294ee1afa7f5aeb0ac6b8958f7a8b49d0 100644
--- a/lib/internal/modules/esm/translators.js
+++ b/lib/internal/modules/esm/translators.js
@@ -246,7 +246,7 @@ function createCJSModuleWrap(url, source, isMain, loadCJS = loadCJSModule) {
@@ -272,7 +272,7 @@ function createCJSModuleWrap(url, source, isMain, loadCJS = loadCJSModule) {
const { exportNames, module } = cjsPreparseModuleExports(filename, source);
cjsCache.set(url, module);
@ -83,7 +85,7 @@ index 8f88214f558c52ef26000fb0e1ef4d391327e84e..d182eedf5e96039e0029d36e51f40b75
[...exportNames] : ['default', ...exportNames];
if (isMain) {
@@ -268,8 +268,8 @@ function createCJSModuleWrap(url, source, isMain, loadCJS = loadCJSModule) {
@@ -294,8 +294,8 @@ function createCJSModuleWrap(url, source, isMain, loadCJS = loadCJSModule) {
({ exports } = module);
}
for (const exportName of exportNames) {
@ -94,7 +96,7 @@ index 8f88214f558c52ef26000fb0e1ef4d391327e84e..d182eedf5e96039e0029d36e51f40b75
continue;
}
// We might trigger a getter -> dont fail.
@@ -304,6 +304,10 @@ translators.set('require-commonjs', (url, source, isMain) => {
@@ -329,6 +329,10 @@ translators.set('require-commonjs', (url, source, isMain) => {
return createCJSModuleWrap(url, source);
});
@ -102,14 +104,14 @@ index 8f88214f558c52ef26000fb0e1ef4d391327e84e..d182eedf5e96039e0029d36e51f40b75
+ return createCJSModuleWrap('electron', '');
+});
+
// Handle CommonJS modules referenced by `require` calls.
// This translator function must be sync, as `require` is sync.
translators.set('require-commonjs-typescript', (url, source, isMain) => {
// Handle CommonJS modules referenced by `import` statements or expressions,
// or as the initial entry point when the ESM loader handles a CommonJS entry.
translators.set('commonjs', async function commonjsStrategy(url, source,
diff --git a/lib/internal/url.js b/lib/internal/url.js
index 3cb186182947a14407e9d5c4d94ab0554298a658..e35ae9ac316ba2e5b8f562d353b2c5ae978abb63 100644
index e6ed5466b8807a52633d8406824058bdc8c2ce13..e055facddf086eb8fb456b865ce006cdb7602b0a 100644
--- a/lib/internal/url.js
+++ b/lib/internal/url.js
@@ -1495,6 +1495,8 @@ function fileURLToPath(path, options = kEmptyObject) {
@@ -1485,6 +1485,8 @@ function fileURLToPath(path, options = kEmptyObject) {
path = new URL(path);
else if (!isURL(path))
throw new ERR_INVALID_ARG_TYPE('path', ['string', 'URL'], path);

Просмотреть файл

@ -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 77c20a4b6b9db414444974f68c5def8788386d2b..5fc1b6f2446d7c786024eb60800e2edab613dcd1 100644
index 46106fa94b3055648e4f01cd28860d427268a253..e0bf37f09dceb93af58990438ab577a9d4b843e8 100644
--- a/src/api/environment.cc
+++ b/src/api/environment.cc
@@ -564,6 +564,10 @@ MultiIsolatePlatform* GetMultiIsolatePlatform(IsolateData* env) {
@@ -557,6 +557,10 @@ MultiIsolatePlatform* GetMultiIsolatePlatform(IsolateData* env) {
return env->platform();
}
@ -22,7 +22,7 @@ index 77c20a4b6b9db414444974f68c5def8788386d2b..5fc1b6f2446d7c786024eb60800e2eda
int thread_pool_size,
node::tracing::TracingController* tracing_controller) {
diff --git a/src/node.h b/src/node.h
index 60598f54114b2424f10706e57d8aa50c4634bcb0..0fec9477fd0f2a3c2aa68284131c510b0da0e025 100644
index 6373adacb628459a4c9d7237da2587aee318e2d8..4f2eb9d0aab88b70c86339e750799080e980d7da 100644
--- a/src/node.h
+++ b/src/node.h
@@ -133,6 +133,7 @@ struct SnapshotData;

Просмотреть файл

@ -16,125 +16,11 @@ Upstreams:
- https://github.com/nodejs/node/pull/39138
- https://github.com/nodejs/node/pull/39136
diff --git a/deps/ncrypto/ncrypto.cc b/deps/ncrypto/ncrypto.cc
index eb3533bb4623b152605c3c590f37f086cce5f073..ded231aeaa15af22845704cfcc7d24a44bd88f8e 100644
--- a/deps/ncrypto/ncrypto.cc
+++ b/deps/ncrypto/ncrypto.cc
@@ -6,13 +6,11 @@
#include <openssl/evp.h>
#include <openssl/hmac.h>
#include <openssl/pkcs12.h>
+#include <openssl/rand.h>
#include <openssl/x509v3.h>
#if OPENSSL_VERSION_MAJOR >= 3
#include <openssl/provider.h>
#endif
-#ifdef OPENSSL_IS_BORINGSSL
-#include "dh-primes.h"
-#endif // OPENSSL_IS_BORINGSSL
namespace ncrypto {
namespace {
@@ -665,7 +663,7 @@ bool SafeX509SubjectAltNamePrint(const BIOPointer& out, X509_EXTENSION* ext) {
bool ok = true;
- for (int i = 0; i < sk_GENERAL_NAME_num(names); i++) {
+ for (size_t i = 0; i < sk_GENERAL_NAME_num(names); i++) {
GENERAL_NAME* gen = sk_GENERAL_NAME_value(names, i);
if (i != 0)
@@ -691,7 +689,7 @@ bool SafeX509InfoAccessPrint(const BIOPointer& out, X509_EXTENSION* ext) {
bool ok = true;
- for (int i = 0; i < sk_ACCESS_DESCRIPTION_num(descs); i++) {
+ for (size_t i = 0; i < sk_ACCESS_DESCRIPTION_num(descs); i++) {
ACCESS_DESCRIPTION* desc = sk_ACCESS_DESCRIPTION_value(descs, i);
if (i != 0)
@@ -1002,7 +1000,11 @@ BIOPointer BIOPointer::NewMem() {
}
BIOPointer BIOPointer::NewSecMem() {
+#ifdef OPENSSL_IS_BORINGSSL
+ return BIOPointer(BIO_new(BIO_s_mem()));
+#else
return BIOPointer(BIO_new(BIO_s_secmem()));
+#endif
}
BIOPointer BIOPointer::New(const BIO_METHOD* method) {
@@ -1057,8 +1059,10 @@ BignumPointer DHPointer::FindGroup(const std::string_view name,
FindGroupOption option) {
#define V(n, p) if (EqualNoCase(name, n)) return BignumPointer(p(nullptr));
if (option != FindGroupOption::NO_SMALL_PRIMES) {
+#ifndef OPENSSL_IS_BORINGSSL
V("modp1", BN_get_rfc2409_prime_768);
V("modp2", BN_get_rfc2409_prime_1024);
+#endif
V("modp5", BN_get_rfc3526_prime_1536);
}
V("modp14", BN_get_rfc3526_prime_2048);
@@ -1130,11 +1134,13 @@ DHPointer::CheckPublicKeyResult DHPointer::checkPublicKey(const BignumPointer& p
int codes = 0;
if (DH_check_pub_key(dh_.get(), pub_key.get(), &codes) != 1)
return DHPointer::CheckPublicKeyResult::CHECK_FAILED;
+#ifndef OPENSSL_IS_BORINGSSL
if (codes & DH_CHECK_PUBKEY_TOO_SMALL) {
return DHPointer::CheckPublicKeyResult::TOO_SMALL;
} else if (codes & DH_CHECK_PUBKEY_TOO_SMALL) {
return DHPointer::CheckPublicKeyResult::TOO_LARGE;
- } else if (codes != 0) {
+#endif
+ if (codes != 0) {
return DHPointer::CheckPublicKeyResult::INVALID;
}
return CheckPublicKeyResult::NONE;
diff --git a/deps/ncrypto/ncrypto.h b/deps/ncrypto/ncrypto.h
index 661c996889d0a89c1c38658a0933fcf5e3cdc1b9..1261d5d99fdf4e17b8dec66660028ce184f1cf89 100644
--- a/deps/ncrypto/ncrypto.h
+++ b/deps/ncrypto/ncrypto.h
@@ -413,8 +413,8 @@ public:
#ifndef OPENSSL_IS_BORINGSSL
TOO_SMALL = DH_R_CHECK_PUBKEY_TOO_SMALL,
TOO_LARGE = DH_R_CHECK_PUBKEY_TOO_LARGE,
- INVALID = DH_R_CHECK_PUBKEY_INVALID,
#endif
+ INVALID = DH_R_INVALID_PUBKEY,
CHECK_FAILED = 512,
};
// Check to see if the given public key is suitable for this DH instance.
diff --git a/deps/ncrypto/unofficial.gni b/deps/ncrypto/unofficial.gni
index ea024af73e215b3cad5f08796ac405f419530c86..41061b524eea74330b8d2452635a38c48f21386b 100644
--- a/deps/ncrypto/unofficial.gni
+++ b/deps/ncrypto/unofficial.gni
@@ -27,6 +27,6 @@ template("ncrypto_gn_build") {
forward_variables_from(invoker, "*")
public_configs = [ ":ncrypto_config" ]
sources = gypi_values.ncrypto_sources
- deps = [ "../openssl" ]
+ deps = [ "$node_crypto_path" ]
}
}
diff --git a/node.gni b/node.gni
index 32709b860ccb12d8d1e75342a65dda0b86129b21..18d58591e3d0f1f3512db00033c3410a65702864 100644
--- a/node.gni
+++ b/node.gni
@@ -10,6 +10,8 @@ declare_args() {
# The location of V8, use the one from node's deps by default.
node_v8_path = "//v8"
+ node_crypto_path = "//third_party/boringssl"
+
# The NODE_MODULE_VERSION defined in node_version.h.
node_module_version = exec_script("$node_path/tools/getmoduleversion.py", [], "value")
diff --git a/src/crypto/crypto_cipher.cc b/src/crypto/crypto_cipher.cc
index fe35a8e0f6bbb7ab515a0343a7ed046c44e86474..43a7abbf237d8d809953e302b83755a3283a1bf4 100644
index 4f0637f9511d1b90ae9d33760428dceb772667bd..5aba390c49613816ac359dfe995dc2c0a93f2206 100644
--- a/src/crypto/crypto_cipher.cc
+++ b/src/crypto/crypto_cipher.cc
@@ -1078,7 +1078,7 @@ void PublicKeyCipher::Cipher(const FunctionCallbackInfo<Value>& args) {
@@ -1088,7 +1088,7 @@ void PublicKeyCipher::Cipher(const FunctionCallbackInfo<Value>& args) {
if (EVP_PKEY_decrypt_init(ctx.get()) <= 0) {
return ThrowCryptoError(env, ERR_get_error());
}
@ -143,19 +29,19 @@ index fe35a8e0f6bbb7ab515a0343a7ed046c44e86474..43a7abbf237d8d809953e302b83755a3
int rsa_pkcs1_implicit_rejection =
EVP_PKEY_CTX_ctrl_str(ctx.get(), "rsa_pkcs1_implicit_rejection", "1");
// From the doc -2 means that the option is not supported.
@@ -1094,6 +1094,7 @@ void PublicKeyCipher::Cipher(const FunctionCallbackInfo<Value>& args) {
@@ -1104,6 +1104,7 @@ void PublicKeyCipher::Cipher(const FunctionCallbackInfo<Value>& args) {
"RSA_PKCS1_PADDING is no longer supported for private decryption,"
" this can be reverted with --security-revert=CVE-2024-PEND");
" this can be reverted with --security-revert=CVE-2023-46809");
}
+#endif
}
const EVP_MD* digest = nullptr;
diff --git a/src/crypto/crypto_common.cc b/src/crypto/crypto_common.cc
index 6a967702b22df0eb8aa10e853fd232794955860d..31058cccc6ffeed6b09aaecda320ee2f15849ec8 100644
index 85d48dfd2c15c453707bf6eb94e22f89b4f856b2..fe31a9a7f465a03d2de365cef392dfbb7c540156 100644
--- a/src/crypto/crypto_common.cc
+++ b/src/crypto/crypto_common.cc
@@ -134,7 +134,7 @@ const char* GetClientHelloALPN(const SSLPointer& ssl) {
@@ -158,7 +158,7 @@ const char* GetClientHelloALPN(const SSLPointer& ssl) {
const unsigned char* buf;
size_t len;
size_t rem;
@ -164,7 +50,7 @@ index 6a967702b22df0eb8aa10e853fd232794955860d..31058cccc6ffeed6b09aaecda320ee2f
if (!SSL_client_hello_get0_ext(
ssl.get(),
TLSEXT_TYPE_application_layer_protocol_negotiation,
@@ -147,13 +147,15 @@ const char* GetClientHelloALPN(const SSLPointer& ssl) {
@@ -171,13 +171,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);
@ -181,7 +67,7 @@ index 6a967702b22df0eb8aa10e853fd232794955860d..31058cccc6ffeed6b09aaecda320ee2f
if (!SSL_client_hello_get0_ext(
ssl.get(),
TLSEXT_TYPE_server_name,
@@ -175,6 +177,8 @@ const char* GetClientHelloServerName(const SSLPointer& ssl) {
@@ -199,6 +201,8 @@ const char* GetClientHelloServerName(const SSLPointer& ssl) {
if (len + 2 > rem)
return nullptr;
return reinterpret_cast<const char*>(buf + 5);
@ -190,25 +76,7 @@ index 6a967702b22df0eb8aa10e853fd232794955860d..31058cccc6ffeed6b09aaecda320ee2f
}
const char* GetServerName(SSL* ssl) {
@@ -282,7 +286,7 @@ StackOfX509 CloneSSLCerts(X509Pointer&& cert,
if (!peer_certs) return StackOfX509();
if (cert && !sk_X509_push(peer_certs.get(), cert.release()))
return StackOfX509();
- for (int i = 0; i < sk_X509_num(ssl_certs); i++) {
+ for (size_t i = 0; i < sk_X509_num(ssl_certs); i++) {
X509Pointer cert(X509_dup(sk_X509_value(ssl_certs, i)));
if (!cert || !sk_X509_push(peer_certs.get(), cert.get()))
return StackOfX509();
@@ -298,7 +302,7 @@ MaybeLocal<Object> AddIssuerChainToObject(X509Pointer* cert,
Environment* const env) {
cert->reset(sk_X509_delete(peer_certs.get(), 0));
for (;;) {
- int i;
+ size_t i;
for (i = 0; i < sk_X509_num(peer_certs.get()); i++) {
ncrypto::X509View ca(sk_X509_value(peer_certs.get(), i));
if (!cert->view().isIssuedBy(ca)) continue;
@@ -384,14 +388,14 @@ MaybeLocal<Array> GetClientHelloCiphers(
@@ -1036,14 +1040,14 @@ MaybeLocal<Array> GetClientHelloCiphers(
Environment* env,
const SSLPointer& ssl) {
EscapableHandleScope scope(env->isolate());
@ -227,7 +95,7 @@ index 6a967702b22df0eb8aa10e853fd232794955860d..31058cccc6ffeed6b09aaecda320ee2f
Local<Object> obj = Object::New(env->isolate());
if (!Set(env->context(),
obj,
@@ -444,8 +448,11 @@ MaybeLocal<Object> GetEphemeralKey(Environment* env, const SSLPointer& ssl) {
@@ -1096,8 +1100,11 @@ MaybeLocal<Object> GetEphemeralKey(Environment* env, const SSLPointer& ssl) {
EscapableHandleScope scope(env->isolate());
Local<Object> info = Object::New(env->isolate());
@ -241,19 +109,19 @@ index 6a967702b22df0eb8aa10e853fd232794955860d..31058cccc6ffeed6b09aaecda320ee2f
crypto::EVPKeyPointer key(raw_key);
diff --git a/src/crypto/crypto_context.cc b/src/crypto/crypto_context.cc
index c924a54639e8c22d765dc240dffacfffb200ca0c..287afcc792a0a2b7e19126ee9a48ebe21cc8844e 100644
index cef0c877c67643d47da787eddb95ed5a410a941b..1b8af49a48f1a34a92d4f0b502d435f3a4ab5d8e 100644
--- a/src/crypto/crypto_context.cc
+++ b/src/crypto/crypto_context.cc
@@ -94,7 +94,7 @@ int SSL_CTX_use_certificate_chain(SSL_CTX* ctx,
// the CA certificates.
SSL_CTX_clear_extra_chain_certs(ctx);
- for (int i = 0; i < sk_X509_num(extra_certs); i++) {
+ for (size_t i = 0; i < sk_X509_num(extra_certs); i++) {
X509* ca = sk_X509_value(extra_certs, i);
// NOTE: Increments reference count on `ca`
@@ -920,11 +920,12 @@ void SecureContext::SetDHParam(const FunctionCallbackInfo<Value>& args) {
@@ -63,7 +63,7 @@ inline X509_STORE* GetOrCreateRootCertStore() {
// Caller responsible for BIO_free_all-ing the returned object.
BIOPointer LoadBIO(Environment* env, Local<Value> v) {
if (v->IsString() || v->IsArrayBufferView()) {
- BIOPointer bio(BIO_new(BIO_s_secmem()));
+ BIOPointer bio(BIO_new(BIO_s_mem()));
if (!bio) return nullptr;
ByteSource bsrc = ByteSource::FromStringOrBuffer(env, v);
if (bsrc.size() > INT_MAX) return nullptr;
@@ -882,10 +882,12 @@ void SecureContext::SetDHParam(const FunctionCallbackInfo<Value>& args) {
// If the user specified "auto" for dhparams, the JavaScript layer will pass
// true to this function instead of the original string. Any other string
// value will be interpreted as custom DH parameters below.
@ -262,106 +130,66 @@ index c924a54639e8c22d765dc240dffacfffb200ca0c..287afcc792a0a2b7e19126ee9a48ebe2
CHECK(SSL_CTX_set_dh_auto(sc->ctx_.get(), true));
return;
}
-
+#endif
DHPointer dh;
{
BIOPointer bio(LoadBIO(env, args[0]));
@@ -1150,7 +1151,7 @@ void SecureContext::LoadPKCS12(const FunctionCallbackInfo<Value>& args) {
}
// Add CA certs too
- for (int i = 0; i < sk_X509_num(extra_certs.get()); i++) {
+ for (size_t i = 0; i < sk_X509_num(extra_certs.get()); i++) {
X509* ca = sk_X509_value(extra_certs.get(), i);
X509_STORE_add_cert(sc->GetCertStoreOwnedByThisSecureContext(), ca);
diff --git a/src/crypto/crypto_dh.cc b/src/crypto/crypto_dh.cc
index e5664dfa2bc7e11922fa965f28acdf21470d1147..33ffbbb85d05f5356183e3aa1ca23707c5629b5d 100644
index dac37f52b9687cadfa2d02152241e9a6e4c16ddf..d47cfa4ad8707ed7f0a42e7fe176fec25be64305 100644
--- a/src/crypto/crypto_dh.cc
+++ b/src/crypto/crypto_dh.cc
@@ -7,7 +7,9 @@
#include "memory_tracker-inl.h"
#include "ncrypto.h"
#include "node_errors.h"
+#ifndef OPENSSL_IS_BORINGSSL
#include "openssl/bnerr.h"
+#endif
#include "openssl/dh.h"
#include "threadpoolwork-inl.h"
#include "v8.h"
@@ -86,11 +88,7 @@ void New(const FunctionCallbackInfo<Value>& args) {
if (args[0]->IsInt32()) {
int32_t bits = args[0].As<Int32>()->Value();
if (bits < 2) {
-#if OPENSSL_VERSION_MAJOR >= 3
- ERR_put_error(ERR_LIB_DH, 0, DH_R_MODULUS_TOO_SMALL, __FILE__, __LINE__);
-#else
- ERR_put_error(ERR_LIB_BN, 0, BN_R_BITS_TOO_SMALL, __FILE__, __LINE__);
-#endif
+ OPENSSL_PUT_ERROR(BN, BN_R_BITS_TOO_SMALL);
return ThrowCryptoError(env, ERR_get_error(), "Invalid prime length");
}
@@ -103,7 +101,7 @@ void New(const FunctionCallbackInfo<Value>& args) {
}
int32_t generator = args[1].As<Int32>()->Value();
if (generator < 2) {
- ERR_put_error(ERR_LIB_DH, 0, DH_R_BAD_GENERATOR, __FILE__, __LINE__);
+ OPENSSL_PUT_ERROR(DH, DH_R_BAD_GENERATOR);
return ThrowCryptoError(env, ERR_get_error(), "Invalid generator");
}
@@ -132,12 +130,12 @@ void New(const FunctionCallbackInfo<Value>& args) {
if (args[1]->IsInt32()) {
int32_t generator = args[1].As<Int32>()->Value();
if (generator < 2) {
- ERR_put_error(ERR_LIB_DH, 0, DH_R_BAD_GENERATOR, __FILE__, __LINE__);
+ OPENSSL_PUT_ERROR(DH, DH_R_BAD_GENERATOR);
return ThrowCryptoError(env, ERR_get_error(), "Invalid generator");
}
bn_g = BignumPointer::New();
if (!bn_g.setWord(generator)) {
- ERR_put_error(ERR_LIB_DH, 0, DH_R_BAD_GENERATOR, __FILE__, __LINE__);
+ OPENSSL_PUT_ERROR(DH, DH_R_BAD_GENERATOR);
return ThrowCryptoError(env, ERR_get_error(), "Invalid generator");
}
} else {
@@ -146,11 +144,11 @@ void New(const FunctionCallbackInfo<Value>& args) {
return THROW_ERR_OUT_OF_RANGE(env, "generator is too big");
bn_g = BignumPointer(reinterpret_cast<uint8_t*>(arg1.data()), arg1.size());
if (!bn_g) {
- ERR_put_error(ERR_LIB_DH, 0, DH_R_BAD_GENERATOR, __FILE__, __LINE__);
+ OPENSSL_PUT_ERROR(DH, DH_R_BAD_GENERATOR);
return ThrowCryptoError(env, ERR_get_error(), "Invalid generator");
}
if (bn_g.getWord() < 2) {
- ERR_put_error(ERR_LIB_DH, 0, DH_R_BAD_GENERATOR, __FILE__, __LINE__);
+ OPENSSL_PUT_ERROR(DH, DH_R_BAD_GENERATOR);
return ThrowCryptoError(env, ERR_get_error(), "Invalid generator");
}
@@ -154,13 +154,11 @@ bool DiffieHellman::Init(BignumPointer&& bn_p, int g) {
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;
}
@@ -258,15 +256,17 @@ void ComputeSecret(const FunctionCallbackInfo<Value>& args) {
BignumPointer key(key_buf.data(), key_buf.size());
switch (dh.checkPublicKey(key)) {
- case DHPointer::CheckPublicKeyResult::INVALID:
- // Fall-through
case DHPointer::CheckPublicKeyResult::CHECK_FAILED:
return THROW_ERR_CRYPTO_INVALID_KEYTYPE(env,
"Unspecified validation error");
+#ifndef OPENSSL_IS_BORINGSSL
case DHPointer::CheckPublicKeyResult::TOO_SMALL:
return THROW_ERR_CRYPTO_INVALID_KEYLEN(env, "Supplied key is too small");
case DHPointer::CheckPublicKeyResult::TOO_LARGE:
return THROW_ERR_CRYPTO_INVALID_KEYLEN(env, "Supplied key is too large");
+#endif
+ case DHPointer::CheckPublicKeyResult::INVALID:
+ return THROW_ERR_CRYPTO_INVALID_KEYTYPE(env, "Supplied key is invalid");
case DHPointer::CheckPublicKeyResult::NONE:
break;
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;
}
@@ -398,9 +398,11 @@ EVPKeyCtxPointer DhKeyGenTraits::Setup(DhKeyPairGenConfig* params) {
BignumPointer bn_p(
@@ -176,20 +174,17 @@ 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;
}
BignumPointer bn_g(
BN_bin2bn(reinterpret_cast<const unsigned char*>(g), g_len, nullptr));
if (BN_is_zero(bn_g.get()) || BN_is_one(bn_g.get())) {
- 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;
}
BignumPointer bn_p(
@@ -219,8 +214,10 @@ typedef BignumPointer (*StandardizedGroupInstantiator)();
inline StandardizedGroupInstantiator FindDiffieHellmanGroup(const char* name) {
#define V(n, p) \
if (StringEqualNoCase(name, n)) return InstantiateStandardizedGroup<p>
+#ifndef OPENSSL_IS_BORINGSSL
V("modp1", BN_get_rfc2409_prime_768);
V("modp2", BN_get_rfc2409_prime_1024);
+#endif
V("modp5", BN_get_rfc3526_prime_1536);
V("modp14", BN_get_rfc3526_prime_2048);
V("modp15", BN_get_rfc3526_prime_3072);
@@ -565,9 +562,11 @@ EVPKeyCtxPointer DhKeyGenTraits::Setup(DhKeyPairGenConfig* params) {
key_params = EVPKeyPointer(EVP_PKEY_new());
CHECK(key_params);
CHECK_EQ(EVP_PKEY_assign_DH(key_params.get(), dh.release()), 1);
@ -374,7 +202,7 @@ index e5664dfa2bc7e11922fa965f28acdf21470d1147..33ffbbb85d05f5356183e3aa1ca23707
if (!param_ctx ||
EVP_PKEY_paramgen_init(param_ctx.get()) <= 0 ||
EVP_PKEY_CTX_set_dh_paramgen_prime_len(
@@ -414,6 +416,9 @@ EVPKeyCtxPointer DhKeyGenTraits::Setup(DhKeyPairGenConfig* params) {
@@ -581,6 +580,9 @@ EVPKeyCtxPointer DhKeyGenTraits::Setup(DhKeyPairGenConfig* params) {
}
key_params = EVPKeyPointer(raw_params);
@ -385,7 +213,7 @@ index e5664dfa2bc7e11922fa965f28acdf21470d1147..33ffbbb85d05f5356183e3aa1ca23707
UNREACHABLE();
}
diff --git a/src/crypto/crypto_dsa.cc b/src/crypto/crypto_dsa.cc
index 5d081863cf2dcdcf8c2d09db6060eeb5e78c452f..67523ec1c406e345945e1dde663c784c43a1c624 100644
index 3fa4a415dc911a13afd90dfb31c1ed4ad0fd268f..fa48dffc31342c44a1c1207b9d4c3dc72ed93b60 100644
--- a/src/crypto/crypto_dsa.cc
+++ b/src/crypto/crypto_dsa.cc
@@ -40,7 +40,7 @@ namespace crypto {
@ -409,18 +237,18 @@ index 5d081863cf2dcdcf8c2d09db6060eeb5e78c452f..67523ec1c406e345945e1dde663c784c
return EVPKeyCtxPointer();
diff --git a/src/crypto/crypto_keys.cc b/src/crypto/crypto_keys.cc
index 8488fc57faaf722174032c5a927d150c76120d60..c51efc92d4818ee7701b4725585fb7e1d2d644ad 100644
index 35474c31bfc2e3692b7ca10e4ed7026b9c275dfb..43c42c14f75018d4705f218fe4ed7e5dacb46bb8 100644
--- a/src/crypto/crypto_keys.cc
+++ b/src/crypto/crypto_keys.cc
@@ -1204,6 +1204,7 @@ void KeyObjectHandle::GetAsymmetricKeyType(
@@ -1239,6 +1239,7 @@ void KeyObjectHandle::GetAsymmetricKeyType(
}
bool KeyObjectHandle::CheckEcKeyData() const {
+#ifndef OPENSSL_IS_BORINGSSL
MarkPopErrorOnReturn mark_pop_error_on_return;
const auto& key = data_.GetAsymmetricKey();
@@ -1220,6 +1221,9 @@ bool KeyObjectHandle::CheckEcKeyData() const {
const ManagedEVPPKey& key = data_->GetAsymmetricKey();
@@ -1257,6 +1258,9 @@ bool KeyObjectHandle::CheckEcKeyData() const {
#else
return EVP_PKEY_public_check(ctx.get()) == 1;
#endif
@ -431,43 +259,43 @@ index 8488fc57faaf722174032c5a927d150c76120d60..c51efc92d4818ee7701b4725585fb7e1
void KeyObjectHandle::CheckEcKeyData(const FunctionCallbackInfo<Value>& args) {
diff --git a/src/crypto/crypto_random.cc b/src/crypto/crypto_random.cc
index b59e394d9a7e2c19fdf1f2b0177753ff488da0fa..91218f49da5392c6f769495ee7f9275a47ce09b1 100644
index 48154df7dc91ed7c0d65323199bc2f59dfc68135..6431e5c3062890975854780d15ecb84370b81770 100644
--- a/src/crypto/crypto_random.cc
+++ b/src/crypto/crypto_random.cc
@@ -134,7 +134,7 @@ Maybe<void> RandomPrimeTraits::AdditionalConfig(
@@ -140,7 +140,7 @@ Maybe<bool> RandomPrimeTraits::AdditionalConfig(
params->bits = bits;
params->safe = safe;
- params->prime = BignumPointer::NewSecure();
+ params->prime = BignumPointer::New();
- 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<void>();
return Nothing<bool>();
diff --git a/src/crypto/crypto_rsa.cc b/src/crypto/crypto_rsa.cc
index 02e8e24b4054afd4c3ca797c19a78927319a0d9e..d2a931a3f8f9490fe17ef8a82d0204ee2cca409d 100644
index 23b2b8c56dec8ac600b8f14b78d9e80b7fa3ed3b..e7a8fe4181542252d9142ea9460cacc5b4acd00d 100644
--- a/src/crypto/crypto_rsa.cc
+++ b/src/crypto/crypto_rsa.cc
@@ -608,10 +608,11 @@ Maybe<void> GetRsaKeyDetail(Environment* env,
@@ -616,10 +616,11 @@ Maybe<bool> GetRsaKeyDetail(
}
if (params->saltLength != nullptr) {
- if (ASN1_INTEGER_get_int64(&salt_length, params->saltLength) != 1) {
- ThrowCryptoError(env, ERR_get_error(), "ASN1_INTEGER_get_in64 error");
- return Nothing<void>();
- return Nothing<bool>();
- }
+ // TODO(codebytere): Upstream a shim to BoringSSL?
+ // if (ASN1_INTEGER_get_int64(&salt_length, params->saltLength) != 1) {
+ // ThrowCryptoError(env, ERR_get_error(), "ASN1_INTEGER_get_in64 error");
+ // return Nothing<void>();
+ // return Nothing<bool>();
+ // }
}
if (target
diff --git a/src/crypto/crypto_util.cc b/src/crypto/crypto_util.cc
index 793c196f8ce538c66b20611d00e12392ff9e878b..ee81048caab4ccfe26ea9e677782c9c955d162a9 100644
index 990638ec3993bde40ad3dd40d373d816ebc66a6a..63d971e1fe6b861e29c12f04563701b01fdfb976 100644
--- a/src/crypto/crypto_util.cc
+++ b/src/crypto/crypto_util.cc
@@ -495,24 +495,15 @@ Maybe<void> Decorate(Environment* env,
@@ -518,24 +518,15 @@ Maybe<void> Decorate(Environment* env,
V(BIO) \
V(PKCS7) \
V(X509V3) \
@ -493,7 +321,7 @@ index 793c196f8ce538c66b20611d00e12392ff9e878b..ee81048caab4ccfe26ea9e677782c9c9
V(USER) \
#define V(name) case ERR_LIB_##name: lib = #name "_"; break;
@@ -654,7 +645,7 @@ void SecureBuffer(const FunctionCallbackInfo<Value>& args) {
@@ -716,7 +707,7 @@ void SecureBuffer(const FunctionCallbackInfo<Value>& args) {
CHECK(args[0]->IsUint32());
Environment* env = Environment::GetCurrent(args);
uint32_t len = args[0].As<Uint32>()->Value();
@ -502,7 +330,7 @@ index 793c196f8ce538c66b20611d00e12392ff9e878b..ee81048caab4ccfe26ea9e677782c9c9
if (data == nullptr) {
// There's no memory available for the allocation.
// Return nothing.
@@ -665,7 +656,7 @@ void SecureBuffer(const FunctionCallbackInfo<Value>& args) {
@@ -727,7 +718,7 @@ void SecureBuffer(const FunctionCallbackInfo<Value>& args) {
data,
len,
[](void* data, size_t len, void* deleter_data) {
@ -511,7 +339,7 @@ index 793c196f8ce538c66b20611d00e12392ff9e878b..ee81048caab4ccfe26ea9e677782c9c9
},
data);
Local<ArrayBuffer> buffer = ArrayBuffer::New(env->isolate(), store);
@@ -673,10 +664,12 @@ void SecureBuffer(const FunctionCallbackInfo<Value>& args) {
@@ -735,10 +726,12 @@ void SecureBuffer(const FunctionCallbackInfo<Value>& args) {
}
void SecureHeapUsed(const FunctionCallbackInfo<Value>& args) {
@ -525,10 +353,10 @@ index 793c196f8ce538c66b20611d00e12392ff9e878b..ee81048caab4ccfe26ea9e677782c9c9
} // namespace
diff --git a/src/env.h b/src/env.h
index fc8dbd615255851cad90e1d8ffe225f5e0c6a718..49ca9c0042ccf22ad1fffa54f05fd443cbc681ba 100644
index 30561ab7a24c734be71ed29d963c11e2ea2c2b22..7cb77fb4f35a60fbda5b868798321ac8b6340bfa 100644
--- a/src/env.h
+++ b/src/env.h
@@ -50,7 +50,7 @@
@@ -49,7 +49,7 @@
#include "uv.h"
#include "v8.h"
@ -537,7 +365,7 @@ index fc8dbd615255851cad90e1d8ffe225f5e0c6a718..49ca9c0042ccf22ad1fffa54f05fd443
#include <openssl/evp.h>
#endif
@@ -1073,7 +1073,7 @@ class Environment final : public MemoryRetainer {
@@ -1065,7 +1065,7 @@ class Environment : public MemoryRetainer {
kExitInfoFieldCount
};
@ -547,7 +375,7 @@ index fc8dbd615255851cad90e1d8ffe225f5e0c6a718..49ca9c0042ccf22ad1fffa54f05fd443
// We declare another alias here to avoid having to include crypto_util.h
using EVPMDPointer = DeleteFnPtr<EVP_MD, EVP_MD_free>;
diff --git a/src/node_metadata.h b/src/node_metadata.h
index c59e65ad1fe3fac23f1fc25ca77e6133d1ccaccd..f2f07434e076e2977755ef7dac7d489aedb760b0 100644
index cf051585e779e2b03bd7b95fe5008b89cc7f8162..9de49c6828468fdf846dcd4ad445390f14446099 100644
--- a/src/node_metadata.h
+++ b/src/node_metadata.h
@@ -6,7 +6,7 @@
@ -560,7 +388,7 @@ index c59e65ad1fe3fac23f1fc25ca77e6133d1ccaccd..f2f07434e076e2977755ef7dac7d489a
#if NODE_OPENSSL_HAS_QUIC
#include <openssl/quic.h>
diff --git a/src/node_options.cc b/src/node_options.cc
index cfc599ec9a6197231c3469d318f02c620cdb03a8..29630fcccc3bd9d24ad6aec64bef2fedfc3c4031 100644
index dba59c5560c22899bd108789360f21fd85dd41bf..818baf611fcab7838a339f3ea137467653e270d0 100644
--- a/src/node_options.cc
+++ b/src/node_options.cc
@@ -6,7 +6,7 @@
@ -573,7 +401,7 @@ index cfc599ec9a6197231c3469d318f02c620cdb03a8..29630fcccc3bd9d24ad6aec64bef2fed
#endif
diff --git a/src/node_options.h b/src/node_options.h
index 9e656a2815045aa5da7eb267708c03058be9f362..600e0850f01e01024414d42b25605f256200540a 100644
index 10c220f66122336215f25b9674acfdfe6df82a8e..e8b2243d24fe95ff31254071133fb646e186c07e 100644
--- a/src/node_options.h
+++ b/src/node_options.h
@@ -11,7 +11,7 @@
@ -585,37 +413,3 @@ index 9e656a2815045aa5da7eb267708c03058be9f362..600e0850f01e01024414d42b25605f25
#include "openssl/opensslv.h"
#endif
diff --git a/unofficial.gni b/unofficial.gni
index de6ff5548ca5282199b7d85c11941c1fa351a9d9..3d8b7957e791ce2fa2a8d0937a87b6010087803d 100644
--- a/unofficial.gni
+++ b/unofficial.gni
@@ -145,7 +145,6 @@ template("node_gn_build") {
]
deps = [
":run_node_js2c",
- "deps/brotli",
"deps/cares",
"deps/histogram",
"deps/llhttp",
@@ -156,6 +155,8 @@ template("node_gn_build") {
"deps/sqlite",
"deps/uvwasi",
"//third_party/zlib",
+ "//third_party/brotli:dec",
+ "//third_party/brotli:enc",
"$node_v8_path:v8_libplatform",
]
@@ -182,10 +183,8 @@ template("node_gn_build") {
deps += [ "//third_party/icu" ]
}
if (node_use_openssl) {
- deps += [
- "deps/ncrypto",
- "//third_party/boringssl"
- ]
+ deps += [ "deps/ncrypto" ]
+ public_deps += [ "$node_crypto_path" ]
sources += gypi_values.node_crypto_sources
}
if (node_enable_inspector) {

Просмотреть файл

@ -6,39 +6,39 @@ Subject: fix: lazyload fs in esm loaders to apply asar patches
Changes { foo } from fs to just "fs.foo" so that our patching of fs is applied to esm loaders
diff --git a/lib/internal/modules/esm/load.js b/lib/internal/modules/esm/load.js
index 605e812d515fc467001e4ab88fc15b4af3fd4aa2..463e76cb1abc0c2fdddba4db2ca2e00f7c591e12 100644
index ac24cf305bd5995ad13b37ee36f9e1fe3589c5d7..22248b753c14960122f1d6b9bfe6b89fdb8d2010 100644
--- a/lib/internal/modules/esm/load.js
+++ b/lib/internal/modules/esm/load.js
@@ -8,7 +8,7 @@ const { kEmptyObject } = require('internal/util');
@@ -10,7 +10,7 @@ const { kEmptyObject } = require('internal/util');
const { defaultGetFormat } = require('internal/modules/esm/get_format');
const { validateAttributes, emitImportAssertionWarning } = require('internal/modules/esm/assert');
const { getOptionValue } = require('internal/options');
-const { readFileSync } = require('fs');
+const fs = require('fs');
const defaultType =
getOptionValue('--experimental-default-type');
@@ -40,8 +40,7 @@ async function getSource(url, context) {
const responseURL = href;
// Do not eagerly grab .manifest, it may be in TDZ
const policy = getOptionValue('--experimental-policy') ?
@@ -42,8 +42,7 @@ async function getSource(url, context) {
let responseURL = href;
let source;
if (protocol === 'file:') {
- const { readFile: readFileAsync } = require('internal/fs/promises').exports;
- source = await readFileAsync(url);
+ source = await fs.promises.readFile(url);
} else if (protocol === 'data:') {
const result = dataURLProcessor(url);
if (result === 'failure') {
@@ -65,7 +64,7 @@ function getSourceSync(url, context) {
const match = RegExpPrototypeExec(DATA_URL_PATTERN, url.pathname);
if (!match) {
@@ -82,7 +81,7 @@ function getSourceSync(url, context) {
const responseURL = href;
let source;
if (protocol === 'file:') {
- source = readFileSync(url);
+ source = fs.readFileSync(url);
} else if (protocol === 'data:') {
const result = dataURLProcessor(url);
if (result === 'failure') {
const match = RegExpPrototypeExec(DATA_URL_PATTERN, url.pathname);
if (!match) {
diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js
index f05c6f99c0037193c5802024be46a967d6cf47a0..f3dad958b2ec275992554477b9344214c8c1e2c8 100644
index 52cdb7d5e14a18ed7b1b65e429729cf47dce3f98..69f73f829706deddc4f328b78af9d58434af647d 100644
--- a/lib/internal/modules/esm/resolve.js
+++ b/lib/internal/modules/esm/resolve.js
@@ -24,7 +24,7 @@ const {
@ -49,8 +49,17 @@ index f05c6f99c0037193c5802024be46a967d6cf47a0..f3dad958b2ec275992554477b9344214
+const fs = require('fs');
const { getOptionValue } = require('internal/options');
// Do not eagerly grab .manifest, it may be in TDZ
const { sep, posix: { relative: relativePosixPath }, resolve } = require('path');
@@ -259,7 +259,7 @@ function finalizeResolution(resolved, base, preserveSymlinks) {
const policy = getOptionValue('--experimental-policy') ?
@@ -251,7 +251,7 @@ function finalizeResolution(resolved, base, preserveSymlinks) {
throw err;
}
- const stats = internalModuleStat(toNamespacedPath(StringPrototypeEndsWith(path, '/') ?
+ const stats = internalFsBinding.internalModuleStat(toNamespacedPath(StringPrototypeEndsWith(path, '/') ?
StringPrototypeSlice(path, -1) : path));
// Check for stats.isDirectory()
@@ -267,7 +267,7 @@ function finalizeResolution(resolved, base, preserveSymlinks) {
}
if (!preserveSymlinks) {
@ -59,11 +68,20 @@ index f05c6f99c0037193c5802024be46a967d6cf47a0..f3dad958b2ec275992554477b9344214
[internalFS.realpathCacheKey]: realpathCache,
});
const { search, hash } = resolved;
@@ -826,7 +826,7 @@ function packageResolve(specifier, base, conditions) {
let packageJSONPath = fileURLToPath(packageJSONUrl);
let lastPath;
do {
- const stat = internalModuleStat(toNamespacedPath(StringPrototypeSlice(packageJSONPath, 0,
+ const stat = internalFsBinding.internalModuleStat(toNamespacedPath(StringPrototypeSlice(packageJSONPath, 0,
packageJSONPath.length - 13)));
// Check for !stat.isDirectory()
if (stat !== 1) {
diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js
index d182eedf5e96039e0029d36e51f40b75c6fb2a39..06b31af80ebbfbf35ec787a94f345775eb512ebf 100644
index 89ca269294ee1afa7f5aeb0ac6b8958f7a8b49d0..f3dfc69cd2cdec50bc3b3f7cb2d63349812d87dd 100644
--- a/lib/internal/modules/esm/translators.js
+++ b/lib/internal/modules/esm/translators.js
@@ -34,7 +34,7 @@ const {
@@ -36,7 +36,7 @@ const {
const { BuiltinModule } = require('internal/bootstrap/realm');
const assert = require('internal/assert');
@ -72,7 +90,7 @@ index d182eedf5e96039e0029d36e51f40b75c6fb2a39..06b31af80ebbfbf35ec787a94f345775
const { dirname, extname, isAbsolute } = require('path');
const {
loadBuiltinModule,
@@ -335,7 +335,7 @@ translators.set('commonjs', async function commonjsStrategy(url, source,
@@ -356,7 +356,7 @@ translators.set('commonjs', async function commonjsStrategy(url, source,
try {
// We still need to read the FS to detect the exports.
@ -81,7 +99,7 @@ index d182eedf5e96039e0029d36e51f40b75c6fb2a39..06b31af80ebbfbf35ec787a94f345775
} catch {
// Continue regardless of error.
}
@@ -403,7 +403,7 @@ function cjsPreparseModuleExports(filename, source) {
@@ -424,7 +424,7 @@ function cjsPreparseModuleExports(filename, source) {
isAbsolute(resolved)) {
// TODO: this should be calling the `load` hook chain to get the source
// (and fallback to reading the FS only if the source is nullish).

Просмотреть файл

@ -10,7 +10,7 @@ This change removes the usage of these constants to fix a compilation failure du
See: https://github.com/llvm/llvm-project/pull/80542
diff --git a/deps/uv/include/uv.h b/deps/uv/include/uv.h
index 7f48b7daa87d1a5b14bc6f641b60f21263fa5ec3..0be470c9139a6da19414295a59f1a237cc3a50d7 100644
index 3375600023e39ddacf62cc17deb4f206db942084..cc106422dd36aa0564e74dd8a16eec496433d3bd 100644
--- a/deps/uv/include/uv.h
+++ b/deps/uv/include/uv.h
@@ -155,7 +155,6 @@ struct uv__queue {
@ -86,10 +86,10 @@ index 149c7c107322919dfeea1dfe89dc223f78b0e979..e4e8dac6b8b5924a7eae83935031e091
NODE_DEFINE_CONSTANT(target, ETIMEDOUT);
#endif
diff --git a/src/node_errors.cc b/src/node_errors.cc
index 65f95c3157add2afca26a133183b65ccba6e9924..81091d364d32094dc91c7abb0c5fe9963d100a8b 100644
index 69e474257b0427f894375fbc8a2c031f1b8e0c55..f0e968c0dfa8963404c3b87827b8d11a139051cc 100644
--- a/src/node_errors.cc
+++ b/src/node_errors.cc
@@ -857,10 +857,6 @@ const char* errno_string(int errorno) {
@@ -855,10 +855,6 @@ const char* errno_string(int errorno) {
ERRNO_CASE(ENOBUFS);
#endif
@ -100,7 +100,7 @@ index 65f95c3157add2afca26a133183b65ccba6e9924..81091d364d32094dc91c7abb0c5fe996
#ifdef ENODEV
ERRNO_CASE(ENODEV);
#endif
@@ -899,14 +895,6 @@ const char* errno_string(int errorno) {
@@ -897,14 +893,6 @@ const char* errno_string(int errorno) {
ERRNO_CASE(ENOSPC);
#endif
@ -115,7 +115,7 @@ index 65f95c3157add2afca26a133183b65ccba6e9924..81091d364d32094dc91c7abb0c5fe996
#ifdef ENOSYS
ERRNO_CASE(ENOSYS);
#endif
@@ -989,10 +977,6 @@ const char* errno_string(int errorno) {
@@ -987,10 +975,6 @@ const char* errno_string(int errorno) {
ERRNO_CASE(ESTALE);
#endif

Просмотреть файл

@ -1,25 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shelley Vohr <shelley.vohr@gmail.com>
Date: Fri, 18 Oct 2024 17:01:06 +0200
Subject: fix: remove harmony-import-assertions from node.cc
harmony-import-assertions has been removed from V8 as of
https://chromium-review.googlesource.com/c/v8/v8/+/5507047,
so we should remove it from node.cc as well.
This patch can be removed when we upgrade to a V8 version that
contains the above CL.
diff --git a/src/node.cc b/src/node.cc
index ccc1085a84b214d241687fa9ebd45b55b2cc60d8..1df8e1f00a0e2ffa63bfd4369240b837ab6a9c50 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -804,7 +804,7 @@ static ExitCode ProcessGlobalArgsInternal(std::vector<std::string>* args,
}
// TODO(nicolo-ribaudo): remove this once V8 doesn't enable it by default
// anymore.
- v8_args.emplace_back("--no-harmony-import-assertions");
+ // v8_args.emplace_back("--no-harmony-import-assertions");
auto env_opts = per_process::cli_options->per_isolate->per_env;
if (std::find(v8_args.begin(), v8_args.end(),

Просмотреть файл

@ -15,27 +15,31 @@ to recognize asar files.
This reverts commit 9cf2e1f55b8446a7cde23699d00a3be73aa0c8f1.
diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js
index f3dad958b2ec275992554477b9344214c8c1e2c8..a086217046fd5ed7cfb09cfd2ed62f3987eb1f31 100644
index 69f73f829706deddc4f328b78af9d58434af647d..1d53a2a47423150e822bb917b2725d3a6a794814 100644
--- a/lib/internal/modules/esm/resolve.js
+++ b/lib/internal/modules/esm/resolve.js
@@ -27,14 +27,13 @@ const { BuiltinModule } = require('internal/bootstrap/realm');
const fs = require('fs');
const { getOptionValue } = require('internal/options');
// Do not eagerly grab .manifest, it may be in TDZ
-const { sep, posix: { relative: relativePosixPath }, resolve } = require('path');
+const { sep, posix: { relative: relativePosixPath }, toNamespacedPath, resolve } = require('path');
const preserveSymlinks = getOptionValue('--preserve-symlinks');
const preserveSymlinksMain = getOptionValue('--preserve-symlinks-main');
@@ -36,10 +36,9 @@ const preserveSymlinksMain = getOptionValue('--preserve-symlinks-main');
const experimentalNetworkImports =
getOptionValue('--experimental-network-imports');
const inputTypeFlag = getOptionValue('--input-type');
-const { URL, pathToFileURL, fileURLToPath, isURL, URLParse } = require('internal/url');
+const { URL, pathToFileURL, fileURLToPath, isURL, URLParse, toPathIfFileURL } = require('internal/url');
-const { URL, pathToFileURL, fileURLToPath, isURL } = require('internal/url');
+const { URL, pathToFileURL, fileURLToPath, isURL, toPathIfFileURL } = require('internal/url');
const { getCWDURL, setOwnProperty } = require('internal/util');
const { canParse: URLCanParse } = internalBinding('url');
-const { legacyMainResolve: FSLegacyMainResolve } = internalBinding('fs');
const {
ERR_INPUT_TYPE_NOT_ALLOWED,
ERR_INVALID_ARG_TYPE,
@@ -154,34 +153,13 @@ function emitLegacyIndexDeprecation(url, packageJSONUrl, base, main) {
@@ -59,7 +58,7 @@ const { Module: CJSModule } = require('internal/modules/cjs/loader');
const { getPackageScopeConfig } = require('internal/modules/esm/package_config');
const { getConditionsSet } = require('internal/modules/esm/utils');
const packageJsonReader = require('internal/modules/package_json_reader');
-const { internalModuleStat } = internalBinding('fs');
+const internalFsBinding = internalBinding('fs');
/**
* @typedef {import('internal/modules/esm/package_config.js').PackageConfig} PackageConfig
@@ -162,34 +161,13 @@ function emitLegacyIndexDeprecation(url, packageJSONUrl, base, main) {
const realpathCache = new SafeMap();
@ -77,7 +81,7 @@ index f3dad958b2ec275992554477b9344214c8c1e2c8..a086217046fd5ed7cfb09cfd2ed62f39
/**
* Legacy CommonJS main resolution:
@@ -196,22 +174,44 @@ const legacyMainResolveExtensionsIndexes = {
@@ -204,22 +182,44 @@ const legacyMainResolveExtensionsIndexes = {
* @returns {URL}
*/
function legacyMainResolve(packageJSONUrl, packageConfig, base) {
@ -138,10 +142,10 @@ index f3dad958b2ec275992554477b9344214c8c1e2c8..a086217046fd5ed7cfb09cfd2ed62f39
const encodedSepRegEx = /%2F|%5C/i;
diff --git a/src/node_file.cc b/src/node_file.cc
index 0bb70eb0fcd42ddf4d5e585065cf1ad8e74faab3..b565beae625d970ba92ab667a145d8897d4e8a6e 100644
index 73ad5a1a2c092d7f8dac84585fb9b13e76e84e13..039f693de14bec248f93262ad70f2736c24827e3 100644
--- a/src/node_file.cc
+++ b/src/node_file.cc
@@ -19,14 +19,12 @@
@@ -19,14 +19,11 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "node_file.h" // NOLINT(build/include_inline)
@ -149,14 +153,14 @@ index 0bb70eb0fcd42ddf4d5e585065cf1ad8e74faab3..b565beae625d970ba92ab667a145d889
#include "aliased_buffer-inl.h"
#include "memory_tracker-inl.h"
#include "node_buffer.h"
#include "node_errors.h"
-#include "node_errors.h"
#include "node_external_reference.h"
#include "node_file-inl.h"
-#include "node_metadata.h"
#include "node_process-inl.h"
#include "node_stat_watcher.h"
#include "node_url.h"
@@ -3208,146 +3206,6 @@ constexpr std::array<std::string_view, 10> legacy_main_extensions = {
@@ -3127,135 +3124,6 @@ constexpr std::array<std::string_view, 10> legacy_main_extensions = {
} // namespace
@ -198,20 +202,14 @@ index 0bb70eb0fcd42ddf4d5e585065cf1ad8e74faab3..b565beae625d970ba92ab667a145d889
- return;
- }
-
- FromNamespacedPath(&initial_file_path.value());
- node::url::FromNamespacedPath(&initial_file_path.value());
-
- package_initial_file = *initial_file_path;
-
- for (int i = 0; i < legacy_main_extensions_with_main_end; i++) {
- file_path = *initial_file_path + std::string(legacy_main_extensions[i]);
- // TODO(anonrig): Remove this when ToNamespacedPath supports std::string
- Local<Value> local_file_path =
- Buffer::Copy(env->isolate(), file_path.c_str(), file_path.size())
- .ToLocalChecked();
- BufferValue buff_file_path(isolate, local_file_path);
- ToNamespacedPath(env, &buff_file_path);
-
- switch (FilePathIsFile(env, buff_file_path.ToString())) {
- switch (FilePathIsFile(env, file_path)) {
- case BindingData::FilePathIsFileReturnType::kIsFile:
- return args.GetReturnValue().Set(i);
- case BindingData::FilePathIsFileReturnType::kIsNotFile:
@ -241,20 +239,14 @@ index 0bb70eb0fcd42ddf4d5e585065cf1ad8e74faab3..b565beae625d970ba92ab667a145d889
- return;
- }
-
- FromNamespacedPath(&initial_file_path.value());
- node::url::FromNamespacedPath(&initial_file_path.value());
-
- for (int i = legacy_main_extensions_with_main_end;
- i < legacy_main_extensions_package_fallback_end;
- i++) {
- file_path = *initial_file_path + std::string(legacy_main_extensions[i]);
- // TODO(anonrig): Remove this when ToNamespacedPath supports std::string
- Local<Value> local_file_path =
- Buffer::Copy(env->isolate(), file_path.c_str(), file_path.size())
- .ToLocalChecked();
- BufferValue buff_file_path(isolate, local_file_path);
- ToNamespacedPath(env, &buff_file_path);
-
- switch (FilePathIsFile(env, buff_file_path.ToString())) {
- switch (FilePathIsFile(env, file_path)) {
- case BindingData::FilePathIsFileReturnType::kIsFile:
- return args.GetReturnValue().Set(i);
- case BindingData::FilePathIsFileReturnType::kIsNotFile:
@ -300,10 +292,11 @@ index 0bb70eb0fcd42ddf4d5e585065cf1ad8e74faab3..b565beae625d970ba92ab667a145d889
- package_initial_file,
- *module_base);
-}
-
void BindingData::MemoryInfo(MemoryTracker* tracker) const {
tracker->TrackField("stats_field_array", stats_field_array);
@@ -3448,19 +3306,6 @@ InternalFieldInfoBase* BindingData::Serialize(int index) {
tracker->TrackField("stats_field_bigint_array", stats_field_bigint_array);
@@ -3355,19 +3223,6 @@ InternalFieldInfoBase* BindingData::Serialize(int index) {
return info;
}
@ -323,15 +316,15 @@ index 0bb70eb0fcd42ddf4d5e585065cf1ad8e74faab3..b565beae625d970ba92ab667a145d889
static void CreatePerIsolateProperties(IsolateData* isolate_data,
Local<ObjectTemplate> target) {
Isolate* isolate = isolate_data->isolate();
@@ -3520,7 +3365,6 @@ static void CreatePerIsolateProperties(IsolateData* isolate_data,
SetMethod(isolate, target, "cpSyncCheckPaths", CpSyncCheckPaths);
@@ -3422,7 +3277,6 @@ static void CreatePerIsolateProperties(IsolateData* isolate_data,
SetMethod(isolate, target, "mkdtemp", Mkdtemp);
StatWatcher::CreatePerIsolateProperties(isolate_data, target);
- BindingData::CreatePerIsolateProperties(isolate_data, target);
target->Set(
FIXED_ONE_BYTE_STRING(isolate, "kFsStatsFieldsNumber"),
@@ -3593,7 +3437,6 @@ BindingData* FSReqBase::binding_data() {
@@ -3495,7 +3349,6 @@ BindingData* FSReqBase::binding_data() {
void RegisterExternalReferences(ExternalReferenceRegistry* registry) {
registry->Register(Access);
StatWatcher::RegisterExternalReferences(registry);
@ -340,7 +333,7 @@ index 0bb70eb0fcd42ddf4d5e585065cf1ad8e74faab3..b565beae625d970ba92ab667a145d889
registry->Register(GetFormatOfExtensionlessFile);
registry->Register(Close);
diff --git a/src/node_file.h b/src/node_file.h
index bdad1ae25f4892cbbfd8cc30c4d8b4a6f600edbc..5a3c462853aa784d9ef61ff4f63010848c48b92c 100644
index 6f1b55284db0f4f8c70081b4834a074c717f3cc9..a969fff32bd156aa9393c1db9eec474eb7432cea 100644
--- a/src/node_file.h
+++ b/src/node_file.h
@@ -86,13 +86,6 @@ class BindingData : public SnapshotableObject {

Просмотреть файл

@ -6,10 +6,10 @@ Subject: fix: suppress clang -Wdeprecated-declarations in libuv
Should be upstreamed.
diff --git a/deps/uv/src/win/util.c b/deps/uv/src/win/util.c
index a96cb915930a30a49ba55fd7d15ea48f0b471f89..3c15f348bd3a9a42afcf0e4d0182d2d6f3d05cb1 100644
index f6ec79cd57b5010ed5fd6829d952bcdacc8b7671..5cda078a55f7825d135a107fa98e1aa3527dd147 100644
--- a/deps/uv/src/win/util.c
+++ b/deps/uv/src/win/util.c
@@ -1537,10 +1537,17 @@ int uv_os_uname(uv_utsname_t* buffer) {
@@ -1685,10 +1685,17 @@ int uv_os_uname(uv_utsname_t* buffer) {
#ifdef _MSC_VER
#pragma warning(suppress : 4996)
#endif

Просмотреть файл

@ -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 451b7c2195e7ad3ab0bde95259e054dc431d7de9..d49941881e6cfd8647a6d44a57e0daaf1c874702 100644
index c284b39b1ac13eaea8776b7b4f457c084dce5fb8..c794751ecd4448119ce33d661e694f83b3323f03 100644
--- a/lib/internal/modules/cjs/loader.js
+++ b/lib/internal/modules/cjs/loader.js
@@ -182,6 +182,13 @@ const {
@@ -185,6 +185,13 @@ const {
CHAR_FORWARD_SLASH,
} = require('internal/constants');
@ -23,7 +23,7 @@ index 451b7c2195e7ad3ab0bde95259e054dc431d7de9..d49941881e6cfd8647a6d44a57e0daaf
const {
isProxy,
} = require('internal/util/types');
@@ -1541,10 +1548,12 @@ Module.prototype._compile = function(content, filename, format) {
@@ -1464,10 +1471,12 @@ Module.prototype._compile = function(content, filename, loadAsESM = false) {
this[kIsExecuting] = true;
if (inspectorWrapper) {
result = inspectorWrapper(compiledWrapper, thisValue, exports,

Просмотреть файл

@ -7,7 +7,7 @@ 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 f7a62364b6107ab0bad33ea2f745703c746991dc..bab2aaf3db66452216035db594dc3ebdc3606c8b 100644
index 12262f40ce123440a9a0f974386cfbe8511f4459..f3c15b61d33bdae44de528e106fcc6f930f1c388 100644
--- a/lib/internal/bootstrap/node.js
+++ b/lib/internal/bootstrap/node.js
@@ -134,6 +134,10 @@ process.domain = null;
@ -21,3 +21,47 @@ index f7a62364b6107ab0bad33ea2f745703c746991dc..bab2aaf3db66452216035db594dc3ebd
// process.config is serialized config.gypi
const binding = internalBinding('builtins');
diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js
index c794751ecd4448119ce33d661e694f83b3323f03..364469160af5e348f8890417de16a63c0d1dca67 100644
--- a/lib/internal/modules/cjs/loader.js
+++ b/lib/internal/modules/cjs/loader.js
@@ -138,7 +138,7 @@ const {
const assert = require('internal/assert');
const fs = require('fs');
const path = require('path');
-const { internalModuleStat } = internalBinding('fs');
+const internalFsBinding = internalBinding('fs');
const { safeGetenv } = internalBinding('credentials');
const {
privateSymbols: {
@@ -233,7 +233,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 && 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 88c079d10d116107aa34dc9281f64c799c48c0b5..069f922612777f226127dc44f4091eed30416925 100644
--- a/lib/internal/modules/package_json_reader.js
+++ b/lib/internal/modules/package_json_reader.js
@@ -12,7 +12,7 @@ const {
const {
ERR_INVALID_PACKAGE_CONFIG,
} = require('internal/errors').codes;
-const { internalModuleReadJSON } = internalBinding('fs');
+const internalFsBinding = internalBinding('fs');
const { resolve, sep, toNamespacedPath } = require('path');
const permission = require('internal/process/permission');
const { kEmptyObject } = require('internal/util');
@@ -53,7 +53,7 @@ function read(jsonPath, { base, specifier, isESM } = kEmptyObject) {
const {
0: string,
1: containsKeys,
- } = internalModuleReadJSON(
+ } = internalFsBinding.internalModuleReadJSON(
toNamespacedPath(jsonPath),
);
const result = {

Просмотреть файл

@ -0,0 +1,19 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samuel Attard <marshallofsound@electronjs.org>
Date: Thu, 11 Jan 2024 15:14:43 +1300
Subject: spec: add Iterator to global intrinsics
Ref: https://chromium-review.googlesource.com/c/v8/v8/+/4266490
diff --git a/test/common/globals.js b/test/common/globals.js
index cb7c1629007ecfc6c6a1aae0e6d1e9a50f07d147..5d1c4415eeb09e92d062330afc0aecb1d297b6d3 100644
--- a/test/common/globals.js
+++ b/test/common/globals.js
@@ -63,6 +63,7 @@ const intrinsics = new Set([
'SharedArrayBuffer',
'Atomics',
'WebAssembly',
+ 'Iterator',
]);
if (global.gc) {

Просмотреть файл

@ -0,0 +1,118 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: ishell <isheludko@gmail.com>
Date: Mon, 25 Mar 2024 15:45:41 +0100
Subject: src: do not use deprecated V8 API
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Namely:
- `v8::ObjectTemplate::SetAccessor(v8::Local<v8::String>, ...);`
- `v8::ObjectTemplate::SetNativeDataProperty` with `AccessControl`
Refs: https://github.com/v8/v8/commit/46c241eb99557fe8205acac5c526650c3847d180
Refs: https://github.com/v8/v8/commit/6ec883986bd417e2a42ddb960bd9449deb7e4639
Co-authored-by: Michaël Zasso <targos@protonmail.com>
PR-URL: https://github.com/nodejs/node/pull/53084
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
(cherry picked from commit 26d5cafff76d3a096ebfd7d7a6279d4b5b190230)
diff --git a/src/base_object-inl.h b/src/base_object-inl.h
index da8fed7b3013df10ae02be2070545c74d9a978f0..518b22dabef0974c2e7ecb466669925338524059 100644
--- a/src/base_object-inl.h
+++ b/src/base_object-inl.h
@@ -132,14 +132,14 @@ v8::EmbedderGraph::Node::Detachedness BaseObject::GetDetachedness() const {
template <int Field>
void BaseObject::InternalFieldGet(
- v8::Local<v8::String> property,
+ v8::Local<v8::Name> property,
const v8::PropertyCallbackInfo<v8::Value>& info) {
info.GetReturnValue().Set(
info.This()->GetInternalField(Field).As<v8::Value>());
}
-template <int Field, bool (v8::Value::* typecheck)() const>
-void BaseObject::InternalFieldSet(v8::Local<v8::String> property,
+template <int Field, bool (v8::Value::*typecheck)() const>
+void BaseObject::InternalFieldSet(v8::Local<v8::Name> property,
v8::Local<v8::Value> value,
const v8::PropertyCallbackInfo<void>& info) {
// This could be e.g. value->IsFunction().
diff --git a/src/base_object.h b/src/base_object.h
index 5968694e8393d8434fb2ffee411dfac4c93aff29..5c16d0d1b32e2d056f4fcfa0e01781292932a0fa 100644
--- a/src/base_object.h
+++ b/src/base_object.h
@@ -111,10 +111,10 @@ class BaseObject : public MemoryRetainer {
// Setter/Getter pair for internal fields that can be passed to SetAccessor.
template <int Field>
- static void InternalFieldGet(v8::Local<v8::String> property,
+ static void InternalFieldGet(v8::Local<v8::Name> property,
const v8::PropertyCallbackInfo<v8::Value>& info);
template <int Field, bool (v8::Value::*typecheck)() const>
- static void InternalFieldSet(v8::Local<v8::String> property,
+ static void InternalFieldSet(v8::Local<v8::Name> property,
v8::Local<v8::Value> value,
const v8::PropertyCallbackInfo<void>& info);
diff --git a/src/node_builtins.cc b/src/node_builtins.cc
index 3e37aa8b0c9696cceb3f3cfab9721f38c74a2fba..78f20de6b127961e9de7b5caaeca702ed7a36e01 100644
--- a/src/node_builtins.cc
+++ b/src/node_builtins.cc
@@ -11,7 +11,6 @@ namespace node {
namespace builtins {
using v8::Context;
-using v8::DEFAULT;
using v8::EscapableHandleScope;
using v8::Function;
using v8::FunctionCallbackInfo;
@@ -720,7 +719,6 @@ void BuiltinLoader::CreatePerIsolateProperties(IsolateData* isolate_data,
nullptr,
Local<Value>(),
None,
- DEFAULT,
SideEffectType::kHasNoSideEffect);
target->SetNativeDataProperty(FIXED_ONE_BYTE_STRING(isolate, "builtinIds"),
@@ -728,7 +726,6 @@ void BuiltinLoader::CreatePerIsolateProperties(IsolateData* isolate_data,
nullptr,
Local<Value>(),
None,
- DEFAULT,
SideEffectType::kHasNoSideEffect);
target->SetNativeDataProperty(
@@ -737,7 +734,6 @@ void BuiltinLoader::CreatePerIsolateProperties(IsolateData* isolate_data,
nullptr,
Local<Value>(),
None,
- DEFAULT,
SideEffectType::kHasNoSideEffect);
target->SetNativeDataProperty(FIXED_ONE_BYTE_STRING(isolate, "natives"),
@@ -745,7 +741,6 @@ void BuiltinLoader::CreatePerIsolateProperties(IsolateData* isolate_data,
nullptr,
Local<Value>(),
None,
- DEFAULT,
SideEffectType::kHasNoSideEffect);
SetMethod(isolate, target, "getCacheUsage", BuiltinLoader::GetCacheUsage);
diff --git a/src/node_external_reference.h b/src/node_external_reference.h
index 4e2ad9024020fa0851da41da44afccdf188c7044..c4aba23510872d66b58a1adc88cdd1ee85a86cfe 100644
--- a/src/node_external_reference.h
+++ b/src/node_external_reference.h
@@ -64,8 +64,6 @@ class ExternalReferenceRegistry {
V(CFunctionWithBool) \
V(const v8::CFunctionInfo*) \
V(v8::FunctionCallback) \
- V(v8::AccessorGetterCallback) \
- V(v8::AccessorSetterCallback) \
V(v8::AccessorNameGetterCallback) \
V(v8::AccessorNameSetterCallback) \
V(v8::GenericNamedPropertyDefinerCallback) \

Просмотреть файл

@ -16,7 +16,7 @@ patch:
(cherry picked from commit 30329d06235a9f9733b1d4da479b403462d1b326)
diff --git a/src/env-inl.h b/src/env-inl.h
index 28a15aa741ddd40c664aae641797e7cc2813442f..08fe98e10b7716c694bbc882299fe0ed9e282d73 100644
index d98a32d6ec311459877bc3b0de33cca4766aeda7..9fc934975b015b97ddd84bf3eea5d53144130035 100644
--- a/src/env-inl.h
+++ b/src/env-inl.h
@@ -62,31 +62,6 @@ inline uv_loop_t* IsolateData::event_loop() const {
@ -52,10 +52,10 @@ index 28a15aa741ddd40c664aae641797e7cc2813442f..08fe98e10b7716c694bbc882299fe0ed
return &(wrapper_data_->cppgc_id);
}
diff --git a/src/env.cc b/src/env.cc
index 665b064091d4cc42a4dc9ee5b0ea9e2f190338ca..4c8cb75945d82544ce2237d94cd1406d15efe424 100644
index 38802b1e9acf9b3e99fdc4f39770e896393befe3..e0433e29ca98c42a38d1da6d66085fdea1edde29 100644
--- a/src/env.cc
+++ b/src/env.cc
@@ -23,6 +23,7 @@
@@ -22,6 +22,7 @@
#include "util-inl.h"
#include "v8-cppgc.h"
#include "v8-profiler.h"
@ -63,7 +63,7 @@ index 665b064091d4cc42a4dc9ee5b0ea9e2f190338ca..4c8cb75945d82544ce2237d94cd1406d
#include <algorithm>
#include <atomic>
@@ -71,7 +72,6 @@ using v8::TryCatch;
@@ -68,7 +69,6 @@ using v8::TryCatch;
using v8::Uint32;
using v8::Undefined;
using v8::Value;
@ -71,7 +71,7 @@ index 665b064091d4cc42a4dc9ee5b0ea9e2f190338ca..4c8cb75945d82544ce2237d94cd1406d
using worker::Worker;
int const ContextEmbedderTag::kNodeContextTag = 0x6e6f64;
@@ -532,6 +532,14 @@ void IsolateData::CreateProperties() {
@@ -530,6 +530,14 @@ void IsolateData::CreateProperties() {
CreateEnvProxyTemplate(this);
}
@ -86,7 +86,7 @@ index 665b064091d4cc42a4dc9ee5b0ea9e2f190338ca..4c8cb75945d82544ce2237d94cd1406d
constexpr uint16_t kDefaultCppGCEmbedderID = 0x90de;
Mutex IsolateData::isolate_data_mutex_;
std::unordered_map<uint16_t, std::unique_ptr<PerIsolateWrapperData>>
@@ -569,36 +577,16 @@ IsolateData::IsolateData(Isolate* isolate,
@@ -567,36 +575,16 @@ IsolateData::IsolateData(Isolate* isolate,
v8::CppHeap* cpp_heap = isolate->GetCppHeap();
uint16_t cppgc_id = kDefaultCppGCEmbedderID;
@ -130,7 +130,7 @@ index 665b064091d4cc42a4dc9ee5b0ea9e2f190338ca..4c8cb75945d82544ce2237d94cd1406d
{
// GC could still be run after the IsolateData is destroyed, so we store
@@ -630,11 +618,12 @@ IsolateData::~IsolateData() {
@@ -628,11 +616,12 @@ IsolateData::~IsolateData() {
}
}
@ -146,10 +146,10 @@ index 665b064091d4cc42a4dc9ee5b0ea9e2f190338ca..4c8cb75945d82544ce2237d94cd1406d
void IsolateData::MemoryInfo(MemoryTracker* tracker) const {
diff --git a/src/env.h b/src/env.h
index 49ca9c0042ccf22ad1fffa54f05fd443cbc681ba..945535d0dc40f1a32f7e3ecf7d50361e591ba6c8 100644
index 7cb77fb4f35a60fbda5b868798321ac8b6340bfa..06746554e1d60a9377ff6d7d970220f3fa88e4ac 100644
--- a/src/env.h
+++ b/src/env.h
@@ -175,10 +175,6 @@ class NODE_EXTERN_PRIVATE IsolateData : public MemoryRetainer {
@@ -174,10 +174,6 @@ class NODE_EXTERN_PRIVATE IsolateData : public MemoryRetainer {
uint16_t* embedder_id_for_cppgc() const;
uint16_t* embedder_id_for_non_cppgc() const;
@ -161,7 +161,7 @@ index 49ca9c0042ccf22ad1fffa54f05fd443cbc681ba..945535d0dc40f1a32f7e3ecf7d50361e
inline MultiIsolatePlatform* platform() const;
inline const SnapshotData* snapshot_data() const;
diff --git a/src/node.h b/src/node.h
index c16204ad2a4787eeffe61eedda254d3a5509df8c..c39f586e9c5e7e9db75d922d244ea8e4d6d56841 100644
index df3fb3372d6357b5d77b4f683e309b8483998128..01e8a4f2ed905bf5bbb803419012a014c204b460 100644
--- a/src/node.h
+++ b/src/node.h
@@ -1561,24 +1561,14 @@ void RegisterSignalHandler(int signal,

Просмотреть файл

@ -11,20 +11,6 @@ two fields in node.js.
branch of Node.js. This patch can be removed when Electron upgrades to
a stable Node release that contains the change. -- Charles)
diff --git a/src/crypto/crypto_timing.cc b/src/crypto/crypto_timing.cc
index 3d8ccc77b5952a999c5fe48792259d32b402c460..867a1c4aca54b9d41490d23a5eb55088b7e941cc 100644
--- a/src/crypto/crypto_timing.cc
+++ b/src/crypto/crypto_timing.cc
@@ -59,7 +59,8 @@ bool FastTimingSafeEqual(Local<Value> receiver,
if (a.length() != b.length() || !a.getStorageIfAligned(&data_a) ||
!b.getStorageIfAligned(&data_b)) {
TRACK_V8_FAST_API_CALL("crypto.timingSafeEqual.error");
- options.fallback = true;
+ v8::HandleScope scope(options.isolate);
+ THROW_ERR_CRYPTO_TIMING_SAFE_EQUAL_LENGTH(options.isolate);
return false;
}
diff --git a/src/histogram.cc b/src/histogram.cc
index 4dbdea9be5721486d71a9dda77311b4919d450a3..4aacaa2a5d12533a039b4b96cb7f1fd79063d50f 100644
--- a/src/histogram.cc
@ -39,36 +25,6 @@ index 4dbdea9be5721486d71a9dda77311b4919d450a3..4aacaa2a5d12533a039b4b96cb7f1fd7
return;
}
HistogramBase* histogram;
diff --git a/src/node_file.cc b/src/node_file.cc
index b565beae625d970ba92ab667a145d8897d4e8a6e..31c2fe82299d6905855c4efffeea4a4d161a88d5 100644
--- a/src/node_file.cc
+++ b/src/node_file.cc
@@ -1049,23 +1049,10 @@ static int32_t FastInternalModuleStat(
const FastOneByteString& input,
// NOLINTNEXTLINE(runtime/references) This is V8 api.
FastApiCallbackOptions& options) {
- // This needs a HandleScope which needs an isolate.
- Isolate* isolate = Isolate::TryGetCurrent();
- if (!isolate) {
- options.fallback = true;
- return -1;
- }
-
- HandleScope scope(isolate);
- Environment* env = Environment::GetCurrent(recv->GetCreationContextChecked());
+ Environment* env = Environment::GetCurrent(options.isolate);
+ HandleScope scope(env->isolate());
auto path = std::filesystem::path(input.data, input.data + input.length);
- if (UNLIKELY(!env->permission()->is_granted(
- env, permission::PermissionScope::kFileSystemRead, path.string()))) {
- options.fallback = true;
- return -1;
- }
-
switch (std::filesystem::status(path).type()) {
case std::filesystem::file_type::directory:
return 1;
diff --git a/src/node_wasi.cc b/src/node_wasi.cc
index ad1da44a01f437c97e06a3857eebd2edcebc83da..7123278e1a0942b61a76e9b1e7464eb8b5064079 100644
--- a/src/node_wasi.cc

Просмотреть файл

@ -0,0 +1,87 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Etienne Pierre-Doray <etipdoray@gmail.com>
Date: Mon, 11 Dec 2023 04:13:38 -0500
Subject: src: update default V8 platform to override functions with location
Xref: https://chromium-review.googlesource.com/c/v8/v8/+/4514946
Xref: https://chromium-review.googlesource.com/c/v8/v8/+/4336198
Backported from https://github.com/nodejs/node-v8/commit/f66b996030e94a7e4874820a53475338e1df4fe3
diff --git a/src/node_platform.cc b/src/node_platform.cc
index 97cf6cb840bab5016e485b0dd90b3e4e1d8686c9..00ca9757bc4d0cdeb03a3f32be3ef19077cb7969 100644
--- a/src/node_platform.cc
+++ b/src/node_platform.cc
@@ -501,17 +501,22 @@ bool PerIsolatePlatformData::FlushForegroundTasksInternal() {
return did_work;
}
-void NodePlatform::CallOnWorkerThread(std::unique_ptr<Task> task) {
+void NodePlatform::PostTaskOnWorkerThreadImpl(
+ v8::TaskPriority priority,
+ std::unique_ptr<v8::Task> task,
+ const v8::SourceLocation& location) {
worker_thread_task_runner_->PostTask(std::move(task));
}
-void NodePlatform::CallDelayedOnWorkerThread(std::unique_ptr<Task> task,
- double delay_in_seconds) {
+void NodePlatform::PostDelayedTaskOnWorkerThreadImpl(
+ v8::TaskPriority priority,
+ std::unique_ptr<v8::Task> task,
+ double delay_in_seconds,
+ const v8::SourceLocation& location) {
worker_thread_task_runner_->PostDelayedTask(std::move(task),
delay_in_seconds);
}
-
IsolatePlatformDelegate* NodePlatform::ForIsolate(Isolate* isolate) {
Mutex::ScopedLock lock(per_isolate_mutex_);
auto data = per_isolate_[isolate];
@@ -533,8 +538,10 @@ bool NodePlatform::FlushForegroundTasks(Isolate* isolate) {
return per_isolate->FlushForegroundTasksInternal();
}
-std::unique_ptr<v8::JobHandle> NodePlatform::CreateJob(
- v8::TaskPriority priority, std::unique_ptr<v8::JobTask> job_task) {
+std::unique_ptr<v8::JobHandle> NodePlatform::CreateJobImpl(
+ v8::TaskPriority priority,
+ std::unique_ptr<v8::JobTask> job_task,
+ const v8::SourceLocation& location) {
return v8::platform::NewDefaultJobHandle(
this, priority, std::move(job_task), NumberOfWorkerThreads());
}
diff --git a/src/node_platform.h b/src/node_platform.h
index 1062f3b1b9c386a7bde8dca366c6f008bb183ab7..77cb5e6e4f891c510cdaf7fd6175a1f00d9bc420 100644
--- a/src/node_platform.h
+++ b/src/node_platform.h
@@ -147,17 +147,23 @@ class NodePlatform : public MultiIsolatePlatform {
// v8::Platform implementation.
int NumberOfWorkerThreads() override;
- void CallOnWorkerThread(std::unique_ptr<v8::Task> task) override;
- void CallDelayedOnWorkerThread(std::unique_ptr<v8::Task> task,
- double delay_in_seconds) override;
+ void PostTaskOnWorkerThreadImpl(v8::TaskPriority priority,
+ std::unique_ptr<v8::Task> task,
+ const v8::SourceLocation& location) override;
+ void PostDelayedTaskOnWorkerThreadImpl(
+ v8::TaskPriority priority,
+ std::unique_ptr<v8::Task> task,
+ double delay_in_seconds,
+ const v8::SourceLocation& location) override;
bool IdleTasksEnabled(v8::Isolate* isolate) override;
double MonotonicallyIncreasingTime() override;
double CurrentClockTimeMillis() override;
v8::TracingController* GetTracingController() override;
bool FlushForegroundTasks(v8::Isolate* isolate) override;
- std::unique_ptr<v8::JobHandle> CreateJob(
+ std::unique_ptr<v8::JobHandle> CreateJobImpl(
v8::TaskPriority priority,
- std::unique_ptr<v8::JobTask> job_task) override;
+ std::unique_ptr<v8::JobTask> job_task,
+ const v8::SourceLocation& location) override;
void RegisterIsolate(v8::Isolate* isolate, uv_loop_t* loop) override;
void RegisterIsolate(v8::Isolate* isolate,

Просмотреть файл

@ -0,0 +1,153 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Igor Sheludko <isheludko@gmail.com>
Date: Tue, 30 Apr 2024 15:22:06 +0200
Subject: src: use new V8 API to define stream accessor
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Define XxxStream.prototype.onread as an accessor in JavaScript sense.
Previously it was defined via soon-to-be-deprecated
`v8::ObjectTemplate::SetAccessor(..)` which used to call setter even
for property stores via stream object.
The replacement V8 API `v8::ObjectTemplate::SetNativeDataProperty(..)`
defines a properly behaving data property and thus a store to a stream
object will not trigger the "onread" setter callback.
In order to preserve the desired behavior of storing the value in the
receiver's internal field the "onread" property should be defined as
a proper JavaScript accessor.
PR-URL: https://github.com/nodejs/node/pull/53084
Refs: https://github.com/v8/v8/commit/46c241eb99557fe8205acac5c526650c3847d180
Refs: https://github.com/v8/v8/commit/6ec883986bd417e2a42ddb960bd9449deb7e4639
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
(cherry picked from commit bd151552ef35b0eed415eb1c50d30dafd341cee8)
diff --git a/src/base_object-inl.h b/src/base_object-inl.h
index 518b22dabef0974c2e7ecb466669925338524059..61f30b3cfbdb0f3d21fe8e93dc97c55162b69a69 100644
--- a/src/base_object-inl.h
+++ b/src/base_object-inl.h
@@ -132,19 +132,18 @@ v8::EmbedderGraph::Node::Detachedness BaseObject::GetDetachedness() const {
template <int Field>
void BaseObject::InternalFieldGet(
- v8::Local<v8::Name> property,
- const v8::PropertyCallbackInfo<v8::Value>& info) {
- info.GetReturnValue().Set(
- info.This()->GetInternalField(Field).As<v8::Value>());
+ const v8::FunctionCallbackInfo<v8::Value>& args) {
+ args.GetReturnValue().Set(
+ args.This()->GetInternalField(Field).As<v8::Value>());
}
template <int Field, bool (v8::Value::*typecheck)() const>
-void BaseObject::InternalFieldSet(v8::Local<v8::Name> property,
- v8::Local<v8::Value> value,
- const v8::PropertyCallbackInfo<void>& info) {
+void BaseObject::InternalFieldSet(
+ const v8::FunctionCallbackInfo<v8::Value>& args) {
+ v8::Local<v8::Value> value = args[0];
// This could be e.g. value->IsFunction().
CHECK(((*value)->*typecheck)());
- info.This()->SetInternalField(Field, value);
+ args.This()->SetInternalField(Field, value);
}
bool BaseObject::has_pointer_data() const {
diff --git a/src/base_object.h b/src/base_object.h
index 5c16d0d1b32e2d056f4fcfa0e01781292932a0fa..ce6277dec5a2b9313ecd3699b39ec17585d5adc5 100644
--- a/src/base_object.h
+++ b/src/base_object.h
@@ -111,12 +111,9 @@ class BaseObject : public MemoryRetainer {
// Setter/Getter pair for internal fields that can be passed to SetAccessor.
template <int Field>
- static void InternalFieldGet(v8::Local<v8::Name> property,
- const v8::PropertyCallbackInfo<v8::Value>& info);
+ static void InternalFieldGet(const v8::FunctionCallbackInfo<v8::Value>& args);
template <int Field, bool (v8::Value::*typecheck)() const>
- static void InternalFieldSet(v8::Local<v8::Name> property,
- v8::Local<v8::Value> value,
- const v8::PropertyCallbackInfo<void>& info);
+ static void InternalFieldSet(const v8::FunctionCallbackInfo<v8::Value>& args);
// This is a bit of a hack. See the override in async_wrap.cc for details.
virtual bool IsDoneInitializing() const;
diff --git a/src/stream_base.cc b/src/stream_base.cc
index d2649ea0a649bb2f6c6becf1891c0b6d773c1a62..9d855c2992492d3394d9f8af4e53781027a2dd83 100644
--- a/src/stream_base.cc
+++ b/src/stream_base.cc
@@ -492,6 +492,29 @@ Local<Object> StreamBase::GetObject() {
return GetAsyncWrap()->object();
}
+void StreamBase::AddAccessor(v8::Isolate* isolate,
+ v8::Local<v8::Signature> signature,
+ enum v8::PropertyAttribute attributes,
+ v8::Local<v8::FunctionTemplate> t,
+ JSMethodFunction* getter,
+ JSMethodFunction* setter,
+ v8::Local<v8::String> string) {
+ Local<FunctionTemplate> getter_templ =
+ NewFunctionTemplate(isolate,
+ getter,
+ signature,
+ ConstructorBehavior::kThrow,
+ SideEffectType::kHasNoSideEffect);
+ Local<FunctionTemplate> setter_templ =
+ NewFunctionTemplate(isolate,
+ setter,
+ signature,
+ ConstructorBehavior::kThrow,
+ SideEffectType::kHasSideEffect);
+ t->PrototypeTemplate()->SetAccessorProperty(
+ string, getter_templ, setter_templ, attributes);
+}
+
void StreamBase::AddMethod(Isolate* isolate,
Local<Signature> signature,
enum PropertyAttribute attributes,
@@ -561,11 +584,14 @@ void StreamBase::AddMethods(IsolateData* isolate_data,
JSMethod<&StreamBase::WriteString<LATIN1>>);
t->PrototypeTemplate()->Set(FIXED_ONE_BYTE_STRING(isolate, "isStreamBase"),
True(isolate));
- t->PrototypeTemplate()->SetAccessor(
- FIXED_ONE_BYTE_STRING(isolate, "onread"),
- BaseObject::InternalFieldGet<StreamBase::kOnReadFunctionField>,
- BaseObject::InternalFieldSet<StreamBase::kOnReadFunctionField,
- &Value::IsFunction>);
+ AddAccessor(isolate,
+ sig,
+ static_cast<PropertyAttribute>(DontDelete | DontEnum),
+ t,
+ BaseObject::InternalFieldGet<StreamBase::kOnReadFunctionField>,
+ BaseObject::InternalFieldSet<StreamBase::kOnReadFunctionField,
+ &Value::IsFunction>,
+ FIXED_ONE_BYTE_STRING(isolate, "onread"));
}
void StreamBase::RegisterExternalReferences(
diff --git a/src/stream_base.h b/src/stream_base.h
index 62a8928e144ad6aa67eeccdbc46d44da22887fb8..ccbd769ceaf3c1e024defb3104e601d037c98b6a 100644
--- a/src/stream_base.h
+++ b/src/stream_base.h
@@ -413,6 +413,13 @@ class StreamBase : public StreamResource {
EmitToJSStreamListener default_listener_;
void SetWriteResult(const StreamWriteResult& res);
+ static void AddAccessor(v8::Isolate* isolate,
+ v8::Local<v8::Signature> sig,
+ enum v8::PropertyAttribute attributes,
+ v8::Local<v8::FunctionTemplate> t,
+ JSMethodFunction* getter,
+ JSMethodFunction* setter,
+ v8::Local<v8::String> str);
static void AddMethod(v8::Isolate* isolate,
v8::Local<v8::Signature> sig,
enum v8::PropertyAttribute attributes,

Просмотреть файл

@ -0,0 +1,27 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= <targos@protonmail.com>
Date: Mon, 11 Mar 2024 09:27:11 +0000
Subject: src: use supported API to get stalled TLA messages
Refs: https://github.com/v8/v8/commit/23e3b6f650162ed2b332e55aa802adb8f41b50f2
diff --git a/src/module_wrap.cc b/src/module_wrap.cc
index 9bbb8ab908d8d992abb43254860d51f57f56387b..92edfc6fc6401edd3685a0137eac25d9e37566f6 100644
--- a/src/module_wrap.cc
+++ b/src/module_wrap.cc
@@ -587,11 +587,10 @@ void ModuleWrap::EvaluateSync(const FunctionCallbackInfo<Value>& args) {
if (module->IsGraphAsync()) {
CHECK(env->options()->print_required_tla);
- auto stalled = module->GetStalledTopLevelAwaitMessage(isolate);
- if (stalled.size() != 0) {
- for (auto pair : stalled) {
- Local<v8::Message> message = std::get<1>(pair);
-
+ auto stalled_messages =
+ std::get<1>(module->GetStalledTopLevelAwaitMessages(isolate));
+ if (stalled_messages.size() != 0) {
+ for (auto& message : stalled_messages) {
std::string reason = "Error: unexpected top-level await at ";
std::string info =
FormatErrorMessage(isolate, context, "", message, true);

Просмотреть файл

@ -7,7 +7,7 @@ This refactors several allocators to allocate within the V8 memory cage,
allowing them to be compatible with the V8_SANDBOXED_POINTERS feature.
diff --git a/src/api/environment.cc b/src/api/environment.cc
index 5fc1b6f2446d7c786024eb60800e2edab613dcd1..f59abcb21d64b910d8d42eb23c03109f62558813 100644
index e0bf37f09dceb93af58990438ab577a9d4b843e8..b9098d102b40adad7fafcc331ac62870617019b9 100644
--- a/src/api/environment.cc
+++ b/src/api/environment.cc
@@ -101,6 +101,14 @@ MaybeLocal<Value> PrepareStackTraceCallback(Local<Context> context,
@ -25,49 +25,11 @@ index 5fc1b6f2446d7c786024eb60800e2edab613dcd1..f59abcb21d64b910d8d42eb23c03109f
void* NodeArrayBufferAllocator::Allocate(size_t size) {
void* ret;
if (zero_fill_field_ || per_process::cli_options->zero_fill_all_buffers)
diff --git a/src/crypto/crypto_dh.cc b/src/crypto/crypto_dh.cc
index 33ffbbb85d05f5356183e3aa1ca23707c5629b5d..008d212ebe25b0022020379aa08963c12828940c 100644
--- a/src/crypto/crypto_dh.cc
+++ b/src/crypto/crypto_dh.cc
@@ -51,6 +51,25 @@ void DiffieHellman::MemoryInfo(MemoryTracker* tracker) const {
namespace {
MaybeLocal<Value> DataPointerToBuffer(Environment* env,
ncrypto::DataPointer&& data) {
+#if defined(V8_ENABLE_SANDBOX)
+ std::unique_ptr<v8::BackingStore> backing;
+ if (data.size() > 0) {
+ std::unique_ptr<ArrayBuffer::Allocator> allocator(ArrayBuffer::Allocator::NewDefaultAllocator());
+ void* v8_data = allocator->Allocate(data.size());
+ CHECK(v8_data);
+ memcpy(v8_data, data.get(), data.size());
+ backing = ArrayBuffer::NewBackingStore(
+ v8_data,
+ data.size(),
+ [](void* data, size_t length, void*) {
+ std::unique_ptr<ArrayBuffer::Allocator> allocator(ArrayBuffer::Allocator::NewDefaultAllocator());
+ allocator->Free(data, length);
+ }, nullptr);
+ } else {
+ NoArrayBufferZeroFillScope no_zero_fill_scope(env->isolate_data());
+ backing = v8::ArrayBuffer::NewBackingStore(env->isolate(), data.size());
+ }
+#else
auto backing = ArrayBuffer::NewBackingStore(
data.get(),
data.size(),
@@ -59,6 +78,7 @@ MaybeLocal<Value> DataPointerToBuffer(Environment* env,
},
nullptr);
data.release();
+#endif
auto ab = ArrayBuffer::New(env->isolate(), std::move(backing));
return Buffer::New(env, ab, 0, ab->ByteLength()).FromMaybe(Local<Value>());
diff --git a/src/crypto/crypto_util.cc b/src/crypto/crypto_util.cc
index ee81048caab4ccfe26ea9e677782c9c955d162a9..643c9d31dc2737faa2ec51684ffceb35a1014a58 100644
index 63d971e1fe6b861e29c12f04563701b01fdfb976..f39652a6f5196531cd78ce74e91076b1b9e970ca 100644
--- a/src/crypto/crypto_util.cc
+++ b/src/crypto/crypto_util.cc
@@ -326,10 +326,35 @@ ByteSource& ByteSource::operator=(ByteSource&& other) noexcept {
@@ -348,10 +348,35 @@ ByteSource& ByteSource::operator=(ByteSource&& other) noexcept {
return *this;
}
@ -104,7 +66,7 @@ index ee81048caab4ccfe26ea9e677782c9c955d162a9..643c9d31dc2737faa2ec51684ffceb35
std::unique_ptr<BackingStore> ptr = ArrayBuffer::NewBackingStore(
allocated_data_,
size(),
@@ -341,10 +366,11 @@ std::unique_ptr<BackingStore> ByteSource::ReleaseToBackingStore() {
@@ -363,10 +388,11 @@ std::unique_ptr<BackingStore> ByteSource::ReleaseToBackingStore() {
data_ = nullptr;
size_ = 0;
return ptr;
@ -117,7 +79,7 @@ index ee81048caab4ccfe26ea9e677782c9c955d162a9..643c9d31dc2737faa2ec51684ffceb35
return ArrayBuffer::New(env->isolate(), std::move(store));
}
@@ -641,6 +667,16 @@ namespace {
@@ -703,6 +729,16 @@ namespace {
// in which case this has the same semantics as
// using OPENSSL_malloc. However, if the secure heap is
// initialized, SecureBuffer will automatically use it.
@ -134,7 +96,7 @@ index ee81048caab4ccfe26ea9e677782c9c955d162a9..643c9d31dc2737faa2ec51684ffceb35
void SecureBuffer(const FunctionCallbackInfo<Value>& args) {
CHECK(args[0]->IsUint32());
Environment* env = Environment::GetCurrent(args);
@@ -662,6 +698,7 @@ void SecureBuffer(const FunctionCallbackInfo<Value>& args) {
@@ -724,6 +760,7 @@ void SecureBuffer(const FunctionCallbackInfo<Value>& args) {
Local<ArrayBuffer> buffer = ArrayBuffer::New(env->isolate(), store);
args.GetReturnValue().Set(Uint8Array::New(buffer, 0, len));
}
@ -143,10 +105,10 @@ index ee81048caab4ccfe26ea9e677782c9c955d162a9..643c9d31dc2737faa2ec51684ffceb35
void SecureHeapUsed(const FunctionCallbackInfo<Value>& args) {
#ifndef OPENSSL_IS_BORINGSSL
diff --git a/src/crypto/crypto_util.h b/src/crypto/crypto_util.h
index 922e77091d72172ed6cfc5e8477901e3608396c5..16a236c69caed6d60248c7973531a95adc8f2edb 100644
index 4ba261014695cf1aa8eb53b21a2873f4c4ea8e43..b695d131bcdc331974f544924138bb5eedc50c9f 100644
--- a/src/crypto/crypto_util.h
+++ b/src/crypto/crypto_util.h
@@ -268,7 +268,7 @@ class ByteSource {
@@ -285,7 +285,7 @@ class ByteSource {
// Creates a v8::BackingStore that takes over responsibility for
// any allocated data. The ByteSource will be reset with size = 0
// after being called.
@ -155,44 +117,11 @@ index 922e77091d72172ed6cfc5e8477901e3608396c5..16a236c69caed6d60248c7973531a95a
v8::Local<v8::ArrayBuffer> ToArrayBuffer(Environment* env);
diff --git a/src/crypto/crypto_x509.cc b/src/crypto/crypto_x509.cc
index af2f953f0388dbce326b0c519de3883552f8f009..7fb34057a486914dd886ec4d3d23be90cccb4fea 100644
--- a/src/crypto/crypto_x509.cc
+++ b/src/crypto/crypto_x509.cc
@@ -174,6 +174,19 @@ MaybeLocal<Value> ToV8Value(Local<Context> context, const BIOPointer& bio) {
MaybeLocal<Value> ToBuffer(Environment* env, BIOPointer* bio) {
if (bio == nullptr || !*bio) return {};
BUF_MEM* mem = *bio;
+#if defined(V8_ENABLE_SANDBOX)
+ std::unique_ptr<ArrayBuffer::Allocator> allocator(ArrayBuffer::Allocator::NewDefaultAllocator());
+ void* v8_data = allocator->Allocate(mem->length);
+ CHECK(v8_data);
+ memcpy(v8_data, mem->data, mem->length);
+ std::unique_ptr<v8::BackingStore> backing = ArrayBuffer::NewBackingStore(
+ v8_data,
+ mem->length,
+ [](void* data, size_t length, void*) {
+ std::unique_ptr<ArrayBuffer::Allocator> allocator(ArrayBuffer::Allocator::NewDefaultAllocator());
+ allocator->Free(data, length);
+ }, nullptr);
+#else
auto backing = ArrayBuffer::NewBackingStore(
mem->data,
mem->length,
@@ -181,6 +194,8 @@ MaybeLocal<Value> ToBuffer(Environment* env, BIOPointer* bio) {
BIOPointer free_me(static_cast<BIO*>(data));
},
bio->release());
+#endif
+
auto ab = ArrayBuffer::New(env->isolate(), std::move(backing));
Local<Value> ret;
if (!Buffer::New(env, ab, 0, ab->ByteLength()).ToLocal(&ret)) return {};
diff --git a/src/node_i18n.cc b/src/node_i18n.cc
index 43bb68351bf0a68285e464601013bbdbd5d5df5f..4126bbff080548c91154a6dcc437359c82a6c771 100644
index 2aa7cd98ecc179519a6bb1932dafa86a38bda4f5..79376bef2e674f05fd95380dd419e8778cb98623 100644
--- a/src/node_i18n.cc
+++ b/src/node_i18n.cc
@@ -107,7 +107,7 @@ namespace {
@@ -106,7 +106,7 @@ namespace {
template <typename T>
MaybeLocal<Object> ToBufferEndian(Environment* env, MaybeStackBuffer<T>* buf) {
@ -201,7 +130,7 @@ index 43bb68351bf0a68285e464601013bbdbd5d5df5f..4126bbff080548c91154a6dcc437359c
if (ret.IsEmpty())
return ret;
@@ -184,7 +184,7 @@ MaybeLocal<Object> TranscodeLatin1ToUcs2(Environment* env,
@@ -183,7 +183,7 @@ MaybeLocal<Object> TranscodeLatin1ToUcs2(Environment* env,
return {};
}
@ -210,7 +139,7 @@ index 43bb68351bf0a68285e464601013bbdbd5d5df5f..4126bbff080548c91154a6dcc437359c
}
MaybeLocal<Object> TranscodeFromUcs2(Environment* env,
@@ -229,7 +229,7 @@ MaybeLocal<Object> TranscodeUcs2FromUtf8(Environment* env,
@@ -228,7 +228,7 @@ MaybeLocal<Object> TranscodeUcs2FromUtf8(Environment* env,
return {};
}
@ -219,7 +148,7 @@ index 43bb68351bf0a68285e464601013bbdbd5d5df5f..4126bbff080548c91154a6dcc437359c
}
MaybeLocal<Object> TranscodeUtf8FromUcs2(Environment* env,
@@ -253,7 +253,7 @@ MaybeLocal<Object> TranscodeUtf8FromUcs2(Environment* env,
@@ -252,7 +252,7 @@ MaybeLocal<Object> TranscodeUtf8FromUcs2(Environment* env,
return {};
}
@ -229,7 +158,7 @@ index 43bb68351bf0a68285e464601013bbdbd5d5df5f..4126bbff080548c91154a6dcc437359c
constexpr const char* EncodingName(const enum encoding encoding) {
diff --git a/src/node_internals.h b/src/node_internals.h
index fe2d25decd883085e4c3f368ab4acc01a7f66f6e..bcd5c87afcff9c56429443363c63fc8079521451 100644
index 6264f23d54d6028bb0158f12a9296ba67a846358..613300215766aeb108219b0d1c3b95ee02db964f 100644
--- a/src/node_internals.h
+++ b/src/node_internals.h
@@ -117,7 +117,9 @@ v8::Maybe<bool> InitializePrimordials(v8::Local<v8::Context> context);

Просмотреть файл

@ -7,7 +7,7 @@ Instead of disabling the tests, flag them as flaky so they still run
but don't cause CI failures on flakes.
diff --git a/test/parallel/parallel.status b/test/parallel/parallel.status
index 24e1a74886bad536dc08df75fbdb0508e4e1420a..7f3be73474557788050a9110b0e29e602b7d6397 100644
index 79a953df7da64b7d7580e099a5cc5160e7842999..94616df356cab50c8ef4099e7863f5986deed377 100644
--- a/test/parallel/parallel.status
+++ b/test/parallel/parallel.status
@@ -5,6 +5,16 @@ prefix parallel

Просмотреть файл

@ -14,7 +14,7 @@ meaningless. Fix it for now by replacing the process.argv0 basename instead.
Some form of fix for this should be upstreamed.
diff --git a/test/parallel/test-node-output-v8-warning.mjs b/test/parallel/test-node-output-v8-warning.mjs
index 309e904c49b7124b64831293e0473a5d35249081..6636144f5074811f95bbe53a62718c8084088bdc 100644
index 8e497739d21c70d5c792f43c268746a200916063..cad1910e020b15775ee16122bc9d310680fed687 100644
--- a/test/parallel/test-node-output-v8-warning.mjs
+++ b/test/parallel/test-node-output-v8-warning.mjs
@@ -2,11 +2,18 @@ import '../common/index.mjs';
@ -33,10 +33,10 @@ index 309e904c49b7124b64831293e0473a5d35249081..6636144f5074811f95bbe53a62718c80
+ return str.replaceAll(`${baseName} --`, '* --');
+}
+
describe('v8 output', { concurrency: !process.env.TEST_PARALLEL }, () => {
describe('v8 output', { concurrency: true }, () => {
function normalize(str) {
return str.replaceAll(snapshot.replaceWindowsPaths(process.cwd()), '')
@@ -15,10 +22,10 @@ describe('v8 output', { concurrency: !process.env.TEST_PARALLEL }, () => {
@@ -15,10 +22,10 @@ describe('v8 output', { concurrency: true }, () => {
.replaceAll('*test*', '*')
.replaceAll(/.*?\*fixtures\*v8\*/g, '(node:*) V8: *') // Replace entire path before fixtures/v8
.replaceAll('*fixtures*v8*', '*')

Просмотреть файл

@ -0,0 +1,23 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shelley Vohr <shelley.vohr@gmail.com>
Date: Tue, 16 Jan 2024 19:39:10 +0100
Subject: test: match wpt/streams/transferable/transform-stream-members.any.js
to upstream
All four of this calls should fail - see third_party/blink/web_tests/external/wpt/streams/transferable/transform-stream-members.any-expected.txt
diff --git a/test/wpt/status/streams.json b/test/wpt/status/streams.json
index 5425c86bba85079a44745779d998337aaa063df1..775661cd59b14132c9a811e448792ea02198f949 100644
--- a/test/wpt/status/streams.json
+++ b/test/wpt/status/streams.json
@@ -60,7 +60,9 @@
"fail": {
"expected": [
"Transferring [object TransformStream],[object ReadableStream] should fail",
- "Transferring [object TransformStream],[object WritableStream] should fail"
+ "Transferring [object TransformStream],[object WritableStream] should fail",
+ "Transferring [object ReadableStream],[object TransformStream] should fail",
+ "Transferring [object WritableStream],[object TransformStream] should fail"
]
}
},

Просмотреть файл

@ -6,7 +6,7 @@ Subject: test: update v8-stats test for V8 12.6
Refs: https://github.com/v8/v8/commit/e30e228ee6e034de49a40af0173113198a19b497
diff --git a/test/parallel/test-v8-stats.js b/test/parallel/test-v8-stats.js
index bb954165f42c9de3db66bc5fdcac647654ad71ea..07be833e6e749a2bb68490c935c6791c178d126f 100644
index 2366cbf716c11851bb3a759dce5db47d616516dc..9d2971ba9411bb98107f6a9acc8a07ec438b76e5 100644
--- a/test/parallel/test-v8-stats.js
+++ b/test/parallel/test-v8-stats.js
@@ -48,6 +48,8 @@ const expectedHeapSpaces = [
@ -16,5 +16,5 @@ index bb954165f42c9de3db66bc5fdcac647654ad71ea..07be833e6e749a2bb68490c935c6791c
+ 'shared_trusted_large_object_space',
+ 'shared_trusted_space',
'trusted_large_object_space',
'trusted_space',
'trusted_space'
];

Просмотреть файл

@ -1,70 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Santiago Gimeno <santiago.gimeno@gmail.com>
Date: Tue, 5 Mar 2024 14:54:59 +0100
Subject: win: almost fix race detecting ESRCH in uv_kill
It might happen that only using `WaitForSingleObject()` with timeout 0
could return WAIT_TIMEOUT as the process might not have been signaled
yet. To improve things, first use `GetExitCodeProcess()` and check
that `status` is not `STILL_ACTIVE`. Then, to cover for the case that the exit
code was actually `STILL_ACTIVE` use `WaitForSingleObject()`. This could
still be prone to the race condition but only for that case.
diff --git a/deps/uv/src/win/process.c b/deps/uv/src/win/process.c
index 4e94dee90e13eede63d8e97ddc9992726f874ea9..f46f34289e8e7d3a2af914d89e6164b751a3e47d 100644
--- a/deps/uv/src/win/process.c
+++ b/deps/uv/src/win/process.c
@@ -1308,16 +1308,34 @@ static int uv__kill(HANDLE process_handle, int signum) {
/* Unconditionally terminate the process. On Windows, killed processes
* normally return 1. */
int err;
+ DWORD status;
if (TerminateProcess(process_handle, 1))
return 0;
- /* If the process already exited before TerminateProcess was called,.
+ /* If the process already exited before TerminateProcess was called,
* TerminateProcess will fail with ERROR_ACCESS_DENIED. */
err = GetLastError();
- if (err == ERROR_ACCESS_DENIED &&
- WaitForSingleObject(process_handle, 0) == WAIT_OBJECT_0) {
- return UV_ESRCH;
+ if (err == ERROR_ACCESS_DENIED) {
+ /* First check using GetExitCodeProcess() with status different from
+ * STILL_ACTIVE (259). This check can be set incorrectly by the process,
+ * though that is uncommon. */
+ if (GetExitCodeProcess(process_handle, &status) &&
+ status != STILL_ACTIVE) {
+ return UV_ESRCH;
+ }
+
+ /* But the process could have exited with code == STILL_ACTIVE, use then
+ * WaitForSingleObject with timeout zero. This is prone to a race
+ * condition as it could return WAIT_TIMEOUT because the handle might
+ * not have been signaled yet.That would result in returning the wrong
+ * error code here (UV_EACCES instead of UV_ESRCH), but we cannot fix
+ * the kernel synchronization issue that TerminateProcess is
+ * inconsistent with WaitForSingleObject with just the APIs available to
+ * us in user space. */
+ if (WaitForSingleObject(process_handle, 0) == WAIT_OBJECT_0) {
+ return UV_ESRCH;
+ }
}
return uv_translate_sys_error(err);
@@ -1325,6 +1343,14 @@ static int uv__kill(HANDLE process_handle, int signum) {
case 0: {
/* Health check: is the process still alive? */
+ DWORD status;
+
+ if (!GetExitCodeProcess(process_handle, &status))
+ return uv_translate_sys_error(GetLastError());
+
+ if (status != STILL_ACTIVE)
+ return UV_ESRCH;
+
switch (WaitForSingleObject(process_handle, 0)) {
case WAIT_OBJECT_0:
return UV_ESRCH;

Просмотреть файл

@ -0,0 +1,85 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jameson Nash <vtjnash@gmail.com>
Date: Mon, 2 Oct 2023 15:15:18 +0200
Subject: win,process: avoid assert after spawning Store app (#4152)
Make sure this handle is functional. The Windows kernel seems to have a
bug that if the first use of AssignProcessToJobObject is for a Windows
Store program, subsequent attempts to use the handle with fail with
INVALID_PARAMETER (87). This is possilby because all uses of the handle
must be for the same Terminal Services session. We can ensure it is
tied to our current session now by adding ourself to it. We could
remove ourself afterwards, but there doesn't seem to be a reason to.
Secondly, we start the process suspended so that we can make sure we
added it to the job control object before it does anything itself (such
as launch more jobs or exit).
Fixes: https://github.com/JuliaLang/julia/issues/51461
diff --git a/deps/uv/src/win/process.c b/deps/uv/src/win/process.c
index 3e451e2291d6ed200ec258e874becbbea22bbc27..a71a08bdd60166ef1d4ef490ff3e083b44188852 100644
--- a/deps/uv/src/win/process.c
+++ b/deps/uv/src/win/process.c
@@ -105,6 +105,21 @@ static void uv__init_global_job_handle(void) {
&info,
sizeof info))
uv_fatal_error(GetLastError(), "SetInformationJobObject");
+
+
+ if (!AssignProcessToJobObject(uv_global_job_handle_, GetCurrentProcess())) {
+ /* Make sure this handle is functional. The Windows kernel has a bug that
+ * if the first use of AssignProcessToJobObject is for a Windows Store
+ * program, subsequent attempts to use the handle with fail with
+ * INVALID_PARAMETER (87). This is possibly because all uses of the handle
+ * must be for the same Terminal Services session. We can ensure it is tied
+ * to our current session now by adding ourself to it. We could remove
+ * ourself afterwards, but there doesn't seem to be a reason to.
+ */
+ DWORD err = GetLastError();
+ if (err != ERROR_ACCESS_DENIED)
+ uv_fatal_error(err, "AssignProcessToJobObject");
+ }
}
@@ -1102,6 +1117,7 @@ int uv_spawn(uv_loop_t* loop,
* breakaway.
*/
process_flags |= DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP;
+ process_flags |= CREATE_SUSPENDED;
}
if (!CreateProcessW(application_path,
@@ -1119,11 +1135,6 @@ int uv_spawn(uv_loop_t* loop,
goto done;
}
- /* Spawn succeeded. Beyond this point, failure is reported asynchronously. */
-
- process->process_handle = info.hProcess;
- process->pid = info.dwProcessId;
-
/* If the process isn't spawned as detached, assign to the global job object
* so windows will kill it when the parent process dies. */
if (!(options->flags & UV_PROCESS_DETACHED)) {
@@ -1146,6 +1157,19 @@ int uv_spawn(uv_loop_t* loop,
}
}
+ if (process_flags & CREATE_SUSPENDED) {
+ if (ResumeThread(info.hThread) == ((DWORD)-1)) {
+ err = GetLastError();
+ TerminateProcess(info.hProcess, 1);
+ goto done;
+ }
+ }
+
+ /* Spawn succeeded. Beyond this point, failure is reported asynchronously. */
+
+ process->process_handle = info.hProcess;
+ process->pid = info.dwProcessId;
+
/* Set IPC pid to all IPC pipes. */
for (i = 0; i < options->stdio_count; i++) {
const uv_stdio_container_t* fdopt = &options->stdio[i];

Просмотреть файл

@ -1 +0,0 @@
fix_rename_sqlite_win32_exports_to_avoid_conflicts_with_node_js.patch

Просмотреть файл

@ -1,31 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shelley Vohr <shelley.vohr@gmail.com>
Date: Sun, 27 Oct 2024 21:01:11 +0100
Subject: fix: rename sqlite win32 exports to avoid conflicts with Node.js
As of https://github.com/nodejs/node/pull/53752, a number of symbols
exported by SQLite are now exported by Node.js. This change renames
the exported symbols in SQLite to avoid conflicts with Node.js.
This should be upstreamed to SQLite.
diff --git a/amalgamation/rename_exports.h b/amalgamation/rename_exports.h
index b1c485159a624ea1bfbec603aabc58074721e72a..8eb71ae67acc3e0ad17bae2e87e85bf12c10b9af 100644
--- a/amalgamation/rename_exports.h
+++ b/amalgamation/rename_exports.h
@@ -367,6 +367,15 @@
#define sqlite3session_patchset chrome_sqlite3session_patchset // Lines 11449-11453
#define sqlite3session_patchset_strm chrome_sqlite3session_patchset_strm // Lines 12728-12732
#define sqlite3session_table_filter chrome_sqlite3session_table_filter // Lines 11219-11226
+#define sqlite3_win32_write_debug chrome_sqlite3_win32_write_debug
+#define sqlite3_win32_sleep chrome_sqlite3_win32_sleep
+#define sqlite3_win32_is_nt chrome_sqlite3_win32_is_nt
+#define sqlite3_win32_utf8_to_unicode chrome_sqlite3_win32_utf8_to_unicode
+#define sqlite3_win32_unicode_to_utf8 chrome_sqlite3_win32_unicode_to_utf8
+#define sqlite3_win32_mbcs_to_utf8 chrome_sqlite3_win32_mbcs_to_utf8
+#define sqlite3_win32_utf8_to_mbcs_v2 chrome_sqlite3_win32_utf8_to_mbcs_v2
+#define sqlite3_win32_utf8_to_mbcs chrome_sqlite3_win32_utf8_to_mbcs
+#define sqlite3_win32_mbcs_to_utf8_v2 chrome_sqlite3_win32_mbcs_to_utf8_v2
#endif // THIRD_PARTY_SQLITE_AMALGAMATION_RENAME_EXPORTS_H_

Просмотреть файл

@ -1,14 +1,12 @@
[
"abort/test-abort-backtrace",
"es-module/test-vm-compile-function-lineoffset",
"parallel/test-async-context-frame",
"parallel/test-bootstrap-modules",
"parallel/test-child-process-fork-exec-path",
"parallel/test-code-cache",
"parallel/test-cluster-primary-error",
"parallel/test-cluster-primary-kill",
"parallel/test-crypto-aes-wrap",
"parallel/test-crypto-authenticated",
"parallel/test-crypto-authenticated-stream",
"parallel/test-crypto-des3-wrap",
"parallel/test-crypto-dh-group-setters",
@ -37,7 +35,6 @@
"parallel/test-inspector-port-zero-cluster",
"parallel/test-inspector-tracing-domain",
"parallel/test-module-loading-globalpaths",
"parallel/test-module-print-timing",
"parallel/test-openssl-ca-options",
"parallel/test-process-versions",
"parallel/test-process-get-builtin",
@ -63,7 +60,6 @@
"parallel/test-snapshot-incompatible",
"parallel/test-snapshot-namespaced-builtin",
"parallel/test-snapshot-net",
"parallel/test-snapshot-reproducible",
"parallel/test-snapshot-typescript",
"parallel/test-snapshot-umd",
"parallel/test-snapshot-warning",

Просмотреть файл

@ -183,7 +183,7 @@ int NodeMain() {
const std::vector<std::string> args = ElectronCommandLine::AsUtf8();
ExitIfContainsDisallowedFlags(args);
std::shared_ptr<node::InitializationResult> result =
std::unique_ptr<node::InitializationResult> result =
node::InitializeOncePerProcess(
args,
{node::ProcessInitializationFlags::kNoInitializeV8,

Просмотреть файл

@ -165,10 +165,8 @@ bool ShouldBlockAccessToPath(const base::FilePath& path,
ChromeFileSystemAccessPermissionContext::kBlockedPaths) {
if (key == ChromeFileSystemAccessPermissionContext::kNoBasePathKey) {
rules.emplace_back(base::FilePath{rule_path}, type);
} else if (base::FilePath block_path;
base::PathService::Get(key, &block_path)) {
rules.emplace_back(rule_path ? block_path.Append(rule_path) : block_path,
type);
} else if (base::FilePath path; base::PathService::Get(key, &path)) {
rules.emplace_back(rule_path ? path.Append(rule_path) : path, type);
}
}

Просмотреть файл

@ -568,7 +568,7 @@ void NodeBindings::Initialize(v8::Local<v8::Context> context) {
if (!fuses::IsNodeOptionsEnabled())
process_flags |= node::ProcessInitializationFlags::kDisableNodeOptionsEnv;
std::shared_ptr<node::InitializationResult> result =
std::unique_ptr<node::InitializationResult> result =
node::InitializeOncePerProcess(
args,
static_cast<node::ProcessInitializationFlags::Flags>(process_flags));

Просмотреть файл

@ -510,8 +510,7 @@ describe('utilityProcess module', () => {
expect(output).to.equal(result);
});
// TODO(codebytere): figure out why this is failing in ASAN- builds on Linux.
ifit(!process.env.IS_ASAN)('does not inherit parent env when custom env is provided', async () => {
it('does not inherit parent env when custom env is provided', async () => {
const appProcess = childProcess.spawn(process.execPath, [path.join(fixturesPath, 'env-app'), '--create-custom-env'], {
env: {
FROM: 'parent',

Просмотреть файл

@ -1,4 +1,5 @@
#include <node_api.h>
#undef NAPI_VERSION
#include <node_buffer.h>
#include <v8.h>

Просмотреть файл

@ -20,5 +20,4 @@ export const emittedUntil = async (emitter: NodeJS.EventEmitter, eventName: stri
for await (const args of on(emitter, eventName)) {
if (untilFn(...args)) { return args; }
}
return [];
};

Просмотреть файл

@ -997,12 +997,12 @@
dependencies:
undici-types "~6.19.2"
"@types/node@^22.7.7":
version "22.7.7"
resolved "https://registry.yarnpkg.com/@types/node/-/node-22.7.7.tgz#6cd9541c3dccb4f7e8b141b491443f4a1570e307"
integrity sha512-SRxCrrg9CL/y54aiMCG3edPKdprgMVGDXjA3gB8UmmBW5TcXzRUYAh8EWzTnSJFAd1rgImPELza+A3bJ+qxz8Q==
"@types/node@^20.9.0":
version "20.9.0"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.9.0.tgz#bfcdc230583aeb891cf51e73cfdaacdd8deae298"
integrity sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw==
dependencies:
undici-types "~6.19.2"
undici-types "~5.26.4"
"@types/normalize-package-data@^2.4.0":
version "2.4.1"
@ -7042,7 +7042,14 @@ stringify-object@^3.3.0:
is-obj "^1.0.1"
is-regexp "^1.0.0"
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.1"
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
@ -7434,6 +7441,11 @@ unbox-primitive@^1.0.2:
has-symbols "^1.0.3"
which-boxed-primitive "^1.0.2"
undici-types@~5.26.4:
version "5.26.5"
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617"
integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==
undici-types@~6.19.2:
version "6.19.8"
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02"