Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mac: window.close() breaks the cefclient with --hide-window-on-close #3660

Open
nik-sp opened this issue Mar 6, 2024 · 0 comments
Open

mac: window.close() breaks the cefclient with --hide-window-on-close #3660

nik-sp opened this issue Mar 6, 2024 · 0 comments
Labels
bug Bug report macos MacOS platform views Related to the Views framework

Comments

@nik-sp
Copy link
Collaborator

nik-sp commented Mar 6, 2024

Description

When using the window.close() method in the cefclient application on macOS with the --hide-window-on-close flag enabled, the application breaks. The page is rendered white, it's impossible to close the application.

To Reproduce

Steps to reproduce the behavior:

  1. Launch the cefclient application with the --hide-window-on-close flag enabled.
  2. Navigate within the application to a webpage where window.close() is invoked.
  3. Invoke window.close() programmatically or through an action in the webpage.
  4. Notice that the window is close, but the app still present in the dock

Expected behavior

The application should gracefully close the window or hide it according to the --hide-window-on-close flag setting, without breaking or exhibiting unexpected behavior when window.close() is invoked.

Screenshots

With hidden frame
Screenshot 2024-03-06 at 16 37 50

Versions (please complete the following information):

  • OS: MacOS 14.3.1
  • CEF Version: 121, 122 and latest main

Additional context

It seems that CloseWithReason exits prematurely because OnWindowCloseRequested returns CloseRequestResult::kCannotClose. As a result, the application ends up in an invalid partially closed state.

void Widget::CloseWithReason(ClosedReason closed_reason) {
  if (widget_closed_) {
    // It appears we can hit this code path if you close a modal dialog then
    // close the last browser before the destructor is hit, which triggers
    // invoking Close again.
    return;
  }
  if (block_close_) {
    return;
  }
  if (non_client_view_ && non_client_view_->OnWindowCloseRequested() ==
                              CloseRequestResult::kCannotClose) {
    return;
  }
@nik-sp nik-sp added the bug Bug report label Mar 6, 2024
@magreenblatt magreenblatt changed the title window.close() breaks the cefclient when --hide-on-close is enabled on macOS mac: window.close() breaks the cefclient with --hide-window-on-close Mar 6, 2024
@magreenblatt magreenblatt added macos MacOS platform views Related to the Views framework labels Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug report macos MacOS platform views Related to the Views framework
Projects
None yet
Development

No branches or pull requests

2 participants