Title: [127779] trunk
Revision
127779
Author
ann...@chromium.org
Date
2012-09-06 13:06:00 -0700 (Thu, 06 Sep 2012)

Log Message

ASSERT reached when TextTrack.mode is set to DISABLED.
https://bugs.webkit.org/show_bug.cgi?id=94651

Reviewed by Eric Carlson.

This patch ensures that cues that have already been added to the
cueTree in HTMLMediaElement, are not added again.

Source/WebCore:

Test: media/track/track-mode-disabled-crash.html

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::textTrackAddCue): Do not add the cue if it already
exists in m_cueTree.

LayoutTests:

* media/track/track-mode-disabled-crash-expected.txt: Added.
* media/track/track-mode-disabled-crash.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (127778 => 127779)


--- trunk/LayoutTests/ChangeLog	2012-09-06 19:54:14 UTC (rev 127778)
+++ trunk/LayoutTests/ChangeLog	2012-09-06 20:06:00 UTC (rev 127779)
@@ -1,3 +1,16 @@
+2012-09-06  Anna Cavender  <ann...@chromium.org>
+
+        ASSERT reached when TextTrack.mode is set to DISABLED.
+        https://bugs.webkit.org/show_bug.cgi?id=94651
+
+        Reviewed by Eric Carlson.
+
+        This patch ensures that cues that have already been added to the
+        cueTree in HTMLMediaElement, are not added again.
+
+        * media/track/track-mode-disabled-crash-expected.txt: Added.
+        * media/track/track-mode-disabled-crash.html: Added.
+
 2012-09-06  Geoffrey Garen  <gga...@apple.com>
 
         Unskipped fast/dom/HTMLScriptElement/script-reexecution-pretty-diff.html

Added: trunk/LayoutTests/media/track/track-mode-disabled-crash-expected.txt (0 => 127779)


--- trunk/LayoutTests/media/track/track-mode-disabled-crash-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/media/track/track-mode-disabled-crash-expected.txt	2012-09-06 20:06:00 UTC (rev 127779)
@@ -0,0 +1,13 @@
+Tests that cues are properly removed from the active cue list when their track changes mode to disabled.
+
+EVENT(canplaythrough)
+** Set the mode of the text track to showing. **
+** Seek to a time with a caption. **
+EVENT(seeked)
+** Set the mode of the text track to hidden, then showing again. **
+** Set the mode of the text track to disabled. **
+
+No crash. PASS.
+
+END OF TEST
+

Added: trunk/LayoutTests/media/track/track-mode-disabled-crash.html (0 => 127779)


--- trunk/LayoutTests/media/track/track-mode-disabled-crash.html	                        (rev 0)
+++ trunk/LayoutTests/media/track/track-mode-disabled-crash.html	2012-09-06 20:06:00 UTC (rev 127779)
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+        <script src=""
+        <script src=""
+        <script>
+            var testTrack;
+
+            function seeked()
+            {
+                consoleWrite("** Set the mode of the text track to hidden, then showing again. **");
+                testTrack.track.mode = "hidden";
+                testTrack.track.mode = "showing";
+
+                consoleWrite("** Set the mode of the text track to disabled. **");
+                testTrack.track.mode = "disabled";
+
+                consoleWrite("");
+                consoleWrite("No crash. PASS.");
+                consoleWrite("");
+
+                endTest();                
+            }
+
+            function startTest()
+            {
+                consoleWrite("** Set the mode of the text track to showing. **");
+                testTrack.track.mode = "showing";
+                consoleWrite("** Seek to a time with a caption. **");
+                video.currentTime = 1.5;
+            }
+
+            function loaded()
+            {
+                findMediaElement();
+                testTrack = document.querySelector('track');
+
+                video.src = "" '../content/counting');
+                waitForEvent('seeked', seeked);
+                waitForEvent('canplaythrough', startTest);
+            }
+
+        </script>
+    </head>
+    <body _onload_="loaded()">
+        <video controls >
+            <track src="" kind="captions" default >
+        </video>
+      <p>Tests that cues are properly removed from the active cue list when their track changes mode to disabled.</p>
+    </body>
+</html>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (127778 => 127779)


--- trunk/Source/WebCore/ChangeLog	2012-09-06 19:54:14 UTC (rev 127778)
+++ trunk/Source/WebCore/ChangeLog	2012-09-06 20:06:00 UTC (rev 127779)
@@ -1,3 +1,19 @@
+2012-09-06  Anna Cavender  <ann...@chromium.org>
+
+        ASSERT reached when TextTrack.mode is set to DISABLED.
+        https://bugs.webkit.org/show_bug.cgi?id=94651
+
+        Reviewed by Eric Carlson.
+
+        This patch ensures that cues that have already been added to the
+        cueTree in HTMLMediaElement, are not added again.
+
+        Test: media/track/track-mode-disabled-crash.html
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::textTrackAddCue): Do not add the cue if it already
+        exists in m_cueTree.
+
 2012-09-06  Zan Dobersek  <zandober...@gmail.com>
 
         Another unreviewed GTK build fix.

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (127778 => 127779)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2012-09-06 19:54:14 UTC (rev 127778)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2012-09-06 20:06:00 UTC (rev 127779)
@@ -1347,7 +1347,9 @@
     // zero-length cues.
     double endTime = max(cue->startTime(), cue->endTime());
 
-    m_cueTree.add(m_cueTree.createInterval(cue->startTime(), endTime, cue.get()));
+    CueIntervalTree::IntervalType interval = m_cueTree.createInterval(cue->startTime(), endTime, cue.get());
+    if (!m_cueTree.contains(interval))
+        m_cueTree.add(interval);
     updateActiveTextTrackCues(currentTime());
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to