REGRESSION (iOS 13): rAF stops firing when navigating away cross-origin and then...
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Sep 2019 23:46:45 +0000 (23:46 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Sep 2019 23:46:45 +0000 (23:46 +0000)
https://bugs.webkit.org/show_bug.cgi?id=201767
<rdar://problem/55350854>

Reviewed by Tim Horton.

Source/WebKit:

This is a follow-up to r249961 to address crashes when navigating back cross-origin to a page
that uses requestAnimationFrame. r249961 took care of moving RemoteLayerTreeDisplayRefreshMonitor
objects from one RemoteLayerTreeDrawingArea to another but failed to tell those monitors
about their new drawingArea. As a result, RemoteLayerTreeDrawingArea::willDestroyDisplayRefreshMonitor()
would not get called on the new drawing area when it should have.

* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.h:
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.mm:
(WebKit::RemoteLayerTreeDisplayRefreshMonitor::updateDrawingArea):
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::adoptDisplayRefreshMonitorsFromDrawingArea):

LayoutTests:

Call finishJSTest() on a timer to make it more likely to reproduce the bug.

* http/tests/navigation/page-cache-requestAnimationFrame.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250165 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/http/tests/navigation/page-cache-requestAnimationFrame.html
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.h
Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.mm
Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm

index cbecad0..89008cd 100644 (file)
@@ -1,3 +1,15 @@
+2019-09-20  Chris Dumez  <cdumez@apple.com>
+
+        REGRESSION (iOS 13): rAF stops firing when navigating away cross-origin and then back
+        https://bugs.webkit.org/show_bug.cgi?id=201767
+        <rdar://problem/55350854>
+
+        Reviewed by Tim Horton.
+
+        Call finishJSTest() on a timer to make it more likely to reproduce the bug.
+
+        * http/tests/navigation/page-cache-requestAnimationFrame.html:
+
 2019-09-20  Devin Rousso  <drousso@apple.com>
 
         Web Inspector: HTML Formatter - better indentation/newline handling for self closing tags
index 3b1e864..61caf07 100644 (file)
@@ -37,7 +37,9 @@ function step() {
     if (i % 10 == 0 && restoredFromPageCache) {
         testPassed("requestAnimationFrame is running after restoring from PageCache.");
         clearTimeout(timerHandle);
-        finishJSTest();
+        setTimeout(() => {
+            finishJSTest();
+        }, 100);
     } else
         requestAnimationFrame(step);
 }
index 4f787ab..7c1aa28 100644 (file)
@@ -1,3 +1,23 @@
+2019-09-20  Chris Dumez  <cdumez@apple.com>
+
+        REGRESSION (iOS 13): rAF stops firing when navigating away cross-origin and then back
+        https://bugs.webkit.org/show_bug.cgi?id=201767
+        <rdar://problem/55350854>
+
+        Reviewed by Tim Horton.
+
+        This is a follow-up to r249961 to address crashes when navigating back cross-origin to a page
+        that uses requestAnimationFrame. r249961 took care of moving RemoteLayerTreeDisplayRefreshMonitor
+        objects from one RemoteLayerTreeDrawingArea to another but failed to tell those monitors
+        about their new drawingArea. As a result, RemoteLayerTreeDrawingArea::willDestroyDisplayRefreshMonitor()
+        would not get called on the new drawing area when it should have.
+
+        * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.h:
+        * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.mm:
+        (WebKit::RemoteLayerTreeDisplayRefreshMonitor::updateDrawingArea):
+        * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
+        (WebKit::RemoteLayerTreeDrawingArea::adoptDisplayRefreshMonitorsFromDrawingArea):
+
 2019-09-20  Keith Rollin  <krollin@apple.com>
 
         Remove some support for < iOS 13
index 32b7f5a..d1f7747 100644 (file)
@@ -44,6 +44,7 @@ public:
     bool requestRefreshCallback() override;
 
     void didUpdateLayers();
+    void updateDrawingArea(RemoteLayerTreeDrawingArea&);
 
 private:
     explicit RemoteLayerTreeDisplayRefreshMonitor(WebCore::PlatformDisplayID, RemoteLayerTreeDrawingArea&);
index ce014cc..35c8141 100644 (file)
@@ -67,6 +67,11 @@ void RemoteLayerTreeDisplayRefreshMonitor::didUpdateLayers()
     handleDisplayRefreshedNotificationOnMainThread(this);
 }
 
+void RemoteLayerTreeDisplayRefreshMonitor::updateDrawingArea(RemoteLayerTreeDrawingArea& drawingArea)
+{
+    m_drawingArea = makeWeakPtr(drawingArea);
+}
+
 }
 
 #endif // USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
index 9c1fdbe..e8da19a 100644 (file)
@@ -121,7 +121,8 @@ void RemoteLayerTreeDrawingArea::adoptDisplayRefreshMonitorsFromDrawingArea(Draw
     if (is<RemoteLayerTreeDrawingArea>(drawingArea)) {
         auto& otherDrawingArea = downcast<RemoteLayerTreeDrawingArea>(drawingArea);
         m_displayRefreshMonitors = WTFMove(otherDrawingArea.m_displayRefreshMonitors);
-        otherDrawingArea.m_displayRefreshMonitorsToNotify = nullptr;
+        for (auto* monitor : m_displayRefreshMonitors)
+            monitor->updateDrawingArea(*this);
     }
 }