Skip to content

Commit

Permalink
fix: close window when leave fs crash (#25604)
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Sep 23, 2020
1 parent a99256d commit 894d41e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion shell/browser/api/electron_api_browser_window.cc
Expand Up @@ -336,11 +336,11 @@ void BrowserWindow::OnWindowResize() {
}

void BrowserWindow::OnWindowLeaveFullScreen() {
TopLevelWindow::OnWindowLeaveFullScreen();
#if defined(OS_MACOSX)
if (web_contents()->IsFullscreenForCurrentTab())
web_contents()->ExitFullscreen(true);
#endif
TopLevelWindow::OnWindowLeaveFullScreen();
}

void BrowserWindow::Focus() {
Expand Down
16 changes: 16 additions & 0 deletions spec-main/api-browser-window-spec.ts
Expand Up @@ -3938,6 +3938,22 @@ describe('BrowserWindow module', () => {
});

ifdescribe(process.platform === 'darwin')('fullscreen state', () => {
it('should not cause a crash if called when exiting fullscreen', async () => {
const w = new BrowserWindow();

const enterFullScreen = emittedOnce(w, 'enter-full-screen');
w.setFullScreen(true);
await enterFullScreen;

await delay();

const leaveFullScreen = emittedOnce(w, 'leave-full-screen');
w.setFullScreen(false);
await leaveFullScreen;

w.close();
});

it('can be changed with setFullScreen method', async () => {
const w = new BrowserWindow();
const enterFullScreen = emittedOnce(w, 'enter-full-screen');
Expand Down

0 comments on commit 894d41e

Please sign in to comment.