Bug 146825 - Safari page goes blank after suspending and resuming with an alert open
Summary: Safari page goes blank after suspending and resuming with an alert open
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: iPhone / iPad iOS 8.0
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2015-07-09 22:37 PDT by chenwenhong
Modified: 2018-11-28 13:59 PST (History)
10 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description chenwenhong 2015-07-09 22:37:04 PDT
1、open a webpage in safari
2、trigger alert
3、press home button set safari app into background mode
4、click safari app icon to resume,the result is webpage is empty behind the alert view controller. recovered when dismiss the alert
Comment 1 Justin 2015-11-13 13:20:47 PST
This is also happening with Chromium in WKWebView mode in iOS9.
Comment 2 Ali Juma 2018-11-28 11:09:44 PST
What's happening is that when Safari is resumed, the WebProcess is blocked on a sync IPC (see  WebChromeClient::runJavaScriptAlert) waiting for the alert to be dismissed. In the UIProcess, the RemoteLayerTreeDrawingAreaProxy detaches the root layer after Safari goes into the background (see hideContentUntilPendingUpdate), so when Safari is resumed the UIProcess has no layer tree to draw from until the next composited layer flush. And the WebProcess is blocked until the alert is dismissed, so we can't flush until that happens.

Having a way to persist the snapshot that's taken when the app goes into the background (so that it continues to be displayed until the alert is dismissed) might be a way to fix this, but not sure if it's worth the complexity for this edge case.
Comment 3 Radar WebKit Bug Importer 2018-11-28 13:49:17 PST
<rdar://problem/46320427>
Comment 4 Tim Horton 2018-11-28 13:59:00 PST
(In reply to Ali Juma from comment #2)
> What's happening is that when Safari is resumed, the WebProcess is blocked
> on a sync IPC (see  WebChromeClient::runJavaScriptAlert) waiting for the
> alert to be dismissed. In the UIProcess, the RemoteLayerTreeDrawingAreaProxy
> detaches the root layer after Safari goes into the background (see
> hideContentUntilPendingUpdate), so when Safari is resumed the UIProcess has
> no layer tree to draw from until the next composited layer flush. And the
> WebProcess is blocked until the alert is dismissed, so we can't flush until
> that happens.
> 
> Having a way to persist the snapshot that's taken when the app goes into the
> background (so that it continues to be displayed until the alert is
> dismissed) might be a way to fix this, but not sure if it's worth the
> complexity for this edge case.

That snapshot is not of the page content, but the whole app (including the alert), so keeping it up would be problematic w.r.t. actually being able to dismiss the alert.

Really what you'd want is a snapshot of the page content that you could pop in in place of the layer tree before you've had a chance to get another commit in (including repainted tiles), but I think I agree that that's pretty expensive for a rare edge case.