Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Refactor FXIOS-7772 [v123] Added url check for server side redirection #3989

Merged
merged 1 commit into from
Jan 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions focus-ios/Blockzilla/Modules/WebView/WebViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,16 @@ extension WebViewController: UIScrollViewDelegate {
}

extension WebViewController: WKNavigationDelegate {
func webView(_ webView: WKWebView, didReceiveServerRedirectForProvisionalNavigation navigation: WKNavigation!) {
// validate the URL using URIFixup
guard let urlString = webView.url?.absoluteString,
URIFixup.getURL(entry: urlString) != nil else {
// URL failed validation, prevent loading
stop()
return
}
}

func webView(_ webView: WKWebView, didCommit navigation: WKNavigation!) {
delegate?.webControllerDidStartNavigation(self)
trackingProtectionManager.trackingProtectionStatus.trackingInformation = TPPageStats()
Expand Down