Skip to content
This repository was archived by the owner on Feb 24, 2025. It is now read-only.

Commit 387691a

Browse files
committed
Fix deciding policy for history web view
1 parent a45647a commit 387691a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

DuckDuckGo/History/View/HistoryWebViewModel.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,12 @@ final class HistoryWebViewModel: NSObject {
6262
}
6363

6464
extension HistoryWebViewModel: WKNavigationDelegate {
65+
/// Allow loading all URLs with `duck` scheme and `history` host.
66+
/// Deny all other URLs.
6567
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction) async -> WKNavigationActionPolicy {
66-
navigationAction.request.url == .history ? .allow : .cancel
68+
let isDuckScheme = navigationAction.request.url?.isDuckURLScheme == true
69+
let isHistoryHost = navigationAction.request.url?.host == URL.history.host
70+
return (isDuckScheme && isHistoryHost) ? .allow : .cancel
6771
}
6872
}
6973

0 commit comments

Comments
 (0)