electron/shell/browser/api
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
..
views chore: more iwyu (#43063) 2024-07-29 12:42:57 -05:00
electron_api_app.cc chore: bump chromium to 133.0.6920.0 (main) (#45055) 2025-01-10 10:52:34 -06:00
electron_api_app.h chore: bump chromium to 133.0.6920.0 (main) (#45055) 2025-01-10 10:52:34 -06:00
electron_api_app_mac.mm chore: remove more unused #include calls (#43000) 2024-07-25 11:25:45 +02:00
electron_api_app_mas.mm chore: bump chromium to 117.0.5923.0 (main) (#39304) 2023-08-04 10:47:29 +02:00
electron_api_auto_updater.cc fix: gin_helper::MicrotasksScope instantiation (#43185) 2024-08-05 08:24:27 -05:00
electron_api_auto_updater.h refactor: declare gin::Wrapper subclasses as final (#43527) 2024-09-04 18:40:02 -05:00
electron_api_base_window.cc chore: remove unused arg from BaseWindow::GetBackgroundColor() (#44906) 2024-12-02 11:39:10 -05:00
electron_api_base_window.h chore: remove unused arg from BaseWindow::GetBackgroundColor() (#44906) 2024-12-02 11:39:10 -05:00
electron_api_browser_window.cc refactor: unfilter unresponsive events (#44629) 2024-11-13 17:59:13 -08:00
electron_api_browser_window.h refactor: unfilter unresponsive events (#44629) 2024-11-13 17:59:13 -08:00
electron_api_content_tracing.cc refactor: in StopTracing(), use string literals instead of optional<string> (#45292) 2025-01-22 09:43:38 -06:00
electron_api_cookies.cc chore: bump chromium to 133.0.6878.0 (main) (#44831) 2024-12-10 13:16:07 -06:00
electron_api_cookies.h chore: remove unused isolate argument from Cookies constructor (#44907) 2024-12-02 11:34:21 -05:00
electron_api_crash_reporter.cc refactor: fix modernize-return-braced-init-list warnings (#44838) 2024-11-27 09:41:46 +09:00
electron_api_crash_reporter.h chore: remove more unused #include calls (#43000) 2024-07-25 11:25:45 +02:00
electron_api_data_pipe_holder.cc refactor: return-braced-init-list pt 2 of 2 (#44870) 2024-11-29 11:44:33 -06:00
electron_api_data_pipe_holder.h refactor: declare gin::Wrapper subclasses as final (#43527) 2024-09-04 18:40:02 -05:00
electron_api_debugger.cc chore: bump chromium to 133.0.6878.0 (main) (#44831) 2024-12-10 13:16:07 -06:00
electron_api_debugger.h refactor: declare gin::Wrapper subclasses as final (#43527) 2024-09-04 18:40:02 -05:00
electron_api_desktop_capturer.cc fix: add patch to fix desktopCapturer.getSources not returning electron windows on Windows (#45000) 2024-12-17 15:20:44 -08:00
electron_api_desktop_capturer.h feat: add support for system picker in setDisplayMediaRequestHandler (#43581) 2024-09-10 16:05:57 -07:00
electron_api_desktop_capturer_mac.mm feat: add support for system picker in setDisplayMediaRequestHandler (#43581) 2024-09-10 16:05:57 -07:00
electron_api_dialog.cc chore: more iwyu (#43063) 2024-07-29 12:42:57 -05:00
electron_api_download_item.cc refactor: return-braced-init-list pt 2 of 2 (#44870) 2024-11-29 11:44:33 -06:00
electron_api_download_item.h refactor: declare gin::Wrapper subclasses as final (#43527) 2024-09-04 18:40:02 -05:00
electron_api_event_emitter.cc chore: remove more unused #include calls (#43000) 2024-07-25 11:25:45 +02:00
electron_api_event_emitter.h chore: add ELECTRON_ prefix to C++ include guards (#31925) 2021-11-22 16:34:31 +09:00
electron_api_global_shortcut.cc chore: bump chromium to 133.0.6878.0 (main) (#44831) 2024-12-10 13:16:07 -06:00
electron_api_global_shortcut.h chore: bump chromium to 133.0.6852.0 (main) (#44748) 2024-11-25 10:45:47 -05:00
electron_api_in_app_purchase.cc chore: more iwyu (#43063) 2024-07-29 12:42:57 -05:00
electron_api_in_app_purchase.h refactor: declare gin::Wrapper subclasses as final (#43527) 2024-09-04 18:40:02 -05:00
electron_api_menu.cc fix: misc-use-internal-linkage warnings (#44843) 2024-11-27 10:40:39 -06:00
electron_api_menu.h chore: bump chromium to 132.0.6807.0 (main) (#44360) 2024-11-04 09:10:00 -05:00
electron_api_menu_mac.h chore: bump chromium to 132.0.6807.0 (main) (#44360) 2024-11-04 09:10:00 -05:00
electron_api_menu_mac.mm chore: bump chromium to 132.0.6807.0 (main) (#44360) 2024-11-04 09:10:00 -05:00
electron_api_menu_views.cc chore: bump chromium to 132.0.6807.0 (main) (#44360) 2024-11-04 09:10:00 -05:00
electron_api_menu_views.h chore: bump chromium to 132.0.6807.0 (main) (#44360) 2024-11-04 09:10:00 -05:00
electron_api_native_theme.cc feat: add transparency checking to nativeTheme (#42862) 2024-07-24 14:38:22 +02:00
electron_api_native_theme.h refactor: declare gin::Wrapper subclasses as final (#43527) 2024-09-04 18:40:02 -05:00
electron_api_native_theme_mac.mm chore: cleanup arc migration helpers (#39606) 2023-08-23 09:54:21 -04:00
electron_api_net_log.cc refactor: fix modernize-return-braced-init-list warnings (#44838) 2024-11-27 09:41:46 +09:00
electron_api_net_log.h refactor: declare gin::Wrapper subclasses as final (#43527) 2024-09-04 18:40:02 -05:00
electron_api_notification.cc refactor: return-braced-init-list pt 2 of 2 (#44870) 2024-11-29 11:44:33 -06:00
electron_api_notification.h refactor: declare gin::Wrapper subclasses as final (#43527) 2024-09-04 18:40:02 -05:00
electron_api_power_monitor.cc chore: bump chromium to 131.0.6734.0 (main) (#43769) 2024-09-25 06:19:39 -05:00
electron_api_power_monitor.h chore: bump chromium to 131.0.6734.0 (main) (#43769) 2024-09-25 06:19:39 -05:00
electron_api_power_monitor_mac.mm fix: user-did-{resign|become}-active events on macOS (#41506) 2024-03-06 12:43:39 +01:00
electron_api_power_monitor_win.cc chore: iwyu mojom-forward header files (#43741) 2024-09-17 12:58:56 -07:00
electron_api_power_save_blocker.cc chore: more iwyu (#43063) 2024-07-29 12:42:57 -05:00
electron_api_power_save_blocker.h refactor: declare gin::Wrapper subclasses as final (#43527) 2024-09-04 18:40:02 -05:00
electron_api_printing.cc chore: remove deprecated webContents.getPrinters() (#39663) 2023-09-05 10:16:41 +02:00
electron_api_protocol.cc refactor: return-braced-init-list pt 2 of 2 (#44870) 2024-11-29 11:44:33 -06:00
electron_api_protocol.h refactor: declare gin::Wrapper subclasses as final (#43527) 2024-09-04 18:40:02 -05:00
electron_api_push_notifications.cc chore: more iwyu (#43063) 2024-07-29 12:42:57 -05:00
electron_api_push_notifications.h refactor: declare gin::Wrapper subclasses as final (#43527) 2024-09-04 18:40:02 -05:00
electron_api_push_notifications_mac.mm chore: cleanup arc migration helpers (#39606) 2023-08-23 09:54:21 -04:00
electron_api_safe_storage.cc refactor: fix modernize-return-braced-init-list warnings (#44838) 2024-11-27 09:41:46 +09:00
electron_api_screen.cc refactor: fix modernize-return-braced-init-list warnings (#44838) 2024-11-27 09:41:46 +09:00
electron_api_screen.h refactor: declare gin::Wrapper subclasses as final (#43527) 2024-09-04 18:40:02 -05:00
electron_api_service_worker_context.cc refactor: return-braced-init-list pt 2 of 2 (#44870) 2024-11-29 11:44:33 -06:00
electron_api_service_worker_context.h refactor: declare gin::Wrapper subclasses as final (#43527) 2024-09-04 18:40:02 -05:00
electron_api_session.cc fix: session.clearData avoidClosingConnections default to false (#45187) 2025-01-15 11:38:50 -05:00
electron_api_session.h feat: Add shared dictionary management APIs (#44750) 2024-12-04 12:25:11 -05:00
electron_api_system_preferences.cc chore: more iwyu (#43063) 2024-07-29 12:42:57 -05:00
electron_api_system_preferences.h refactor: declare gin::Wrapper subclasses as final (#43527) 2024-09-04 18:40:02 -05:00
electron_api_system_preferences_mac.mm chore: bump chromium to 131.0.6734.0 (main) (#43769) 2024-09-25 06:19:39 -05:00
electron_api_system_preferences_win.cc refactor: return-braced-init-list pt 2 of 2 (#44870) 2024-11-29 11:44:33 -06:00
electron_api_tray.cc refactor: fix modernize-return-braced-init-list warnings (#44838) 2024-11-27 09:41:46 +09:00
electron_api_tray.h refactor: declare gin::Wrapper subclasses as final (#43527) 2024-09-04 18:40:02 -05:00
electron_api_utility_process.cc refactor: return-braced-init-list pt 2 of 2 (#44870) 2024-11-29 11:44:33 -06:00
electron_api_utility_process.h fix: utility process exit code for graceful termination (reland) (#44726) 2024-11-20 02:48:15 +09:00
electron_api_view.cc refactor: return-braced-init-list pt 2 of 2 (#44870) 2024-11-29 11:44:33 -06:00
electron_api_view.h fix: WebContentsView removal should compare directly (#44656) 2024-11-14 22:11:20 -05:00
electron_api_web_contents.cc chore: bump chromium to 133.0.6920.0 (main) (#45055) 2025-01-10 10:52:34 -06:00
electron_api_web_contents.h chore: bump chromium to 133.0.6920.0 (main) (#45055) 2025-01-10 10:52:34 -06:00
electron_api_web_contents_impl.cc chore: bump chromium to 131.0.6734.0 (main) (#43769) 2024-09-25 06:19:39 -05:00
electron_api_web_contents_mac.mm chore: bump chromium to 127.0.6521.0 (main) (#42118) 2024-06-07 17:18:35 -04:00
electron_api_web_contents_view.cc refactor: remove InspectableWebContentsViewMac in favor of the Views version (#45238) 2025-01-23 11:54:15 +01:00
electron_api_web_contents_view.h feat: customize border radius of Views (#42320) 2024-07-16 20:16:25 -04:00
electron_api_web_frame_main.cc chore: bump chromium to 133.0.6920.0 (main) (#45055) 2025-01-10 10:52:34 -06:00
electron_api_web_frame_main.h chore: bump chromium to 133.0.6920.0 (main) (#45055) 2025-01-10 10:52:34 -06:00
electron_api_web_request.cc refactor: return-braced-init-list pt 2 of 2 (#44870) 2024-11-29 11:44:33 -06:00
electron_api_web_request.h refactor: declare gin::Wrapper subclasses as final (#43527) 2024-09-04 18:40:02 -05:00
electron_api_web_view_manager.cc chore: rename built-in modules to bindings to match naming update in node (#37182) 2023-02-09 10:31:38 +09:00
frame_subscriber.cc refactor: put empty virtual function definitions in header (#43285) 2024-08-12 09:56:51 +02:00
frame_subscriber.h refactor: put empty virtual function definitions in header (#43285) 2024-08-12 09:56:51 +02:00
gpu_info_enumerator.cc refactor: simplify code by using base::Value::EnsureList() (#41162) 2024-01-30 14:48:09 -06:00
gpu_info_enumerator.h chore: add/fix interface comments for sections of methods (#42566) 2024-06-20 10:49:07 +02:00
gpuinfo_manager.cc chore: more iwyu (#43063) 2024-07-29 12:42:57 -05:00
gpuinfo_manager.h chore: more iwyu (#43063) 2024-07-29 12:42:57 -05:00
message_port.cc refactor: return-braced-init-list pt 2 of 2 (#44870) 2024-11-29 11:44:33 -06:00
message_port.h refactor: declare gin::Wrapper subclasses as final (#43527) 2024-09-04 18:40:02 -05:00
process_metric.cc build: make is_mas_build a generated header instead of config (#43737) 2024-09-17 01:38:56 -07:00
process_metric.h chore: bump chromium to 100.0.4857.0 (main) (#32419) 2022-02-09 18:58:52 -08:00
save_page_handler.cc chore: remove more unused #include calls (#43000) 2024-07-25 11:25:45 +02:00
save_page_handler.h chore: more iwyu (#43063) 2024-07-29 12:42:57 -05:00
ui_event.cc chore: used nested namespaces (#34737) 2022-06-29 12:55:47 -07:00
ui_event.h chore: used nested namespaces (#34737) 2022-06-29 12:55:47 -07:00