You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Destroyed event not emitted on close for custom BrowserView.webContents #37356
I agree to follow the Code of Conduct that this project adheres to.
I have searched the issue tracker for a bug report that matches the one I want to file, without success.
Electron Version
22.3.0
What operating system are you using?
Windows
Operating System Version
Windows 10 version 21H2
What arch are you using?
x64
Last Known Working Electron version
22.2.1
Expected Behavior
I've created a custom BrowserView, added it to my main BrowserWindow via addBrowserView(), and navigated its webContents to a file. Upon receiving a message from the renderer process, I attach a handler to the webContents' 'destroyed' event, then close the contents via webContents.close(). Since I'm omitting the 'waitForBeforeUnload' option in my close() call, I expect the 'destroyed' event to be emitted, and my attached handler to run.
Actual Behavior
The 'destroyed' event is not emitted, and my attached handler never run, until my main BrowserWindow is closed.
To repro, run the attached gist with v22.2.1 and click the "Close" button. After dismissing a message box saying "Closing page 2", that page will disappear and another "Page 2 closed" message box will appear. Run the gist again with v22.3.0 and notice that after dismissing the first message box, the page doesn't seem to disappear, and the second message box never appears.
Activity
pushkin- commentedon Feb 20, 2023
likely culprit