diff --git a/.circleci/config.yml b/.circleci/config.yml index e0fab29d049c1..41cf485cb89ee 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -67,7 +67,7 @@ executors: type: enum enum: ["medium", "xlarge", "2xlarge+"] docker: - - image: electron.azurecr.io/build:4fc81b50f9c0980699d329bc32062fac20a26701 + - image: electron.azurecr.io/build:d818f06a9b1540c7fd38f75ad5a2c493dd6843b6 resource_class: << parameters.size >> macos: diff --git a/DEPS b/DEPS index fa265f7e135b4..55d987e981325 100644 --- a/DEPS +++ b/DEPS @@ -15,7 +15,7 @@ gclient_gn_args = [ vars = { 'chromium_version': - '93.0.4577.25', + '93.0.4577.51', 'node_version': 'v14.17.0', 'nan_version': diff --git a/azure-pipelines-woa.yml b/azure-pipelines-woa.yml index a2e68aa95ac43..f58cf5d2152cd 100644 --- a/azure-pipelines-woa.yml +++ b/azure-pipelines-woa.yml @@ -53,6 +53,16 @@ steps: env: APPVEYOR_TOKEN: $(APPVEYOR_TOKEN) +- powershell: | + $localArtifactPath = "$pwd\src\pdb.zip" + $serverArtifactPath = "$env:APPVEYOR_URL/buildjobs/$env:APPVEYOR_JOB_ID/artifacts/pdb.zip" + Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer $env:APPVEYOR_TOKEN" } + cd src + & "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -y pdb.zip + displayName: 'Download pdb files for detailed stacktraces' + env: + APPVEYOR_TOKEN: $(APPVEYOR_TOKEN) + - powershell: | New-Item src\out\Default\gen\node_headers\Release -Type directory Copy-Item -path src\out\Default\electron.lib -destination src\out\Default\gen\node_headers\Release\node.lib @@ -63,15 +73,30 @@ steps: set npm_config_nodedir=%cd%\out\Default\gen\node_headers set npm_config_arch=arm64 cd electron - # CalculateNativeWinOcclusion is disabled due to https://bugs.chromium.org/p/chromium/issues/detail?id=1139022 - node script/yarn test -- --enable-logging --verbose --disable-features=CalculateNativeWinOcclusion - displayName: 'Run Electron tests' + node script/yarn test --runners=main --runTestFilesSeperately --enable-logging --disable-features=CalculateNativeWinOcclusion + displayName: 'Run Electron Main process tests' + env: + ELECTRON_ENABLE_STACK_DUMPING: true + ELECTRON_OUT_DIR: Default + IGNORE_YARN_INSTALL_ERROR: 1 + ELECTRON_TEST_RESULTS_DIR: junit + MOCHA_MULTI_REPORTERS: 'mocha-junit-reporter, tap' + MOCHA_REPORTER: mocha-multi-reporters + +- script: | + cd src + set npm_config_nodedir=%cd%\out\Default\gen\node_headers + set npm_config_arch=arm64 + cd electron + node script/yarn test --runners=remote --enable-logging --disable-features=CalculateNativeWinOcclusion + displayName: 'Run Electron Remote based tests' env: ELECTRON_OUT_DIR: Default IGNORE_YARN_INSTALL_ERROR: 1 ELECTRON_TEST_RESULTS_DIR: junit MOCHA_MULTI_REPORTERS: 'mocha-junit-reporter, tap' MOCHA_REPORTER: mocha-multi-reporters + condition: always() - task: PublishTestResults@2 displayName: 'Publish Test Results' diff --git a/patches/chromium/add_didinstallconditionalfeatures.patch b/patches/chromium/add_didinstallconditionalfeatures.patch index bf9eb6854c0b4..7f7fcda3d4e39 100644 --- a/patches/chromium/add_didinstallconditionalfeatures.patch +++ b/patches/chromium/add_didinstallconditionalfeatures.patch @@ -23,10 +23,10 @@ index e24c169444c699f295de2c1f1f42683eeca73436..4675cdccb1876a318a9a0253cdf552bb int32_t world_id) {} virtual void DidClearWindowObject() {} diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index 5f7a44233f04adddf7f5a4cd9b40fc0497961fbc..2ce30e48d579fbd06efb6b8464dce7d483bbd6b3 100644 +index 118192cb4ea365f4b8fc84a802b9c6bb030461fc..6d1d25efeb8529c8af54d5429bf33a9dcad286aa 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -4420,6 +4420,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local context, +@@ -4456,6 +4456,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local context, observer.DidCreateScriptContext(context, world_id); } @@ -40,10 +40,10 @@ index 5f7a44233f04adddf7f5a4cd9b40fc0497961fbc..2ce30e48d579fbd06efb6b8464dce7d4 int world_id) { for (auto& observer : observers_) diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h -index 240152022c7d489d81fbadddcb672b02d87443c4..6c8f1e51d646d7925801111ee857af569f28033d 100644 +index aff9b0217d9baf1cdb0724c1ecf9676c136c334d..64253b0e96aa12273ea4c8181274e58e139829e6 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h -@@ -586,6 +586,8 @@ class CONTENT_EXPORT RenderFrameImpl +@@ -589,6 +589,8 @@ class CONTENT_EXPORT RenderFrameImpl blink::WebLocalFrameClient::LazyLoadBehavior lazy_load_behavior) override; void DidCreateScriptContext(v8::Local context, int world_id) override; diff --git a/patches/chromium/build_add_electron_tracing_category.patch b/patches/chromium/build_add_electron_tracing_category.patch index 1fcb3e407a128..6f08b26a45bcf 100644 --- a/patches/chromium/build_add_electron_tracing_category.patch +++ b/patches/chromium/build_add_electron_tracing_category.patch @@ -8,7 +8,7 @@ categories in use are known / declared. This patch is required for us to introduce a new Electron category for Electron-specific tracing. diff --git a/base/trace_event/builtin_categories.h b/base/trace_event/builtin_categories.h -index a9616406d4d3742c90aa0d1cf65ab84cfb8890ed..32142ed13cfca009e09578dff79e94030233cfbf 100644 +index bb47926b3d3ee58e11e9814223384690dd68dac1..f92d53109c9c02c2d144c7397b3653402a09cab0 100644 --- a/base/trace_event/builtin_categories.h +++ b/base/trace_event/builtin_categories.h @@ -77,6 +77,7 @@ diff --git a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch index 6bc8c9fd80113..dbfe62e038246 100644 --- a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch +++ b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch @@ -46,7 +46,7 @@ index 17e03f58263b5254cec991386536286de3b41600..65fdfcec6894249996fa12b947136247 } diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn -index 1625f8917ac257f11f4637ea60eca586ec2492a3..dc0f43e955994fba9dc597c08133a4438ebf1c45 100644 +index 139a04d6cbc1376340cf73a395e051fd2c7c9b11..73f0b275da7fef57f6c9956a16b5370f6771feac 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn @@ -5281,7 +5281,6 @@ test("unit_tests") { diff --git a/patches/chromium/can_create_window.patch b/patches/chromium/can_create_window.patch index 97ab5df2bfc58..aaee7ed804ee3 100644 --- a/patches/chromium/can_create_window.patch +++ b/patches/chromium/can_create_window.patch @@ -9,7 +9,7 @@ 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 ee638fbd09ad247756659a5345ee58abed7dc6cd..c842246f9250c45793c4e763f1de3f2b486a56aa 100644 +index d0899ee86e4cd3906bc324bc7879d458d204ebc8..ecfa972c0e169f235a98239022681b423ce06b78 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc @@ -6280,6 +6280,7 @@ void RenderFrameHostImpl::CreateNewWindow( diff --git a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch index 55759d0ea055c..ed9c8f337e75d 100644 --- a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch +++ b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch @@ -362,7 +362,7 @@ index bb90319f768ed2f3a3e530d64bf622de585ce163..d84de1d218267887f6b8624f913438eb content::RenderFrameHost* opener, content::SiteInstance* source_site_instance, diff --git a/fuchsia/engine/browser/frame_impl.cc b/fuchsia/engine/browser/frame_impl.cc -index bfe73ea9811890f3a0175f2b8cd14459fec980c1..fc4a2a879cd4b1914849b5cadba78caf4c16d804 100644 +index 3fe03fbabb182fa38f0bb17d4904f645531a536f..3f6c4bb2437b5032b758a0ba486fb0967408ecb7 100644 --- a/fuchsia/engine/browser/frame_impl.cc +++ b/fuchsia/engine/browser/frame_impl.cc @@ -388,8 +388,7 @@ bool FrameImpl::IsWebContentsCreationOverridden( diff --git a/patches/chromium/desktop_media_list.patch b/patches/chromium/desktop_media_list.patch index 9e233c1a94721..1b3739be50dc2 100644 --- a/patches/chromium/desktop_media_list.patch +++ b/patches/chromium/desktop_media_list.patch @@ -20,6 +20,7 @@ the implementation in a given frame. but this call is not a one-shot but rather repeats the observer signals for every frame. This is the call which chrome currently uses. +* Disabled WindowCaptureMacV2 feature for https://github.com/electron/electron/pull/30507 This patch allows us to get the one-shot effect with the above classes. @@ -128,7 +129,7 @@ index ad7f766a36b1b6b2a8bc0f96369f1aaadf6681f7..f6c6c14a0937430df62c9b9c1132c591 protected: virtual ~DesktopMediaListObserver() {} diff --git a/chrome/browser/media/webrtc/native_desktop_media_list.cc b/chrome/browser/media/webrtc/native_desktop_media_list.cc -index 0d38b92ccb7ef1ada0d2165d714d80a844c999b8..d1254c8e1acbadb3a1976097031889f19a02554d 100644 +index 5a851f4c89b4ed2b41640bf8bad47b7d8eba8ca1..7687bad18acad2cd607d14d3d3ac39f81e7dcc8a 100644 --- a/chrome/browser/media/webrtc/native_desktop_media_list.cc +++ b/chrome/browser/media/webrtc/native_desktop_media_list.cc @@ -11,15 +11,16 @@ @@ -149,7 +150,18 @@ index 0d38b92ccb7ef1ada0d2165d714d80a844c999b8..d1254c8e1acbadb3a1976097031889f1 #include "media/base/video_util.h" #include "third_party/libyuv/include/libyuv/scale_argb.h" #include "third_party/skia/include/core/SkBitmap.h" -@@ -266,6 +267,8 @@ void NativeDesktopMediaList::Worker::RefreshNextThumbnail() { +@@ -94,8 +95,9 @@ gfx::ImageSkia ScaleDesktopFrame(std::unique_ptr frame, + } + + #if defined(OS_MAC) ++// Refs https://github.com/electron/electron/pull/30507 + const base::Feature kWindowCaptureMacV2{"WindowCaptureMacV2", +- base::FEATURE_ENABLED_BY_DEFAULT}; ++ base::FEATURE_DISABLED_BY_DEFAULT}; + #endif + + } // namespace +@@ -271,6 +273,8 @@ void NativeDesktopMediaList::Worker::RefreshNextThumbnail() { FROM_HERE, base::BindOnce(&NativeDesktopMediaList::UpdateNativeThumbnailsFinished, media_list_)); diff --git a/patches/chromium/disable_color_correct_rendering.patch b/patches/chromium/disable_color_correct_rendering.patch index a75ee980e6772..b6a2dd72e1264 100644 --- a/patches/chromium/disable_color_correct_rendering.patch +++ b/patches/chromium/disable_color_correct_rendering.patch @@ -241,7 +241,7 @@ index 59b34cdb1dc63b8d239cae5397b2a5a4f607bf1c..e2f556532459b1129465ca2b83aa1485 sandbox::policy::switches::kGpuSandboxAllowSysVShm, sandbox::policy::switches::kGpuSandboxFailuresFatal, diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc -index 224e23ad3584dd4511a4173d632547d4a2ee4e9c..0dbb7fad5c9f3b3889b0825d553992d6fe2745f9 100644 +index 9e9316c0bbbecbf425fb04f2cef9bb4f5caf98c6..bd24cb0f6edc37bf23c40f0a7839a2f5d85c9a01 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc @@ -217,6 +217,7 @@ @@ -252,7 +252,7 @@ index 224e23ad3584dd4511a4173d632547d4a2ee4e9c..0dbb7fad5c9f3b3889b0825d553992d6 #include "ui/gl/gl_switches.h" #include "ui/native_theme/native_theme_features.h" #include "url/origin.h" -@@ -3368,6 +3369,7 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( +@@ -3426,6 +3427,7 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( // Propagate the following switches to the renderer command line (along // with any associated values) if present in the browser command line. static const char* const kSwitchNames[] = { diff --git a/patches/chromium/don_t_use_potentially_null_getwebframe_-_view_when_get_blink.patch b/patches/chromium/don_t_use_potentially_null_getwebframe_-_view_when_get_blink.patch index a4b57eb0aa8b9..760360a97442c 100644 --- a/patches/chromium/don_t_use_potentially_null_getwebframe_-_view_when_get_blink.patch +++ b/patches/chromium/don_t_use_potentially_null_getwebframe_-_view_when_get_blink.patch @@ -11,10 +11,10 @@ This regressed in https://chromium-review.googlesource.com/c/chromium/src/+/2572 Upstream: https://chromium-review.googlesource.com/c/chromium/src/+/2598393 diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index 2ce30e48d579fbd06efb6b8464dce7d483bbd6b3..71f8b79a09ff12482f530e94a0b22503f4a66a65 100644 +index 6d1d25efeb8529c8af54d5429bf33a9dcad286aa..36f28a560701c72b8369d657b673480968be07a9 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -2355,7 +2355,7 @@ const blink::WebView* RenderFrameImpl::GetWebView() const { +@@ -2357,7 +2357,7 @@ const blink::WebView* RenderFrameImpl::GetWebView() const { } const blink::web_pref::WebPreferences& RenderFrameImpl::GetBlinkPreferences() { diff --git a/patches/chromium/notification_provenance.patch b/patches/chromium/notification_provenance.patch index 5bbe67884907a..cd5b89741a0f4 100644 --- a/patches/chromium/notification_provenance.patch +++ b/patches/chromium/notification_provenance.patch @@ -108,10 +108,10 @@ index b195cb84d8bba3c51b04f8c32cf909d15bf34335..37528715db985d12771ba2dca86dcec8 const GURL& document_url, mojo::PendingReceiver receiver); diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc -index 8135d0ff1d476b06cc24abb010ad988eb880b557..55c4e3c2bb0b353724c6a1a2f6f853705d1ba501 100644 +index 8d65e805544579ad06a8f6d532104f29d3742a1e..a5e1e13fb11996d4df926480ded2b901de08b75a 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc -@@ -2301,7 +2301,7 @@ void RenderProcessHostImpl::CreateNotificationService( +@@ -2341,7 +2341,7 @@ void RenderProcessHostImpl::CreateNotificationService( document_url = rfh->GetLastCommittedURL(); storage_partition_impl_->GetPlatformNotificationContext()->CreateService( diff --git a/patches/chromium/support_mixed_sandbox_with_zygote.patch b/patches/chromium/support_mixed_sandbox_with_zygote.patch index b437aecfaa250..350ee60b098b1 100644 --- a/patches/chromium/support_mixed_sandbox_with_zygote.patch +++ b/patches/chromium/support_mixed_sandbox_with_zygote.patch @@ -22,10 +22,10 @@ However, the patch would need to be reviewed by the security team, as it does touch a security-sensitive class. diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc -index 55c4e3c2bb0b353724c6a1a2f6f853705d1ba501..224e23ad3584dd4511a4173d632547d4a2ee4e9c 100644 +index a5e1e13fb11996d4df926480ded2b901de08b75a..9e9316c0bbbecbf425fb04f2cef9bb4f5caf98c6 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc -@@ -428,10 +428,18 @@ class RendererSandboxedProcessLauncherDelegate +@@ -429,10 +429,18 @@ class RendererSandboxedProcessLauncherDelegate public: RendererSandboxedProcessLauncherDelegate() = default; @@ -44,7 +44,7 @@ index 55c4e3c2bb0b353724c6a1a2f6f853705d1ba501..224e23ad3584dd4511a4173d632547d4 const base::CommandLine& browser_command_line = *base::CommandLine::ForCurrentProcess(); base::CommandLine::StringType renderer_prefix = -@@ -449,6 +457,11 @@ class RendererSandboxedProcessLauncherDelegate +@@ -450,6 +458,11 @@ class RendererSandboxedProcessLauncherDelegate sandbox::policy::SandboxType GetSandboxType() override { return sandbox::policy::SandboxType::kRenderer; } @@ -56,7 +56,7 @@ index 55c4e3c2bb0b353724c6a1a2f6f853705d1ba501..224e23ad3584dd4511a4173d632547d4 }; #if defined(OS_WIN) -@@ -460,6 +473,9 @@ class RendererSandboxedProcessLauncherDelegateWin +@@ -461,6 +474,9 @@ class RendererSandboxedProcessLauncherDelegateWin bool is_jit_disabled) : renderer_code_integrity_enabled_( GetContentClient()->browser()->IsRendererCodeIntegrityEnabled()) { @@ -66,7 +66,7 @@ index 55c4e3c2bb0b353724c6a1a2f6f853705d1ba501..224e23ad3584dd4511a4173d632547d4 if (is_jit_disabled) { dynamic_code_can_be_disabled_ = true; return; -@@ -2016,9 +2032,15 @@ bool RenderProcessHostImpl::Init() { +@@ -2056,9 +2072,15 @@ bool RenderProcessHostImpl::Init() { std::unique_ptr sandbox_delegate = std::make_unique( cmd_line.get(), IsJitDisabled()); diff --git a/patches/chromium/webview_fullscreen.patch b/patches/chromium/webview_fullscreen.patch index d427a2a7aad81..180d4b22d1411 100644 --- a/patches/chromium/webview_fullscreen.patch +++ b/patches/chromium/webview_fullscreen.patch @@ -14,7 +14,7 @@ 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 c842246f9250c45793c4e763f1de3f2b486a56aa..d993cd6651689818ef4deb4caa02737644bdafb5 100644 +index ecfa972c0e169f235a98239022681b423ce06b78..854c6753bd8a8140746a40601f45109722c7fc6e 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc @@ -5716,6 +5716,15 @@ void RenderFrameHostImpl::EnterFullscreen( diff --git a/patches/config.json b/patches/config.json index b0156f7d1c057..e9a2297ba10f2 100644 --- a/patches/config.json +++ b/patches/config.json @@ -3,6 +3,8 @@ "src/electron/patches/boringssl": "src/third_party/boringssl/src", + "src/electron/patches/webrtc": "src/third_party/webrtc", + "src/electron/patches/v8": "src/v8", "src/electron/patches/node": "src/third_party/electron_node", diff --git a/patches/v8/dcheck.patch b/patches/v8/dcheck.patch index 3311535f5835a..858ad73c9cf06 100644 --- a/patches/v8/dcheck.patch +++ b/patches/v8/dcheck.patch @@ -19,10 +19,10 @@ index 84295e5cde0b2828d965b423e088793864ce29db..63aed17828461e5491904f368ef914ed isolate->default_microtask_queue()->PerformCheckpoint(this); } diff --git a/src/heap/heap.cc b/src/heap/heap.cc -index a4c0e4a728dc474c958014c148f0b9dce77218d5..b8d453270cb27940782079064049afe61d792db4 100644 +index bb5e91a829444d10dcdf5fe426aed59223353819..c1eed7de2f24154f029ac928a21daa2304070516 100644 --- a/src/heap/heap.cc +++ b/src/heap/heap.cc -@@ -5945,9 +5945,9 @@ void Heap::DeinitSharedSpaces() { +@@ -5951,9 +5951,9 @@ void Heap::DeinitSharedSpaces() { void Heap::AddGCPrologueCallback(v8::Isolate::GCCallbackWithData callback, GCType gc_type, void* data) { DCHECK_NOT_NULL(callback); diff --git a/patches/webrtc/.patches b/patches/webrtc/.patches new file mode 100644 index 0000000000000..9cde1db8895b3 --- /dev/null +++ b/patches/webrtc/.patches @@ -0,0 +1 @@ +add_thread_local_to_x_error_trap_cc.patch diff --git a/patches/webrtc/add_thread_local_to_x_error_trap_cc.patch b/patches/webrtc/add_thread_local_to_x_error_trap_cc.patch new file mode 100644 index 0000000000000..0be67e3ccafd1 --- /dev/null +++ b/patches/webrtc/add_thread_local_to_x_error_trap_cc.patch @@ -0,0 +1,24 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jeremy Rose +Date: Tue, 27 Jul 2021 10:32:54 -0700 +Subject: add thread_local to x_error_trap.cc + +Per https://bugs.chromium.org/p/chromium/issues/detail?id=781618#c6. + +To fix this DCHECK firing: https://source.chromium.org/chromium/chromium/src/+/main:third_party/webrtc/modules/desktop_capture/linux/x_error_trap.cc;l=35;drc=25ab3228f3e473f2226f219531ec617d2daa175e + +diff --git a/modules/desktop_capture/linux/x_error_trap.cc b/modules/desktop_capture/linux/x_error_trap.cc +index 13233d827470d9d42be0333c3080e3d107f86fd5..62efb5b5b5194fc8961a27fe2a1efcd77e385d08 100644 +--- a/modules/desktop_capture/linux/x_error_trap.cc ++++ b/modules/desktop_capture/linux/x_error_trap.cc +@@ -19,8 +19,8 @@ namespace webrtc { + namespace { + + // TODO(sergeyu): This code is not thread safe. Fix it. Bug 2202. +-static bool g_xserver_error_trap_enabled = false; +-static int g_last_xserver_error_code = 0; ++static thread_local bool g_xserver_error_trap_enabled = false; ++static thread_local int g_last_xserver_error_code = 0; + + int XServerErrorHandler(Display* display, XErrorEvent* error_event) { + RTC_DCHECK(g_xserver_error_trap_enabled); diff --git a/script/spec-runner.js b/script/spec-runner.js index 7775eb3b5460f..31162d32a76e1 100755 --- a/script/spec-runner.js +++ b/script/spec-runner.js @@ -13,7 +13,7 @@ const fail = '✗'.red; const args = require('minimist')(process.argv, { string: ['runners', 'target'], - boolean: ['buildNativeTests'], + boolean: ['buildNativeTests', 'runTestFilesSeperately'], unknown: arg => unknownFlags.push(arg) }); @@ -123,24 +123,55 @@ async function runElectronTests () { } } -async function runRemoteBasedElectronTests () { +async function runTestUsingElectron (specDir, testName) { let exe = path.resolve(BASE, utils.getElectronExec()); - const runnerArgs = ['electron/spec', ...unknownArgs.slice(2)]; + const runnerArgs = [`electron/${specDir}`, ...unknownArgs.slice(2)]; if (process.platform === 'linux') { runnerArgs.unshift(path.resolve(__dirname, 'dbus_mock.py'), exe); exe = 'python3'; } - - const { status } = childProcess.spawnSync(exe, runnerArgs, { + const { status, signal } = childProcess.spawnSync(exe, runnerArgs, { cwd: path.resolve(__dirname, '../..'), stdio: 'inherit' }); if (status !== 0) { - const textStatus = process.platform === 'win32' ? `0x${status.toString(16)}` : status.toString(); - console.log(`${fail} Electron tests failed with code ${textStatus}.`); + if (status) { + const textStatus = process.platform === 'win32' ? `0x${status.toString(16)}` : status.toString(); + console.log(`${fail} Electron tests failed with code ${textStatus}.`); + } else { + console.log(`${fail} Electron tests failed with kill signal ${signal}.`); + } process.exit(1); } - console.log(`${pass} Electron remote process tests passed.`); + console.log(`${pass} Electron ${testName} process tests passed.`); +} + +const specFilter = (file) => { + if (!/-spec\.[tj]s$/.test(file)) { + return false; + } else { + return true; + } +}; + +async function runTests (specDir, testName) { + if (args.runTestFilesSeperately) { + const getFiles = require('../spec/static/get-files'); + const testFiles = await getFiles(path.resolve(__dirname, `../${specDir}`), { filter: specFilter }); + const baseElectronDir = path.resolve(__dirname, '..'); + unknownArgs.splice(unknownArgs.length, 0, '--files', ''); + testFiles.sort().forEach(async (file) => { + unknownArgs.splice((unknownArgs.length - 1), 1, path.relative(baseElectronDir, file)); + console.log(`Running tests for ${unknownArgs[unknownArgs.length - 1]}`); + await runTestUsingElectron(specDir, testName); + }); + } else { + await runTestUsingElectron(specDir, testName); + } +} + +async function runRemoteBasedElectronTests () { + await runTests('spec', 'remote'); } async function runNativeElectronTests () { @@ -195,27 +226,7 @@ async function runNativeElectronTests () { } async function runMainProcessElectronTests () { - let exe = path.resolve(BASE, utils.getElectronExec()); - const runnerArgs = ['electron/spec-main', ...unknownArgs.slice(2)]; - if (process.platform === 'linux') { - runnerArgs.unshift(path.resolve(__dirname, 'dbus_mock.py'), exe); - exe = 'python3'; - } - - const { status, signal } = childProcess.spawnSync(exe, runnerArgs, { - cwd: path.resolve(__dirname, '../..'), - stdio: 'inherit' - }); - if (status !== 0) { - if (status) { - const textStatus = process.platform === 'win32' ? `0x${status.toString(16)}` : status.toString(); - console.log(`${fail} Electron tests failed with code ${textStatus}.`); - } else { - console.log(`${fail} Electron tests failed with kill signal ${signal}.`); - } - process.exit(1); - } - console.log(`${pass} Electron main process tests passed.`); + await runTests('spec-main', 'main'); } async function installSpecModules (dir) { diff --git a/shell/browser/feature_list.cc b/shell/browser/feature_list.cc index 8a488a08294c3..366eec41403f4 100644 --- a/shell/browser/feature_list.cc +++ b/shell/browser/feature_list.cc @@ -48,12 +48,6 @@ void InitializeFeatureList() { // an empty suggestions list to be returned disable_features += std::string(",") + spellcheck::kWinRetrieveSuggestionsOnlyOnDemand.name; -#endif -#if defined(OS_MAC) - // Disable kWindowCaptureMacV2, which causes the wrong window id to - // be returned (this has been disabled in upstream Chromium here): - // https://chromium-review.googlesource.com/c/chromium/src/+/3069272 - disable_features += std::string(",") + features::kWindowCaptureMacV2.name; #endif base::FeatureList::InitializeInstance(enable_features, disable_features); } diff --git a/shell/browser/native_window_mac.mm b/shell/browser/native_window_mac.mm index 9fdc15144d2e6..3e483a1537c5b 100644 --- a/shell/browser/native_window_mac.mm +++ b/shell/browser/native_window_mac.mm @@ -23,7 +23,6 @@ #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/desktop_media_id.h" -#include "content/public/common/content_features.h" #include "shell/browser/javascript_environment.h" #include "shell/browser/native_browser_view_mac.h" #include "shell/browser/ui/cocoa/electron_native_widget_mac.h" @@ -1256,11 +1255,13 @@ void ViewDidMoveToSuperview(NSView* self, SEL _cmd) { content::DesktopMediaID::TYPE_WINDOW, GetAcceleratedWidget()); // c.f. // https://source.chromium.org/chromium/chromium/src/+/master:chrome/browser/media/webrtc/native_desktop_media_list.cc;l=372?q=kWindowCaptureMacV2&ss=chromium - if (base::FeatureList::IsEnabled(features::kWindowCaptureMacV2)) { + // Refs https://github.com/electron/electron/pull/30507 + // TODO(deepak1556): Match upstream for `kWindowCaptureMacV2` +#if 0 if (remote_cocoa::ScopedCGWindowID::Get(desktop_media_id.id)) { desktop_media_id.window_id = desktop_media_id.id; } - } +#endif return desktop_media_id; }