Bug 1116355 - Throw when setting SourceBuffer mode to 'sequence'. r=karlt,rs=Ms2ger
authorBobby Holley <bobbyholley@gmail.com>
Tue, 30 Dec 2014 12:22:45 -0800
changeset 247517 d227893d32042cee83c8163c754fb6585ff78638
parent 247516 28af302f47f4d9015fee52eb5faa75d0810cf959
child 247518 c69a53cb9a040d9fbf0c5e692f1ba84d0ab7d655
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt, Ms2ger
bugs1116355
milestone37.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 1116355 - Throw when setting SourceBuffer mode to 'sequence'. r=karlt,rs=Ms2ger
dom/media/mediasource/SourceBuffer.cpp
dom/media/mediasource/test/mochitest.ini
dom/media/mediasource/test/test_SetModeThrows.html
testing/web-platform/meta/media-source/mediasource-sourcebuffer-mode.html.ini
--- a/dom/media/mediasource/SourceBuffer.cpp
+++ b/dom/media/mediasource/SourceBuffer.cpp
@@ -44,16 +44,20 @@ void
 SourceBuffer::SetMode(SourceBufferAppendMode aMode, ErrorResult& aRv)
 {
   MOZ_ASSERT(NS_IsMainThread());
   MSE_API("SourceBuffer(%p)::SetMode(aMode=%d)", this, aMode);
   if (!IsAttached() || mUpdating) {
     aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
     return;
   }
+  if (aMode == SourceBufferAppendMode::Sequence) {
+    aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
+    return;
+  }
   MOZ_ASSERT(mMediaSource->ReadyState() != MediaSourceReadyState::Closed);
   if (mMediaSource->ReadyState() == MediaSourceReadyState::Ended) {
     mMediaSource->SetReadyState(MediaSourceReadyState::Open);
   }
   // TODO: Test append state.
   // TODO: If aMode is "sequence", set sequence start time.
   mAppendMode = aMode;
 }
--- a/dom/media/mediasource/test/mochitest.ini
+++ b/dom/media/mediasource/test/mochitest.ini
@@ -14,12 +14,13 @@ skip-if = true # bug 1093133
 skip-if = (toolkit == 'android' || buildapp == 'mulet') #timeout android/mulet only bug 1101187
 [test_FrameSelection.html]
 [test_HaveMetadataUnbufferedSeek.html]
 [test_LoadedMetadataFired.html]
 [test_SeekableAfterEndOfStream.html]
 [test_SeekableAfterEndOfStreamSplit.html]
 [test_SeekableBeforeEndOfStream.html]
 [test_SeekableBeforeEndOfStreamSplit.html]
+[test_SetModeThrows.html]
 [test_SplitAppendDelay.html]
 [test_SplitAppend.html]
 [test_WaitingOnMissingData.html]
  skip-if = android_version == '10' # bug 1115148 - frequent failures on Android 2.3
new file mode 100644
--- /dev/null
+++ b/dom/media/mediasource/test/test_SetModeThrows.html
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <title>MSE: append initialization only</title>
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="text/javascript" src="mediasource.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+// This test should be removed when we implement sequence mode in bug 1116353 
+runWithMSE(function (ms, v) {
+  ms.addEventListener("sourceopen", function () {
+    var sb = ms.addSourceBuffer("video/webm");
+
+    sb.mode = "segments";
+    ok("true", "Setting to segments does not throw");
+    try {
+      sb.mode = "sequence";
+      ok(false, "Should have thrown");
+    } catch (e) { ok(/supported/.test(e), "Correctly threw not supported: " + e); }
+
+    SimpleTest.finish();
+  });
+});
+
+</script>
+</pre>
+</body>
+</html>
--- a/testing/web-platform/meta/media-source/mediasource-sourcebuffer-mode.html.ini
+++ b/testing/web-platform/meta/media-source/mediasource-sourcebuffer-mode.html.ini
@@ -1,5 +1,7 @@
 [mediasource-sourcebuffer-mode.html]
   type: testharness
   [Test setting SourceBuffer.mode and SourceBuffer.timestampOffset while parsing media segment.]
     expected: FAIL
+  [Test setting SourceBuffer.mode]
+    expected: FAIL # Not supported yet - see bug 1116353