From ee6710fa7f8d5c7262e6337a7635dc1d6be39c59 Mon Sep 17 00:00:00 2001 From: Kyle Hickinson Date: Thu, 16 Nov 2023 12:50:56 -0500 Subject: [PATCH] Dont use unknown secure content state for internal urls/reader mode --- Sources/Brave/Frontend/Browser/BrowserViewController.swift | 7 +++++-- .../BrowserViewController+WKNavigationDelegate.swift | 6 ++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Sources/Brave/Frontend/Browser/BrowserViewController.swift b/Sources/Brave/Frontend/Browser/BrowserViewController.swift index 908c74a9c87..0e67acd1146 100644 --- a/Sources/Brave/Frontend/Browser/BrowserViewController.swift +++ b/Sources/Brave/Frontend/Browser/BrowserViewController.swift @@ -1758,6 +1758,9 @@ public class BrowserViewController: UIViewController { } if tab.secureContentState == .secure && !webView.hasOnlySecureContent { + if let url = tab.webView?.url, url.isReaderModeURL { + break + } tab.secureContentState = .mixedContent } @@ -1800,9 +1803,9 @@ public class BrowserViewController: UIViewController { } if url.isReaderModeURL || InternalURL.isValid(url: url) { - tab.secureContentState = .unknown + tab.secureContentState = .localhost if tabManager.selectedTab === tab { - updateToolbarSecureContentState(.unknown) + updateToolbarSecureContentState(.localhost) } break } diff --git a/Sources/Brave/Frontend/Browser/BrowserViewController/BrowserViewController+WKNavigationDelegate.swift b/Sources/Brave/Frontend/Browser/BrowserViewController/BrowserViewController+WKNavigationDelegate.swift index 39f664c5cb5..29b81f63fb6 100644 --- a/Sources/Brave/Frontend/Browser/BrowserViewController/BrowserViewController+WKNavigationDelegate.swift +++ b/Sources/Brave/Frontend/Browser/BrowserViewController/BrowserViewController+WKNavigationDelegate.swift @@ -67,8 +67,10 @@ extension BrowserViewController: WKNavigationDelegate { if let selectedTab = tabManager.selectedTab, selectedTab.url?.origin != webView.url?.origin { // reset secure content state to unknown until page can be evaluated - selectedTab.secureContentState = .unknown - updateToolbarSecureContentState(.unknown) + if let url = webView.url, !InternalURL.isValid(url: url) { + selectedTab.secureContentState = .unknown + updateToolbarSecureContentState(.unknown) + } // new site has a different origin, hide wallet icon. tabManager.selectedTab?.isWalletIconVisible = false // new site, reset connected addresses