Title: [259299] trunk/Source/WebCore
Revision
259299
Author
[email protected]
Date
2020-03-31 10:39:41 -0700 (Tue, 31 Mar 2020)

Log Message

ASSERTION FAILED: m_wrapper on imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/ready-states/autoplay.html
https://bugs.webkit.org/show_bug.cgi?id=209684
<rdar://problem/60987285>

Reviewed by Darin Adler.

I have not been able to reproduce so this is a speculative fix. HTMLMediaElement::virtualHasPendingActivity()
was checking MainThreadGenericEventQueue::hasPendingEvents() but this would return false for a short amount
of time where we've removed the last event from the queue and before we've actually fired the event. To
address the issue, we now rely on MainThreadGenericEventQueue::hasPendingActivity() which keeps returning
true after we've dequeued the last event, until we've fired it.

No new tests, covered by imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/ready-states/autoplay.html.

* Modules/mediasource/MediaSource.cpp:
(WebCore::MediaSource::virtualHasPendingActivity const):
* Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::virtualHasPendingActivity const):
* dom/GenericEventQueue.cpp:
(WebCore::MainThreadGenericEventQueue::dispatchOneEvent):
(WebCore::MainThreadGenericEventQueue::hasPendingActivity const):
(WebCore::MainThreadGenericEventQueue::hasPendingEvents const): Deleted.
* dom/GenericEventQueue.h:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::virtualHasPendingActivity const):
* html/track/TrackListBase.cpp:
(WebCore::TrackListBase::virtualHasPendingActivity const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (259298 => 259299)


--- trunk/Source/WebCore/ChangeLog	2020-03-31 17:35:30 UTC (rev 259298)
+++ trunk/Source/WebCore/ChangeLog	2020-03-31 17:39:41 UTC (rev 259299)
@@ -1,3 +1,33 @@
+2020-03-31  Chris Dumez  <[email protected]>
+
+        ASSERTION FAILED: m_wrapper on imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/ready-states/autoplay.html
+        https://bugs.webkit.org/show_bug.cgi?id=209684
+        <rdar://problem/60987285>
+
+        Reviewed by Darin Adler.
+
+        I have not been able to reproduce so this is a speculative fix. HTMLMediaElement::virtualHasPendingActivity()
+        was checking MainThreadGenericEventQueue::hasPendingEvents() but this would return false for a short amount
+        of time where we've removed the last event from the queue and before we've actually fired the event. To
+        address the issue, we now rely on MainThreadGenericEventQueue::hasPendingActivity() which keeps returning
+        true after we've dequeued the last event, until we've fired it.
+
+        No new tests, covered by imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/ready-states/autoplay.html.
+
+        * Modules/mediasource/MediaSource.cpp:
+        (WebCore::MediaSource::virtualHasPendingActivity const):
+        * Modules/mediasource/SourceBuffer.cpp:
+        (WebCore::SourceBuffer::virtualHasPendingActivity const):
+        * dom/GenericEventQueue.cpp:
+        (WebCore::MainThreadGenericEventQueue::dispatchOneEvent):
+        (WebCore::MainThreadGenericEventQueue::hasPendingActivity const):
+        (WebCore::MainThreadGenericEventQueue::hasPendingEvents const): Deleted.
+        * dom/GenericEventQueue.h:
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::virtualHasPendingActivity const):
+        * html/track/TrackListBase.cpp:
+        (WebCore::TrackListBase::virtualHasPendingActivity const):
+
 2020-03-31  Chris Lord  <[email protected]>
 
         requestAnimationFrame and cancelAnimationFrame should be present on DedicatedWorkerGlobalScope

Modified: trunk/Source/WebCore/Modules/mediasource/MediaSource.cpp (259298 => 259299)


--- trunk/Source/WebCore/Modules/mediasource/MediaSource.cpp	2020-03-31 17:35:30 UTC (rev 259298)
+++ trunk/Source/WebCore/Modules/mediasource/MediaSource.cpp	2020-03-31 17:39:41 UTC (rev 259299)
@@ -973,7 +973,7 @@
 
 bool MediaSource::virtualHasPendingActivity() const
 {
-    return m_private || m_asyncEventQueue->hasPendingEvents();
+    return m_private || m_asyncEventQueue->hasPendingActivity();
 }
 
 void MediaSource::stop()

Modified: trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp (259298 => 259299)


--- trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp	2020-03-31 17:35:30 UTC (rev 259298)
+++ trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp	2020-03-31 17:39:41 UTC (rev 259299)
@@ -537,7 +537,7 @@
 
 bool SourceBuffer::virtualHasPendingActivity() const
 {
-    return m_source || m_asyncEventQueue->hasPendingEvents();
+    return m_source || m_asyncEventQueue->hasPendingActivity();
 }
 
 void SourceBuffer::stop()

Modified: trunk/Source/WebCore/dom/GenericEventQueue.cpp (259298 => 259299)


--- trunk/Source/WebCore/dom/GenericEventQueue.cpp	2020-03-31 17:35:30 UTC (rev 259298)
+++ trunk/Source/WebCore/dom/GenericEventQueue.cpp	2020-03-31 17:39:41 UTC (rev 259299)
@@ -33,6 +33,7 @@
 #include "ScriptExecutionContext.h"
 #include "Timer.h"
 #include <wtf/MainThread.h>
+#include <wtf/SetForScope.h>
 
 namespace WebCore {
 
@@ -63,7 +64,9 @@
 {
     ASSERT(!m_pendingEvents.isEmpty());
 
+    SetForScope<bool> eventFiringScope(m_isFiringEvent, true);
     Ref<EventTarget> protect(m_owner);
+
     RefPtr<Event> event = m_pendingEvents.takeFirst();
     EventTarget& target = event->target() ? *event->target() : m_owner;
     ASSERT_WITH_MESSAGE(!target.scriptExecutionContext()->activeDOMObjectsAreStopped(),
@@ -86,9 +89,9 @@
     m_pendingEvents.clear();
 }
 
-bool MainThreadGenericEventQueue::hasPendingEvents() const
+bool MainThreadGenericEventQueue::hasPendingActivity() const
 {
-    return !m_pendingEvents.isEmpty();
+    return !m_pendingEvents.isEmpty() || m_isFiringEvent;
 }
 
 bool MainThreadGenericEventQueue::hasPendingEventsOfType(const AtomString& type) const

Modified: trunk/Source/WebCore/dom/GenericEventQueue.h (259298 => 259299)


--- trunk/Source/WebCore/dom/GenericEventQueue.h	2020-03-31 17:35:30 UTC (rev 259298)
+++ trunk/Source/WebCore/dom/GenericEventQueue.h	2020-03-31 17:39:41 UTC (rev 259299)
@@ -50,7 +50,6 @@
     void close();
 
     void cancelAllEvents();
-    bool hasPendingEvents() const;
     bool hasPendingEventsOfType(const AtomString&) const;
 
     void setPaused(bool);
@@ -57,6 +56,8 @@
 
     bool isSuspended() const { return m_isSuspended; }
 
+    bool hasPendingActivity() const;
+
 private:
     friend UniqueRef<MainThreadGenericEventQueue> WTF::makeUniqueRefWithoutFastMallocCheck<MainThreadGenericEventQueue, WebCore::EventTarget&>(WebCore::EventTarget&);
     explicit MainThreadGenericEventQueue(EventTarget&);
@@ -77,6 +78,7 @@
     bool m_isClosed { false };
     bool m_isPausedByClient { false };
     bool m_isSuspended { false };
+    bool m_isFiringEvent { false };
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (259298 => 259299)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2020-03-31 17:35:30 UTC (rev 259298)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2020-03-31 17:39:41 UTC (rev 259299)
@@ -5764,7 +5764,7 @@
 
 bool HTMLMediaElement::virtualHasPendingActivity() const
 {
-    return (hasAudio() && isPlaying()) || m_asyncEventQueue->hasPendingEvents() || m_playbackTargetIsWirelessQueue.hasPendingTasks() || m_creatingControls;
+    return (hasAudio() && isPlaying()) || m_asyncEventQueue->hasPendingActivity() || m_playbackTargetIsWirelessQueue.hasPendingTasks() || m_creatingControls;
 }
 
 void HTMLMediaElement::mediaVolumeDidChange()

Modified: trunk/Source/WebCore/html/track/TrackListBase.cpp (259298 => 259299)


--- trunk/Source/WebCore/html/track/TrackListBase.cpp	2020-03-31 17:35:30 UTC (rev 259298)
+++ trunk/Source/WebCore/html/track/TrackListBase.cpp	2020-03-31 17:39:41 UTC (rev 259299)
@@ -179,7 +179,7 @@
 
 bool TrackListBase::virtualHasPendingActivity() const
 {
-    return m_asyncEventQueue->hasPendingEvents();
+    return m_asyncEventQueue->hasPendingActivity();
 }
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to