-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[BlazorWebView] Implement web request interception #30037
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
Open
mattleibow
wants to merge
28
commits into
net10.0
Choose a base branch
from
dev/blazorwebview-interception
base: net10.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
This also refactors the code a bit and disconnects it from the HybridWebView since the concept is a base idea.
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 pull request enhances the BlazorWebView component by adding web resource request interception, detailed logging, and expanded device tests. Key changes include:
- Introducing the WebResourceRequested event and corresponding interception logic in BlazorWebView and platform-specific handlers.
- Enhancing logging to provide detailed debug information when handling web requests.
- Expanding and improving device tests to validate the new interception functionality.
Reviewed Changes
Copilot reviewed 37 out of 37 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
tests/MauiDeviceTests/WebViewHelpers.* | Refactored retry logic and added new helper methods for asynchronous script execution. |
tests/MauiDeviceTests/Elements/* | Added new test classes for component, navigation, logging, and service behavior while removing redundant test files. |
src/Maui/iOS/BlazorWebViewHandler.iOS.cs | Added request interception and logging logic for iOS. |
src/Maui/Windows/WinUIWebViewManager.cs | Updated request handling to integrate interception and improved logging. |
src/Maui/IBlazorWebView.cs & BlazorWebView.cs | Extended the public API with a new WebResourceRequested event and corresponding interface implementation. |
src/Maui/Android/WebKitWebViewClient.cs | Enhanced interception logic and logging for Android. |
src/Maui/Microsoft.AspNetCore.Components.WebView.Maui.csproj | Removed an unused file reference to streamline the project. |
Comments suppressed due to low confidence (1)
…otnet/maui into dev/blazorwebview-interception
This reverts commit c86cf1e.
This reverts commit e14c75a.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This pull request introduces significant enhancements to the BlazorWebView component, focusing on adding request interception capabilities, improving logging, and expanding test coverage. Key changes include implementing a new event for handling web resource requests, integrating logging for intercepted requests, and adding device tests to validate the new functionality.
Enhancements to Request Interception:
WebResourceRequested
event toBlazorWebView
, enabling applications to intercept and handle web resource requests. This includes methods for setting custom responses. (src/BlazorWebView/src/Maui/BlazorWebView.cs
, [1] [2]IBlazorWebView
to implement theIWebRequestInterceptingWebView
interface, supporting request interception. (src/BlazorWebView/src/Maui/IBlazorWebView.cs
, src/BlazorWebView/src/Maui/IBlazorWebView.csL11-R11)src/BlazorWebView/src/Maui/Android/WebKitWebViewClient.cs
, [1] [2];src/BlazorWebView/src/Maui/iOS/BlazorWebViewHandler.iOS.cs
, [3] [4];src/BlazorWebView/src/Maui/Windows/WinUIWebViewManager.cs
, [5] [6] [7]Logging Improvements:
src/BlazorWebView/src/Maui/Android/WebKitWebViewClient.cs
, [1];src/BlazorWebView/src/Maui/iOS/BlazorWebViewHandler.iOS.cs
, [2];src/BlazorWebView/src/Maui/Windows/WinUIWebViewManager.cs
, [3]Test Coverage Expansion:
BlazorWebViewComponentTests
tests interactions with Razor components. (src/BlazorWebView/tests/MauiDeviceTests/Elements/BlazorWebViewComponentTests.cs
, src/BlazorWebView/tests/MauiDeviceTests/Elements/BlazorWebViewComponentTests.csR1-R59)BlazorWebViewLoggingTests
verifies that request logs are generated correctly. (src/BlazorWebView/tests/MauiDeviceTests/Elements/BlazorWebViewLoggingTests.cs
, src/BlazorWebView/tests/MauiDeviceTests/Elements/BlazorWebViewLoggingTests.csR1-R59)BlazorWebViewNavigationTests
ensures theStartPath
property is respected during navigation. (src/BlazorWebView/tests/MauiDeviceTests/Elements/BlazorWebViewNavigationTests.cs
, src/BlazorWebView/tests/MauiDeviceTests/Elements/BlazorWebViewNavigationTests.csR1-R42)Minor Updates:
src/BlazorWebView/src/Maui/Microsoft.AspNetCore.Components.WebView.Maui.csproj
, src/BlazorWebView/src/Maui/Microsoft.AspNetCore.Components.WebView.Maui.csprojL36)using
directives to improve code clarity. (src/BlazorWebView/src/Maui/Android/WebKitWebViewClient.cs
, [1];src/BlazorWebView/src/Maui/BlazorWebView.cs
, [2];src/BlazorWebView/src/Maui/iOS/BlazorWebViewHandler.iOS.cs
, [3]These changes significantly enhance the extensibility and debugging capabilities of BlazorWebView while ensuring robust test coverage for the new features.