Bug 967157 - Setting TextTrackCue::DisplayState should set TextTrackCue::HasBeenReset to false. r=rillian
authorRick Eyre <rick.eyre@hotmail.com>
Mon, 03 Feb 2014 15:27:51 -0500
changeset 167886 6399a107be1e16b1a75e1b1886e31c3f495b36ec
parent 167885 f5590c1dcf700e1e7248da489c7f5e8b683df66f
child 167887 00d49079bcbc431a20b1fd9265d38923c701a8cd
push id26191
push userryanvm@gmail.com
push dateMon, 10 Feb 2014 20:42:58 +0000
treeherdermozilla-central@d812f80a0f1d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrillian
bugs967157
milestone30.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 967157 - Setting TextTrackCue::DisplayState should set TextTrackCue::HasBeenReset to false. r=rillian
content/media/TextTrackCue.h
content/media/test/chrome.ini
content/media/test/test_texttrackcue_chrome.html
--- a/content/media/TextTrackCue.h
+++ b/content/media/TextTrackCue.h
@@ -317,16 +317,17 @@ public:
   HTMLDivElement* GetDisplayState()
   {
     return static_cast<HTMLDivElement*>(mDisplayState.get());
   }
 
   void SetDisplayState(HTMLDivElement* aDisplayState)
   {
     mDisplayState = aDisplayState;
+    mReset = false;
   }
 
   bool HasBeenReset()
   {
     return mReset;
   }
 
   // Helper functions for implementation.
--- a/content/media/test/chrome.ini
+++ b/content/media/test/chrome.ini
@@ -1,9 +1,10 @@
 #Media chrome tests
 
 [DEFAULT]
 support-files =
   basic.vtt
   seek.webm
 
+[test_texttrackcue_chrome.html]
 [test_texttrack_chrome.html]
 [test_texttracklist_chrome.html]
new file mode 100644
--- /dev/null
+++ b/content/media/test/test_texttrackcue_chrome.html
@@ -0,0 +1,33 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=967157
+-->
+<head>
+  <meta charset='utf-8'>
+  <title>Test for Bug 967157 - Setting TextTrackCue::DisplayState should set TextTrackCue::HasBeenReset to false</title>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<p id="display"></p>
+<div id="content">
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+SimpleTest.waitForExplicitFinish();
+SpecialPowers.pushPrefEnv({"set": [["media.webvtt.enabled", true]]},
+  function() {
+    var cue = new VTTCue(0, 1, "Some text.");
+    is(cue.hasBeenReset, false, "Cue's hasBeenReset flag should be false.");
+    is(cue.displayState, null, "Cue's displayState should be null.");
+
+    cue.startTime = 0.5;
+    is(cue.hasBeenReset, true, "Cue's hasBeenReset flag should now be true.");
+
+    cue.displayState = document.createElement("div");
+    is(cue.hasBeenReset, false, "Cue's hasBeenReset flag should now be false.");
+    SimpleTest.finish();
+  }
+);
+</script>