[HybridWebView] Add the ability to intercept all web resource requests#28876
Merged
mattleibow merged 3 commits intonet10.0from May 29, 2025
Merged
[HybridWebView] Add the ability to intercept all web resource requests#28876mattleibow merged 3 commits intonet10.0from
mattleibow merged 3 commits intonet10.0from
Conversation
Contributor
There was a problem hiding this comment.
Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.
Files not reviewed (1)
- src/Controls/tests/DeviceTests/Resources/Raw/HybridTestRoot/index.html: Language not supported
Comments suppressed due to low confidence (2)
src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.Windows.cs:241
- Switching to a universal filter '*' may intercept more requests than intended, including external resources. Consider verifying that this change does not introduce performance impacts or unintended side effects.
webView.CoreWebView2.AddWebResourceRequestedFilter("*", CoreWebView2WebResourceContext.All);
src/Controls/samples/Controls.Sample/Pages/Controls/HybridWebViewPage.xaml.cs:22
- [nitpick] The string literal 'badthing' is used directly in the condition; consider extracting it into a named constant to improve readability and ensure consistency.
if (e.PlatformArgs.WebResourceRequestedEventArgs.Request.Uri.Contains("badthing", StringComparison.InvariantCultureIgnoreCase))
Member
Author
|
Maybe if we land this, we won't need a "proxy" endpoint as all endpoints will become proxy-able: #25867 |
bb61da6 to
91f3bb2
Compare
a0103f5 to
a6bc950
Compare
b5635ad to
41ba062
Compare
41ba062 to
9b25d52
Compare
Member
Author
|
/backport to release/10.0.1xx-preview4 |
Contributor
|
Started backporting to release/10.0.1xx-preview4: https://github.com/dotnet/maui/actions/runs/14839378964 |
9b25d52 to
ff05a43
Compare
Member
Author
|
/rebase |
a0483ab to
189ed00
Compare
Member
|
/rebase |
189ed00 to
0c3297e
Compare
rmarinho
reviewed
May 28, 2025
rmarinho
reviewed
May 28, 2025
rmarinho
reviewed
May 28, 2025
rmarinho
reviewed
May 28, 2025
rmarinho
reviewed
May 28, 2025
rmarinho
reviewed
May 28, 2025
rmarinho
reviewed
May 28, 2025
rmarinho
reviewed
May 28, 2025
rmarinho
reviewed
May 28, 2025
rmarinho
reviewed
May 28, 2025
rmarinho
reviewed
May 28, 2025
rmarinho
previously approved these changes
May 28, 2025
Member
Member
Author
|
Test failures are unrelated |
This was referenced Jun 16, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.





Description of Change
Note
I have created demo repo with the NuGet packages from the PR (but for .NET 9)
https://github.com/mattleibow/MauiHybridWebViewInterceptionDemo
Intercepting requests before they leave the browser will allow for the addition of headers as well as cancellation of the requests.
The API is only really fully shapeable once all the platforms are complete as each platform is really different, but the idea I have right now is a mix of all the platforms.
Tasks
Issues Fixed
Fixes #11382
Implementation Restrictions
httpandhttpsrequests:https://developer.apple.com/documentation/webkit/wkwebviewconfiguration/seturlschemehandler(_:forurlscheme:)#parameters
1Notes:
1: I seem to not get the event to fire but this is maybe because the WebView2 in .NET MAUI is a bit older that the fix. The [Windows] Upgrade to Windows App SDK 1.7 #28499 PR should update things.