Title: [250187] trunk/Source/WebKit
- Revision
- 250187
- Author
- [email protected]
- Date
- 2019-09-21 16:13:47 -0700 (Sat, 21 Sep 2019)
Log Message
Regression(iOS 13) web views do not deal properly with their window's UIScene changing
https://bugs.webkit.org/show_bug.cgi?id=202070
<rdar://problem/55580699>
Reviewed by Tim Horton.
Web views do not deal properly with their window's UIScene changing. If a Safari window is in the
background for 1 minute, its UIScene will be detached and the window will get a new UIScene if
the user later switches to this window. Our web views listen to UIScene notifications to determine
their visibility and currently stop receiving visibility updates once the window’s UIScene has
changed. This causes view freezes because our WebContent process does not know its view is visible
and keeps its layer tree frozen.
Previously, when our view would be added to a window, we would get this window's UIScene and listen
for UISceneDidEnterBackgroundNotification / UISceneWillEnterForegroundNotification for this UIScene
object. Instead, we now listen to these notifications for ALL the application's UIScenes. Our handler
then checks if the notification's UIScene object matches the current window's UIScene before
forwarding the notification to the rest of WebKit.
* UIProcess/ApplicationStateTracker.mm:
(WebKit::ApplicationStateTracker::ApplicationStateTracker):
(WebKit::ApplicationStateTracker::~ApplicationStateTracker):
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (250186 => 250187)
--- trunk/Source/WebKit/ChangeLog 2019-09-21 22:57:46 UTC (rev 250186)
+++ trunk/Source/WebKit/ChangeLog 2019-09-21 23:13:47 UTC (rev 250187)
@@ -1,3 +1,28 @@
+2019-09-21 Chris Dumez <[email protected]>
+
+ Regression(iOS 13) web views do not deal properly with their window's UIScene changing
+ https://bugs.webkit.org/show_bug.cgi?id=202070
+ <rdar://problem/55580699>
+
+ Reviewed by Tim Horton.
+
+ Web views do not deal properly with their window's UIScene changing. If a Safari window is in the
+ background for 1 minute, its UIScene will be detached and the window will get a new UIScene if
+ the user later switches to this window. Our web views listen to UIScene notifications to determine
+ their visibility and currently stop receiving visibility updates once the window’s UIScene has
+ changed. This causes view freezes because our WebContent process does not know its view is visible
+ and keeps its layer tree frozen.
+
+ Previously, when our view would be added to a window, we would get this window's UIScene and listen
+ for UISceneDidEnterBackgroundNotification / UISceneWillEnterForegroundNotification for this UIScene
+ object. Instead, we now listen to these notifications for ALL the application's UIScenes. Our handler
+ then checks if the notification's UIScene object matches the current window's UIScene before
+ forwarding the notification to the rest of WebKit.
+
+ * UIProcess/ApplicationStateTracker.mm:
+ (WebKit::ApplicationStateTracker::ApplicationStateTracker):
+ (WebKit::ApplicationStateTracker::~ApplicationStateTracker):
+
2019-09-21 Dan Bernstein <[email protected]>
Safari 13 may launch leftover 32-bit plug-in process from Safari 12’s WebKit, which crashes
Modified: trunk/Source/WebKit/UIProcess/ApplicationStateTracker.mm (250186 => 250187)
--- trunk/Source/WebKit/UIProcess/ApplicationStateTracker.mm 2019-09-21 22:57:46 UTC (rev 250186)
+++ trunk/Source/WebKit/UIProcess/ApplicationStateTracker.mm 2019-09-21 23:13:47 UTC (rev 250187)
@@ -108,14 +108,18 @@
m_isInBackground = window.windowScene.activationState == UISceneActivationStateBackground || window.windowScene.activationState == UISceneActivationStateUnattached;
RELEASE_LOG(ViewState, "%p - ApplicationStateTracker::ApplicationStateTracker(): m_isInBackground: %d", this, m_isInBackground);
- m_didEnterBackgroundObserver = [notificationCenter addObserverForName:UISceneDidEnterBackgroundNotification object:window.windowScene queue:nil usingBlock:[this](NSNotification *) {
- RELEASE_LOG(ViewState, "%p - ApplicationStateTracker: UISceneDidEnterBackground", this);
- applicationDidEnterBackground();
+ m_didEnterBackgroundObserver = [notificationCenter addObserverForName:UISceneDidEnterBackgroundNotification object:nil queue:nil usingBlock:[this](NSNotification *notification) {
+ if (notification.object == [[m_view window] windowScene]) {
+ 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();
+ m_willEnterForegroundObserver = [notificationCenter addObserverForName:UISceneWillEnterForegroundNotification object:nil queue:nil usingBlock:[this](NSNotification *notification) {
+ if (notification.object == [[m_view window] windowScene]) {
+ RELEASE_LOG(ViewState, "%p - ApplicationStateTracker: UISceneWillEnterForeground", this);
+ applicationWillEnterForeground();
+ }
}];
#else
m_isInBackground = application.applicationState == UIApplicationStateBackground;
@@ -180,6 +184,7 @@
ApplicationStateTracker::~ApplicationStateTracker()
{
+ RELEASE_LOG(ViewState, "%p - ~ApplicationStateTracker", this);
if (m_applicationStateMonitor) {
[m_applicationStateMonitor invalidate];
return;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes