From 3a05e204f8c0fefcb7c65508f0c8cf59e73e140f Mon Sep 17 00:00:00 2001 From: Kyle Hickinson Date: Fri, 17 Nov 2023 10:32:54 -0500 Subject: [PATCH] Fix #8393: Update the progress & url correctly when cancelling a load (#8432) If you return `cancel` in one of the `decidePolicy*` methods the progress bar gets stuck at 10%. When that load happens on NTP, the url shown also gets stuck showing the cancelled url. --- Sources/Brave/Frontend/Browser/BrowserViewController.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Sources/Brave/Frontend/Browser/BrowserViewController.swift b/Sources/Brave/Frontend/Browser/BrowserViewController.swift index 7c944c95b33..8a23233c117 100644 --- a/Sources/Brave/Frontend/Browser/BrowserViewController.swift +++ b/Sources/Brave/Frontend/Browser/BrowserViewController.swift @@ -1699,6 +1699,10 @@ public class BrowserViewController: UIViewController { case .loading: if tab === tabManager.selectedTab { topToolbar.locationView.loading = tab.loading + // There is a bug in WebKit where if you cancel a load on a request the progress can stick to 0.1 + if !tab.loading, webView.estimatedProgress != 1 { + topToolbar.updateProgressBar(1) + } } case .URL: guard let tab = tabManager[webView] else { break } @@ -1720,6 +1724,8 @@ public class BrowserViewController: UIViewController { // Catch history pushState navigation, but ONLY for same origin navigation, // for reasons above about URL spoofing risk. navigateInTab(tab: tab) + } else { + updateURLBar() } // Rewards reporting