-
Notifications
You must be signed in to change notification settings - Fork 15k
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]: 'close' event is not triggered for sandboxed windows #28215
Comments
NB. I copied your repro to a Fiddle-compatible gist for easy Fiddling. I can indeed reproduce this. |
Interestingly, |
Is |
Huh, apparently not.
gotcha, yeah it makes sense that it should be possible to prevent the window close. |
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment! |
Bump |
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment! |
bump, this looks still valid |
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment! |
repros in v24 |
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment! |
bump |
Tested the original fiddle on v25.2.0 and verified that this is still broken. |
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment! |
repros in v27 |
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment! |
repros in v29 alpha 8 |
Note that in my case, I have a window with multiple BrowserViews in it (like tabs). This case needs to be considered when fixing this since fixing this in the naive way would mean that when one webContents closes, the entire window closes, which isn't really appropriate. It seems like it only makes sense for the "close" event to fire when there are no other webContents in the BrowserWindow. |
It's a weird little inconsistency, although pretty easily to workaround. |
Preflight Checklist
Electron Version
12.0.1, 11.3.0, 10.4.1
What operating system are you using?
Other Linux
Operating System Version
Linux workstation 5.11.6-arch1-1 #1 SMP PREEMPT Thu, 11 Mar 2021 13:48:23 +0000 x86_64 GNU/Linux
What arch are you using?
x64
Last Known Working Electron version
No response
Expected Behavior
close
event should be triggered when the webpage closes itself withwindow.close()
, as it is for non-sandboxed contexts.Actual Behavior
close
event is not triggered onwindow.close()
from inside the webpage for sandboxed contexts.Testcase Gist URL
https://gist.github.com/cecc82a9d8ee56d01aa97b4c716eea9e
Testcase:
Here,
executeJavaScript
is not necessary -- the page can do the same itself, or that could be alternatively done from devtools.If the window is closed externally (via
.close()
method ofBrowserWindow
instance, or via Alt-F4 or other OS/DE method),close
event is always triggered.If
sandbox
is not enabled,close
event is always triggered.closed
(as opposed toclose
) event is also triggered if the window was closed.If the window closes itself with
window.close()
and it's sandboxed --close
event doesn't get triggered.The text was updated successfully, but these errors were encountered: