attempt to fix stale tabs
This commit is contained in:
@@ -594,6 +594,19 @@ class BrowserViewController: UIViewController
|
||||
|
||||
// Blur url bar, if applicable
|
||||
toolbarController.urlBar.textField.resignFirstResponder()
|
||||
|
||||
// If this tab's web content process was jettisoned while in background,
|
||||
// its current page may appear blank and url be nil. Proactively reload
|
||||
// when the tab becomes active again to restore state.
|
||||
if tab.contentProcessTerminated {
|
||||
if webView.url != nil || tab.url != nil {
|
||||
webView.reload()
|
||||
} else if let home = tab.homeURL {
|
||||
tab.beginLoadingURL(home)
|
||||
} else {
|
||||
webView.reload()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override func target(forAction action: Selector, withSender sender: Any?) -> Any? {
|
||||
@@ -618,6 +631,18 @@ class BrowserViewController: UIViewController
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
becomeFirstResponder()
|
||||
|
||||
// If the app resumed and the current tab's web content process was
|
||||
// terminated while in background, ensure we restore it now.
|
||||
if currentTab.contentProcessTerminated {
|
||||
if webView.url != nil || currentTab.url != nil {
|
||||
webView.reload()
|
||||
} else if let home = currentTab.homeURL {
|
||||
currentTab.beginLoadingURL(home)
|
||||
} else {
|
||||
webView.reload()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal func updateScriptBlockerButton() {
|
||||
|
||||
Reference in New Issue
Block a user