electron/shell/browser
trop[bot] 91bb748eaa
refactor: remove InspectableWebContentsViewMac in favor of the Views version (#45238)
* refactor: remove InspectableWebContentsViewMac in favor of the Views version

* cherry-pick: refactor: remove InspectableWebContentsViewMac in favor of the Views version (#41326)

commit e67ab9a93d

Confilcts not resolved, except removal of the files removed
by the original commit.

* resolved conflicts and build issues after cherry-pick

* cherry-picked: fix: add method allowing to disable headless mode in native widget

https://github.com/electron/electron/pull/42996
fixing
https://github.com/electron/electron/issues/42995

* fix: displaying select popup in window created as fullscreen window

`constrainFrameRect:toScreen:` is not being call for windows created
with `fullscreen: true` therefore `headless` mode was not being removed
and `RenderWidgetHostNSViewBridge::DisplayPopupMenu` ignored displaying
popup.

Issue could be fixed by placing additional removal of `headless` mode
in the `toggleFullScreen:`, but `orderWindow:relativeTo:` is called
both for a regular and a fullscreen window, therefore there will be
a single place fixing both cases.

Because `electron::NativeWindowMac` lifetime may be shorter than
`ElectronNSWindow` on which macOS may execute `orderWindow:relativeTo:`
we need to clear `shell_` when `NativeWindow` is being closed.

Fixes #43010.

* fix: Content visibility when using `vibrancy`

We need to put `NSVisualEffectView` before `ViewsCompositorSuperview`
otherwise when using `vibrancy` in `BrowserWindow` `NSVisualEffectView`
will hide content displayed by the compositor.

Fixes #43003
Fixes #42336

In fact main issues reported in these tickets were not present after
cherry-picking original refactor switching to `views::WebView`, so
text could be selected and click event was properly generated. However
both issues testcases were using `vibrancy` and actual content was
invisible, because it was covered by the `NSVisualEffectView`.

* fix: EXCEPTION_ACCESS_VIOLATION crash on BrowserWindow.destroy()

Restored postponed deletion of the `NativeWindow`.

Restoration caused `DCHECK(new_parent_ui_layer->GetCompositor());` failure
in `BrowserCompositorMac::SetParentUiLayer` after the spec test:
`chrome extensions chrome.webRequest does not take precedence over Electron webRequest - http`
with stack:
```
7   Electron Framework 0x000000011fe07830 content::BrowserCompositorMac::SetParentUiLayer(ui::Layer*) + 628
8   Electron Framework 0x000000011fe0c154 content::RenderWidgetHostViewMac::SetParentUiLayer(ui::Layer*) + 220
9   Electron Framework 0x000000011fe226a8 content::WebContentsViewMac::CreateViewForWidget(content::RenderWidgetHost*) + 600
10  Electron Framework 0x000000011fd37e4c content::WebContentsImpl::CreateRenderWidgetHostViewForRenderManager(content::RenderViewHost*) + 164
11  Electron Framework 0x000000011fb32278 content::RenderFrameHostManager::CreateSpeculativeRenderFrame(content::SiteInstanceImpl*, bool, scoped_refptr<content::BrowsingContextState> const&) + 816
12  Electron Framework 0x000000011fb2ab8c content::RenderFrameHostManager::CreateSpeculativeRenderFrameHost(content::SiteInstanceImpl*, content::SiteInstanceImpl*, bool) + 1308
13  Electron Framework 0x000000011fb28598 content::RenderFrameHostManager::GetFrameHostForNavigation(content::NavigationRequest*, content::BrowsingContextGroupSwap*, std::__Cr::basic_string<char, std::__Cr::char_traits<char>, std::__Cr::allocator<char>>*) + 1796
14  Electron Framework 0x000000011fa78660 content::NavigationRequest::SelectFrameHostForOnRequestFailedInternal(bool, bool, std::__Cr::optional<std::__Cr::basic_string<char, std::__Cr::char_traits<char>, std::__Cr::allocator<char>>> const&) + 280
15  Electron Framework 0x000000011fa6a994 content::NavigationRequest::OnRequestFailedInternal(network::URLLoaderCompletionStatus const&, bool, std::__Cr::optional<std::__Cr::basic_string<char, std::__Cr::char_traits<char>, std::__Cr::allocator<char>>> const&, bo
+ 1008
16  Electron Framework 0x000000011fa7772c content::NavigationRequest::OnRequestFailed(network::URLLoaderCompletionStatus const&) + 72
17  Electron Framework 0x000000011f8554ac content::NavigationURLLoaderImpl::NotifyRequestFailed(network::URLLoaderCompletionStatus const&) + 248
```
This was probably the reason of removing `NativeWindow` immediately
in order to cleanup `views_host_` in `WebContentsViewMac` to prevent
using layer without compositor in `WebContentsViewMac::CreateViewForWidget`.

`[ElectronNSWindowDelegate windowWillClose:]` is deleting window host
and the compositor used by the `NativeWindow` therefore detach `NativeWindow`
contents from parent. This will clear `views_host_` and prevent failing
mentioned `DCHECK`.

Fixes #42975

* chore: Applied review suggestions

Co-authored-by: Michał Pichliński <michal.pichlinski@here.io>

* refactor: directly cleanup shell

Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Michał Pichliński <michal.pichlinski@here.io>
Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>
2025-01-23 11:54:15 +01:00
..
api refactor: remove InspectableWebContentsViewMac in favor of the Views version (#45238) 2025-01-23 11:54:15 +01:00
badging chore: bump chromium to 133.0.6920.0 (main) (#45055) 2025-01-10 10:52:34 -06:00
bluetooth chore: bump chromium to 131.0.6734.0 (main) (#43769) 2024-09-25 06:19:39 -05:00
extensions fix: potential crash in chrome.tabs.update() (#45302) 2025-01-23 11:53:40 +01:00
file_system_access fix: getAsFileSystemHandle failure when drag-dropping two directories (#45256) 2025-01-20 14:01:15 -06:00
hid refactor: replace base::StringPrintf() calls with absl::StrFormat() (#44515) 2024-11-04 12:58:16 -06:00
lib chore: more iwyu (#43063) 2024-07-29 12:42:57 -05:00
linux fix: modernize-use-using clang-tidy warnings (#44806) 2024-11-25 10:50:33 -05:00
mac fix: -Wunsafe-buffer-usage warning in didRegisterForRemoteNotificationsWithDeviceToken (#44348) 2024-10-23 14:18:22 -05:00
media chore: iwyu mojom-forward header files (#43741) 2024-09-17 12:58:56 -07:00
net chore: bump chromium to 133.0.6920.0 (main) (#45055) 2025-01-10 10:52:34 -06:00
notifications perf: cache whether or not ELECTRON_DEBUG_NOTIFICATIONS env var is set (#45143) 2025-01-08 20:46:17 -06:00
osr chore: bump chromium to 133.0.6920.0 (main) (#45055) 2025-01-10 10:52:34 -06:00
plugins refactor: fix modernize-return-braced-init-list warnings (#44838) 2024-11-27 09:41:46 +09:00
printing fix: misc-use-internal-linkage warnings (#44843) 2024-11-27 10:40:39 -06:00
resources chore: strip trailing whitespace (#35969) 2023-02-01 12:59:16 +01:00
serial refactor: replace base::StringPrintf() calls with absl::StrFormat() (#44515) 2024-11-04 12:58:16 -06:00
ui refactor: remove InspectableWebContentsViewMac in favor of the Views version (#45238) 2025-01-23 11:54:15 +01:00
usb fix: modernize-avoid-c-arrays (#44813) 2024-11-25 10:49:58 -05:00
webauthn chore: add/fix interface comments for sections of methods (#42566) 2024-06-20 10:49:07 +02:00
win chore: remove unused #includes (#42971) 2024-07-22 11:31:32 +02:00
animation_util.h feat: replace BrowserView with WebContentsView (#35658) 2023-12-13 13:01:03 -08:00
animation_util_mac.mm feat: replace BrowserView with WebContentsView (#35658) 2023-12-13 13:01:03 -08:00
auto_updater.cc build: make is_mas_build a generated header instead of config (#43737) 2024-09-17 01:38:56 -07:00
auto_updater.h fix: modernize-use-equals-default warnings (#44935) 2024-12-03 16:25:48 -06:00
auto_updater_mac.mm chore: bump chromium to 120.0.6099.0 (main) (#40316) 2023-11-01 10:02:12 -04:00
background_throttling_source.h fix: disable background throttling also in the viz::DisplayScheduler (#38924) 2023-09-26 16:00:46 -04:00
browser.cc chore: remove unused base/ includes (#43688) 2024-09-12 16:05:37 +02:00
browser.h chore: more iwyu (#43063) 2024-07-29 12:42:57 -05:00
browser_linux.cc refactor: fix modernize-return-braced-init-list warnings (#44838) 2024-11-27 09:41:46 +09:00
browser_mac.mm build: make is_mas_build a generated header instead of config (#43737) 2024-09-17 01:38:56 -07:00
browser_observer.h fix: modernize-use-equals-default warnings (#44935) 2024-12-03 16:25:48 -06:00
browser_process_impl.cc chore: bump chromium to 129.0.6668.0 (main) (#43368) 2024-08-20 16:54:27 +02:00
browser_process_impl.h chore: bump chromium to 129.0.6668.0 (main) (#43368) 2024-08-20 16:54:27 +02:00
browser_win.cc refactor: return-braced-init-list pt 2 of 2 (#44870) 2024-11-29 11:44:33 -06:00
certificate_manager_model.cc refactor: remove deprecated BrowserContext::ResourceContext (#41221) 2024-02-05 18:12:34 -06:00
certificate_manager_model.h chore: more iwyu (#43063) 2024-07-29 12:42:57 -05:00
child_web_contents_tracker.cc chore: bump chromium to 99.0.4767.0 (main) (#31986) 2022-01-10 17:31:39 -05:00
child_web_contents_tracker.h chore: add ELECTRON_ prefix to C++ include guards (#31925) 2021-11-22 16:34:31 +09:00
cookie_change_notifier.cc chore: more iwyu (#43063) 2024-07-29 12:42:57 -05:00
cookie_change_notifier.h chore: more iwyu (#43063) 2024-07-29 12:42:57 -05:00
draggable_region_provider.h refactor: move draggable regions to WebContents (#36230) 2022-11-07 10:15:57 -08:00
electron_api_ipc_handler_impl.cc chore: remove deprecated ipcRenderer.sendTo() (#39087) 2023-08-28 10:29:27 -04:00
electron_api_ipc_handler_impl.h refactor: inherit Observer classes privately, pt. 2 (#42237) 2024-05-29 13:07:02 -05:00
electron_autofill_driver.cc feat: replace BrowserView with WebContentsView (#35658) 2023-12-13 13:01:03 -08:00
electron_autofill_driver.h chore: more iwyu (#43063) 2024-07-29 12:42:57 -05:00
electron_autofill_driver_factory.cc chore: remove unused base/ includes (#43688) 2024-09-12 16:05:37 +02:00
electron_autofill_driver_factory.h refactor: prefer to inherit observer classes privately (#41360) 2024-05-21 14:21:31 -05:00
electron_browser_client.cc chore: align clipboard blink::web_pref::WebPreferences with upstream (#45280) 2025-01-21 09:39:04 -08:00
electron_browser_client.h chore: bump chromium to 133.0.6920.0 (main) (#45055) 2025-01-10 10:52:34 -06:00
electron_browser_context.cc chore: bump chromium to 133.0.6920.0 (main) (#45055) 2025-01-10 10:52:34 -06:00
electron_browser_context.h chore: iwyu mojom-forward header files (#43741) 2024-09-17 12:58:56 -07:00
electron_browser_main_parts.cc refactor: fix modernize-return-braced-init-list warnings (#44838) 2024-11-27 09:41:46 +09:00
electron_browser_main_parts.h chore: iwyu mojom-forward header files (#43741) 2024-09-17 12:58:56 -07:00
electron_browser_main_parts_linux.cc refactor: move impl classes into unnamed namespaces (#42390) 2024-06-10 17:00:20 -05:00
electron_browser_main_parts_mac.mm chore: remove more unused #include calls (#43000) 2024-07-25 11:25:45 +02:00
electron_browser_main_parts_posix.cc chore: bump chromium to 133.0.6846.0 (main) (#44665) 2024-11-19 19:52:20 -08:00
electron_crypto_module_delegate_nss.cc fix: -Wunsafe-buffer-usage warning in ChunkedDataPipeReadableStream (#44211) 2024-10-14 10:46:24 +02:00
electron_crypto_module_delegate_nss.h feat: Implement password delegate for NSS (#41205) 2024-07-17 09:48:03 -04:00
electron_download_manager_delegate.cc chore: cleanup include groupings (#43478) 2024-08-26 10:44:20 -04:00
electron_download_manager_delegate.h chore: more iwyu (#43063) 2024-07-29 12:42:57 -05:00
electron_gpu_client.cc chore: bump chromium to 100.0.4857.0 (main) (#32419) 2022-02-09 18:58:52 -08:00
electron_gpu_client.h chore: add ELECTRON_ prefix to C++ include guards (#31925) 2021-11-22 16:34:31 +09:00
electron_navigation_throttle.cc chore: bump chromium to 127.0.6521.0 (main) (#42118) 2024-06-07 17:18:35 -04:00
electron_navigation_throttle.h chore: add/fix interface comments for sections of methods (#42566) 2024-06-20 10:49:07 +02:00
electron_pdf_document_helper_client.cc chore: bump chromium to 133.0.6846.0 (main) (#44665) 2024-11-19 19:52:20 -08:00
electron_pdf_document_helper_client.h chore: bump chromium to 133.0.6846.0 (main) (#44665) 2024-11-19 19:52:20 -08:00
electron_permission_manager.cc chore: bump chromium to 133.0.6920.0 (main) (#45055) 2025-01-10 10:52:34 -06:00
electron_permission_manager.h chore: bump chromium to 130.0.6695.0 (main) (#43454) 2024-09-17 18:12:11 -07:00
electron_plugin_info_host_impl.cc chore: bump chromium to 129.0.6650.0 (main) (#43266) 2024-08-12 10:28:33 +02:00
electron_plugin_info_host_impl.h chore: bump chromium to 129.0.6650.0 (main) (#43266) 2024-08-12 10:28:33 +02:00
electron_speech_recognition_manager_delegate.cc refactor: do not subclass ElectronSpeechRecognitionManagerDelegate from SpeechRecognitionEventListener (#42806) 2024-07-10 15:32:50 +02:00
electron_speech_recognition_manager_delegate.h refactor: do not subclass ElectronSpeechRecognitionManagerDelegate from SpeechRecognitionEventListener (#42806) 2024-07-10 15:32:50 +02:00
electron_web_contents_utility_handler_impl.cc chore: bump chromium to 125.0.6412.0 (main) (#41610) 2024-04-15 18:10:32 -04:00
electron_web_contents_utility_handler_impl.h refactor: inherit Observer classes privately, pt. 2 (#42237) 2024-05-29 13:07:02 -05:00
electron_web_ui_controller_factory.cc refactor: return-braced-init-list pt 2 of 2 (#44870) 2024-11-29 11:44:33 -06:00
electron_web_ui_controller_factory.h chore: add ELECTRON_ prefix to C++ include guards (#31925) 2021-11-22 16:34:31 +09:00
event_emitter_mixin.h chore: migrate base::StringPiece to std::string_view (#40915) 2024-01-10 19:00:37 -06:00
extended_web_contents_observer.h fix: modernize-use-equals-default warnings (#44935) 2024-12-03 16:25:48 -06:00
fake_location_provider.cc chore: remove unused base/ includes (#43688) 2024-09-12 16:05:37 +02:00
fake_location_provider.h chore: bump chromium to 116.0.5845.0 (main) (#38827) 2023-06-22 10:51:15 +02:00
feature_list.cc chore: bump chromium to 133.0.6920.0 (main) (#45055) 2025-01-10 10:52:34 -06:00
feature_list.h feat: add support for system picker in setDisplayMediaRequestHandler (#43581) 2024-09-10 16:05:57 -07:00
feature_list_mac.mm feat: add support for system picker in setDisplayMediaRequestHandler (#43581) 2024-09-10 16:05:57 -07:00
file_select_helper.cc refactor: return-braced-init-list pt 2 of 2 (#44870) 2024-11-29 11:44:33 -06:00
file_select_helper.h chore: remove more unused #include calls (#43000) 2024-07-25 11:25:45 +02:00
file_select_helper_mac.mm refactor: replace remaining NULL with nullptr (#40053) 2023-10-03 12:26:35 -07:00
font_defaults.cc fix: -Wunsafe-buffer-usage in electron::SetFontDefaults() (#44014) 2024-09-30 15:09:36 +02:00
font_defaults.h chore: add ELECTRON_ prefix to C++ include guards (#31925) 2021-11-22 16:34:31 +09:00
javascript_environment.cc refactor: fix modernize-return-braced-init-list warnings (#44838) 2024-11-27 09:41:46 +09:00
javascript_environment.h refactor: remove unused fields, methods in gin_helper::Locker (#39803) 2023-09-12 16:53:20 -07:00
login_handler.cc chore: bump chromium to 131.0.6762.0 (main) (#44117) 2024-10-07 18:06:47 -05:00
login_handler.h chore: bump chromium to 131.0.6762.0 (main) (#44117) 2024-10-07 18:06:47 -05:00
microtasks_runner.cc perf: remove isolate scope from DidProcessTask() (#44439) 2024-10-29 23:25:40 -05:00
microtasks_runner.h chore: enable check raw ptr fields (#38167) 2023-05-11 16:07:39 -04:00
native_window.cc refactor: fix modernize-return-braced-init-list warnings (#44838) 2024-11-27 09:41:46 +09:00
native_window.h feat: add query-session-end and improve session-end events on Windows (#44598) 2024-11-22 11:47:36 -08:00
native_window_features.cc chore: bump chromium to 127.0.6521.0 (main) (#42118) 2024-06-07 17:18:35 -04:00
native_window_features.h fix: Add support for Wayland window decorations (#29618) 2022-01-26 13:59:09 -08:00
native_window_mac.h refactor: remove InspectableWebContentsViewMac in favor of the Views version (#45238) 2025-01-23 11:54:15 +01:00
native_window_mac.mm refactor: remove InspectableWebContentsViewMac in favor of the Views version (#45238) 2025-01-23 11:54:15 +01:00
native_window_observer.h fix: modernize-use-equals-default warnings (#44935) 2024-12-03 16:25:48 -06:00
native_window_views.cc refactor: remove InspectableWebContentsViewMac in favor of the Views version (#45238) 2025-01-23 11:54:15 +01:00
native_window_views.h chore: bump chromium to 131.0.6744.0 (main) (#43948) 2024-09-30 14:54:44 +02:00
native_window_views_win.cc feat: add query-session-end and improve session-end events on Windows (#44598) 2024-11-22 11:47:36 -08:00
network_hints_handler_impl.cc chore: bump chromium to 133.0.6920.0 (main) (#45055) 2025-01-10 10:52:34 -06:00
network_hints_handler_impl.h chore: enable check raw ptr fields (#38167) 2023-05-11 16:07:39 -04:00
protocol_registry.cc perf: prefer GURL string_view getters (#43443) 2024-08-23 17:15:45 -05:00
protocol_registry.h perf: prefer GURL string_view getters (#43443) 2024-08-23 17:15:45 -05:00
relauncher.cc refactor: reduce scope of relauncher's internal constants (#44860) 2024-11-30 06:54:40 -06:00
relauncher.h refactor: reduce scope of relauncher's internal constants (#44860) 2024-11-30 06:54:40 -06:00
relauncher_linux.cc chore: remove unused #includes (#42971) 2024-07-22 11:31:32 +02:00
relauncher_mac.cc chore: remove unused #includes (#42971) 2024-07-22 11:31:32 +02:00
relauncher_win.cc refactor: reduce scope of relauncher's internal constants (#44860) 2024-11-30 06:54:40 -06:00
session_preferences.cc refactor: add SessionPreferences::CreateForBrowserContext() (#38656) 2023-06-09 11:20:43 -05:00
session_preferences.h refactor: add SessionPreferences::CreateForBrowserContext() (#38656) 2023-06-09 11:20:43 -05:00
special_storage_policy.cc chore: remove unused base/ includes (#43688) 2024-09-12 16:05:37 +02:00
special_storage_policy.h chore: bump chromium to 106.0.5216.0 (main) (#34993) 2022-08-17 11:35:53 -07:00
web_contents_permission_helper.cc refactor: fix modernize-return-braced-init-list warnings (#44838) 2024-11-27 09:41:46 +09:00
web_contents_permission_helper.h feat: implement File System API support (#41419) 2024-04-10 22:06:47 +02:00
web_contents_preferences.cc chore: bump chromium to 133.0.6920.0 (main) (#45055) 2025-01-10 10:52:34 -06:00
web_contents_preferences.h chore: bump chromium to 133.0.6920.0 (main) (#45055) 2025-01-10 10:52:34 -06:00
web_contents_zoom_controller.cc perf: prefer GURL string_view getters (#43443) 2024-08-23 17:15:45 -05:00
web_contents_zoom_controller.h chore: more iwyu (#43063) 2024-07-29 12:42:57 -05:00
web_contents_zoom_observer.h chore: more iwyu (#43063) 2024-07-29 12:42:57 -05:00
web_view_guest_delegate.cc chore: bump chromium to 133.0.6920.0 (main) (#45055) 2025-01-10 10:52:34 -06:00
web_view_guest_delegate.h refactor: prefer to inherit observer classes privately (#41360) 2024-05-21 14:21:31 -05:00
web_view_manager.cc chore: bump chromium to 121.0.6147.0 (main) (#40523) 2023-11-28 13:40:12 -08:00
web_view_manager.h perf: use flat_set, flat_map for small, trivially-moved containers (#40817) 2024-01-05 12:18:31 +01:00
window_list.cc chore: remove unused base/ includes (#43688) 2024-09-12 16:05:37 +02:00
window_list.h refactor: migrate deprecated LazyInstance code to NoDestructor (#40927) 2024-01-10 14:01:49 -06:00
window_list_observer.h fix: modernize-use-equals-default warnings (#44935) 2024-12-03 16:25:48 -06:00
zoom_level_delegate.cc fix: modernize-avoid-c-arrays (#44813) 2024-11-25 10:49:58 -05:00
zoom_level_delegate.h chore: more iwyu (#43063) 2024-07-29 12:42:57 -05:00