Reload a webview whose web content process terminated on macOS and iOS - #5890
Open
LucaCappelletti94 wants to merge 5 commits into
Open
LucaCappelletti94 wants to merge 5 commits into
LucaCappelletti94 wants to merge 5 commits into
Conversation
6 tasks
This branch has not been deployed
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.
On macOS and iOS the system can kill a webview's web content process, for example under memory pressure while the app is in the background, and the page then stays blank for good. Since tauri-apps/wry#1624 wry's navigation delegate implements
webViewWebContentProcessDidTerminate, which tells WebKit the termination was handled, so WebKit skips the reload it would otherwise do, and Dioxus registered no handler. A reload would have been refused anyway, since only Android may load the index again.Dioxus now registers wry's termination handler and loads the index again by URL rather than calling
reload(), which is reported to fail on devices in tauri-apps/tauri#14371. The new page is redrawn through the path #5863 adds, so component state survives. To avoid a reload loop when the page itself keeps crashing, it follows WebKit's own policy of one reload, then none until the recovered page has been up for 30 seconds. Tested on a real iPhone, iPad and Mac by killing the app's web content process, including a second kill within 30 seconds, which stays blank as intended.Part of #5885 and fixes #4709. Stacked on #5863, which itself sits on #5862 and #5886, so only the last commit belongs to this PR.