Title: [221138] trunk/Source/WebKit
Revision
221138
Author
cdu...@apple.com
Date
2017-08-24 08:59:24 -0700 (Thu, 24 Aug 2017)

Log Message

[iOS] ViewServices started by StoreKitUIService may get suspended unexpectedly
https://bugs.webkit.org/show_bug.cgi?id=175922
<rdar://problem/34028921>

Reviewed by Tim Horton.

ViewServices started by StoreKitUIService may get suspended unexpectedly. This is
because StoreKitUIService is itself a ViewService and is therefore in the background.
To address the issue, treat StoreKitUIService as initially foreground in
ApplicationStateTracker so that its ViewServices do not get suspended. We don't
have good way to deal with ViewServices started by other ViewServices unfortunately.

* Platform/spi/ios/UIKitSPI.h:
* UIProcess/ApplicationStateTracker.mm:
(WebKit::ApplicationStateTracker::ApplicationStateTracker):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (221137 => 221138)


--- trunk/Source/WebKit/ChangeLog	2017-08-24 15:45:20 UTC (rev 221137)
+++ trunk/Source/WebKit/ChangeLog	2017-08-24 15:59:24 UTC (rev 221138)
@@ -1,3 +1,21 @@
+2017-08-24  Chris Dumez  <cdu...@apple.com>
+
+        [iOS] ViewServices started by StoreKitUIService may get suspended unexpectedly
+        https://bugs.webkit.org/show_bug.cgi?id=175922
+        <rdar://problem/34028921>
+
+        Reviewed by Tim Horton.
+
+        ViewServices started by StoreKitUIService may get suspended unexpectedly. This is
+        because StoreKitUIService is itself a ViewService and is therefore in the background.
+        To address the issue, treat StoreKitUIService as initially foreground in
+        ApplicationStateTracker so that its ViewServices do not get suspended. We don't
+        have good way to deal with ViewServices started by other ViewServices unfortunately.
+
+        * Platform/spi/ios/UIKitSPI.h:
+        * UIProcess/ApplicationStateTracker.mm:
+        (WebKit::ApplicationStateTracker::ApplicationStateTracker):
+
 2017-08-23  Youenn Fablet  <you...@apple.com>
 
         [Cache API] Unify WebCore and WebKit error handling

Modified: trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h (221137 => 221138)


--- trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h	2017-08-24 15:45:20 UTC (rev 221137)
+++ trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h	2017-08-24 15:59:24 UTC (rev 221138)
@@ -397,6 +397,7 @@
 
 @interface UIViewController (ViewService)
 - (pid_t)_hostProcessIdentifier;
+@property (readonly) NSString *_hostApplicationBundleIdentifier;
 @end
 
 @protocol UIViewControllerContextTransitioningEx <UIViewControllerContextTransitioning>

Modified: trunk/Source/WebKit/UIProcess/ApplicationStateTracker.mm (221137 => 221138)


--- trunk/Source/WebKit/UIProcess/ApplicationStateTracker.mm	2017-08-24 15:45:20 UTC (rev 221137)
+++ trunk/Source/WebKit/UIProcess/ApplicationStateTracker.mm	2017-08-24 15:59:24 UTC (rev 221138)
@@ -146,6 +146,12 @@
         m_isInBackground = isBackgroundState([applicationStateMonitor mostElevatedApplicationStateForPID:applicationPID]);
         [applicationStateMonitor invalidate];
 
+        // Workaround for <rdar://problem/34028921>. If the host application is StoreKitUIService then it is also a ViewService
+        // and is always in the background. We need to treat StoreKitUIService as foreground for the purpose of process suspension
+        // or its ViewServices will get suspended.
+        if ([serviceViewController._hostApplicationBundleIdentifier isEqualToString:@"com.apple.ios.StoreKitUIService"])
+            m_isInBackground = false;
+
         m_didEnterBackgroundObserver = [notificationCenter addObserverForName:@"_UIViewServiceHostDidEnterBackgroundNotification" object:serviceViewController queue:nil usingBlock:[this](NSNotification *) {
             applicationDidEnterBackground();
         }];
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to