Bug 1253762 - Adapt texttrack_chrome to work with e10s. r=kinetik
authorRalph Giles <giles@mozilla.com>
Fri, 04 Mar 2016 14:56:34 -0800
changeset 287567 af346b5bd5a6cb4ebf8ce9dc925281ce24be5d67
parent 287566 b42c22e14ebc5e6743e2d764be3e0c410f69dcae
child 287568 6c22c66781d352e37948c385131af420afd7d3f9
push id73229
push userrgiles@mozilla.com
push dateWed, 09 Mar 2016 22:32:46 +0000
treeherdermozilla-inbound@a99eb961c111 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskinetik
bugs1253762
milestone48.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 1253762 - Adapt texttrack_chrome to work with e10s. r=kinetik Convert this to a plain mochitest so it runs in the client context, and use the SpecialPowers object's wrap() and unwrap() methods to access the privileged parent pointer api. Rename _chrome to _moz to clarify that this is a moz-specific extension, since chrome privilege is ambiguous in the context of e10s. MozReview-Commit-ID: JQVfqjvS55e
dom/media/test/chrome.ini
dom/media/test/mochitest.ini
dom/media/test/test_texttrack_chrome.html
dom/media/test/test_texttrack_moz.html
--- a/dom/media/test/chrome.ini
+++ b/dom/media/test/chrome.ini
@@ -3,10 +3,9 @@
 [DEFAULT]
 skip-if = buildapp == 'b2g'
 support-files =
   basic.vtt
   seek.webm
 
 [test_texttrackcue_chrome.html]
 skip-if = os=='mac' && debug # bug 1130751
-[test_texttrack_chrome.html]
 [test_texttracklist_chrome.html]
--- a/dom/media/test/mochitest.ini
+++ b/dom/media/test/mochitest.ini
@@ -846,16 +846,17 @@ tags=msg
 tags=msg capturestream
 [test_streams_tracks.html]
 tags=msg capturestream
 [test_texttrack.html]
 [test_texttrackcue.html]
 [test_texttrackevents_video.html]
 [test_texttracklist.html]
 [test_texttrackregion.html]
+[test_texttrack_moz.html]
 [test_timeupdate_small_files.html]
 skip-if = (toolkit == 'android' && processor == 'x86') #x86 only bug 914439
 [test_trackelementevent.html]
 [test_trackevent.html]
 [test_unseekable.html]
 skip-if = toolkit == 'gonk' || (toolkit == 'android' && processor == 'x86') #x86 only and bug 1128845 on gonk
 [test_video_to_canvas.html]
 skip-if = (toolkit == 'android' && processor == 'x86') #x86 only bug 914439
deleted file mode 100644
--- a/dom/media/test/test_texttrack_chrome.html
+++ /dev/null
@@ -1,57 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=881976
--->
-<head>
-  <meta charset='utf-8'>
-  <title>Test for Bug 881976 - TextTrackCue Computed Position</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.regions.enabled", true]]},
-  function() {
-    var video = document.createElement("video");
-
-    // Check if adding a text track manually sets the TextTarckList correctly.
-    video.addTextTrack("subtitles", "", "");
-    is(video.textTracks[0].textTrackList, video.textTracks, "The Track's TextTrackList should be the Video's TextTrackList.");
-
-
-    // Check if loading a Track via a TrackElement sets the TextTarckList correctly.
-    video.src = "seek.webm";
-    video.preload = "auto";
-
-    var trackElement = document.createElement("track");
-    trackElement.src = "basic.vtt";
-    trackElement.kind = "subtitles";
-
-    video.appendChild(trackElement);
-    document.getElementById("content").appendChild(video);
-
-    video.addEventListener("loadedmetadata", function run_tests() {
-      // Re-que run_tests() at the end of the event loop until the track
-      // element has loaded its data.
-      if (trackElement.readyState == 1) {
-        setTimeout(run_tests, 0);
-        return;
-      }
-      is(trackElement.readyState, 2, "Track::ReadyState should be set to LOADED.");
-      is(trackElement.track.textTrackList, video.textTracks, "TrackElement's Track's TextTrackList should be the Video's TextTrackList.");
-
-      SimpleTest.finish();
-    });
-  }
-);
-
-</script>
-</pre>
-</body>
-</html>
\ No newline at end of file
new file mode 100644
--- /dev/null
+++ b/dom/media/test/test_texttrack_moz.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=881976
+-->
+<head>
+  <meta charset='utf-8'>
+  <title>Test for Bug 881976 - TextTrackCue Computed Position</title>
+  <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/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.regions.enabled", true]]},
+    function() {
+      var video = document.createElement("video");
+
+      // Check if adding a text track manually sets the TextTrackList correctly.
+
+      // HTMLTrackElement.textTrackList is an extension available only to
+      // privileged code, so we need to access it through the SpecialPowers
+      // object.
+      video.addTextTrack("subtitles", "", "");
+      is(SpecialPowers.unwrap(SpecialPowers.wrap(video.textTracks[0]).textTrackList),
+          video.textTracks,
+          "The Track's TextTrackList should be the Video's TextTrackList.");
+
+
+      // Check if loading a Track via a TrackElement sets the TextTrackList correctly.
+      video.src = "seek.webm";
+      video.preload = "auto";
+
+      var trackElement = document.createElement("track");
+      trackElement.src = "basic.vtt";
+      trackElement.kind = "subtitles";
+
+      video.appendChild(trackElement);
+      document.getElementById("content").appendChild(video);
+
+      video.addEventListener("loadedmetadata", function run_tests() {
+        // Re-que run_tests() at the end of the event loop until the track
+        // element has loaded its data.
+        if (trackElement.readyState == HTMLTrackElement.LOADING) {
+          setTimeout(run_tests, 0);
+          return;
+        }
+        is(trackElement.readyState, HTMLTrackElement.LOADED,
+            "Track::ReadyState should be set to LOADED.");
+        is(SpecialPowers.unwrap(SpecialPowers.wrap(trackElement.track).textTrackList),
+           video.textTracks,
+           "TrackElement's Track's TextTrackList should be the Video's TextTrackList.");
+
+        SimpleTest.finish();
+      });
+    }
+  );
+</script>
+</pre>
+</body>
+</html>