fix(webview): persist only settled page state to fix stale-URL black screen (#333)#335
Open
theoden8 wants to merge 2 commits into
Open
fix(webview): persist only settled page state to fix stale-URL black screen (#333)#335theoden8 wants to merge 2 commits into
theoden8 wants to merge 2 commits into
Conversation
aa7c1f8 to
ed8cc32
Compare
d7eb198 to
7c14948
Compare
Caching HTML and committing currentUrl on every onLoadStop captured intermediate redirect states — Cloudflare js_challenge callbacks, mid-redirect interstitials — and persisted them as the canonical state. On next launch the WebView booted at the stale single-use token URL, the live-reload one-shot bounced to about:blank, and the user sat on a black page until manually going home. New WebViewModel.lastSettledUrl tracks only URLs the page held for WebViewConfig.settleDelay (3s) without a new onLoadStart. The Timer that fires the cache save now also fires onPageSettled, so both writes share a single settle point and stay coherent. Cancelled by any onLoadStart; rescheduled by SPA pushState; epoch+navigationGen checks bail an in-flight settle body if the page moves under it. toJson persists lastSettledUrl under the existing currentUrl key. onHtmlLoaded is now awaited so the cache file lands before lastSettledUrl advances, ordering the writes against a mid-settle crash. Fixes #333.
A settle Timer scheduled by an onLoadStop fired ~1s before the site is unloaded could still fire after disposeWebView() and commit transient state (cached HTML / lastSettledUrl) for a site the user already switched away from. Wire the closure-local cancelPendingSettle out via WebViewConfig.onSettleHandlerReady and drain it in disposeWebView before the controller is nulled. For #333.
7c14948 to
aebcf37
Compare
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.
The renderer-death recovery and Android paint-nudge fixes that originally
opened this branch landed separately in #375. The two commits remaining
here address the other half of #333 — a transient URL persisted
mid-redirect that boots to about:blank on the next launch:
Settle-gated persistence. Caching HTML and committing currentUrl on
every onLoadStop captured transient redirect states (Cloudflare
js_challenge callbacks, mid-redirect interstitials). On next launch the
WebView booted at the stale single-use token URL, the live-reload
one-shot bounced to about:blank, and the user sat on a black page until
manually going home. New WebViewModel.lastSettledUrl tracks only URLs
the page held for WebViewConfig.settleDelay (3s) without a new
onLoadStart; the cache save and onPageSettled fire from the same settle
point so the (URL, HTML) pair stays coherent. Cancelled by any
onLoadStart, rescheduled by SPA pushState, with epoch + navigationGen
checks to bail an in-flight settle body if the page moves under it.
onHtmlLoaded is awaited so the cache file lands before lastSettledUrl
advances.
Cancel pending settle on dispose. A settle Timer armed ~1s before a
site is unloaded could still fire and commit transient state for a site
the user already switched away from. Drain the Timer via
WebViewConfig.onSettleHandlerReady in disposeWebView before the
controller is nulled.
Fixes #333.