Skip to content

Commit

Permalink
Use loadUrl instead of reload, fix extra refresh calls
Browse files Browse the repository at this point in the history
  • Loading branch information
laghee committed Jan 23, 2025
1 parent 2e81312 commit 34176e8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1360,9 +1360,9 @@ class BrowserTabFragment :
renderer.showNewTab()
}

private fun onBypassMaliciousWarning() {
refresh()
private fun onBypassMaliciousWarning(url: Uri) {
showBrowser()
webView?.loadUrl(url.toString())
}

private fun showSSLWarning(
Expand Down Expand Up @@ -1710,7 +1710,7 @@ class BrowserTabFragment :
is Command.WebViewError -> showError(it.errorType, it.url)
is Command.ShowWarningMaliciousSite -> showMaliciousWarning(it.url)
is Command.EscapeMaliciousSite -> onEscapeMaliciousSite()
is Command.BypassMaliciousSiteWarning -> onBypassMaliciousWarning()
is Command.BypassMaliciousSiteWarning -> onBypassMaliciousWarning(it.url)
is Command.SendResponseToJs -> contentScopeScripts.onResponse(it.data)
is Command.SendResponseToDuckPlayer -> duckPlayerScripts.onResponse(it.data)
is Command.WebShareRequest -> webShareRequest.launch(it.data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1847,13 +1847,12 @@ class BrowserTabViewModel @Inject constructor(

VisitSite -> {
Timber.tag("KateMalicious").d("in VisitSite")
command.postValue(BypassMaliciousSiteWarning)
command.postValue(BypassMaliciousSiteWarning(url))
browserViewState.value = currentBrowserViewState().copy(
browserShowing = true,
showPrivacyShield = HighlightableButton.Visible(enabled = true),
)
addExemptedMaliciousUrlToMemory(url)
onRefreshRequested(false)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,9 @@ sealed class Command {

data object EscapeMaliciousSite : Command()

data object BypassMaliciousSiteWarning : Command()
data class BypassMaliciousSiteWarning(
val url: Uri,
) : Command()

// TODO (cbarreiro) Rename to SendResponseToCSS
data class SendResponseToJs(val data: JsCallbackData) : Command()
Expand Down

0 comments on commit 34176e8

Please sign in to comment.