@@ -46,6 +46,19 @@ class WebKitTabState: TabState, TabStateImpl {
46
46
func updateSecureContentState( ) async {
47
47
visibleSecureContentState = await secureContentState
48
48
}
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
+
49
62
@MainActor private var secureContentState : SecureContentState {
50
63
get async {
51
64
guard let webView = webView, let committedURL = self . lastCommittedURL else {
@@ -129,15 +142,7 @@ class WebKitTabState: TabState, TabStateImpl {
129
142
}
130
143
}
131
144
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 ( )
141
146
}
142
147
143
148
private func webViewIsLoadingDidChange( _ isLoading: Bool ) {
@@ -180,12 +185,7 @@ class WebKitTabState: TabState, TabStateImpl {
180
185
}
181
186
182
187
private func webViewSecurityStateDidChange( ) {
183
- Task { @MainActor in
184
- await updateSecureContentState ( )
185
- observers. forEach {
186
- $0. tabDidChangeVisibleSecurityState ( self )
187
- }
188
- }
188
+ updateSecureContentStateAndNotifyObserversIfNeeded ( )
189
189
}
190
190
191
191
private func webViewSampledPageTopColorDidChange( ) {
0 commit comments