WebxdcStoreActivity: log main-frame WebView load errors#154
Open
jim-daf wants to merge 1 commit into
Open
Conversation
The WebxdcStoreActivity loads a remote store URL via webView.loadUrl (Prefs.getWebxdcStoreUrl). The current WebViewClient overrides shouldOverrideUrlLoading and shouldInterceptRequest, but not onReceivedError, so a failure at the WebView/network layer (URL resolution, TLS handshake, premature reset) is silent: nothing in adb logcat and no signal in the activity itself. interceptRequest already catches RPC failures and synthesises a plain text "Could not load apps. Are you online?" response, which covers the common offline case. But it can only do so once shouldInterceptRequest is actually invoked, which is not guaranteed for every kind of load failure. The point of this change is to leave a trace in the log for those leftover cases. Add onReceivedError on the same anonymous WebViewClient (API 23+), guard with request.isForMainFrame() so transient sub-resource errors do not spam the log, and log the error code and description via the existing Log helper and TAG.
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 #153.
WebxdcStoreActivityloads a remote store URL withwebView.loadUrl(Prefs.getWebxdcStoreUrl(this)). The existingWebViewClientoverridesshouldOverrideUrlLoadingandshouldInterceptRequest, but notonReceivedError, so WebView-layer load failures end up silent in adb logcat.interceptRequestalready catchesRpcExceptionand friends and synthesises a "Could not load apps. Are you online?" plain-text body, which is good UX for the offline case. The change here is strictly additive: aLog.wline that fires forrequest.isForMainFrame()errors only, so the next time someone reports "the store screen is blank" there is something in the log to go on.Notes:
isForMainFrame()andWebResourceErrorare both API 23, and the project already uses@RequiresApi(21)on sibling overrides in the same class.isForMainFrame()guard so the log stays useful.Logimport that is already present in this file, and theTAGconstant that is already defined on the class. No new permission, no new dependency, no behaviour change for successful loads.