-
Notifications
You must be signed in to change notification settings - Fork 834
feat: Adjust WebView2 to handle absolute and relative URIs
#22136
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
base: master
Are you sure you want to change the base?
Conversation
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.
Pull request overview
This PR fixes a bug in WebView2 where calling ToString() on a relative URI causes an InvalidOperationException. The fix updates the code to use AbsoluteUri for absolute URIs and OriginalString for relative URIs, ensuring proper handling of both URI types when navigating.
Key Changes:
- Updated URI-to-string conversion logic to check
IsAbsoluteUribefore deciding betweenAbsoluteUriandOriginalString - Applied the fix consistently across WebView2 property changed handler and CoreWebView2 navigation methods
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/Uno.UI/UI/Xaml/Controls/WebView/WebView2/WebView2.Properties.cs |
Updated Source property changed handler to handle both absolute and relative URIs by checking IsAbsoluteUri before converting to string |
src/Uno.UI/UI/Xaml/Controls/WebView/Core/CoreWebView2.cs |
Applied the same URI handling logic to Navigate and NavigateWithHttpRequestMessage methods for consistency |
|
π€ Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-22136/wasm-skia-net9/index.html |
|
π€ Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-22136/docs/index.html |
Co-authored-by: Copilot <[email protected]>
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.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
|
π€ Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-22136/wasm-skia-net9/index.html |
|
π€ Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-22136/docs/index.html |
ajpinedam
left a comment
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.
Change looks good. Could a test be added to validate this new behaviour?
GitHub Issue: closes #22115
PR Type:
What is the current behavior? π€
What is the new behavior? π
PR Checklist β
Please check if your PR fulfills the following requirements:
Screenshots Compare Test Runresults.Other information βΉοΈ