From 3bf26ca03ca73768e8700e62bf461da03f222ac4 Mon Sep 17 00:00:00 2001 From: Jay Ohms Date: Wed, 20 Mar 2024 19:57:46 -0400 Subject: [PATCH] Only show error screens for SSL errors when the url matches the current visit. This prevents erroring out the entire visit when a 3rd party resource is requested on a page with an SSL error. --- .../main/kotlin/dev/hotwire/turbo/session/TurboSession.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/turbo/src/main/kotlin/dev/hotwire/turbo/session/TurboSession.kt b/turbo/src/main/kotlin/dev/hotwire/turbo/session/TurboSession.kt index 77a8b3c4..82ad6649 100644 --- a/turbo/src/main/kotlin/dev/hotwire/turbo/session/TurboSession.kt +++ b/turbo/src/main/kotlin/dev/hotwire/turbo/session/TurboSession.kt @@ -783,10 +783,12 @@ class TurboSession internal constructor( handler.cancel() val visitError = WebSslError.from(error) + logEvent("onReceivedSslError", "error" to visitError, "url" to error.url) - logEvent("onReceivedSslError", "error" to visitError) - reset() - callback { it.onReceivedError(visitError) } + if (currentVisit?.location == error.url) { + reset() + callback { it.onReceivedError(visitError) } + } } override fun onRenderProcessGone(view: WebView, detail: RenderProcessGoneDetail): Boolean {