Title: [252053] branches/safari-608-branch/Source/WebKit
Revision
252053
Author
kocsen_ch...@apple.com
Date
2019-11-05 08:40:22 -0800 (Tue, 05 Nov 2019)

Log Message

Cherry-pick r248121. rdar://problem/56903580

    Crash under WebProcessProxy::didBecomeUnresponsive()
    https://bugs.webkit.org/show_bug.cgi?id=200346
    <rdar://problem/53795984>

    Reviewed by Geoffrey Garen.

    Make sure the BackgroundProcessResponsivenessTimer / ResponsivenessTimer ref their client
    while they call mayBecomeUnresponsive() / willChangeIsResponsive() / didChangeIsResponsive()
    / didBecomeUnresponsive() on their client, in case calling one of these ends up destroying
    the client.

    * UIProcess/BackgroundProcessResponsivenessTimer.cpp:
    (WebKit::BackgroundProcessResponsivenessTimer::setResponsive):
    * UIProcess/ResponsivenessTimer.cpp:
    (WebKit::ResponsivenessTimer::timerFired):
    * UIProcess/ResponsivenessTimer.h:
    * UIProcess/WebProcessProxy.h:

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

Modified Paths

Diff

Modified: branches/safari-608-branch/Source/WebKit/ChangeLog (252052 => 252053)


--- branches/safari-608-branch/Source/WebKit/ChangeLog	2019-11-05 15:01:59 UTC (rev 252052)
+++ branches/safari-608-branch/Source/WebKit/ChangeLog	2019-11-05 16:40:22 UTC (rev 252053)
@@ -1,3 +1,48 @@
+2019-11-05  Alan Coon  <alanc...@apple.com>
+
+        Cherry-pick r248121. rdar://problem/56903580
+
+    Crash under WebProcessProxy::didBecomeUnresponsive()
+    https://bugs.webkit.org/show_bug.cgi?id=200346
+    <rdar://problem/53795984>
+    
+    Reviewed by Geoffrey Garen.
+    
+    Make sure the BackgroundProcessResponsivenessTimer / ResponsivenessTimer ref their client
+    while they call mayBecomeUnresponsive() / willChangeIsResponsive() / didChangeIsResponsive()
+    / didBecomeUnresponsive() on their client, in case calling one of these ends up destroying
+    the client.
+    
+    * UIProcess/BackgroundProcessResponsivenessTimer.cpp:
+    (WebKit::BackgroundProcessResponsivenessTimer::setResponsive):
+    * UIProcess/ResponsivenessTimer.cpp:
+    (WebKit::ResponsivenessTimer::timerFired):
+    * UIProcess/ResponsivenessTimer.h:
+    * UIProcess/WebProcessProxy.h:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248121 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-08-01  Chris Dumez  <cdu...@apple.com>
+
+            Crash under WebProcessProxy::didBecomeUnresponsive()
+            https://bugs.webkit.org/show_bug.cgi?id=200346
+            <rdar://problem/53795984>
+
+            Reviewed by Geoffrey Garen.
+
+            Make sure the BackgroundProcessResponsivenessTimer / ResponsivenessTimer ref their client
+            while they call mayBecomeUnresponsive() / willChangeIsResponsive() / didChangeIsResponsive()
+            / didBecomeUnresponsive() on their client, in case calling one of these ends up destroying
+            the client.
+
+            * UIProcess/BackgroundProcessResponsivenessTimer.cpp:
+            (WebKit::BackgroundProcessResponsivenessTimer::setResponsive):
+            * UIProcess/ResponsivenessTimer.cpp:
+            (WebKit::ResponsivenessTimer::timerFired):
+            * UIProcess/ResponsivenessTimer.h:
+            * UIProcess/WebProcessProxy.h:
+
 2019-11-04  Alan Coon  <alanc...@apple.com>
 
         Apply patch. rdar://problem/56864381

Modified: branches/safari-608-branch/Source/WebKit/UIProcess/BackgroundProcessResponsivenessTimer.cpp (252052 => 252053)


--- branches/safari-608-branch/Source/WebKit/UIProcess/BackgroundProcessResponsivenessTimer.cpp	2019-11-05 15:01:59 UTC (rev 252052)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/BackgroundProcessResponsivenessTimer.cpp	2019-11-05 16:40:22 UTC (rev 252053)
@@ -116,6 +116,8 @@
     if (m_isResponsive == isResponsive)
         return;
 
+    auto protectedClient = makeRef(client());
+
     client().willChangeIsResponsive();
     m_isResponsive = isResponsive;
     client().didChangeIsResponsive();

Modified: branches/safari-608-branch/Source/WebKit/UIProcess/ResponsivenessTimer.cpp (252052 => 252053)


--- branches/safari-608-branch/Source/WebKit/UIProcess/ResponsivenessTimer.cpp	2019-11-05 15:01:59 UTC (rev 252052)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/ResponsivenessTimer.cpp	2019-11-05 16:40:22 UTC (rev 252053)
@@ -68,6 +68,8 @@
     if (!m_isResponsive)
         return;
 
+    auto protectedClient = makeRef(m_client);
+
     if (!m_client.mayBecomeUnresponsive()) {
         m_waitingForTimer = true;
         m_timer.startOneShot(responsivenessTimeout);
@@ -113,6 +115,8 @@
 void ResponsivenessTimer::stop()
 {
     if (!m_isResponsive) {
+        auto protectedClient = makeRef(m_client);
+
         // We got a life sign from the web process.
         m_client.willChangeIsResponsive();
         m_isResponsive = true;

Modified: branches/safari-608-branch/Source/WebKit/UIProcess/ResponsivenessTimer.h (252052 => 252053)


--- branches/safari-608-branch/Source/WebKit/UIProcess/ResponsivenessTimer.h	2019-11-05 15:01:59 UTC (rev 252052)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/ResponsivenessTimer.h	2019-11-05 16:40:22 UTC (rev 252053)
@@ -42,6 +42,9 @@
         virtual void didChangeIsResponsive() = 0;
 
         virtual bool mayBecomeUnresponsive() = 0;
+
+        virtual void ref() = 0;
+        virtual void deref() = 0;
     };
 
     explicit ResponsivenessTimer(ResponsivenessTimer::Client&);

Modified: branches/safari-608-branch/Source/WebKit/UIProcess/WebProcessProxy.h (252052 => 252053)


--- branches/safari-608-branch/Source/WebKit/UIProcess/WebProcessProxy.h	2019-11-05 15:01:59 UTC (rev 252052)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/WebProcessProxy.h	2019-11-05 16:40:22 UTC (rev 252053)
@@ -308,6 +308,9 @@
 
     void webPageMediaStateDidChange(WebPageProxy&);
 
+    void ref() final { ThreadSafeRefCounted::ref(); }
+    void deref() final { ThreadSafeRefCounted::deref(); }
+
 protected:
     static WebCore::PageIdentifier generatePageID();
     WebProcessProxy(WebProcessPool&, WebsiteDataStore*, IsPrewarmed);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to