Title: [253688] trunk/Source/WebCore
Revision
253688
Author
[email protected]
Date
2019-12-18 08:46:15 -0800 (Wed, 18 Dec 2019)

Log Message

REGRESSION: 32 Tests Crashing on Mac Debug wk2 with ASSERTION FAILED: m_pendingActivityForEventDispatch
https://bugs.webkit.org/show_bug.cgi?id=205397
<rdar://problem/58043626>

Unreviewed, fix debug assertion after r253667. The debug assertion is confused because we now use
the HTML5 event loop, which takes care of taking an ActiveDOMObject PendingActivity whenever we
queue an event.

* workers/service/ServiceWorkerRegistration.cpp:
(WebCore::ServiceWorkerRegistration::ServiceWorkerRegistration):
(WebCore::ServiceWorkerRegistration::getNewestWorker const):
(WebCore::ServiceWorkerRegistration::updateStateFromServer):
(WebCore::ServiceWorkerRegistration::queueTaskToFireUpdateFoundEvent):
(WebCore::ServiceWorkerRegistration::stop):
(WebCore::ServiceWorkerRegistration::hasPendingActivity const):
(WebCore::ServiceWorkerRegistration::getNewestWorker): Deleted.
(WebCore::ServiceWorkerRegistration::updatePendingActivityForEventDispatch): Deleted.
* workers/service/ServiceWorkerRegistration.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (253687 => 253688)


--- trunk/Source/WebCore/ChangeLog	2019-12-18 16:40:26 UTC (rev 253687)
+++ trunk/Source/WebCore/ChangeLog	2019-12-18 16:46:15 UTC (rev 253688)
@@ -1,3 +1,24 @@
+2019-12-18  Chris Dumez  <[email protected]>
+
+        REGRESSION: 32 Tests Crashing on Mac Debug wk2 with ASSERTION FAILED: m_pendingActivityForEventDispatch
+        https://bugs.webkit.org/show_bug.cgi?id=205397
+        <rdar://problem/58043626>
+
+        Unreviewed, fix debug assertion after r253667. The debug assertion is confused because we now use
+        the HTML5 event loop, which takes care of taking an ActiveDOMObject PendingActivity whenever we
+        queue an event.
+
+        * workers/service/ServiceWorkerRegistration.cpp:
+        (WebCore::ServiceWorkerRegistration::ServiceWorkerRegistration):
+        (WebCore::ServiceWorkerRegistration::getNewestWorker const):
+        (WebCore::ServiceWorkerRegistration::updateStateFromServer):
+        (WebCore::ServiceWorkerRegistration::queueTaskToFireUpdateFoundEvent):
+        (WebCore::ServiceWorkerRegistration::stop):
+        (WebCore::ServiceWorkerRegistration::hasPendingActivity const):
+        (WebCore::ServiceWorkerRegistration::getNewestWorker): Deleted.
+        (WebCore::ServiceWorkerRegistration::updatePendingActivityForEventDispatch): Deleted.
+        * workers/service/ServiceWorkerRegistration.h:
+
 2019-12-18  Diego Pino Garcia  <[email protected]>
 
         [GTK][WPE] Renderization of Conic gradients

Modified: trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.cpp (253687 => 253688)


--- trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.cpp	2019-12-18 16:40:26 UTC (rev 253687)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.cpp	2019-12-18 16:46:15 UTC (rev 253688)
@@ -76,7 +76,6 @@
     m_container->addRegistration(*this);
 
     relaxAdoptionRequirement();
-    updatePendingActivityForEventDispatch();
 }
 
 ServiceWorkerRegistration::~ServiceWorkerRegistration()
@@ -101,7 +100,7 @@
     return m_activeWorker.get();
 }
 
-ServiceWorker* ServiceWorkerRegistration::getNewestWorker()
+ServiceWorker* ServiceWorkerRegistration::getNewestWorker() const
 {
     if (m_installingWorker)
         return m_installingWorker.get();
@@ -179,7 +178,6 @@
         m_activeWorker = WTFMove(serviceWorker);
         break;
     }
-    updatePendingActivityForEventDispatch();
 }
 
 void ServiceWorkerRegistration::queueTaskToFireUpdateFoundEvent()
@@ -189,7 +187,6 @@
 
     REGISTRATION_RELEASE_LOG_IF_ALLOWED("fireUpdateFoundEvent: Firing updatefound event for registration %llu", identifier().toUInt64());
 
-    ASSERT(m_pendingActivityForEventDispatch);
     queueTaskToDispatchEvent(*this, TaskSource::DOMManipulation, Event::create(eventNames().updatefoundEvent, Event::CanBubble::No, Event::IsCancelable::No));
 }
 
@@ -212,19 +209,14 @@
 {
     m_isStopped = true;
     removeAllEventListeners();
-    updatePendingActivityForEventDispatch();
 }
 
-void ServiceWorkerRegistration::updatePendingActivityForEventDispatch()
+bool ServiceWorkerRegistration::hasPendingActivity() const
 {
-    // If a registration has no ServiceWorker, then it has been cleared on server-side.
-    if (m_isStopped || !getNewestWorker()) {
-        m_pendingActivityForEventDispatch = nullptr;
-        return;
-    }
-    if (m_pendingActivityForEventDispatch)
-        return;
-    m_pendingActivityForEventDispatch = makePendingActivity(*this);
+    if (!m_isStopped && getNewestWorker() && hasEventListeners())
+        return true;
+
+    return ActiveDOMObject::hasPendingActivity();
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.h (253687 => 253688)


--- trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.h	2019-12-18 16:40:26 UTC (rev 253687)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.h	2019-12-18 16:46:15 UTC (rev 253688)
@@ -53,7 +53,7 @@
     ServiceWorker* waiting();
     ServiceWorker* active();
 
-    ServiceWorker* getNewestWorker();
+    ServiceWorker* getNewestWorker() const;
 
     const String& scope() const;
 
@@ -76,9 +76,11 @@
     void updateStateFromServer(ServiceWorkerRegistrationState, RefPtr<ServiceWorker>&&);
     void queueTaskToFireUpdateFoundEvent();
 
+    // ActiveDOMObject.
+    bool hasPendingActivity() const final;
+
 private:
     ServiceWorkerRegistration(ScriptExecutionContext&, Ref<ServiceWorkerContainer>&&, ServiceWorkerRegistrationData&&);
-    void updatePendingActivityForEventDispatch();
 
     EventTargetInterface eventTargetInterface() const final;
     ScriptExecutionContext* scriptExecutionContext() const final;
@@ -97,7 +99,6 @@
     RefPtr<ServiceWorker> m_activeWorker;
 
     bool m_isStopped { false };
-    RefPtr<PendingActivity<ServiceWorkerRegistration>> m_pendingActivityForEventDispatch;
 };
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to