Skip to content

Commit a4badae

Browse files
committed
Uplift of #29415 (squashed) to release
1 parent 87f7c6b commit a4badae

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

ios/brave-ios/Sources/Web/WebKit/TabWKNavigationHandler.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ class TabWKNavigationHandler: NSObject, WKNavigationDelegate {
320320
tab.lastCommittedURL = webView.url
321321
tab.isRestoring = false
322322
tab.contentsMimeType = pendingMIMEType
323+
tab.updateSecureContentStateAndNotifyObserversIfNeeded()
323324

324325
pendingMIMEType = nil
325326

ios/brave-ios/Sources/Web/WebKit/WebKitTabState.swift

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,19 @@ class WebKitTabState: TabState, TabStateImpl {
4646
func updateSecureContentState() async {
4747
visibleSecureContentState = await secureContentState
4848
}
49+
50+
func updateSecureContentStateAndNotifyObserversIfNeeded() {
51+
Task { @MainActor in
52+
let currentState = visibleSecureContentState
53+
await updateSecureContentState()
54+
if currentState != visibleSecureContentState {
55+
observers.forEach {
56+
$0.tabDidChangeVisibleSecurityState(self)
57+
}
58+
}
59+
}
60+
}
61+
4962
@MainActor private var secureContentState: SecureContentState {
5063
get async {
5164
guard let webView = webView, let committedURL = self.lastCommittedURL else {
@@ -129,15 +142,7 @@ class WebKitTabState: TabState, TabStateImpl {
129142
}
130143
}
131144

132-
Task { @MainActor in
133-
let currentState = visibleSecureContentState
134-
await updateSecureContentState()
135-
if currentState != visibleSecureContentState {
136-
observers.forEach {
137-
$0.tabDidChangeVisibleSecurityState(self)
138-
}
139-
}
140-
}
145+
updateSecureContentStateAndNotifyObserversIfNeeded()
141146
}
142147

143148
private func webViewIsLoadingDidChange(_ isLoading: Bool) {
@@ -180,12 +185,7 @@ class WebKitTabState: TabState, TabStateImpl {
180185
}
181186

182187
private func webViewSecurityStateDidChange() {
183-
Task { @MainActor in
184-
await updateSecureContentState()
185-
observers.forEach {
186-
$0.tabDidChangeVisibleSecurityState(self)
187-
}
188-
}
188+
updateSecureContentStateAndNotifyObserversIfNeeded()
189189
}
190190

191191
private func webViewSampledPageTopColorDidChange() {

0 commit comments

Comments
 (0)