Modified: trunk/Source/WebKit/ChangeLog (250153 => 250154)
--- trunk/Source/WebKit/ChangeLog 2019-09-20 21:35:58 UTC (rev 250153)
+++ trunk/Source/WebKit/ChangeLog 2019-09-20 21:37:24 UTC (rev 250154)
@@ -1,5 +1,21 @@
2019-09-20 Chris Dumez <cdu...@apple.com>
+ ApplicationStateTracker::m_isBackground initialization does not account for UIScenes
+ https://bugs.webkit.org/show_bug.cgi?id=202048
+
+ Reviewed by Geoffrey Garen.
+
+ ApplicationStateTracker::m_isBackground initialization does not account for UIScenes, it merely checks
+ the visibility state of the whole app. It should instead check the visibility state of the window's
+ UIScene.
+
+ This patch also refactors the code a little bit to reduce #ifdef'ing.
+
+ * UIProcess/ApplicationStateTracker.mm:
+ (WebKit::ApplicationStateTracker::ApplicationStateTracker):
+
+2019-09-20 Chris Dumez <cdu...@apple.com>
+
Document no longer needs to store a SessionID
https://bugs.webkit.org/show_bug.cgi?id=202024
Modified: trunk/Source/WebKit/UIProcess/ApplicationStateTracker.mm (250153 => 250154)
--- trunk/Source/WebKit/UIProcess/ApplicationStateTracker.mm 2019-09-20 21:35:58 UTC (rev 250153)
+++ trunk/Source/WebKit/UIProcess/ApplicationStateTracker.mm 2019-09-20 21:37:24 UTC (rev 250154)
@@ -88,7 +88,7 @@
ASSERT([m_view.get() respondsToSelector:m_willEnterForegroundSelector]);
UIWindow *window = [m_view.get() window];
- ASSERT(window);
+ RELEASE_ASSERT(window);
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
UIApplication *application = [UIApplication sharedApplication];
@@ -104,28 +104,33 @@
switch (applicationType(window)) {
case ApplicationType::Application: {
- m_isInBackground = application.applicationState == UIApplicationStateBackground;
- RELEASE_LOG(ProcessSuspension, "%p - ApplicationStateTracker::ApplicationStateTracker(): m_isInBackground: %d", this, m_isInBackground);
+#if HAVE(UISCENE)
+ m_isInBackground = window.windowScene.activationState == UISceneActivationStateBackground || window.windowScene.activationState == UISceneActivationStateUnattached;
+ RELEASE_LOG(ViewState, "%p - ApplicationStateTracker::ApplicationStateTracker(): m_isInBackground: %d", this, m_isInBackground);
-#if HAVE(UISCENE)
m_didEnterBackgroundObserver = [notificationCenter addObserverForName:UISceneDidEnterBackgroundNotification object:window.windowScene queue:nil usingBlock:[this](NSNotification *) {
- RELEASE_LOG(ProcessSuspension, "%p - ApplicationStateTracker: UISceneDidEnterBackground", this);
+ RELEASE_LOG(ViewState, "%p - ApplicationStateTracker: UISceneDidEnterBackground", this);
+ applicationDidEnterBackground();
+ }];
+
+ m_willEnterForegroundObserver = [notificationCenter addObserverForName:UISceneWillEnterForegroundNotification object:window.windowScene queue:nil usingBlock:[this](NSNotification *) {
+ RELEASE_LOG(ViewState, "%p - ApplicationStateTracker: UISceneWillEnterForeground", this);
+ applicationWillEnterForeground();
+ }];
#else
+ m_isInBackground = application.applicationState == UIApplicationStateBackground;
+ RELEASE_LOG(ViewState, "%p - ApplicationStateTracker::ApplicationStateTracker(): m_isInBackground: %d", this, m_isInBackground);
+
m_didEnterBackgroundObserver = [notificationCenter addObserverForName:UIApplicationDidEnterBackgroundNotification object:application queue:nil usingBlock:[this](NSNotification *) {
- RELEASE_LOG(ProcessSuspension, "%p - ApplicationStateTracker: UIApplicationDidEnterBackground", this);
-#endif
+ RELEASE_LOG(ViewState, "%p - ApplicationStateTracker: UIApplicationDidEnterBackground", this);
applicationDidEnterBackground();
}];
-#if HAVE(UISCENE)
- m_willEnterForegroundObserver = [notificationCenter addObserverForName:UISceneWillEnterForegroundNotification object:window.windowScene queue:nil usingBlock:[this](NSNotification *) {
- RELEASE_LOG(ProcessSuspension, "%p - ApplicationStateTracker: UISceneWillEnterForeground", this);
-#else
m_willEnterForegroundObserver = [notificationCenter addObserverForName:UIApplicationWillEnterForegroundNotification object:application queue:nil usingBlock:[this](NSNotification *) {
- RELEASE_LOG(ProcessSuspension, "%p - ApplicationStateTracker: UIApplicationWillEnterForeground", this);
-#endif
+ RELEASE_LOG(ViewState, "%p - ApplicationStateTracker: UIApplicationWillEnterForeground", this);
applicationWillEnterForeground();
}];
+#endif
break;
}