Resolves "New Tab" bug after web content process jettison

This commit is contained in:
2024-08-05 17:36:59 -07:00
parent 29057c8024
commit 69aa02e303
4 changed files with 32 additions and 9 deletions

View File

@@ -10,7 +10,11 @@ import WebKit
extension BrowserViewController: WKNavigationDelegate, WKUIDelegate
{
func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) {
currentTab.loadError = nil
if let tab = tabController.tab(forWebView: webView) {
// We're alive!
tab.contentProcessTerminated = false
tab.loadError = nil
}
// Check to make sure we have connected to the web content process
if !currentTab.bridge.webContentProcessConnected {
@@ -120,6 +124,10 @@ extension BrowserViewController: WKNavigationDelegate, WKUIDelegate
}
}
func webViewWebContentProcessDidTerminate(_ webView: WKWebView) {
tabController.tab(forWebView: webView)?.contentProcessTerminated = true
}
// MARK: WKUIDelegate
func webView(_ webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration, for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -> WKWebView?

View File

@@ -520,6 +520,8 @@ class BrowserViewController: UIViewController
}
internal func updateTitleAndURL(forWebView webView: WKWebView) {
guard let tab = tabController.tab(forWebView: webView) else { return }
if webView == browserView.webView {
browserView.titlebarView.setTitle(webView.title ?? "")
@@ -531,8 +533,7 @@ class BrowserViewController: UIViewController
}
// Figure out which tab this corresponds to
let tab = tabController.tabs.first { $0.webView == webView }
if let tab = tab, let tabIndex = tabController.tabs.firstIndex(of: tab) {
if let tabIndex = tabController.tabs.firstIndex(of: tab) {
tabBarViewController.tabBarView.reloadTab(atIndex: tabIndex)
}
}