Cancel leaked WKWebView navigations in test simulator#229
Open
olivaresf wants to merge 1 commit intofernando/structured-errorsfrom
Open
Cancel leaked WKWebView navigations in test simulator#229olivaresf wants to merge 1 commit intofernando/structured-errorsfrom
olivaresf wants to merge 1 commit intofernando/structured-errorsfrom
Conversation
WebViewNavigationSimulator always called decisionHandler(.allow), which let WKWebView actually navigate to https://example.com over the network. This blocked the shared WKProcessPool and stalled subsequent tests for 12+ minutes in CI. Now the simulator calls .cancel once it has captured the WKNavigationAction (which is all the tests need), and .allow only for intermediate navigations that must complete (e.g., the initial loadHTMLString page load). Also adds stopLoading() cleanup in tearDown as a safety net. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Member
|
Yes!! This has been bugging me for so long. Glad to see it finally getting addressed. Nice work @olivaresf! |
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 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.
Summary
WebViewNavigationSimulator.decidePolicyForalways calleddecisionHandler(.allow), which let WKWebView actually navigate tohttps://example.comover the real network after capturing theWKNavigationAction. This blocked WebKit's sharedWKProcessPooland stalled subsequent tests for 12+ minutes in CI..cancelonce theWKNavigationActionis captured (which is all the tests need), and.allowonly for intermediate navigations that must complete (e.g., the initialloadHTMLStringpage load)stopLoading()cleanup intearDownas a safety netBefore & after (local run, 208 tests on
main)test_handling_link_activated_...BridgeComponentAsyncAPITests.test_didReceiveCachesTheMessageBridgeComponentAsyncAPITests.test_replyToMessageNotReceived...Test plan
🤖 Generated with Claude Code