fix: close window when leave fs crash (#25468)
This commit is contained in:
parent
2cfa41e6e0
commit
a65f7f7d42
2 changed files with 17 additions and 1 deletions
|
@ -340,11 +340,11 @@ void BrowserWindow::OnWindowResize() {
|
|||
}
|
||||
|
||||
void BrowserWindow::OnWindowLeaveFullScreen() {
|
||||
BaseWindow::OnWindowLeaveFullScreen();
|
||||
#if defined(OS_MAC)
|
||||
if (web_contents()->IsFullscreen())
|
||||
web_contents()->ExitFullscreen(true);
|
||||
#endif
|
||||
BaseWindow::OnWindowLeaveFullScreen();
|
||||
}
|
||||
|
||||
void BrowserWindow::Focus() {
|
||||
|
|
|
@ -3970,6 +3970,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');
|
||||
|
|
Loading…
Reference in a new issue