Bug 131860

Summary: [iOS] REGRESSION (r167039): WebKit incorrectly sets a background process assertion state when displaying a PDF
Product: WebKit Reporter: Andy Estes <aestes>
Component: New BugsAssignee: Andy Estes <aestes>
Status: RESOLVED FIXED    
Severity: Normal CC: thorton
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 131453    
Bug Blocks:    
Attachments:
Description Flags
Patch thorton: review+

Description Andy Estes 2014-04-18 15:14:15 PDT
[iOS] REGRESSION (r167039): WebKit incorrectly sets a background process assertion state when displaying a PDF
Comment 1 Andy Estes 2014-04-18 15:14:34 PDT
<rdar://problem/16631282>
Comment 2 Andy Estes 2014-04-18 15:18:08 PDT
Created attachment 229678 [details]
Patch
Comment 3 Tim Horton 2014-04-18 15:23:39 PDT
Comment on attachment 229678 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=229678&action=review

> Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm:130
> -    return [m_contentView window];
> +    return [m_webView window];

We also need to notify the view state that it needs to recompute when WKWebView goes into/out of window, just like WKContentView does:
WKWebView

- (void)didMoveToWindow
{
    _page->viewStateDidChange(ViewState::IsInWindow);
}
Comment 4 Tim Horton 2014-04-18 15:25:49 PDT
Comment on attachment 229678 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=229678&action=review

>> Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm:130
>> +    return [m_webView window];
> 
> We also need to notify the view state that it needs to recompute when WKWebView goes into/out of window, just like WKContentView does:
> WKWebView
> 
> - (void)didMoveToWindow
> {
>     _page->viewStateDidChange(ViewState::IsInWindow);
> }

And the reason is, we want to background e.g. the network process if you have a PDF currently loaded and then remove the WKWebView (so the WKContentView didMoveToWindow won't get called, and won't viewStateDidChange, so WKWebView has to do it). There's also no real reason to do it in WKContentView's didMoveToWindow, since it will only change on WKWebView's.
Comment 5 Andy Estes 2014-04-18 15:49:09 PDT
Committed r167512: <http://trac.webkit.org/changeset/167512>