fix: clang variable configuration in generated node headers (#44200)

* fix: clang variable configuration in generated node headers

Co-authored-by: deepak1556 <hop2deep@gmail.com>

* chore: restore value in common.gypi

Co-authored-by: deepak1556 <hop2deep@gmail.com>

* chore: update patches

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
This commit is contained in:
trop[bot] 2024-10-11 12:25:42 -05:00 committed by GitHub
parent afce3ce7c7
commit 9011532b2e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 50 additions and 21 deletions

View file

@ -23,10 +23,10 @@ index ad0092ef2e13853e4bb8b923481559a043b00ab7..1c2dfd23f18733e21312992877ae1499
int32_t world_id) {}
virtual void DidClearWindowObject() {}
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 724818204a4fa1578102c2fe1a8877735323595a..954fdbbdd4d07c32d6fe78632ca95efc29fadc3c 100644
index 24904d0b6436353601aa43c603f9d12fb8eff960..a673c3c00bc59e3bd8b0ed2ecb086856f57134ac 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -4791,6 +4791,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context,
@@ -4794,6 +4794,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context,
observer.DidCreateScriptContext(context, world_id);
}

View file

@ -15,10 +15,10 @@ Refs changes in:
This patch reverts the changes to fix associated crashes in Electron.
diff --git a/third_party/blink/renderer/core/frame/frame.cc b/third_party/blink/renderer/core/frame/frame.cc
index 6210eae2b7c25dae24ad7087d3e0ac494dada375..934ee55c89c526ca8fa390a13c4dd79b1c85882f 100644
index 2f33ec660a975522c473ecd50e633b5edaca707f..65221a51927d9f44bd6adbad88fa1144f2db3add 100644
--- a/third_party/blink/renderer/core/frame/frame.cc
+++ b/third_party/blink/renderer/core/frame/frame.cc
@@ -131,14 +131,6 @@ bool Frame::Detach(FrameDetachType type) {
@@ -135,14 +135,6 @@ bool Frame::Detach(FrameDetachType type) {
DCHECK(!IsDetached());
@ -33,7 +33,7 @@ index 6210eae2b7c25dae24ad7087d3e0ac494dada375..934ee55c89c526ca8fa390a13c4dd79b
if (type == FrameDetachType::kRemove) {
if (provisional_frame_) {
provisional_frame_->Detach(FrameDetachType::kRemove);
@@ -162,6 +154,14 @@ bool Frame::Detach(FrameDetachType type) {
@@ -166,6 +158,14 @@ bool Frame::Detach(FrameDetachType type) {
GetWindowProxyManager()->ClearForSwap();
}

View file

@ -33,7 +33,7 @@ index ad7aef003b233245201937c58be12fa3acb6b1a4..275eb74983e684310753dabcd453e5a2
"//base",
"//build:branding_buildflags",
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
index 2b66b11333f732ea1ec65474d709b55638696cf3..d2d5eb596db1fc166c0498c2f7a6c15080e5d775 100644
index 7f1c26990d8d43e92615bd3a5f4046d121d6ac6b..89d03b68cab5cec6095c2df2159a2f1cd15df0be 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -4486,7 +4486,7 @@ static_library("browser") {
@ -46,7 +46,7 @@ index 2b66b11333f732ea1ec65474d709b55638696cf3..d2d5eb596db1fc166c0498c2f7a6c150
# than here in :chrome_dll.
deps += [ "//chrome:packed_resources_integrity_header" ]
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn
index 2a55a6189c6a5c399a08edf4659f33f541726093..f8e8fb75e71a265a0cc2b7c57c4f0fd9035c6def 100644
index c53d7af88b3570e6c320b408afa449e51e355b6b..61aecb395632212911d57545cb068ca67bbac7d5 100644
--- a/chrome/test/BUILD.gn
+++ b/chrome/test/BUILD.gn
@@ -7173,9 +7173,12 @@ test("unit_tests") {
@ -63,7 +63,7 @@ index 2a55a6189c6a5c399a08edf4659f33f541726093..f8e8fb75e71a265a0cc2b7c57c4f0fd9
"//chrome//services/util_win:unit_tests",
"//chrome/app:chrome_dll_resources",
"//chrome/app:win_unit_tests",
@@ -8180,6 +8183,10 @@ test("unit_tests") {
@@ -8181,6 +8184,10 @@ test("unit_tests") {
"../browser/performance_manager/policies/background_tab_loading_policy_unittest.cc",
]
@ -74,7 +74,7 @@ index 2a55a6189c6a5c399a08edf4659f33f541726093..f8e8fb75e71a265a0cc2b7c57c4f0fd9
sources += [
# The importer code is not used on Android.
"../common/importer/firefox_importer_utils_unittest.cc",
@@ -8236,7 +8243,6 @@ test("unit_tests") {
@@ -8237,7 +8244,6 @@ test("unit_tests") {
# Non-android deps for "unit_tests" target.
deps += [
"../browser/screen_ai:screen_ai_install_state",

View file

@ -9,10 +9,10 @@ potentially prevent a window from being created.
TODO(loc): this patch is currently broken.
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc
index c2e377d5b1603a2d3c67a61911545ce361d418c2..20fe5301a0120e926d118f8b27ef57621833a5bf 100644
index a0d5a983bb46a50dcf31afadc10f597a0e3ed15d..b6bda9691f0ae96ee4ba5d0d96d4e57e4fa592c2 100644
--- a/content/browser/renderer_host/render_frame_host_impl.cc
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
@@ -9040,6 +9040,7 @@ void RenderFrameHostImpl::CreateNewWindow(
@@ -9060,6 +9060,7 @@ void RenderFrameHostImpl::CreateNewWindow(
last_committed_origin_, params->window_container_type,
params->target_url, params->referrer.To<Referrer>(),
params->frame_name, params->disposition, *params->features,
@ -148,10 +148,10 @@ index a080fb57f00c712eb8a3a9be669413e1082ce3b3..4826eea9747c4860d7f5b4b8d478e62c
// typically happens when popups are created.
virtual void WebContentsCreated(WebContents* source_contents,
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index d5e16b9e780efac46e088b3ef226e4418a90aeaf..724818204a4fa1578102c2fe1a8877735323595a 100644
index 7b7e727c44a1477640f8702ad818f4a8607e3fb7..24904d0b6436353601aa43c603f9d12fb8eff960 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -6834,6 +6834,10 @@ WebView* RenderFrameImpl::CreateNewWindow(
@@ -6837,6 +6837,10 @@ WebView* RenderFrameImpl::CreateNewWindow(
request.HasUserGesture(), GetWebFrame()->IsAdFrame(),
GetWebFrame()->IsAdScriptInStack());
@ -210,10 +210,10 @@ index c576ace24e81cc877aa2595d40e0a13a7af9f6a2..210fb97d44c19c29af424cc7b9cb3169
} // namespace blink
diff --git a/third_party/blink/renderer/core/frame/local_dom_window.cc b/third_party/blink/renderer/core/frame/local_dom_window.cc
index 7b8158aff39c247e1729edb032833cdebf949acf..7d77f26106950deb1bae43ca7dcd7e0cde0ac6b5 100644
index fe3c23e1dd1c818b5cb07a609dbbf17763c6d583..77bcaaf388fe1fb4577e25880b10154db0b46ce4 100644
--- a/third_party/blink/renderer/core/frame/local_dom_window.cc
+++ b/third_party/blink/renderer/core/frame/local_dom_window.cc
@@ -2248,6 +2248,8 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate,
@@ -2251,6 +2251,8 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate,
WebWindowFeatures window_features =
GetWindowFeaturesFromString(features, entered_window);

View file

@ -40,10 +40,10 @@ index 22bb23e6a84d3b6686461f87e846125ad7484742..198403ec544e71f50c8555d131015b80
// origin of |common_params.url| and/or |common_params.initiator_origin|.
url::Origin resolved_origin = url::Origin::Resolve(
diff --git a/third_party/blink/renderer/core/loader/document_loader.cc b/third_party/blink/renderer/core/loader/document_loader.cc
index 0fb02ada85ed3d4cc113ac7ce18d6efdb7065627..9e78c486fdc9b931dfcbcf40145076a22f221e35 100644
index f8098c86def00cac76932551bf413266facdc935..98a4c1ad9f561e1bec1e6113db46d4bcf3d3f694 100644
--- a/third_party/blink/renderer/core/loader/document_loader.cc
+++ b/third_party/blink/renderer/core/loader/document_loader.cc
@@ -2261,6 +2261,10 @@ Frame* DocumentLoader::CalculateOwnerFrame() {
@@ -2264,6 +2264,10 @@ Frame* DocumentLoader::CalculateOwnerFrame() {
scoped_refptr<SecurityOrigin> DocumentLoader::CalculateOrigin(
Document* owner_document) {
scoped_refptr<SecurityOrigin> origin;
@ -54,7 +54,7 @@ index 0fb02ada85ed3d4cc113ac7ce18d6efdb7065627..9e78c486fdc9b931dfcbcf40145076a2
StringBuilder debug_info_builder;
// Whether the origin is newly created within this call, instead of copied
// from an existing document's origin or from `origin_to_commit_`. If this is
@@ -2313,6 +2317,10 @@ scoped_refptr<SecurityOrigin> DocumentLoader::CalculateOrigin(
@@ -2316,6 +2320,10 @@ scoped_refptr<SecurityOrigin> DocumentLoader::CalculateOrigin(
debug_info_builder.Append(", url=");
debug_info_builder.Append(owner_document->Url().BaseAsString());
debug_info_builder.Append(")");

View file

@ -10,7 +10,7 @@ an about:blank check to this area.
Ref: https://chromium-review.googlesource.com/c/chromium/src/+/5403876
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc
index 2605701ace806adef40b748f93aebae45144e1be..888e1386d7ed0003bbaabddeefa98d2c25e9adbb 100644
index 67e53ad616687ea17719e3f4f1d00192c5b69d61..1642d61585c7aee3ec7a0907f5cdcd016e29ca6e 100644
--- a/content/browser/renderer_host/render_frame_host_impl.cc
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
@@ -782,8 +782,8 @@ void VerifyThatBrowserAndRendererCalculatedOriginsToCommitMatch(

View file

@ -15,10 +15,10 @@ Note that we also need to manually update embedder's
`api::WebContents::IsFullscreenForTabOrPending` value.
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc
index 20fe5301a0120e926d118f8b27ef57621833a5bf..2605701ace806adef40b748f93aebae45144e1be 100644
index b6bda9691f0ae96ee4ba5d0d96d4e57e4fa592c2..67e53ad616687ea17719e3f4f1d00192c5b69d61 100644
--- a/content/browser/renderer_host/render_frame_host_impl.cc
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
@@ -8155,6 +8155,17 @@ void RenderFrameHostImpl::EnterFullscreen(
@@ -8175,6 +8175,17 @@ void RenderFrameHostImpl::EnterFullscreen(
}
}

View file

@ -52,3 +52,4 @@ build_don_t_redefine_win32_lean_and_mean.patch
src_use_supported_api_to_get_stalled_tla_messages.patch
build_compile_with_c_20_support.patch
add_v8_taskpirority_to_foreground_task_runner_signature.patch
build_restore_clang_as_default_compiler_on_macos.patch

View file

@ -0,0 +1,24 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: deepak1556 <hop2deep@gmail.com>
Date: Fri, 11 Oct 2024 15:01:25 +0900
Subject: build: restore clang as default compiler on macOS
Refs https://github.com/nodejs/node/commit/6e0a2bb54c5bbeff0e9e33e1a0c683ed980a8a0f
configures the value at build time which doesn't work in Electron
as it depends on the environment in which the headers got generated from which
cannot reflect the value per platform. It works for Node.js since
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 2eb62610db2f0ebf68fa9a55ffba98291ecfe451..3ec08ee144b586d05c4e49c2251416734cbc02c5 100644
--- a/common.gypi
+++ b/common.gypi
@@ -125,6 +125,7 @@
'v8_base': '<(PRODUCT_DIR)/obj.target/tools/v8_gypfiles/libv8_snapshot.a',
}],
['OS=="mac"', {
+ 'clang%': 1,
'obj_dir%': '<(PRODUCT_DIR)/obj.target',
'v8_base': '<(PRODUCT_DIR)/libv8_snapshot.a',
}],

View file

@ -61,6 +61,10 @@ def main(target_file, target_cpu):
v['node_module_version'] = int(args['node_module_version'])
# Used by certain versions of node-gyp.
v['build_v8_with_gn'] = 'false'
# Enable clang conditionally based on target platform
# in common.gypi
if 'clang' in v:
del v['clang']
with open(target_file, 'w+', encoding='utf-8') as file_out:
file_out.write(pprint.pformat(config, indent=2))