From 66319373061fbc505f1c78bdc8bd5ff77b371a4a Mon Sep 17 00:00:00 2001 From: Soner YUKSEL Date: Mon, 18 Dec 2023 16:58:17 -0500 Subject: [PATCH] Fix #8576: Address bar blank before website starts loading (#8577) --- .../Brave/Frontend/Browser/BrowserViewController.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Sources/Brave/Frontend/Browser/BrowserViewController.swift b/Sources/Brave/Frontend/Browser/BrowserViewController.swift index e1966b89a46b..7a65c1c8daf1 100644 --- a/Sources/Brave/Frontend/Browser/BrowserViewController.swift +++ b/Sources/Brave/Frontend/Browser/BrowserViewController.swift @@ -1755,6 +1755,14 @@ public class BrowserViewController: UIViewController { navigateInTab(tab: tab) } else { updateURLBar() + // If navigation will start from NTP, tab display url will be nil until + // didCommit is called and it will cause url bar be empty in that period + // To fix this when tab display url is empty, webview url is used + if tab.url?.displayURL == nil { + if let url = webView.url, !url.isLocal, !InternalURL.isValid(url: url) { + updateToolbarCurrentURL(url.displayURL) + } + } } // Rewards reporting