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

Commit

Permalink
Refactor FXIOS-7772 [v123] Added url check for server side redirection
Browse files Browse the repository at this point in the history
  • Loading branch information
nbhasin2 committed Jan 16, 2024
1 parent ceb87c9 commit ee053a0
Showing 1 changed file with 10 additions and 0 deletions.
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

0 comments on commit ee053a0

Please sign in to comment.