-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[HybridWebView] Always complete web requests #28286
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.
PR Overview
This PR ensures that all web requests in HybridWebView complete regardless of success, preventing stalls in asynchronous JS operations. Key changes include:
- Adding HybridWebView developer tools in debug builds in MauiProgramDefaults.
- Updating the iOS HybridWebViewHandler to always return a 404 response with a consistent message when requests fail, eliminating early exits.
- Removing the conditional error logging branch in StartUrlSchemeTask to guarantee request completion.
Reviewed Changes
File | Description |
---|---|
src/Core/tests/DeviceTests.Shared/MauiProgramDefaults.cs | Added registration of developer tools in debug builds to support HybridWebView functionality. |
src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.iOS.cs | Modified response handling to always complete web requests using a lazy 404 message and removed error logging branch. |
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.iOS.cs:155
- Ensure there are automated tests covering the new behavior for non-200 responses in HybridWebViewHandler.iOS.cs. Verify that TestCases.HostApp and TestCases.Shared.Tests include cases that validate the consistent completion of web requests.
if (statusCode == 200)
/backport release/9.0.1xx-sr4 |
/backport to release/9.0.1xx-sr4 |
Started backporting to release/9.0.1xx-sr4: https://github.com/dotnet/maui/actions/runs/13790493864 |
Description of Change
Currently iOS and Mac Catalyst only complete the requests if they are successful. This PR updates the logic to make sure to always complete the requests so the app can continue. Any async fetches will now complete, allowing the JS to continue.
Windows and Android already do this and I added a test for this in #28230, however Mac Catalyst was very iffy and we merged thinking it was the CI ghosts. Turns out, CI was sending the right messages and we trusted AI too much.
Issues Fixed
Fixes #28285