WebViews: clear loading indicator on main-frame load errors#556
Open
jim-daf wants to merge 1 commit into
Open
Conversation
DocumentationWebView, ResponseBrowser and SinglePageBrowser all show a loading spinner that is hidden from inside onPageFinished (directly or via the onLoaded callback). None of them override onReceivedError, so a main-frame load failure leaves the spinner spinning forever: showLoading()/isLoading=true -> network/cache error -> onPageFinished never fires -> hideLoading()/onLoaded() never runs. This is reachable in practice for the documentation view, which is configured with blockNetworkLoads=true + cacheMode=LOAD_CACHE_ELSE_NETWORK and so requires the bundled cache to be present; a cache-miss on a fresh install means the user is stuck on the spinner. Add onReceivedError on each WebViewClient and call hideLoading() / onLoaded() for main-frame errors only. Sub-resource errors are still ignored so we do not race the spinner off on transient asset failures. No new permission, no behaviour change for successful loads.
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.
Closes #555.
DocumentationWebView,ResponseBrowserandSinglePageBrowserall show a loading spinner that is hidden from insideonPageFinished(directly or via theonLoadedcallback). None of them overrideonReceivedError, so a main-frame load failure leaves the spinner spinning forever:This is most reachable for the documentation view, which is configured with
blockNetworkLoads = trueandcacheMode = LOAD_CACHE_ELSE_NETWORK. The WebView is told to use only the cache, so a cache miss for the bundled documentation has no network fallback and the user is stuck on the spinner.This PR adds
onReceivedError(view, request, error)to each of the three WebViewClients and calls the same "loading is done" hook each one already uses:Notes:
request.isForMainFrameis the guard so sub-resource errors are still ignored. The existingonPageFinishedpath is unchanged for successful loads.android.webkit.WebResourceError). No new permission, no new resource, no new dependency.