Compare commits

..

1 Commits

Author SHA1 Message Date
Niklas Wenzel
346d31f5e0 feat: make Chrome extensions work on custom protocols 2026-02-25 20:18:53 +01:00
56 changed files with 526 additions and 226 deletions

2
DEPS
View File

@@ -4,7 +4,7 @@ vars = {
'chromium_version':
'147.0.7699.0',
'node_version':
'v24.14.0',
'v24.13.1',
'nan_version':
'675cefebca42410733da8a454c8d9391fcebfbc2',
'squirrel.mac_version':

View File

@@ -1556,6 +1556,19 @@ Enables full sandbox mode on the app. This means that all renderers will be laun
This method can only be called before app is ready.
### `app.enableExtensionsOnAllProtocols()`
Enables Chrome extensions on all protocols.
By default, Chrome extensions are enabled only for a select number of protocols
such as `http`, `https`, and `file`. Calling this function will enable Chrome extensions
on all protocols, including [custom protocols](protocol.md).
This can have security implications. For most apps, it is recommended to enable
this during development only and keep it disabled in production builds.
This method can only be called before app is ready.
### `app.isInApplicationsFolder()` _macOS_
Returns `boolean` - Whether the application is currently running from the

View File

@@ -144,3 +144,4 @@ fix_linux_tray_id.patch
expose_gtk_ui_platform_field.patch
patch_osr_control_screen_info.patch
refactor_allow_customizing_config_in_freedesktopsecretkeyprovider.patch
feat_allow_enabling_extensions_on_all_protocols.patch

View File

@@ -6,10 +6,10 @@ 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 ae58a0b0a64ae1fdb3f9cd8587041d71a121c6b9..f9d4e9b015ad266452dfa2a442b432ef31d09a5b 100644
index ae58a0b0a64ae1fdb3f9cd8587041d71a121c6b9..0ed56526002b12deb6d29f3dd23a0d74d8e7473c 100644
--- a/.gn
+++ b/.gn
@@ -167,4 +167,28 @@ exec_script_allowlist =
@@ -167,4 +167,27 @@ exec_script_allowlist =
"//tools/grit/grit_rule.gni",
"//tools/gritsettings/BUILD.gn",
@@ -25,7 +25,6 @@ index ae58a0b0a64ae1fdb3f9cd8587041d71a121c6b9..f9d4e9b015ad266452dfa2a442b432ef
+ "//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/merve/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",

View File

@@ -0,0 +1,84 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Niklas Wenzel <dev@nikwen.de>
Date: Wed, 25 Feb 2026 16:24:03 +0100
Subject: feat: allow enabling extensions on all protocols
This allows us to use Chrome extensions on custom protocols.
The patch can't really be upstreamed, unfortunately, because there are
other URLPattern functions that we don't patch that Chrome needs.
Patching those properly would require replacing the bitmap logic in
URLPattern with a more flexible solution. This would be a larger effort
and Chromium might reject it for performance reasons.
See: https://source.chromium.org/chromium/chromium/src/+/main:extensions/common/url_pattern.h;l=53-74;drc=50dbcddad2f8e36ddfcec21d4551f389df425c37
This patch makes it work in the context of Electron.
diff --git a/extensions/common/url_pattern.cc b/extensions/common/url_pattern.cc
index 4054af728030306c5473f9a47e580595596768a0..38c3f5976a122e6e4b7e8512ef977242fa395d8d 100644
--- a/extensions/common/url_pattern.cc
+++ b/extensions/common/url_pattern.cc
@@ -133,6 +133,13 @@ std::string_view CanonicalizeHostForMatching(std::string_view host_piece) {
} // namespace
+bool URLPattern::enable_extensions_on_all_protocols_ = false;
+
+// static
+void URLPattern::EnableExtensionsOnAllProtocols() {
+ enable_extensions_on_all_protocols_ = true;
+}
+
// static
bool URLPattern::IsValidSchemeForExtensions(std::string_view scheme) {
for (auto* valid_scheme : kValidSchemes) {
@@ -140,11 +147,14 @@ bool URLPattern::IsValidSchemeForExtensions(std::string_view scheme) {
return true;
}
}
- return false;
+ return enable_extensions_on_all_protocols_;
}
// static
int URLPattern::GetValidSchemeMaskForExtensions() {
+ if (enable_extensions_on_all_protocols_) {
+ return SCHEME_ALL;
+ }
int result = 0;
for (int valid_scheme_mask : kValidSchemeMasks) {
result |= valid_scheme_mask;
@@ -401,7 +411,7 @@ bool URLPattern::IsValidScheme(std::string_view scheme) const {
}
}
- return false;
+ return enable_extensions_on_all_protocols_;
}
void URLPattern::SetPath(std::string_view path) {
diff --git a/extensions/common/url_pattern.h b/extensions/common/url_pattern.h
index 4d09251b0160644d86682ad3db7c41b50f360e6f..78978b82e37e080add6680300d09503acdb663db 100644
--- a/extensions/common/url_pattern.h
+++ b/extensions/common/url_pattern.h
@@ -96,6 +96,8 @@ class URLPattern {
// Returns the mask for all schemes considered valid for extensions.
static int GetValidSchemeMaskForExtensions();
+ static void EnableExtensionsOnAllProtocols();
+
explicit URLPattern(int valid_schemes);
// Convenience to construct a URLPattern from a string. If the string is not
@@ -251,6 +253,9 @@ class URLPattern {
// Get an error string for a ParseResult.
static const char* GetParseResultString(URLPattern::ParseResult parse_result);
+ protected:
+ static bool enable_extensions_on_all_protocols_;
+
private:
// Returns true if any of the `schemes` items matches our scheme.
bool MatchesAnyScheme(const std::vector<std::string>& schemes) const;

View File

@@ -1 +1,2 @@
chore_expose_ui_to_allow_electron_to_set_dock_side.patch
feat_allow_enabling_extension_panels_on_all_protocols.patch

View File

@@ -0,0 +1,41 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Niklas Wenzel <dev@nikwen.de>
Date: Wed, 25 Feb 2026 16:23:07 +0100
Subject: feat: allow enabling extension panels on all protocols
This allows us to show Chrome extension panels on pages served over
custom protocols.
diff --git a/front_end/core/root/Runtime.ts b/front_end/core/root/Runtime.ts
index 19824217973f002a52478c7fa63a3faa217b0c63..6406fff61691fab0d2a8cc5344aaee743937c84e 100644
--- a/front_end/core/root/Runtime.ts
+++ b/front_end/core/root/Runtime.ts
@@ -639,6 +639,7 @@ export type HostConfig = Platform.TypeScriptUtilities.RecursivePartial<{
* or guest mode, rather than a "normal" profile.
*/
isOffTheRecord: boolean,
+ devToolsExtensionsOnAllProtocols: boolean,
devToolsEnableOriginBoundCookies: HostConfigEnableOriginBoundCookies,
devToolsAnimationStylesInStylesTab: HostConfigAnimationStylesInStylesTab,
thirdPartyCookieControls: HostConfigThirdPartyCookieControls,
diff --git a/front_end/panels/common/ExtensionServer.ts b/front_end/panels/common/ExtensionServer.ts
index 0a5ec620b135b128013d6ddbb5299f9a5813f122..1a6118b4fa1607a634720b5579a50d1b4478b60a 100644
--- a/front_end/panels/common/ExtensionServer.ts
+++ b/front_end/panels/common/ExtensionServer.ts
@@ -12,6 +12,7 @@ import * as Host from '../../core/host/host.js';
import * as i18n from '../../core/i18n/i18n.js';
import * as Platform from '../../core/platform/platform.js';
import * as _ProtocolClient from '../../core/protocol_client/protocol_client.js'; // eslint-disable-line @typescript-eslint/no-unused-vars
+import * as Root from '../../core/root/root.js';
import * as SDK from '../../core/sdk/sdk.js';
import type * as Protocol from '../../generated/protocol.js';
import * as Bindings from '../../models/bindings/bindings.js';
@@ -1607,7 +1608,7 @@ export class ExtensionServer extends Common.ObjectWrapper.ObjectWrapper<EventTyp
return false;
}
- if (!kPermittedSchemes.includes(parsedURL.protocol)) {
+ if (!Root.Runtime.hostConfig.devToolsExtensionsOnAllProtocols && !kPermittedSchemes.includes(parsedURL.protocol)) {
return false;
}

View File

@@ -6,7 +6,7 @@ Subject: Delete deprecated fields on v8::Isolate
https://chromium-review.googlesource.com/c/v8/v8/+/7081397
diff --git a/src/api/environment.cc b/src/api/environment.cc
index 2111ee63a6ace438c1a143c90a807ed9fc2bcc9d..ce6426a1bf2dadb1a642874a05718724ef0f3d7c 100644
index cfc9b3157d08d62f43e2e5bb01229fe663f3ca61..cce0e1cdc37aa324aa2c52ba134fc1a9a55b10ba 100644
--- a/src/api/environment.cc
+++ b/src/api/environment.cc
@@ -218,8 +218,6 @@ void SetIsolateCreateParamsForNode(Isolate::CreateParams* params) {

View File

@@ -6,10 +6,10 @@ Subject: Remove deprecated `GetIsolate`
https://chromium-review.googlesource.com/c/v8/v8/+/6905244
diff --git a/src/api/environment.cc b/src/api/environment.cc
index 8974bac7dca43294cc5cc4570f8e2e78f42aefaa..2111ee63a6ace438c1a143c90a807ed9fc2bcc9d 100644
index d753ad6c6b49b26b86920124f7ac90c1e052638e..cfc9b3157d08d62f43e2e5bb01229fe663f3ca61 100644
--- a/src/api/environment.cc
+++ b/src/api/environment.cc
@@ -795,7 +795,7 @@ std::unique_ptr<MultiIsolatePlatform> MultiIsolatePlatform::Create(
@@ -668,7 +668,7 @@ std::unique_ptr<MultiIsolatePlatform> MultiIsolatePlatform::Create(
MaybeLocal<Object> GetPerContextExports(Local<Context> context,
IsolateData* isolate_data) {
@@ -18,7 +18,7 @@ index 8974bac7dca43294cc5cc4570f8e2e78f42aefaa..2111ee63a6ace438c1a143c90a807ed9
EscapableHandleScope handle_scope(isolate);
Local<Object> global = context->Global();
@@ -841,7 +841,7 @@ void ProtoThrower(const FunctionCallbackInfo<Value>& info) {
@@ -714,7 +714,7 @@ void ProtoThrower(const FunctionCallbackInfo<Value>& info) {
// This runs at runtime, regardless of whether the context
// is created from a snapshot.
Maybe<void> InitializeContextRuntime(Local<Context> context) {
@@ -27,7 +27,7 @@ index 8974bac7dca43294cc5cc4570f8e2e78f42aefaa..2111ee63a6ace438c1a143c90a807ed9
HandleScope handle_scope(isolate);
// When `IsCodeGenerationFromStringsAllowed` is true, V8 takes the fast path
@@ -920,7 +920,7 @@ Maybe<void> InitializeContextRuntime(Local<Context> context) {
@@ -793,7 +793,7 @@ Maybe<void> InitializeContextRuntime(Local<Context> context) {
}
Maybe<void> InitializeBaseContextForSnapshot(Local<Context> context) {
@@ -36,7 +36,7 @@ index 8974bac7dca43294cc5cc4570f8e2e78f42aefaa..2111ee63a6ace438c1a143c90a807ed9
HandleScope handle_scope(isolate);
// Delete `Intl.v8BreakIterator`
@@ -945,7 +945,7 @@ Maybe<void> InitializeBaseContextForSnapshot(Local<Context> context) {
@@ -818,7 +818,7 @@ Maybe<void> InitializeBaseContextForSnapshot(Local<Context> context) {
}
Maybe<void> InitializeMainContextForSnapshot(Local<Context> context) {
@@ -45,7 +45,7 @@ index 8974bac7dca43294cc5cc4570f8e2e78f42aefaa..2111ee63a6ace438c1a143c90a807ed9
HandleScope handle_scope(isolate);
// Initialize the default values.
@@ -963,7 +963,7 @@ Maybe<void> InitializeMainContextForSnapshot(Local<Context> context) {
@@ -836,7 +836,7 @@ Maybe<void> InitializeMainContextForSnapshot(Local<Context> context) {
MaybeLocal<Object> InitializePrivateSymbols(Local<Context> context,
IsolateData* isolate_data) {
CHECK(isolate_data);
@@ -54,7 +54,7 @@ index 8974bac7dca43294cc5cc4570f8e2e78f42aefaa..2111ee63a6ace438c1a143c90a807ed9
EscapableHandleScope scope(isolate);
Context::Scope context_scope(context);
@@ -987,7 +987,7 @@ MaybeLocal<Object> InitializePrivateSymbols(Local<Context> context,
@@ -860,7 +860,7 @@ MaybeLocal<Object> InitializePrivateSymbols(Local<Context> context,
MaybeLocal<Object> InitializePerIsolateSymbols(Local<Context> context,
IsolateData* isolate_data) {
CHECK(isolate_data);
@@ -63,7 +63,7 @@ index 8974bac7dca43294cc5cc4570f8e2e78f42aefaa..2111ee63a6ace438c1a143c90a807ed9
EscapableHandleScope scope(isolate);
Context::Scope context_scope(context);
@@ -1013,7 +1013,7 @@ MaybeLocal<Object> InitializePerIsolateSymbols(Local<Context> context,
@@ -886,7 +886,7 @@ MaybeLocal<Object> InitializePerIsolateSymbols(Local<Context> context,
Maybe<void> InitializePrimordials(Local<Context> context,
IsolateData* isolate_data) {
// Run per-context JS files.
@@ -120,10 +120,10 @@ index 4c5427596d1c90d3a413cdd9ff4f1151e657073d..70135a6be65e41fcb3564ddf6d1e8083
NewStringType::kNormal,
mem->length)
diff --git a/src/encoding_binding.cc b/src/encoding_binding.cc
index 6fe4f0492dc1f3eaf576c8ff7866080a54cb81c1..41e8e052ff81df78ece87163b0499966cc2ed1b9 100644
index a913e34c73db3fb62aedcf28bee1bf1c4d59de7a..9de38eb9907269e99fdf0907aa35862572a2c643 100644
--- a/src/encoding_binding.cc
+++ b/src/encoding_binding.cc
@@ -76,7 +76,7 @@ void BindingData::Deserialize(Local<Context> context,
@@ -75,7 +75,7 @@ void BindingData::Deserialize(Local<Context> context,
int index,
InternalFieldInfoBase* info) {
DCHECK_IS_SNAPSHOT_SLOT(index);
@@ -353,10 +353,10 @@ index 52483740bb377a2bc2a16af701615d9a4e448eae..84d17a46efe146c1794a43963c41a446
CHECK(!env->temporary_required_module_facade_original.IsEmpty());
return env->temporary_required_module_facade_original.Get(isolate);
diff --git a/src/node.h b/src/node.h
index bbe35c7a8f1bc0bcddf628af42b71efaef8a7759..102bcc0b3400fd334bdf259a076a3ac3b5d4a266 100644
index 5a6004ca4dfd15a813f3fcc7687958432e4fd5a0..ee4eb270eeb5a76415e74ac6322e0cb347fe60ce 100644
--- a/src/node.h
+++ b/src/node.h
@@ -1142,7 +1142,7 @@ NODE_DEPRECATED("Use v8::Date::ValueOf() directly",
@@ -1064,7 +1064,7 @@ NODE_DEPRECATED("Use v8::Date::ValueOf() directly",
#define NODE_DEFINE_CONSTANT(target, constant) \
do { \
@@ -365,7 +365,7 @@ index bbe35c7a8f1bc0bcddf628af42b71efaef8a7759..102bcc0b3400fd334bdf259a076a3ac3
v8::Local<v8::Context> context = isolate->GetCurrentContext(); \
v8::Local<v8::String> constant_name = v8::String::NewFromUtf8Literal( \
isolate, #constant, v8::NewStringType::kInternalized); \
@@ -1158,7 +1158,7 @@ NODE_DEPRECATED("Use v8::Date::ValueOf() directly",
@@ -1080,7 +1080,7 @@ NODE_DEPRECATED("Use v8::Date::ValueOf() directly",
#define NODE_DEFINE_HIDDEN_CONSTANT(target, constant) \
do { \
@@ -375,10 +375,10 @@ index bbe35c7a8f1bc0bcddf628af42b71efaef8a7759..102bcc0b3400fd334bdf259a076a3ac3
v8::Local<v8::String> constant_name = v8::String::NewFromUtf8Literal( \
isolate, #constant, v8::NewStringType::kInternalized); \
diff --git a/src/node_blob.cc b/src/node_blob.cc
index 4311d71bb0526f9a83a16525243446a590092910..417cd8cbd307b9bfc498ad2df24ed193616ac512 100644
index d278a32c9934c15bc721da164efccca7bc7e7111..ab862bf93a411e6ae6da7c9f9706cee279a0ad70 100644
--- a/src/node_blob.cc
+++ b/src/node_blob.cc
@@ -562,7 +562,7 @@ void BlobBindingData::Deserialize(Local<Context> context,
@@ -554,7 +554,7 @@ void BlobBindingData::Deserialize(Local<Context> context,
int index,
InternalFieldInfoBase* info) {
DCHECK_IS_SNAPSHOT_SLOT(index);
@@ -388,10 +388,10 @@ index 4311d71bb0526f9a83a16525243446a590092910..417cd8cbd307b9bfc498ad2df24ed193
BlobBindingData* binding = realm->AddBindingData<BlobBindingData>(holder);
CHECK_NOT_NULL(binding);
diff --git a/src/node_builtins.cc b/src/node_builtins.cc
index 3377d697615ee168e49e83c4202bc227581f1aaf..1a9a57b73e635ac61016598687167a08b073f84a 100644
index 703ac1be06249736073f797058d170576a0db1bf..f0607ec9fd1983386166d0f4782adac99ace943e 100644
--- a/src/node_builtins.cc
+++ b/src/node_builtins.cc
@@ -260,7 +260,7 @@ MaybeLocal<Function> BuiltinLoader::LookupAndCompileInternal(
@@ -275,7 +275,7 @@ MaybeLocal<Function> BuiltinLoader::LookupAndCompileInternal(
const char* id,
LocalVector<String>* parameters,
Realm* optional_realm) {
@@ -400,7 +400,7 @@ index 3377d697615ee168e49e83c4202bc227581f1aaf..1a9a57b73e635ac61016598687167a08
EscapableHandleScope scope(isolate);
Local<String> source;
@@ -382,7 +382,7 @@ void BuiltinLoader::SaveCodeCache(const char* id, Local<Function> fun) {
@@ -397,7 +397,7 @@ void BuiltinLoader::SaveCodeCache(const char* id, Local<Function> fun) {
MaybeLocal<Function> BuiltinLoader::LookupAndCompile(Local<Context> context,
const char* id,
Realm* optional_realm) {
@@ -409,7 +409,7 @@ index 3377d697615ee168e49e83c4202bc227581f1aaf..1a9a57b73e635ac61016598687167a08
LocalVector<String> parameters(isolate);
// Detects parameters of the scripts based on module ids.
// internal/bootstrap/realm: process, getLinkedBinding,
@@ -436,7 +436,7 @@ MaybeLocal<Function> BuiltinLoader::LookupAndCompile(Local<Context> context,
@@ -451,7 +451,7 @@ MaybeLocal<Function> BuiltinLoader::LookupAndCompile(Local<Context> context,
MaybeLocal<Value> BuiltinLoader::CompileAndCall(Local<Context> context,
const char* id,
Realm* realm) {
@@ -418,7 +418,7 @@ index 3377d697615ee168e49e83c4202bc227581f1aaf..1a9a57b73e635ac61016598687167a08
// Detects parameters of the scripts based on module ids.
// internal/bootstrap/realm: process, getLinkedBinding,
// getInternalBinding, primordials
@@ -492,7 +492,7 @@ MaybeLocal<Value> BuiltinLoader::CompileAndCall(Local<Context> context,
@@ -507,7 +507,7 @@ MaybeLocal<Value> BuiltinLoader::CompileAndCall(Local<Context> context,
if (!maybe_fn.ToLocal(&fn)) {
return MaybeLocal<Value>();
}
@@ -427,7 +427,7 @@ index 3377d697615ee168e49e83c4202bc227581f1aaf..1a9a57b73e635ac61016598687167a08
return fn->Call(context, undefined, argc, argv);
}
@@ -530,14 +530,14 @@ bool BuiltinLoader::CompileAllBuiltinsAndCopyCodeCache(
@@ -545,14 +545,14 @@ bool BuiltinLoader::CompileAllBuiltinsAndCopyCodeCache(
to_eager_compile_.emplace(id);
}
@@ -546,7 +546,7 @@ index ba6ffc2b6565dea500bc8dd4818c8fcb7648694a..e834325a763f7ea8f53210145b5edd13
InternalFieldInfo* casted_info = static_cast<InternalFieldInfo*>(info);
BindingData* binding =
diff --git a/src/node_messaging.cc b/src/node_messaging.cc
index 9ff675d23914aaa168de2f82b8509027de477cbf..76c934ccbc98737918c18a28e63df7eb759fed7c 100644
index 57e068ae249d618c2658638f9f3b03e1fedb6524..8c51ae4e0a435971c6d0288af87810877dd31a49 100644
--- a/src/node_messaging.cc
+++ b/src/node_messaging.cc
@@ -254,7 +254,7 @@ namespace {
@@ -586,7 +586,7 @@ index 9ff675d23914aaa168de2f82b8509027de477cbf..76c934ccbc98737918c18a28e63df7eb
data_.Reset();
return ret;
diff --git a/src/node_modules.cc b/src/node_modules.cc
index ffc19850ac563082b14729e93d69695ef2c868f5..0cd351e7aff9e293e736e0aca22e67b577eb48eb 100644
index cecdda74847801fd5821bc0afdf0dfc9f131c44a..04ebecc5d924f6c2fddd9992462d1ff692e1cee5 100644
--- a/src/node_modules.cc
+++ b/src/node_modules.cc
@@ -70,7 +70,7 @@ void BindingData::Deserialize(v8::Local<v8::Context> context,
@@ -660,10 +660,10 @@ index c2e24b4645e7903e08c80aead1c18c7bcff1bd89..e34d24d51d5c090b560d06f727043f20
// Recreate the buffer in the constructor.
InternalFieldInfo* casted_info = static_cast<InternalFieldInfo*>(info);
diff --git a/src/node_sqlite.cc b/src/node_sqlite.cc
index 050d779bdcd2b3129abddc3fefa1e852831df236..3f4749286406e03e77de6567b667c0098fbc2a18 100644
index 6bfc54dd81446545ebbb0faedb55a5383b81de49..2e52fb801684feb22800d4809daab006fc7cae9c 100644
--- a/src/node_sqlite.cc
+++ b/src/node_sqlite.cc
@@ -2162,7 +2162,7 @@ bool StatementSync::BindParams(const FunctionCallbackInfo<Value>& args) {
@@ -2061,7 +2061,7 @@ bool StatementSync::BindParams(const FunctionCallbackInfo<Value>& args) {
if (args[0]->IsObject() && !args[0]->IsArrayBufferView()) {
Local<Object> obj = args[0].As<Object>();
@@ -758,7 +758,7 @@ index 5c7d268d38ff55ce4db07463b1ea0bcb2f4e63ea..bd83654012442195866e57173b6e5d4d
static void Clear(const FunctionCallbackInfo<Value>& info) {
diff --git a/src/node_worker.cc b/src/node_worker.cc
index 1acc61af0c995ddefbc00fe232b2454de77a84a3..3041746fc8a132f68cc1d801bb1700634699828d 100644
index e7d26b4c8cbb08a175084ceac51395860dc60598..fa4ec53ee556a23c8fd018caa1eee51bc5e004fe 100644
--- a/src/node_worker.cc
+++ b/src/node_worker.cc
@@ -1465,8 +1465,6 @@ void GetEnvMessagePort(const FunctionCallbackInfo<Value>& args) {

View File

@@ -11,10 +11,10 @@ really in 20/21. We have to wait until 22 is released to be able to
build with upstream GN files.
diff --git a/configure.py b/configure.py
index 98a8b147e4cbfd5957c35688f2b37ae0ca52a818..fd13970ae73bbe5db186f81faed792a5597bbcd0 100755
index f31d460038db2fa2fa4c47d62be3100da959978f..209f23b04663113e4f6b3c3242c0544cfed9a950 100755
--- a/configure.py
+++ b/configure.py
@@ -1821,7 +1821,7 @@ def configure_v8(o, configs):
@@ -1736,7 +1736,7 @@ def configure_v8(o, configs):
# Until we manage to get rid of all those, v8_enable_sandbox cannot be used.
# Note that enabling pointer compression without enabling sandbox is unsupported by V8,
# so this can be broken at any time.
@@ -23,54 +23,8 @@ index 98a8b147e4cbfd5957c35688f2b37ae0ca52a818..fd13970ae73bbe5db186f81faed792a5
# We set v8_enable_pointer_compression_shared_cage to 0 always, even when
# pointer compression is enabled so that we don't accidentally enable shared
# cage mode when pointer compression is on.
diff --git a/deps/merve/BUILD.gn b/deps/merve/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..7bb318f8835dba6f4a6f211d8534bb6923958747
--- /dev/null
+++ b/deps/merve/BUILD.gn
@@ -0,0 +1,14 @@
+##############################################################################
+# #
+# DO NOT EDIT THIS FILE! #
+# #
+##############################################################################
+
+# This file is used by GN for building, which is NOT the build system used for
+# building official binaries.
+# Please modify the gyp files if you are making changes to build system.
+
+import("unofficial.gni")
+
+merve_gn_build("merve") {
+}
diff --git a/deps/merve/unofficial.gni b/deps/merve/unofficial.gni
new file mode 100644
index 0000000000000000000000000000000000000000..dfb508d1d22f84accb146620ed07d89715b367e6
--- /dev/null
+++ b/deps/merve/unofficial.gni
@@ -0,0 +1,20 @@
+# This file is used by GN for building, which is NOT the build system used for
+# building official binaries.
+# Please edit the gyp files if you are making changes to build system.
+
+# The actual configurations are put inside a template in unofficial.gni to
+# prevent accidental edits from contributors.
+template("merve_gn_build") {
+ config("merve_config") {
+ include_dirs = [ "." ]
+ }
+ gypi_values = exec_script("../../tools/gypi_to_gn.py",
+ [ rebase_path("merve.gyp") ],
+ "scope",
+ [ "merve.gyp" ])
+ source_set(target_name) {
+ forward_variables_from(invoker, "*")
+ public_configs = [ ":merve_config" ]
+ sources = gypi_values.merve_sources
+ }
+}
diff --git a/node.gni b/node.gni
index d4438f7fd61598afac2c1e3184721a759d22b10c..156fee33b3813fe4d94a1c9585f217a99dbfbd5f 100644
index d4438f7fd61598afac2c1e3184721a759d22b10c..e2407027ab05e59b2f0f1c213b98ea469db7a91b 100644
--- a/node.gni
+++ b/node.gni
@@ -5,10 +5,10 @@
@@ -86,16 +40,7 @@ index d4438f7fd61598afac2c1e3184721a759d22b10c..156fee33b3813fe4d94a1c9585f217a9
# The location of OpenSSL - use the one from node's deps by default.
node_openssl_path = "$node_path/deps/openssl"
@@ -26,8 +26,6 @@ declare_args() {
# TODO(zcbenz): This is currently copied from configure.py, we should share
# the list between configure.py and GN configurations.
node_builtin_shareable_builtins = [
- "deps/cjs-module-lexer/lexer.js",
- "deps/cjs-module-lexer/dist/lexer.js",
"deps/undici/undici.js",
"deps/amaro/dist/index.js",
]
@@ -50,7 +48,7 @@ declare_args() {
@@ -50,7 +50,7 @@ declare_args() {
node_openssl_system_ca_path = ""
# Initialize v8 platform during node.js startup.
@@ -104,7 +49,7 @@ index d4438f7fd61598afac2c1e3184721a759d22b10c..156fee33b3813fe4d94a1c9585f217a9
# Custom build tag.
node_tag = ""
@@ -70,10 +68,16 @@ declare_args() {
@@ -70,10 +70,16 @@ declare_args() {
# TODO(zcbenz): There are few broken things for now:
# 1. cross-os compilation is not supported.
# 2. node_mksnapshot crashes when cross-compiling for x64 from arm64.
@@ -123,10 +68,10 @@ index d4438f7fd61598afac2c1e3184721a759d22b10c..156fee33b3813fe4d94a1c9585f217a9
assert(!node_enable_inspector || node_use_openssl,
diff --git a/src/node_builtins.cc b/src/node_builtins.cc
index f25ca01d6ef016489371a3a1c9d8500da65e8023..2c816bef8d64f3e0ba2993c4885641620ee64272 100644
index 7b34b14856a5193c723987f69d6040bdb6aa7c34..90fdf52d79954bf2cd86fd1d2d6da8199683d344 100644
--- a/src/node_builtins.cc
+++ b/src/node_builtins.cc
@@ -760,6 +760,7 @@ void BuiltinLoader::RegisterExternalReferences(
@@ -775,6 +775,7 @@ void BuiltinLoader::RegisterExternalReferences(
registry->Register(GetNatives);
RegisterExternalReferencesForInternalizedBuiltinCode(registry);
@@ -306,10 +251,10 @@ index 856878c33681a73d41016729dabe48b0a6a80589..91a11852d206b65485fe90fd037a0bd1
if sys.platform == 'win32':
files = [ x.replace('\\', '/') for x in files ]
diff --git a/unofficial.gni b/unofficial.gni
index c742b62c484e9dd205eff63dcffad78c76828375..bff7b0650cfe8578a044e45d0f9e352859909695 100644
index c742b62c484e9dd205eff63dcffad78c76828375..20d2483bb16e297ab5b12aab6f56948d6d25cb03 100644
--- a/unofficial.gni
+++ b/unofficial.gni
@@ -147,31 +147,42 @@ template("node_gn_build") {
@@ -147,31 +147,41 @@ template("node_gn_build") {
public_configs = [
":node_external_config",
"deps/googletest:googletest_config",
@@ -328,7 +273,6 @@ index c742b62c484e9dd205eff63dcffad78c76828375..bff7b0650cfe8578a044e45d0f9e3528
"deps/cares",
"deps/histogram",
"deps/llhttp",
+ "deps/merve",
"deps/nbytes",
"deps/nghttp2",
- "deps/ngtcp2",
@@ -355,7 +299,7 @@ index c742b62c484e9dd205eff63dcffad78c76828375..bff7b0650cfe8578a044e45d0f9e3528
"$target_gen_dir/node_javascript.cc",
] + gypi_values.node_sources
@@ -194,7 +205,7 @@ template("node_gn_build") {
@@ -194,7 +204,7 @@ template("node_gn_build") {
}
if (node_use_openssl) {
deps += [ "deps/ncrypto" ]
@@ -364,7 +308,7 @@ index c742b62c484e9dd205eff63dcffad78c76828375..bff7b0650cfe8578a044e45d0f9e3528
sources += gypi_values.node_crypto_sources
}
if (node_use_sqlite) {
@@ -223,6 +234,10 @@ template("node_gn_build") {
@@ -223,6 +233,10 @@ template("node_gn_build") {
}
}
@@ -375,7 +319,7 @@ index c742b62c484e9dd205eff63dcffad78c76828375..bff7b0650cfe8578a044e45d0f9e3528
executable(target_name) {
forward_variables_from(invoker, "*")
@@ -314,6 +329,7 @@ template("node_gn_build") {
@@ -314,6 +328,7 @@ template("node_gn_build") {
}
executable("node_js2c") {
@@ -383,7 +327,7 @@ index c742b62c484e9dd205eff63dcffad78c76828375..bff7b0650cfe8578a044e45d0f9e3528
deps = [
"deps/uv",
"$node_simdutf_path",
@@ -324,26 +340,75 @@ template("node_gn_build") {
@@ -324,26 +339,75 @@ template("node_gn_build") {
"src/embedded_data.cc",
"src/embedded_data.h",
]
@@ -469,7 +413,7 @@ index c742b62c484e9dd205eff63dcffad78c76828375..bff7b0650cfe8578a044e45d0f9e3528
outputs = [ "$target_gen_dir/node_javascript.cc" ]
# Get the path to node_js2c executable of the host toolchain.
@@ -357,11 +422,11 @@ template("node_gn_build") {
@@ -357,11 +421,11 @@ template("node_gn_build") {
get_label_info(":node_js2c($host_toolchain)", "name") +
host_executable_suffix

View File

@@ -14,10 +14,18 @@ We don't need to do this for zlib, as the existing gn workflow uses the same
Upstreamed at https://github.com/nodejs/node/pull/55903
diff --git a/unofficial.gni b/unofficial.gni
index bff7b0650cfe8578a044e45d0f9e352859909695..4ab316e45bd84e43a53335df60f847b17fe6c2fa 100644
index 20d2483bb16e297ab5b12aab6f56948d6d25cb03..253226009faf563f6db285d4b2908f308c1f96ea 100644
--- a/unofficial.gni
+++ b/unofficial.gni
@@ -199,7 +199,17 @@ template("node_gn_build") {
@@ -160,7 +160,6 @@ template("node_gn_build") {
":run_node_js2c",
"deps/cares",
"deps/histogram",
- "deps/llhttp",
"deps/nbytes",
"deps/nghttp2",
"deps/postject",
@@ -198,7 +197,17 @@ template("node_gn_build") {
configs -= [ "//build/config/gcc:symbol_visibility_hidden" ]
configs += [ "//build/config/gcc:symbol_visibility_default" ]
}
@@ -36,7 +44,7 @@ index bff7b0650cfe8578a044e45d0f9e352859909695..4ab316e45bd84e43a53335df60f847b1
if (v8_enable_i18n_support) {
deps += [ "//third_party/icu" ]
}
@@ -232,6 +242,19 @@ template("node_gn_build") {
@@ -231,6 +240,19 @@ template("node_gn_build") {
sources += node_inspector.node_inspector_sources +
node_inspector.node_inspector_generated_sources
}

View File

@@ -33,7 +33,7 @@ index 8d7204f6cb48f783adc4d1c1eb2de0c83b7fffe2..a154559a56bf383d3c26af523c9bb07b
// Non-alphabetic chars.
diff --git a/lib/internal/http.js b/lib/internal/http.js
index f8b4fd7c4ca5a0907806c7e804de8c951675a36a..209e3bcf8be5a23ac528dcd673bed82cbad709ca 100644
index e664663348adc7bb31f7c9ec78481bbeb71401d9..62b659beb766b8256b214447af376f438278b058 100644
--- a/lib/internal/http.js
+++ b/lib/internal/http.js
@@ -11,8 +11,8 @@ const {
@@ -64,10 +64,10 @@ index f8b4fd7c4ca5a0907806c7e804de8c951675a36a..209e3bcf8be5a23ac528dcd673bed82c
function ipToInt(ip) {
diff --git a/node.gyp b/node.gyp
index f5cd416b5fe7a51084bc4af9a4427a8e62599fd8..5eb70ce3820f2b82121bc102c5182ab768cbef36 100644
index c035d1d7cdac1d18cca0ef5cefbc5ce4c1fd1b86..a48e4e5d1fb7621b12b9abeaaf78214515a23efc 100644
--- a/node.gyp
+++ b/node.gyp
@@ -182,7 +182,6 @@
@@ -176,7 +176,6 @@
'src/timers.cc',
'src/timer_wrap.cc',
'src/tracing/agent.cc',
@@ -75,7 +75,7 @@ index f5cd416b5fe7a51084bc4af9a4427a8e62599fd8..5eb70ce3820f2b82121bc102c5182ab7
'src/tracing/node_trace_writer.cc',
'src/tracing/trace_event.cc',
'src/tracing/traced_value.cc',
@@ -314,7 +313,6 @@
@@ -308,7 +307,6 @@
'src/tcp_wrap.h',
'src/timers.h',
'src/tracing/agent.h',

View File

@@ -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 b3b5c23e471ece7584d209b3ae4197c46011d50e..bdcea65ad3e0315c85b1818e695d8b63093aed34 100644
index cf3ceaf19972ee107deff63b4dba16c12191c615..6159350823fd9f0090e2b98e8797e829fd481750 100644
--- a/common.gypi
+++ b/common.gypi
@@ -89,6 +89,8 @@
@@ -42,10 +42,10 @@ index b3b5c23e471ece7584d209b3ae4197c46011d50e..bdcea65ad3e0315c85b1818e695d8b63
# list in v8/BUILD.gn.
['v8_enable_v8_checks == 1', {
diff --git a/configure.py b/configure.py
index fd13970ae73bbe5db186f81faed792a5597bbcd0..162e3b09c92b49cd39d32a87ff97a54555d3e47b 100755
index 209f23b04663113e4f6b3c3242c0544cfed9a950..88164b99ae3d37f47e5e9a9ba96d7b450d6ba4ab 100755
--- a/configure.py
+++ b/configure.py
@@ -1802,6 +1802,7 @@ def configure_library(lib, output, pkgname=None):
@@ -1717,6 +1717,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)
@@ -54,7 +54,7 @@ index fd13970ae73bbe5db186f81faed792a5597bbcd0..162e3b09c92b49cd39d32a87ff97a545
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 ebfd7229b5f0044b628fbe0b03ac211f0c6ed9a6..b92a9d42da8419741c435643b7401efcb21a9e8b 100644
index be22ad370217a13aef2479d478a6373feaf6f208..19c34a430d095c06ccf5a988db91311d420a485a 100644
--- a/src/node.h
+++ b/src/node.h
@@ -22,6 +22,12 @@

View File

@@ -10,10 +10,10 @@ JS errors and ensures embedder JS is loaded via LoadEmbedderJavaScriptSource.
That method is generated by our modifications to js2c.cc in the BUILD.gn patch
diff --git a/lib/internal/fs/watchers.js b/lib/internal/fs/watchers.js
index a493c9579669072d97c7caa9049e846bda36f8b9..334ffaa6f2d955125ca8b427ace1442c94011e18 100644
index 605dee28cace56f2366fec9d7f18894559044ae4..15dcabb3b1682438eb6d5a681363b7ea8602b9e7 100644
--- a/lib/internal/fs/watchers.js
+++ b/lib/internal/fs/watchers.js
@@ -361,12 +361,13 @@ function emitCloseNT(self) {
@@ -299,12 +299,13 @@ function emitCloseNT(self) {
}
// Legacy alias on the C++ wrapper object. This is not public API, so we may
@@ -34,7 +34,7 @@ index a493c9579669072d97c7caa9049e846bda36f8b9..334ffaa6f2d955125ca8b427ace1442c
let kResistStopPropagation;
diff --git a/src/node_builtins.cc b/src/node_builtins.cc
index 2c816bef8d64f3e0ba2993c4885641620ee64272..3377d697615ee168e49e83c4202bc227581f1aaf 100644
index 90fdf52d79954bf2cd86fd1d2d6da8199683d344..703ac1be06249736073f797058d170576a0db1bf 100644
--- a/src/node_builtins.cc
+++ b/src/node_builtins.cc
@@ -39,6 +39,7 @@ using v8::Value;
@@ -42,9 +42,9 @@ index 2c816bef8d64f3e0ba2993c4885641620ee64272..3377d697615ee168e49e83c4202bc227
: config_(GetConfig()), code_cache_(std::make_shared<BuiltinCodeCache>()) {
LoadJavaScriptSource();
+ LoadEmbedderJavaScriptSource();
#ifdef NODE_SHARED_BUILTIN_UNDICI_UNDICI_PATH
AddExternalizedBuiltin("internal/deps/undici/undici",
STRINGIFY(NODE_SHARED_BUILTIN_UNDICI_UNDICI_PATH));
#ifdef NODE_SHARED_BUILTIN_CJS_MODULE_LEXER_LEXER_PATH
AddExternalizedBuiltin(
"internal/deps/cjs-module-lexer/lexer",
diff --git a/src/node_builtins.h b/src/node_builtins.h
index bcdd50f635757f41287c87df1db9cd3b55c4b6b9..e908f3c0e314b90ff7b6c599940ea8f4e657c709 100644
--- a/src/node_builtins.h

View File

@@ -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 bdcea65ad3e0315c85b1818e695d8b63093aed34..0653735a0b154e326e5df7049a7beb395f0015c8 100644
index 6159350823fd9f0090e2b98e8797e829fd481750..5f47ec9bb405f6c1574304ac68807929604cd402 100644
--- a/common.gypi
+++ b/common.gypi
@@ -128,6 +128,7 @@

View File

@@ -10,7 +10,7 @@ M151, and so we should allow for building until then.
This patch can be removed at the M151 branch point.
diff --git a/common.gypi b/common.gypi
index 0653735a0b154e326e5df7049a7beb395f0015c8..006f52ed18d955da0d9a06e881e86e6e724095ac 100644
index 5f47ec9bb405f6c1574304ac68807929604cd402..914f28b41d05b1485874885570ae5adaabd8e1b2 100644
--- a/common.gypi
+++ b/common.gypi
@@ -677,7 +677,7 @@

View File

@@ -20,7 +20,7 @@ index ab7dc27de3e304f6d912d5834da47e3b4eb25495..b6c0fd4ceee989dac55c7d54e52fef18
}
}
diff --git a/unofficial.gni b/unofficial.gni
index 4ab316e45bd84e43a53335df60f847b17fe6c2fa..def9a302830e493e51cc2b3588816fcbd3a1bb51 100644
index 253226009faf563f6db285d4b2908f308c1f96ea..dd686d2f7c8d2f6e8d6bd13a7bf2b4b140556ba9 100644
--- a/unofficial.gni
+++ b/unofficial.gni
@@ -143,7 +143,10 @@ template("node_gn_build") {
@@ -35,7 +35,7 @@ index 4ab316e45bd84e43a53335df60f847b17fe6c2fa..def9a302830e493e51cc2b3588816fcb
public_configs = [
":node_external_config",
"deps/googletest:googletest_config",
@@ -364,6 +367,7 @@ template("node_gn_build") {
@@ -362,6 +365,7 @@ template("node_gn_build") {
"src/embedded_data.h",
]
include_dirs = [ "src", "tools" ]

View File

@@ -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 740706e917b7d28c520abdbd743605bf73274f30..9ab30b3c9bc663d2947fcbfaac6f06d2c8f8a5b1 100644
index 3b284583d6ccc9b2d0273d678335b9ab0a6fa81c..fbbdc26b8d1428084709ab113f102c42424842b0 100644
--- a/src/node_binding.cc
+++ b/src/node_binding.cc
@@ -656,6 +656,10 @@ void GetInternalBinding(const FunctionCallbackInfo<Value>& args) {
@@ -655,6 +655,10 @@ void GetInternalBinding(const FunctionCallbackInfo<Value>& args) {
args.GetReturnValue().Set(exports);
}

View File

@@ -18,10 +18,10 @@ Stage 3.
Upstreamed in https://github.com/nodejs/node/pull/60364
diff --git a/src/node.cc b/src/node.cc
index b9d35e60f39d1edd910cd0fc1e57157458db93f5..4421ddd05f69e32f38d074a4cc04e4e7eac89e76 100644
index ae082f2d0498e0e694e427da71078ca19086e275..f9630a5cd9bed1535a7839517313a2d47d403b1f 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -778,7 +778,7 @@ static ExitCode ProcessGlobalArgsInternal(std::vector<std::string>* args,
@@ -782,7 +782,7 @@ static ExitCode ProcessGlobalArgsInternal(std::vector<std::string>* args,
if (std::ranges::find(v8_args, "--no-js-source-phase-imports") ==
v8_args.end()) {

View File

@@ -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 c5a7dc9cacf8b983984e7c7de9e63d26e418cc8d..b3b5c23e471ece7584d209b3ae4197c46011d50e 100644
index 5adfd888711ae46a3ba157853359145c4409169b..cf3ceaf19972ee107deff63b4dba16c12191c615 100644
--- a/common.gypi
+++ b/common.gypi
@@ -91,6 +91,23 @@

View File

@@ -78,7 +78,7 @@ index a944c18518471a55a44a7ff32190fe9920d0cb20..82214a5d051bb2ca487c92f684b03dcf
void* Data() { return data_; }
diff --git a/src/node_modules.cc b/src/node_modules.cc
index d067b47e7e30a95740fe0275c70445707dec426b..391c57eed9058602bd8311d885cf5fc60bfea903 100644
index c5c61888ecaaeeb23ebc9887f19ae3ad4c30dbd4..e2db3f4935ad58c5b409c67bfe5fc964f4ea5e83 100644
--- a/src/node_modules.cc
+++ b/src/node_modules.cc
@@ -642,7 +642,7 @@ void GetCompileCacheEntry(const FunctionCallbackInfo<Value>& args) {

View File

@@ -9,10 +9,10 @@ conflict with Blink's in renderer and worker processes.
We should try to upstream some version of this.
diff --git a/doc/api/cli.md b/doc/api/cli.md
index f05686608297e538f0a6f65abb389281bced4291..c8da076f80a559b9ee6d2ffed831b088c15c8e88 100644
index d94226df8d90d791c3c5fdb7cab7357b0e2555b0..7512ec43ea10d9b0e167125040bc8136f7ad568a 100644
--- a/doc/api/cli.md
+++ b/doc/api/cli.md
@@ -1820,6 +1820,14 @@ changes:
@@ -1814,6 +1814,14 @@ changes:
Disable using [syntax detection][] to determine module type.
@@ -27,7 +27,7 @@ index f05686608297e538f0a6f65abb389281bced4291..c8da076f80a559b9ee6d2ffed831b088
### `--no-experimental-global-navigator`
<!-- YAML
@@ -3499,6 +3507,7 @@ one is included in the list below.
@@ -3493,6 +3501,7 @@ one is included in the list below.
* `--no-addons`
* `--no-async-context-frame`
* `--no-deprecation`
@@ -96,7 +96,7 @@ index f6f81f50c8bd91a72ca96093dc64c183bd58039b..aa18dab6e4171d8a7f0af4b7db1b8c2c
"experimental WebSocket API",
&EnvironmentOptions::experimental_websocket,
diff --git a/test/parallel/test-process-env-allowed-flags-are-documented.js b/test/parallel/test-process-env-allowed-flags-are-documented.js
index d62a2583523c6b3c1de394a18e8060199e446bf1..7d6c6ea7949fd6b52bb54c31a2d71257349e64a9 100644
index f09bf0940dad2068f0aa5dce783dd422773d4bbb..ccf4ffcacf9bd9965978738656b8fe091fee4d6a 100644
--- a/test/parallel/test-process-env-allowed-flags-are-documented.js
+++ b/test/parallel/test-process-env-allowed-flags-are-documented.js
@@ -122,7 +122,6 @@ const undocumented = difference(process.allowedNodeEnvironmentFlags,

View File

@@ -11,7 +11,7 @@ We can fix this by allowing the C++ implementation of legacyMainResolve to use
a fileExists function that does take Asar into account.
diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js
index 81799fc159cf20344aac64cd7129240deb9a4fe8..12b476ff97603718186dd25b1f435d377841bd89 100644
index 8dc8bbfe8d73e2d11edc261d6fe9f37aaa81e4cd..9c965f21918b8170ca2c2d6efee067b52537698e 100644
--- a/lib/internal/modules/esm/resolve.js
+++ b/lib/internal/modules/esm/resolve.js
@@ -28,14 +28,13 @@ const { BuiltinModule } = require('internal/bootstrap/realm');

View File

@@ -12,10 +12,10 @@ This can be removed/refactored once Node.js upgrades to a version of V8
containing the above CL.
diff --git a/src/node.cc b/src/node.cc
index 0bc086ccd1ff449c0f3fb08a972a0c45d3178f1c..b9d35e60f39d1edd910cd0fc1e57157458db93f5 100644
index 8791119956ff93d65163d2ef424a8d821ebbdfad..ae082f2d0498e0e694e427da71078ca19086e275 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -1244,7 +1244,7 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args,
@@ -1248,7 +1248,7 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args,
result->platform_ = per_process::v8_platform.Platform();
}

View File

@@ -868,10 +868,10 @@ index d21a6bd3d98d6db26cc82896e62da2869cf22842..21553911f8e16a76187bfff120dfbeea
// Make sure memory isn't released before being returned
diff --git a/test/parallel/test-tls-client-auth.js b/test/parallel/test-tls-client-auth.js
index 04bf40b9a9e1ac6b92e98e3c4201c3e6e427d70c..495a7590be29370900659d1385afcbbb99a1fbf8 100644
index b347c0a88df571296127985f8e7b70de66726cc0..66465783d344dab1330069e36577d41fc75db962 100644
--- a/test/parallel/test-tls-client-auth.js
+++ b/test/parallel/test-tls-client-auth.js
@@ -110,7 +110,7 @@ if (tls.DEFAULT_MAX_VERSION === 'TLSv1.3') connect({
@@ -112,7 +112,7 @@ if (tls.DEFAULT_MAX_VERSION === 'TLSv1.3') connect({
// and sends a fatal Alert to the client that the client discovers there has
// been a fatal error.
pair.client.conn.once('error', common.mustCall((err) => {
@@ -879,12 +879,12 @@ index 04bf40b9a9e1ac6b92e98e3c4201c3e6e427d70c..495a7590be29370900659d1385afcbbb
+ //assert.strictEqual(err.code, 'ERR_SSL_TLSV13_ALERT_CERTIFICATE_REQUIRED');
cleanup();
}));
}));
});
diff --git a/test/parallel/test-tls-peer-certificate.js b/test/parallel/test-tls-peer-certificate.js
index 6c440ee44b8cf862a7bc96975ed503a1f49b33a4..212c2b0cbeeeb929a9622541ea49d9eb198188ce 100644
index 41e3c883d950e074dffcdd6df888eaf47696039c..304724b564956ff3c38cb42793141ddcc57dfd75 100644
--- a/test/parallel/test-tls-peer-certificate.js
+++ b/test/parallel/test-tls-peer-certificate.js
@@ -54,7 +54,7 @@ connect({
@@ -55,7 +55,7 @@ connect({
assert.strictEqual(peerCert.ca, false);
assert.strictEqual(peerCert.issuerCertificate.ca, true);
assert.strictEqual(peerCert.subject.emailAddress, 'ry@tinyclouds.org');
@@ -893,7 +893,7 @@ index 6c440ee44b8cf862a7bc96975ed503a1f49b33a4..212c2b0cbeeeb929a9622541ea49d9eb
assert.strictEqual(peerCert.exponent, '0x10001');
assert.strictEqual(peerCert.bits, 2048);
// The conversion to bits is odd because modulus isn't a buffer, its a hex
@@ -94,7 +94,7 @@ connect({
@@ -95,7 +95,7 @@ connect({
const issuer = peerCert.issuerCertificate;
assert.strictEqual(issuer.issuerCertificate, issuer);
@@ -901,8 +901,8 @@ index 6c440ee44b8cf862a7bc96975ed503a1f49b33a4..212c2b0cbeeeb929a9622541ea49d9eb
+ assert.match(issuer.serialNumber, /4AB16C8DFD6A7D0D2DFCABDF9C4B0E92C6AD0229/i);
return cleanup();
}));
@@ -112,7 +112,7 @@ connect({
});
@@ -114,7 +114,7 @@ connect({
assert.ok(peerCert.issuerCertificate);
assert.strictEqual(peerCert.subject.emailAddress, 'ry@tinyclouds.org');
@@ -911,7 +911,7 @@ index 6c440ee44b8cf862a7bc96975ed503a1f49b33a4..212c2b0cbeeeb929a9622541ea49d9eb
assert.strictEqual(peerCert.exponent, undefined);
assert.strictEqual(peerCert.pubKey, undefined);
assert.strictEqual(peerCert.modulus, undefined);
@@ -144,7 +144,6 @@ connect({
@@ -146,7 +146,6 @@ connect({
const issuer = peerCert.issuerCertificate;
assert.strictEqual(issuer.issuerCertificate, issuer);
@@ -919,12 +919,12 @@ index 6c440ee44b8cf862a7bc96975ed503a1f49b33a4..212c2b0cbeeeb929a9622541ea49d9eb
-
+ assert.match(issuer.serialNumber, /32E8197681DA33185867B52885F678BFDBA51727/i);
return cleanup();
}));
});
diff --git a/test/parallel/test-tls-pfx-authorizationerror.js b/test/parallel/test-tls-pfx-authorizationerror.js
index 53fcc0b16b5bd6f50c334fb7cc5671e31c1546b9..da428f1320e9e7bd1683724806a7438ed5aa38cc 100644
index eb705d591ef23a90bd78d52797fd1a58bc84a7dd..da428f1320e9e7bd1683724806a7438ed5aa38cc 100644
--- a/test/parallel/test-tls-pfx-authorizationerror.js
+++ b/test/parallel/test-tls-pfx-authorizationerror.js
@@ -22,8 +22,8 @@ const server = tls
@@ -22,13 +22,13 @@ const server = tls
rejectUnauthorized: false
},
common.mustCall(function(c) {
@@ -935,7 +935,19 @@ index 53fcc0b16b5bd6f50c334fb7cc5671e31c1546b9..da428f1320e9e7bd1683724806a7438e
assert.strictEqual(c.authorizationError, null);
c.end();
})
@@ -41,8 +41,8 @@ const server = tls
)
- .listen(0, function() {
+ .listen(0, common.mustCall(function() {
const client = tls.connect(
{
port: this.address().port,
@@ -36,16 +36,16 @@ const server = tls
passphrase: 'sample',
rejectUnauthorized: false
},
- function() {
+ common.mustCall(() => {
for (let i = 0; i < 10; ++i) {
// Calling this repeatedly is a regression test that verifies
// that .getCertificate() does not accidentally decrease the
// reference count of the X509* certificate on the native side.
@@ -946,6 +958,11 @@ index 53fcc0b16b5bd6f50c334fb7cc5671e31c1546b9..da428f1320e9e7bd1683724806a7438e
}
client.end();
server.close();
- }
+ }),
);
- });
+ }));
diff --git a/test/parallel/test-tls-set-sigalgs.js b/test/parallel/test-tls-set-sigalgs.js
index 985ca13ba2ac7d58f87c263c7654c4f4087efddf..21c199bdb12739f82a075c4e10e08faf8c587cf4 100644
--- a/test/parallel/test-tls-set-sigalgs.js
@@ -1028,7 +1045,7 @@ index bd788ec4ed88289d35798b8af8c9490a68e081a2..c6a6f33490595faabaefc9b58afdd813
for (const name of ['ML-DSA-44', 'ML-DSA-65', 'ML-DSA-87']) {
parameters.push({
diff --git a/test/parallel/test-x509-escaping.js b/test/parallel/test-x509-escaping.js
index a5937a09cb1535778a6345885a69ca9bcecf3e96..336313d30b3329b73c04f2f6d6a5e02375a11a72 100644
index c8fc4abbb108a6d6849e8452d97d29187da2ebe6..825ba4c8dce775f401080a0522565bb7a087bcc3 100644
--- a/test/parallel/test-x509-escaping.js
+++ b/test/parallel/test-x509-escaping.js
@@ -438,7 +438,7 @@ const { hasOpenSSL3 } = require('../common/crypto');

View File

@@ -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/translators.js b/lib/internal/modules/esm/translators.js
index a6fbcb6fd3c2413df96273d93b7339cad3f25f7a..130fe48b233691d8ee4c5d56f80d331924619008 100644
index e4d5579565eea07013c8260fa3c4aa3b266a4b35..fbcef937b26023e0f6f97a0e58ac7350e7616f58 100644
--- a/lib/internal/modules/esm/translators.js
+++ b/lib/internal/modules/esm/translators.js
@@ -392,6 +392,10 @@ function cjsPreparseModuleExports(filename, source, format) {
@@ -407,6 +407,10 @@ function cjsPreparseModuleExports(filename, source, format) {
return { module, exportNames: module[kModuleExportNames] };
}

View File

@@ -8,7 +8,7 @@ resource path. This commit ensures that the TraverseParent function
bails out if the parent path is outside of the resource path.
diff --git a/src/node_modules.cc b/src/node_modules.cc
index 0cd351e7aff9e293e736e0aca22e67b577eb48eb..b925434940baeeb6b06882242ca947736866d175 100644
index 04ebecc5d924f6c2fddd9992462d1ff692e1cee5..5d9a9da3a068a68c13c5c0cacfe07eec3dad8bc3 100644
--- a/src/node_modules.cc
+++ b/src/node_modules.cc
@@ -345,8 +345,41 @@ const BindingData::PackageConfig* BindingData::TraverseParent(

View File

@@ -8,10 +8,10 @@ an API override to replace the native `ReadFileSync` in the `modules`
binding.
diff --git a/src/env_properties.h b/src/env_properties.h
index 454750db0113d289e7f8c8cb160e91797790572c..09786f710a88e0243bfaab10d0eca5cb2db62245 100644
index bb874fec74c73b5de0ef6d1e2a872ebceefb11ce..6fafe2a8029c535fa98276e2d73f04ee603a7805 100644
--- a/src/env_properties.h
+++ b/src/env_properties.h
@@ -492,6 +492,7 @@
@@ -491,6 +491,7 @@
V(maybe_cache_generated_source_map, v8::Function) \
V(messaging_deserialize_create_object, v8::Function) \
V(message_port, v8::Object) \
@@ -20,7 +20,7 @@ index 454750db0113d289e7f8c8cb160e91797790572c..09786f710a88e0243bfaab10d0eca5cb
V(performance_entry_callback, v8::Function) \
V(prepare_stack_trace_callback, v8::Function) \
diff --git a/src/node_modules.cc b/src/node_modules.cc
index 3e4918a35e0d2f100f14596a3857f927b2a38c8f..ffc19850ac563082b14729e93d69695ef2c868f5 100644
index 95a7b8c32693c32ca9f57e01aff9ef06b84f78b2..cecdda74847801fd5821bc0afdf0dfc9f131c44a 100644
--- a/src/node_modules.cc
+++ b/src/node_modules.cc
@@ -23,12 +23,14 @@ namespace modules {
@@ -118,7 +118,7 @@ index 3e4918a35e0d2f100f14596a3857f927b2a38c8f..ffc19850ac563082b14729e93d69695e
SetMethod(isolate, target, "readPackageJSON", ReadPackageJSON);
SetMethod(isolate,
target,
@@ -751,6 +802,8 @@ void BindingData::CreatePerContextProperties(Local<Object> target,
@@ -735,6 +786,8 @@ void BindingData::CreatePerContextProperties(Local<Object> target,
void BindingData::RegisterExternalReferences(
ExternalReferenceRegistry* registry) {

View File

@@ -77,10 +77,10 @@ index 22c1e9f1ae652b033903f56f394352806ddff754..961da666a233541203b5416909fd1ff0
if (cjsModule?.[kIsExecuting]) {
const parentFilename = urlToFilename(parentURL);
diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js
index cc1230648881d8d14ba3902fca78291c90fb79fb..edf347102fedbb28bce221defa99c37b5834024b 100644
index c1d774b9c5c4049f7ecda4e3a1faaa59dad01764..4fd58b1cea557ec122bd860e1ebc15bd04c44f78 100644
--- a/lib/internal/modules/esm/resolve.js
+++ b/lib/internal/modules/esm/resolve.js
@@ -751,6 +751,9 @@ function packageImportsResolve(name, base, conditions) {
@@ -752,6 +752,9 @@ function packageImportsResolve(name, base, conditions) {
throw importNotDefined(name, packageJSONUrl, base);
}
@@ -90,7 +90,7 @@ index cc1230648881d8d14ba3902fca78291c90fb79fb..edf347102fedbb28bce221defa99c37b
/**
* Resolves a package specifier to a URL.
@@ -765,6 +768,11 @@ function packageResolve(specifier, base, conditions) {
@@ -766,6 +769,11 @@ function packageResolve(specifier, base, conditions) {
return new URL('node:' + specifier);
}
@@ -103,10 +103,10 @@ index cc1230648881d8d14ba3902fca78291c90fb79fb..edf347102fedbb28bce221defa99c37b
const packageConfig = packageJsonReader.read(packageJSONPath, { __proto__: null, specifier, base, isESM: true });
diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js
index d6c96996a900da8e7d4f7f5104312e73e72c2d62..ec76d7ffa45f49721d395e8e33be79114daa0369 100644
index 1716328c7a98996a8933dbaa00a1c6c3156fb2ff..30f887663bbbd9913eff35f0e6e5b8291adda120 100644
--- a/lib/internal/modules/esm/translators.js
+++ b/lib/internal/modules/esm/translators.js
@@ -214,7 +214,9 @@ function createCJSModuleWrap(url, translateContext, parentURL, loadCJS = loadCJS
@@ -223,7 +223,9 @@ function createCJSModuleWrap(url, translateContext, parentURL, loadCJS = loadCJS
const { exportNames, module } = cjsPreparseModuleExports(filename, source, sourceFormat);
cjsCache.set(url, module);
@@ -117,7 +117,7 @@ index d6c96996a900da8e7d4f7f5104312e73e72c2d62..ec76d7ffa45f49721d395e8e33be7911
if (!exportNames.has('default')) {
ArrayPrototypePush(wrapperNames, 'default');
}
@@ -313,6 +315,10 @@ translators.set('require-commonjs', (url, translateContext, parentURL) => {
@@ -325,6 +327,10 @@ translators.set('require-commonjs', (url, translateContext, parentURL) => {
return createCJSModuleWrap(url, translateContext, parentURL);
});

View File

@@ -94,7 +94,7 @@ index 175ec8ba0f2a908ffad2ce48434aeed573b09c90..3218590ddce1e92c2a9d776f20f9fb01
Cipher() = default;
Cipher(const EVP_CIPHER* cipher) : cipher_(cipher) {}
diff --git a/node.gni b/node.gni
index 156fee33b3813fe4d94a1c9585f217a99dbfbd5f..8239967653fee7791800ee3292e77b91bffaaef9 100644
index e2407027ab05e59b2f0f1c213b98ea469db7a91b..c64761b730e61edcdc0e46a48699f2fd5bb1c0a6 100644
--- a/node.gni
+++ b/node.gni
@@ -11,7 +11,7 @@ declare_args() {
@@ -298,7 +298,7 @@ index 3ab33341806ad6c0b06b982a30a57b7b5399e38f..754ddf7b331465c56081db05d6fd2a45
// 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 7f6268a1d83d3182b318bc95fd2ee119a2df8dea..f2ee335aa98a2465f63dafa33664197acc6f79b1 100644
index d9c533f100d25aeab1fe8589932a8ddead431258..2acab8786a8a752b17961445edeb872c2b08fdeb 100644
--- a/src/node_metadata.h
+++ b/src/node_metadata.h
@@ -8,7 +8,7 @@

View File

@@ -28,7 +28,7 @@ index 5f1921d15bc1d3a68c35990f85e36a0e8a5b3ec4..99c6ce57c04768d125dd0a1c6bd62bca
const result = dataURLProcessor(url);
if (result === 'failure') {
diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js
index edf347102fedbb28bce221defa99c37b5834024b..81799fc159cf20344aac64cd7129240deb9a4fe8 100644
index 4fd58b1cea557ec122bd860e1ebc15bd04c44f78..8dc8bbfe8d73e2d11edc261d6fe9f37aaa81e4cd 100644
--- a/lib/internal/modules/esm/resolve.js
+++ b/lib/internal/modules/esm/resolve.js
@@ -25,7 +25,7 @@ const {
@@ -50,10 +50,10 @@ index edf347102fedbb28bce221defa99c37b5834024b..81799fc159cf20344aac64cd7129240d
});
const { search, hash } = resolved;
diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js
index ec76d7ffa45f49721d395e8e33be79114daa0369..a6fbcb6fd3c2413df96273d93b7339cad3f25f7a 100644
index 30f887663bbbd9913eff35f0e6e5b8291adda120..e4d5579565eea07013c8260fa3c4aa3b266a4b35 100644
--- a/lib/internal/modules/esm/translators.js
+++ b/lib/internal/modules/esm/translators.js
@@ -23,7 +23,7 @@ const {
@@ -24,7 +24,7 @@ const {
const { BuiltinModule } = require('internal/bootstrap/realm');
const assert = require('internal/assert');
@@ -62,7 +62,7 @@ index ec76d7ffa45f49721d395e8e33be79114daa0369..a6fbcb6fd3c2413df96273d93b7339ca
const { dirname, extname } = require('path');
const {
assertBufferSource,
@@ -350,7 +350,7 @@ translators.set('commonjs', function commonjsStrategy(url, translateContext, par
@@ -365,7 +365,7 @@ translators.set('commonjs', function commonjsStrategy(url, translateContext, par
try {
// We still need to read the FS to detect the exports.

View File

@@ -10,10 +10,10 @@ change, it seems to introduce an incompatibility when compiling
using clang modules. Disabling them resolves the issue.
diff --git a/unofficial.gni b/unofficial.gni
index def9a302830e493e51cc2b3588816fcbd3a1bb51..900c5e4d8a48d0725420518c923c7024518158b8 100644
index dd686d2f7c8d2f6e8d6bd13a7bf2b4b140556ba9..97e4bcfaa8aa42a5fc2b68ccdd8128eac8886532 100644
--- a/unofficial.gni
+++ b/unofficial.gni
@@ -197,6 +197,10 @@ template("node_gn_build") {
@@ -195,6 +195,10 @@ template("node_gn_build") {
"CoreFoundation.framework",
"Security.framework",
]
@@ -24,7 +24,7 @@ index def9a302830e493e51cc2b3588816fcbd3a1bb51..900c5e4d8a48d0725420518c923c7024
}
if (is_posix) {
configs -= [ "//build/config/gcc:symbol_visibility_hidden" ]
@@ -369,6 +373,12 @@ template("node_gn_build") {
@@ -367,6 +371,12 @@ template("node_gn_build") {
include_dirs = [ "src", "tools" ]
configs += [ "//build/config/compiler:no_exit_time_destructors" ]

View File

@@ -6,7 +6,7 @@ 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 0a6788d1b848d860fa3fa3e857c7feab6f16311e..a6b01d7e143fa6ffeda6fa7723e279db7678ddd4 100644
index 2b199e82fee3a9d56521b9c5cc04a20cdfd6f045..e28755a20176c2806769430910b28a0e61d7691e 100644
--- a/lib/internal/modules/cjs/loader.js
+++ b/lib/internal/modules/cjs/loader.js
@@ -209,6 +209,13 @@ const {
@@ -23,7 +23,7 @@ index 0a6788d1b848d860fa3fa3e857c7feab6f16311e..a6b01d7e143fa6ffeda6fa7723e279db
const {
isProxy,
} = require('internal/util/types');
@@ -1807,9 +1814,12 @@ Module.prototype._compile = function(content, filename, format) {
@@ -1799,10 +1806,12 @@ Module.prototype._compile = function(content, filename, format) {
if (this[kIsMainSymbol] && getOptionValue('--inspect-brk')) {
const { callAndPauseOnStart } = internalBinding('inspector');
result = callAndPauseOnStart(compiledWrapper, thisValue, exports,
@@ -31,10 +31,10 @@ index 0a6788d1b848d860fa3fa3e857c7feab6f16311e..a6b01d7e143fa6ffeda6fa7723e279db
+ require, module, filename, dirname,
+ process, localGlobal, localBuffer);
} else {
- result = FunctionPrototypeCall(compiledWrapper, thisValue, exports, require, module, filename, dirname);
+ result = FunctionPrototypeCall(compiledWrapper, thisValue, exports,
+ require, module, filename, dirname,
+ process, localGlobal, localBuffer);
result = ReflectApply(compiledWrapper, thisValue,
- [exports, require, module, filename, dirname]);
+ [exports, require, module, filename, dirname,
+ process, localGlobal, localBuffer]);
}
this[kIsExecuting] = false;
if (requireDepth === 0) { statCache = null; }

View File

@@ -18,7 +18,7 @@ This can be removed when Node.js upgrades to a version of V8 containing CLs
from the above issue.
diff --git a/src/api/environment.cc b/src/api/environment.cc
index 5f51ad205189bd75d0d9638b1104c12b537b4e9b..8974bac7dca43294cc5cc4570f8e2e78f42aefaa 100644
index 53f05293bd94e159dfedf48735989e668acdd08e..d753ad6c6b49b26b86920124f7ac90c1e052638e 100644
--- a/src/api/environment.cc
+++ b/src/api/environment.cc
@@ -323,6 +323,10 @@ Isolate* NewIsolate(Isolate::CreateParams* params,
@@ -102,7 +102,7 @@ index fdabe48dd7776c59298f7d972286d0d2ed062752..b5cf58cc953590493beb52abf249e33e
isolate, object, wrappable);
}
diff --git a/src/node.h b/src/node.h
index b92a9d42da8419741c435643b7401efcb21a9e8b..bbe35c7a8f1bc0bcddf628af42b71efaef8a7759 100644
index 19c34a430d095c06ccf5a988db91311d420a485a..5a6004ca4dfd15a813f3fcc7687958432e4fd5a0 100644
--- a/src/node.h
+++ b/src/node.h
@@ -78,6 +78,7 @@
@@ -123,7 +123,7 @@ index b92a9d42da8419741c435643b7401efcb21a9e8b..bbe35c7a8f1bc0bcddf628af42b71efa
NODE_EXTERN v8::Isolate* NewIsolate(
std::shared_ptr<ArrayBufferAllocator> allocator,
struct uv_loop_s* event_loop,
@@ -1702,9 +1704,10 @@ void RegisterSignalHandler(int signal,
@@ -1624,9 +1626,10 @@ void RegisterSignalHandler(int signal,
// work with only Node.js versions with v8::Object::Wrap() should use that
// instead.
NODE_DEPRECATED("Use v8::Object::Wrap()",
@@ -138,7 +138,7 @@ index b92a9d42da8419741c435643b7401efcb21a9e8b..bbe35c7a8f1bc0bcddf628af42b71efa
} // namespace node
diff --git a/src/node_main_instance.cc b/src/node_main_instance.cc
index 6f674df3ed0dc1b4e5cd3a249fb787a9fc98361d..90f9eb84b6835c36a91ce23d77722812ce173c0f 100644
index dd6ecd1f9d82f6661b2480c0195e33515633429f..334d5cb7df7a763e0929468392dad83421cad606 100644
--- a/src/node_main_instance.cc
+++ b/src/node_main_instance.cc
@@ -44,6 +44,8 @@ NodeMainInstance::NodeMainInstance(const SnapshotData* snapshot_data,
@@ -151,7 +151,7 @@ index 6f674df3ed0dc1b4e5cd3a249fb787a9fc98361d..90f9eb84b6835c36a91ce23d77722812
isolate_ =
NewIsolate(isolate_params_.get(), event_loop, platform, snapshot_data);
diff --git a/src/node_worker.cc b/src/node_worker.cc
index fa7dc52b19119ed3d2dc407c029f56107476bc39..1acc61af0c995ddefbc00fe232b2454de77a84a3 100644
index fcfd5fecdebd2724441eb83b498b38b11eedad25..e7d26b4c8cbb08a175084ceac51395860dc60598 100644
--- a/src/node_worker.cc
+++ b/src/node_worker.cc
@@ -181,6 +181,9 @@ class WorkerThreadData {

View File

@@ -63,7 +63,7 @@ index e66d4fcb0c064f96cdb819c783027d864fe88d12..619980b36db457ef7e476eacd446e3bf
return Intercepted::kNo;
}
diff --git a/src/node_modules.cc b/src/node_modules.cc
index b925434940baeeb6b06882242ca947736866d175..d067b47e7e30a95740fe0275c70445707dec426b 100644
index 5d9a9da3a068a68c13c5c0cacfe07eec3dad8bc3..c5c61888ecaaeeb23ebc9887f19ae3ad4c30dbd4 100644
--- a/src/node_modules.cc
+++ b/src/node_modules.cc
@@ -682,7 +682,7 @@ static void PathHelpersLazyGetter(Local<v8::Name> name,

View File

@@ -121,10 +121,10 @@ index b30297eac08ad9587642b723f91d7e3b954294d4..4c5427596d1c90d3a413cdd9ff4f1151
auto backing = ArrayBuffer::NewBackingStore(
mem->data,
diff --git a/src/node_buffer.cc b/src/node_buffer.cc
index e1bee00825d140232456d6dc2337420fde6bda17..04edc4ca3c0e7c2284d2822fe9f5de66ff64fda2 100644
index ddee7b7e40c3ee4054b2b15b75154607aa6431ed..decc3c8c966c2322f22d6bdd871514bb53882a29 100644
--- a/src/node_buffer.cc
+++ b/src/node_buffer.cc
@@ -1443,7 +1443,7 @@ inline size_t CheckNumberToSize(Local<Value> number) {
@@ -1420,7 +1420,7 @@ inline size_t CheckNumberToSize(Local<Value> number) {
CHECK(value >= 0 && value < maxSize);
size_t size = static_cast<size_t>(value);
#ifdef V8_ENABLE_SANDBOX
@@ -133,41 +133,6 @@ index e1bee00825d140232456d6dc2337420fde6bda17..04edc4ca3c0e7c2284d2822fe9f5de66
#endif
return size;
}
@@ -1466,6 +1466,26 @@ void CreateUnsafeArrayBuffer(const FunctionCallbackInfo<Value>& args) {
env->isolate_data()->is_building_snapshot()) {
buf = ArrayBuffer::New(isolate, size);
} else {
+#if defined(V8_ENABLE_SANDBOX)
+ // When the V8 sandbox is enabled, all array buffers must be allocated
+ // within the V8 memory cage via the V8 allocator.
+ std::unique_ptr<ArrayBuffer::Allocator> allocator(
+ ArrayBuffer::Allocator::NewDefaultAllocator());
+ void* data = allocator->AllocateUninitialized(size);
+ if (!data) [[unlikely]] {
+ THROW_ERR_MEMORY_ALLOCATION_FAILED(env);
+ return;
+ }
+ std::unique_ptr<BackingStore> store = ArrayBuffer::NewBackingStore(
+ data,
+ size,
+ [](void* data, size_t length, void*) {
+ std::unique_ptr<ArrayBuffer::Allocator> allocator(
+ ArrayBuffer::Allocator::NewDefaultAllocator());
+ allocator->Free(data, length);
+ },
+ nullptr);
+#else
std::unique_ptr<BackingStore> store = ArrayBuffer::NewBackingStore(
isolate,
size,
@@ -1476,6 +1496,7 @@ void CreateUnsafeArrayBuffer(const FunctionCallbackInfo<Value>& args) {
THROW_ERR_MEMORY_ALLOCATION_FAILED(env);
return;
}
+#endif
buf = ArrayBuffer::New(isolate, std::move(store));
}
diff --git a/src/node_i18n.cc b/src/node_i18n.cc
index 3c4f419aa29470b3280174b58680b9421b0340b5..3b24ad2a2316f89d98b067e2c13988f87a9a00d2 100644
--- a/src/node_i18n.cc

View File

@@ -12,10 +12,10 @@ See:
https://chromium-review.googlesource.com/c/v8/v8/+/6826001
diff --git a/test/fixtures/test-runner/output/describe_it.snapshot b/test/fixtures/test-runner/output/describe_it.snapshot
index cae467f6487ffef4fbe94da229e30c2537fe9e95..f1240a6a99dafc18ad51d413719df58b757893ab 100644
index 67d4af7f1b9f45d48b35c930cb1490ee019d0bdf..21d8744340c5a4c002d8c91266f46c2b66591b6e 100644
--- a/test/fixtures/test-runner/output/describe_it.snapshot
+++ b/test/fixtures/test-runner/output/describe_it.snapshot
@@ -726,6 +726,8 @@ not ok 60 - timeouts
@@ -690,6 +690,8 @@ not ok 54 - timeouts
code: 'ERR_TEST_FAILURE'
stack: |-
*
@@ -23,8 +23,8 @@ index cae467f6487ffef4fbe94da229e30c2537fe9e95..f1240a6a99dafc18ad51d413719df58b
+ *
...
1..2
not ok 61 - successful thenable
@@ -748,6 +750,7 @@ not ok 62 - rejected thenable
not ok 55 - successful thenable
@@ -712,6 +714,7 @@ not ok 56 - rejected thenable
code: 'ERR_TEST_FAILURE'
stack: |-
*

View File

@@ -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 73a866bbef8b75e9f351ad9b1d3b0fd7850fca86..a052cc735a5660cb1b8b2875bb24c205ad7ecf94 100644
index 8bf4ae46f2d1d204d05adb6e951a613902f8bae2..2438ed04e3477c3bc74d02717129bf830a40c5f4 100644
--- a/test/parallel/parallel.status
+++ b/test/parallel/parallel.status
@@ -5,6 +5,16 @@ prefix parallel

View File

@@ -99,7 +99,8 @@
"report/test-report-uv-handles",
"report/test-report-worker",
"report/test-report-writereport",
"sea/test-single-executable",
"sea/test-single-executable-blob-config",
"sea/test-single-executable-blob-config-errors",
"sequential/test-tls-connect",
"wpt/test-webcrypto",
"wasm-allocation/test-wasm-allocation"

View File

@@ -86,6 +86,10 @@
#include "v8/include/cppgc/allocation.h"
#include "v8/include/v8-traced-handle.h"
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
#include "extensions/common/url_pattern.h"
#endif
#if BUILDFLAG(IS_WIN)
#include "base/strings/utf_string_conversions.h"
#include "shell/browser/notifications/win/windows_toast_activator.h"
@@ -1546,6 +1550,28 @@ void App::EnableSandbox(gin_helper::ErrorThrower thrower) {
command_line->AppendSwitch(switches::kEnableSandbox);
}
void App::EnableExtensionsOnAllProtocols(gin_helper::ErrorThrower thrower) {
if (Browser::Get()->is_ready()) {
thrower.ThrowError(
"app.enableExtensionsOnAllProtocols() can only be called "
"before app is ready");
return;
}
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
enable_extensions_on_all_protocols_ = true;
URLPattern::EnableExtensionsOnAllProtocols();
#endif
}
bool App::AreExtensionsEnabledOnAllProtocols() const {
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
return enable_extensions_on_all_protocols_;
#else
return false;
#endif
}
v8::Local<v8::Promise> App::SetProxy(gin::Arguments* args) {
v8::Isolate* isolate = args->isolate();
gin_helper::Promise<void> promise(isolate);
@@ -1949,6 +1975,8 @@ gin::ObjectTemplateBuilder App::GetObjectTemplateBuilder(v8::Isolate* isolate) {
&App::IsHardwareAccelerationEnabled)
.SetMethod("disableDomainBlockingFor3DAPIs",
&App::DisableDomainBlockingFor3DAPIs)
.SetMethod("enableExtensionsOnAllProtocols",
&App::EnableExtensionsOnAllProtocols)
.SetMethod("getFileIcon", &App::GetFileIcon)
.SetMethod("getAppMetrics", &App::GetAppMetrics)
.SetMethod("getGPUFeatureStatus", &App::GetGPUFeatureStatus)

View File

@@ -89,6 +89,8 @@ class App final : public gin::Wrappable<App>,
static bool IsPackaged();
bool AreExtensionsEnabledOnAllProtocols() const;
App();
~App() override;
@@ -236,6 +238,7 @@ class App final : public gin::Wrappable<App>,
v8::Local<v8::Promise> GetGPUInfo(v8::Isolate* isolate,
const std::string& info_type);
void EnableSandbox(gin_helper::ErrorThrower thrower);
void EnableExtensionsOnAllProtocols(gin_helper::ErrorThrower thrower);
void SetUserAgentFallback(const std::string& user_agent);
std::string GetUserAgentFallback();
v8::Local<v8::Promise> SetProxy(gin::Arguments* args);
@@ -293,6 +296,10 @@ class App final : public gin::Wrappable<App>,
bool disable_domain_blocking_for_3DAPIs_ = false;
bool watch_singleton_socket_on_ready_ = false;
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
bool enable_extensions_on_all_protocols_ = false;
#endif
std::unique_ptr<content::ScopedAccessibilityMode> scoped_accessibility_mode_;
};

View File

@@ -617,6 +617,12 @@ void ElectronBrowserClient::AppendExtraCommandLineSwitches(
command_line->AppendSwitch(switches::kServiceWorkerPreload);
}
}
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
if (api::App::Get()->AreExtensionsEnabledOnAllProtocols()) {
command_line->AppendSwitch(switches::kEnableExtensionsOnAllProtocols);
}
#endif
}
}

View File

@@ -44,6 +44,7 @@
#include "services/network/public/cpp/simple_url_loader_stream_consumer.h"
#include "services/network/public/cpp/wrapper_shared_url_loader_factory.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
#include "shell/browser/api/electron_api_app.h"
#include "shell/browser/api/electron_api_web_contents.h"
#include "shell/browser/native_window_views.h"
#include "shell/browser/net/asar/asar_url_loader_factory.h"
@@ -865,6 +866,8 @@ void InspectableWebContents::GetSyncInformation(DispatchCallback callback) {
void InspectableWebContents::GetHostConfig(DispatchCallback callback) {
base::DictValue response_dict;
response_dict.Set("devToolsExtensionsOnAllProtocols",
api::App::Get()->AreExtensionsEnabledOnAllProtocols());
base::Value response = base::Value(std::move(response_dict));
std::move(callback).Run(&response);
}

View File

@@ -8,6 +8,7 @@
#include <string_view>
#include "base/strings/cstring_view.h"
#include "electron/buildflags/buildflags.h"
namespace electron {
@@ -270,6 +271,12 @@ inline constexpr base::cstring_view kStreamingSchemes = "streaming-schemes";
// Register schemes as supporting V8 code cache.
inline constexpr base::cstring_view kCodeCacheSchemes = "code-cache-schemes";
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
// Enable Chrome extensions on all protocols.
inline constexpr base::cstring_view kEnableExtensionsOnAllProtocols =
"enable-extensions-on-all-protocols";
#endif
// The browser process app model ID
inline constexpr base::cstring_view kAppUserModelId = "app-user-model-id";

View File

@@ -162,6 +162,11 @@ RendererClientBase::RendererClientBase() {
ParseSchemesCLISwitch(command_line, switches::kSecureSchemes);
for (const std::string& scheme : secure_schemes_list)
url::AddSecureScheme(scheme.data());
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
// Parse --enable-extensions-on-all-protocols
if (command_line->HasSwitch(switches::kEnableExtensionsOnAllProtocols))
URLPattern::EnableExtensionsOnAllProtocols();
#endif
// We rely on the unique process host id which is notified to the
// renderer process via command line switch from the content layer,
// if this switch is removed from the content layer for some reason,

View File

@@ -1765,6 +1765,15 @@ describe('app module', () => {
});
});
describe('enableExtensionsOnAllProtocols() API', () => {
// Proper tests are in extensions-spec.ts
it('throws when called after app is ready', () => {
expect(() => {
app.enableExtensionsOnAllProtocols();
}).to.throw(/before app is ready/);
});
});
describe('disableDomainBlockingFor3DAPIs() API', () => {
it('throws when called after app is ready', () => {
expect(() => {

View File

@@ -3,6 +3,7 @@ import { app, session, webFrameMain, BrowserWindow, ipcMain, WebContents, Extens
import { expect } from 'chai';
import * as WebSocket from 'ws';
import { spawn } from 'node:child_process';
import { once } from 'node:events';
import * as fs from 'node:fs/promises';
import * as http from 'node:http';
@@ -1338,4 +1339,26 @@ describe('chrome extensions', () => {
});
});
});
describe('custom protocol', () => {
async function runFixture (name: string) {
const appProcess = spawn(process.execPath, [(path.join(fixtures, 'extensions', name, 'main.js'))]);
let output = '';
appProcess.stdout.on('data', (data) => { output += data; });
await once(appProcess.stdout, 'end');
return output.trim();
};
it('loads DevTools extensions on custom protocols with app.enableExtensionsOnAllProtocols() and runs content and background scripts', async () => {
const output = await runFixture('custom-protocol');
expect(output).to.equal('Title: MESSAGE RECEIVED');
});
it('loads DevTools panels on custom protocols with app.enableExtensionsOnAllProtocols()', async () => {
const output = await runFixture('custom-protocol-panel');
expect(output).to.equal('ELECTRON TEST PANEL created');
});
});
});

View File

@@ -0,0 +1,7 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<script src="devtools.js"></script>
</head>
</html>

View File

@@ -0,0 +1,4 @@
/* global chrome */
chrome.devtools.panels.create('ELECTRON TEST PANEL', '', 'panel.html');
console.log('ELECTRON TEST PANEL created');

View File

@@ -0,0 +1,6 @@
{
"name": "custom-protocol-panel",
"version": "1.0",
"devtools_page": "devtools.html",
"manifest_version": 3
}

View File

@@ -0,0 +1,4 @@
<!doctype html>
<body>
DevTools panel
</body>

View File

@@ -0,0 +1,48 @@
const { app, BrowserWindow, protocol, session } = require('electron/main');
const { once } = require('node:events');
const path = require('node:path');
const html = '<html><body><h1>EMPTY PAGE</h1></body></html>';
const scheme = 'custom';
protocol.registerSchemesAsPrivileged([
{
scheme,
privileges: {
standard: true,
secure: true,
allowServiceWorkers: true,
supportFetchAPI: true,
bypassCSP: false,
corsEnabled: true,
stream: true
}
}
]);
app.enableExtensionsOnAllProtocols();
app.whenReady().then(async () => {
const ses = session.defaultSession;
ses.protocol.handle(scheme, () => new Response(html, {
headers: { 'Content-Type': 'text/html' }
}));
await ses.extensions.loadExtension(path.join(__dirname, 'extension'));
const win = new BrowserWindow();
win.webContents.openDevTools();
await once(win.webContents, 'devtools-opened');
win.devToolsWebContents.on('console-message', ({ message }) => {
if (message === 'ELECTRON TEST PANEL created') {
console.log(message);
app.quit();
}
});
await win.loadURL(`${scheme}://app/`);
});

View File

@@ -0,0 +1,7 @@
/* global chrome */
chrome.runtime.onMessage.addListener((_message, sender, reply) => {
reply({
text: 'MESSAGE RECEIVED',
senderTabId: sender.tab && sender.tab.id
});
});

View File

@@ -0,0 +1,5 @@
/* global chrome */
chrome.runtime.sendMessage({ text: 'hello from content script' }, (response) => {
if (!response || !response.text) return;
document.title = response.text;
});

View File

@@ -0,0 +1,15 @@
{
"name": "custom-protocol",
"version": "1.0",
"background": {
"service_worker": "background.js"
},
"content_scripts": [
{
"matches": ["<all_urls>"],
"js": ["content_script.js"],
"run_at": "document_start"
}
],
"manifest_version": 3
}

View File

@@ -0,0 +1,42 @@
const { app, BrowserWindow, protocol, session } = require('electron/main');
const path = require('node:path');
const html = '<html><body><h1>EMPTY PAGE</h1></body></html>';
const scheme = 'example';
protocol.registerSchemesAsPrivileged([
{
scheme,
privileges: {
standard: true,
secure: true,
allowServiceWorkers: true,
supportFetchAPI: true,
bypassCSP: false,
corsEnabled: true,
stream: true
}
}
]);
app.enableExtensionsOnAllProtocols();
app.whenReady().then(async () => {
const ses = session.defaultSession;
ses.protocol.handle(scheme, () => new Response(html, {
headers: { 'Content-Type': 'text/html' }
}));
await ses.extensions.loadExtension(path.join(__dirname, 'extension'));
const win = new BrowserWindow();
win.on('page-title-updated', (_event, title) => {
console.log(`Title: ${title}`);
app.quit();
});
await win.loadURL(`${scheme}://app/`);
});