Add configuration option to allow moving window to background when window.close is called#1115
Conversation
…ndow.close is called When allow_scripts_to_close_windows property is set to true, scripts can close windows that are not opened by them. But after window.close API is called, page is in "is closing" and browser expects window to be closed. When integrator wants to hide browser window/suspend browser, instead of closing it, page will be stuck in "is closing" state, where some APIs don't work anymore. This change introduces new property allow_move_to_suspend_on_window_close (disabled by default) which removes setting "is closing" state and just sends notification to browser integration, without any expectations on how it's handled.
|
I don't fully get what this wants to achieve. |
Right now, with allow_scripts_to_close_windows property set to true, when application calls window.close(), page is switched to "is closing" state and page->chrome().closeWindow() is called, which sends event to integration that it should close window. The only correct behaviour at this point is to really close window.
When allow_move_to_suspend_on_window_close is true, value of allow_scripts_to_close_windows is ignored and scripts can close window. I assumed there's no point in checking allow_scripts_to_close_windows value since anybody who'll use it will want to close window in all cases (not only those created by scripts). If you disagree, I might modify that check. It doesn't matter that much to me.
yes, I checked and modifying that whole change to look like this also works: Would such solution be acceptable? |
mmmm I'm a bit worried about leaving something in an inconsistent state if we do so. |
When allow_scripts_to_close_windows property is set to true, scripts can close windows that are not opened by them. But after window.close API is called, page is in "is closing" and browser expects window to be closed. When integrator wants to hide browser window/suspend browser, instead of closing it, page will be stuck in "is closing" state, where some APIs don't work anymore.
This change introduces new property allow_move_to_suspend_on_window_close (disabled by default) which removes setting "is closing" state and just sends notification to browser integration, without any expectations on how it's handled.