Skip to content

Commit

Permalink
Bugfix FXIOS-8940 Re-add screenshot code (#19760) (#19763)
Browse files Browse the repository at this point in the history
(cherry picked from commit 20c6074)

Co-authored-by: OrlaM <omitchell@mozilla.com>
  • Loading branch information
mergify[bot] and OrlaM committed Apr 11, 2024
1 parent 36d5d26 commit 46f3c8e
Showing 1 changed file with 15 additions and 1 deletion.
Expand Up @@ -1764,14 +1764,28 @@ class BrowserViewController: UIViewController,
}

if webViewStatus == .finishedNavigation {
if tab !== tabManager.selectedTab, let webView = tab.webView {
if tab !== tabManager.selectedTab,
let webView = tab.webView,
tab.screenshot == nil {
// To Screenshot a tab that is hidden we must add the webView,
// then wait enough time for the webview to render.
webView.frame = contentContainer.frame
view.insertSubview(webView, at: 0)
// This is kind of a hacky fix for Bug 1476637 to prevent webpages from focusing the
// touch-screen keyboard from the background even though they shouldn't be able to.
webView.resignFirstResponder()

// We need a better way of identifying when webviews are finished rendering
// There are cases in which the page will still show a loading animation or nothing
// when the screenshot is being taken, depending on internet connection
// Issue created: https://github.com/mozilla-mobile/firefox-ios/issues/7003
let delayedTimeInterval = DispatchTimeInterval.milliseconds(500)
DispatchQueue.main.asyncAfter(deadline: .now() + delayedTimeInterval) {
self.screenshotHelper.takeScreenshot(tab)
if webView.superview == self.view {
webView.removeFromSuperview()
}
}
}
}
}
Expand Down

1 comment on commit 46f3c8e

@firefoxci-taskcluster
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh oh! Looks like an error! Details

InterpreterError at template.tasks[0].extra[0].treeherder[1].symbol: unknown context value cron

Please sign in to comment.