-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
GH-8186: Workaround for application.confirmExit
#8732
Conversation
Thank you very much,I fix the following minor defects and I tested it runs fine.👍
|
Thank you so much for helping with this, @zhaomenghuan. The "confirm exit" seems to work, unfortunately, I noticed a critical issue; #6530 is back. I need to work on this PR. |
packages/core/src/electron-browser/window/electron-window-service.ts
Outdated
Show resolved
Hide resolved
application.confirmExit
application.confirmExit
This is ready for review. I am not totally happy with removing the @marechal-p and @zhaomenghuan, could you please help with the verification? @mcgordonite, I would like to kindly ask you to chime in and help with Windows's verification. I have a strong opinion on moving forward with my proposed change, and I do not want to break something on your side. Thank you! |
3b6bbf5
to
e2d309e
Compare
@marechal-p, I fixed the issue you have noticed. Thank you! Please check if you are fine with the proposed change or not. |
I made a fixup commit based on your work, I would be more comfortable with this logic: https://github.com/eclipse-theia/theia/compare/mp/GH-8186 I applied your "how to test" steps and everything went right on my machine (Windows 10) both for Electron and browser. |
Cool. I will take a look 👍 |
@marechal-p, I've verified it with both examples on macOS; it works. Let's go with your changes, and thank you for your time to help me. Could you please squash the commits but please do not change anything else. |
e2d309e
to
66e619c
Compare
- Moved the `beforeunload` handling logic to the frontend. - Removed the `attachWillPreventUnload` from the main electron app. Signed-off-by: Akos Kitta <kittaakos@typefox.io>
66e619c
to
0c86eaf
Compare
Thanks, @marechal-p 🙏 I leave the PR open for a few days to see if somebody has a remark. |
What it does
beforeunload
handling logic to the frontend.attachWillPreventUnload
from the main electron app.How to test
Electron env:
frontend-application.ts
, line 190 (insidethis.windowsService.onUnload
).confirmExit
tonever
.Ctrl/Cmd+R
.Expectation:
frontend-application.ts
, line 190 (insidethis.windowsService.onUnload
).confirmExit
tonever
.Reload Window
command.Expectation:
frontend-application.ts
, line 190 (insidethis.windowsService.onUnload
).confirmExit
tonever
.Cmd+Q
)Expectation:
frontend-application.ts
, line 190 (insidethis.windowsService.onUnload
).confirmExit
tonever
.X
.Expectation:
frontend-application.ts
, line 190 (insidethis.windowsService.onUnload
).confirmExit
tonever
.X
.Expectation:
frontend-application.ts
, line 190 (insidethis.windowsService.onUnload
).confirmExit
toalways
.1. - 5.
).No
.Expectation:
src-gen/frontend/index.js
and verify the LS is still running. Try the content assist.frontend-application.ts
, line 190 (insidethis.windowsService.onUnload
).confirmExit
toalways
.1. - 5.
).Yes
.Expectation:
frontend-application.ts
, line 190 (insidethis.windowsService.onUnload
).confirmExit
toifRequired
.src-gen/frontend/index.js
make sure it's not dirty.1. - 5.
).Expectation:
frontend-application.ts
, line 190 (insidethis.windowsService.onUnload
).confirmExit
toifRequired
.src-gen/frontend/index.js
and make it dirty.1. - 5.
).Yes
.Expectation:
frontend-application.ts
, line 190 (insidethis.windowsService.onUnload
).confirmExit
toifRequired
.src-gen/frontend/index.js
and make it dirty.1. - 5.
).No
.Expectation:
src-gen/frontend/index.js
and verify the LS is still running. Try the content assist.Browser env:
Essentially, do the same as in electron env. However, there is one case that cannot be verified the same way; when you reload the browser window. In such cases, you won't hit the breakpoint in the browser (I use Brave, but it should behave the same in Chrome) but there is a trick for this use-case. Start the backend in debug mode. Check the backend log; you must see
root INFO Changed application state from 'ready' to 'closing_window'.
when you reload the window even if you do not hit the breakpoint. If you start the backend in debug mode from VS Code, you can even filter the Debug Console with"Changed application state from"
and you will see the expected state transition logs.Review checklist
Reminder for reviewers