Skip to content

Reload a webview whose web content process terminated on macOS and iOS - #5890

Open
LucaCappelletti94 wants to merge 5 commits into
DioxusLabs:mainfrom
LucaCappelletti94:upstream/ios-webcontent-termination
Open

LucaCappelletti94 wants to merge 5 commits into
DioxusLabs:mainfrom
LucaCappelletti94:upstream/ios-webcontent-termination

Conversation

@LucaCappelletti94

Copy link
Copy Markdown

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.

telegram-cloud-photo-size-4-5911119676983415629-w

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Resuming iOS app leads to blank screen when too long in the background

1 participant