Skip URL filter for subresources and avoid double-load of allow-list URLs in module description WebView#633
Open
jim-daf wants to merge 1 commit into
Open
Conversation
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.
What this does
Two small fixes in the
WebViewClientused to render module descriptions inapp/src/main/kotlin/com/dergoogler/mmrl/ui/screens/moduleView/ViewDescriptionScreen.kt:if (!request.isForMainFrame) return falseat the top ofshouldOverrideUrlLoadingso the dispatcher only acts on top-level navigations.view.loadUrl(mUrl)call before the finalreturn false.Why
For an allow-list URL the previous flow was
view.loadUrl(mUrl)followed byreturn false. Returning false already tells the WebView to load the URL itself, so the explicitloadUrlcauses the page to be fetched twice on any in-page link click to adesc.mmrl.devURL.For the subresource path,
shouldOverrideUrlLoadingis dispatched for iframe navigations and some redirect flows. Without theisForMainFramegate, an off-allow-list subresource (for example an embedded frame) would get routed intoIntent.ACTION_VIEW, which is not what the comment above the WebView (// #NotAReadlDomain) intends.Diff size
Four lines added, one removed, all inside the existing
shouldOverrideUrlLoadingoverride. No public API changes.