-
Notifications
You must be signed in to change notification settings - Fork 677
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
Revoke HandleAcceleratorKeyActivated when a WebView2 is closed #7117
Revoke HandleAcceleratorKeyActivated when a WebView2 is closed #7117
Conversation
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🕐
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
🎉 Handy links: |
Description
When a WebView2 is closed, we no longer need to forward tab messages to the CoreWebView2. However, the event handler will still try even when the WebView2 is closed if it has not been destroyed, since the auto-revoker won't have kicked in. We should explicitly revoke this handler when Close() is called on the WebView2. Once the webview has been closed, when we get a KeyDown event, we should no longer mark it handled, and instead let normal Xaml tab handling happen.
I also moved some code so some registering and revoking was closer together, and in matching order. (First commit)
Motivation and Context
Without this change, a closed WebView2 will still try to forward the tab to a no-longer-existing hwnd owned by the CoreWebView2, and the app will crash.
How Has This Been Tested?
Added LifetimeStatesTabTest, which tabs past the webview 1) before a core webview is created, 2) after a core webview is created but before any navigation, and 3) after the webview has been closed. I've also verified manually.