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

[Bug]: Calling preventDefault on BrowserWindow close event still destroys BrowserViews' webContents #42033

Open
3 tasks done
yangannyx opened this issue May 3, 2024 · 1 comment
Labels
30-x-y 31-x-y bug 🪲 bug/regression ↩️ A new version of Electron broke something component/BrowserView component/WebContentsView has-repro-gist Issue can be reproduced with code at https://gist.github.com/

Comments

@yangannyx
Copy link

Preflight Checklist

Electron Version

30.0.0

What operating system are you using?

macOS

Operating System Version

Sonoma 14.4.1

What arch are you using?

arm64 (including Apple Silicon)

Last Known Working Electron version

29.3.2

Expected Behavior

Calling preventDefault on a BrowserWindow close event should not destroy the window's BrowserViews's webContents.

Actual Behavior

BrowserWindow close event destroys all BrowserViews' webContents, even when preventDefault is called.

In the attached jist, on versions of electron < v30, I'm able to close the app window and reopen the app by clicking on the Electron app in the dock. After version 30, reopening the app shows a completely blank window.

App after reopening on Electron <30
Screenshot 2024-05-03 at 2 01 10 PM

App after reopening on Electron 30
Screenshot 2024-05-03 at 2 01 56 PM

Testcase Gist URL

https://gist.github.com/yangannyx/0f758e003426f3829cb791aa3c51ac4d

Additional Information

No response

@electron-issue-triage electron-issue-triage bot added the has-repro-gist Issue can be reproduced with code at https://gist.github.com/ label May 3, 2024
@dsanders11 dsanders11 added bug/regression ↩️ A new version of Electron broke something component/BrowserView labels May 6, 2024
@codebytere
Copy link
Member

codebytere commented May 6, 2024

Tracked initially to #35658 - your gist actually crashes after that first PR. That crash is then fixed in #41154, producing the current behavior.

Ah - looks like this change happens here: https://github.com/electron/electron/pull/35658/files#diff-8ad85e06abb8d70e94f4f58a38578024d942a6e039d8c18b27dd46f9cbb2fabdR57

@nornagon was this an intended breaking change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
30-x-y 31-x-y bug 🪲 bug/regression ↩️ A new version of Electron broke something component/BrowserView component/WebContentsView has-repro-gist Issue can be reproduced with code at https://gist.github.com/
Projects
Status: 🛑 Blocks Stable
Status: 🛑 Blocks Stable
Development

Successfully merging a pull request may close this issue.

4 participants