Bug 135329

Summary: Don't rely on reading applicationState from within DidEnterBackground/WillEnterForeground
Product: WebKit Reporter: Gavin Barraclough <barraclough>
Component: WebKit2Assignee: Gavin Barraclough <barraclough>
Status: RESOLVED FIXED    
Severity: Normal CC: sam, thorton
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Fix sam: review+

Description Gavin Barraclough 2014-07-27 16:02:52 PDT
API may not be stable.
Comment 1 Gavin Barraclough 2014-07-27 16:09:17 PDT
Created attachment 235584 [details]
Fix

Basic browsing seems to work.
Comment 2 Sam Weinig 2014-07-27 16:18:46 PDT
Comment on attachment 235584 [details]
Fix

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

I'm not clear if this makes sense to be on the WKContentView.  I believe there are some PDF related issues with that.  I need to check with Tim/Andy.

> Source/WebKit2/UIProcess/ios/WKContentView.mm:514
> +    _isBackground = TRUE;

This should be YES.

> Source/WebKit2/UIProcess/ios/WKContentView.mm:520
> +    _isBackground = FALSE;

This should be NO.
Comment 3 Sam Weinig 2014-07-27 16:23:17 PDT
Comment on attachment 235584 [details]
Fix

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

> Source/WebKit2/UIProcess/ios/ProcessAssertionIOS.mm:106
> +    _appIsBackground = FALSE;

Please use NO.

> Source/WebKit2/UIProcess/ios/ProcessAssertionIOS.mm:112
> +    _appIsBackground = TRUE;

Please use YES.
Comment 4 Sam Weinig 2014-07-27 16:24:16 PDT
(In reply to comment #2)
> (From update of attachment 235584 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=235584&action=review
> 
> I'm not clear if this makes sense to be on the WKContentView.  I believe there are some PDF related issues with that.  I need to check with Tim/Andy.
> 

I checked with Tim, and this is not an issue in this case. The problem was depending on WKContentView to always be parented (which in the PDF case it is not), but since we don't care about parentage in this case, it doesn't matter.  r=me.
Comment 5 Gavin Barraclough 2014-07-27 16:37:42 PDT
Fixed in r171663.
Comment 6 Tim Horton 2014-07-27 18:00:06 PDT
Probably at some point we should move those notification listeners to WKWebView, but not today. I think this is fine.