Background tabs are not fully reactivated after a link is opened from an external...
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Apr 2019 16:32:30 +0000 (16:32 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Apr 2019 16:32:30 +0000 (16:32 +0000)
commitb29054d8889f2348f9fe26e7e60b590acede7752
tree04786a749c34a4029ba87ea8a4a19697f70978f2
parent9cd00c3b96003f68e14d135a6e6b551b8f654056
Background tabs are not fully reactivated after a link is opened from an external application.
<rdar://problem/49533278> and https://bugs.webkit.org/show_bug.cgi?id=196705

Reviewed by Chris Dumez.

If an app unparents a WKWebView right after activation but before the "applicationWillEnterForeground" notification
is dispatched, then that WKWebView is in a broken state with a frozen layer tree.

The WKApplicationStateTrackingView logic needs to be a little more resilient.

* UIProcess/ios/WKApplicationStateTrackingView.mm:
(-[WKApplicationStateTrackingView willMoveToWindow:]): When clearing the window, remember the current background state.
(-[WKApplicationStateTrackingView didMoveToWindow]): If our last observed background state doesn't match the current
  background state then fake the relevant notification.
(-[WKApplicationStateTrackingView _applicationDidEnterBackground]): Remember that we've observed a backgrounding.
(-[WKApplicationStateTrackingView _applicationWillEnterForeground]): Remember that we've observed a foregrounding.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244113 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/ios/WKApplicationStateTrackingView.mm