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]: Destroyed event not emitted on close for custom BrowserView.webContents #37356

Closed
3 tasks done
mgalla10 opened this issue Feb 20, 2023 · 1 comment · Fixed by #37420
Closed
3 tasks done

[Bug]: Destroyed event not emitted on close for custom BrowserView.webContents #37356

mgalla10 opened this issue Feb 20, 2023 · 1 comment · Fixed by #37420

Comments

@mgalla10
Copy link

Preflight Checklist

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.

Testcase Gist URL

https://gist.github.com/mgalla10/cdff38e750ae49d01500445b019493ca

Additional Information

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants