Title: [253808] trunk/Source/WebCore
Revision
253808
Author
[email protected]
Date
2019-12-19 18:11:18 -0800 (Thu, 19 Dec 2019)

Log Message

Invalid assert with tracks not associated to media element
https://bugs.webkit.org/show_bug.cgi?id=205360

Patch by Doug Kelly <[email protected]> on 2019-12-19
Reviewed by Eric Carlson.

Remove asserts around TextTrack when not attached to a media element and instead return a zero index.

* html/track/TextTrack.cpp:
(WebCore::TextTrack::trackIndex):
(WebCore::TextTrack::trackIndexRelativeToRenderedTracks):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (253807 => 253808)


--- trunk/Source/WebCore/ChangeLog	2019-12-20 02:04:53 UTC (rev 253807)
+++ trunk/Source/WebCore/ChangeLog	2019-12-20 02:11:18 UTC (rev 253808)
@@ -1,3 +1,16 @@
+2019-12-19  Doug Kelly  <[email protected]>
+
+        Invalid assert with tracks not associated to media element
+        https://bugs.webkit.org/show_bug.cgi?id=205360
+
+        Reviewed by Eric Carlson.
+
+        Remove asserts around TextTrack when not attached to a media element and instead return a zero index.
+
+        * html/track/TextTrack.cpp:
+        (WebCore::TextTrack::trackIndex):
+        (WebCore::TextTrack::trackIndexRelativeToRenderedTracks):
+
 2019-12-19  Sihui Liu  <[email protected]>
 
         IndexedDB: remove timer for pending operations in IDBTransaction

Modified: trunk/Source/WebCore/html/track/TextTrack.cpp (253807 => 253808)


--- trunk/Source/WebCore/html/track/TextTrack.cpp	2019-12-20 02:04:53 UTC (rev 253807)
+++ trunk/Source/WebCore/html/track/TextTrack.cpp	2019-12-20 02:11:18 UTC (rev 253808)
@@ -438,9 +438,11 @@
 
 int TextTrack::trackIndex()
 {
-    ASSERT(m_mediaElement);
-    if (!m_trackIndex)
+    if (!m_trackIndex) {
+        if (!m_mediaElement)
+            return 0;
         m_trackIndex = m_mediaElement->ensureTextTracks().getTrackIndex(*this);
+    }
     return m_trackIndex.value();
 }
 
@@ -465,9 +467,11 @@
 
 int TextTrack::trackIndexRelativeToRenderedTracks()
 {
-    ASSERT(m_mediaElement);
-    if (!m_renderedTrackIndex)
+    if (!m_renderedTrackIndex) {
+        if (!m_mediaElement)
+            return 0;
         m_renderedTrackIndex = m_mediaElement->ensureTextTracks().getTrackIndexRelativeToRenderedTracks(*this);
+    }
     return m_renderedTrackIndex.value();
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to