Bug 1096089: Make end argument an unrestricted double as per spec. r=cajbir r=bholley
authorJean-Yves Avenard <jyavenard@mozilla.com>
Wed, 25 Feb 2015 20:35:44 +1100
changeset 230832 da8e7a594541258f4c57f063044d2b717c8862c0
parent 230831 49f1f94b73af6943a55233e57cbff35b41185c7a
child 230833 da80a09d5b4eab8d915e4b4e211d3788b33834fe
push id28337
push usercbook@mozilla.com
push dateThu, 26 Feb 2015 10:57:44 +0000
treeherdermozilla-central@599b84826bf3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscajbir, bholley
bugs1096089
milestone39.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 1096089: Make end argument an unrestricted double as per spec. r=cajbir r=bholley Also, test for updating value before testing for duration and start, as per spec: http://w3c.github.io/media-source/#widl-SourceBuffer-remove-void-double-start-unrestricted-double-end
dom/media/mediasource/SourceBuffer.cpp
dom/webidl/SourceBuffer.webidl
testing/web-platform/meta/media-source/mediasource-remove.html.ini
--- a/dom/media/mediasource/SourceBuffer.cpp
+++ b/dom/media/mediasource/SourceBuffer.cpp
@@ -247,26 +247,26 @@ void
 SourceBuffer::Remove(double aStart, double aEnd, ErrorResult& aRv)
 {
   MOZ_ASSERT(NS_IsMainThread());
   MSE_API("Remove(aStart=%f, aEnd=%f)", aStart, aEnd);
   if (!IsAttached()) {
     aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
     return;
   }
+  if (mUpdating) {
+    aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
+    return;
+  }
   if (IsNaN(mMediaSource->Duration()) ||
       aStart < 0 || aStart > mMediaSource->Duration() ||
       aEnd <= aStart || IsNaN(aEnd)) {
     aRv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR);
     return;
   }
-  if (mUpdating) {
-    aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
-    return;
-  }
   if (mMediaSource->ReadyState() == MediaSourceReadyState::Ended) {
     mMediaSource->SetReadyState(MediaSourceReadyState::Open);
   }
 
   StartUpdating();
   nsRefPtr<nsIRunnable> task = new RangeRemovalRunnable(this, aStart, aEnd);
   NS_DispatchToMainThread(task);
 }
--- a/dom/webidl/SourceBuffer.webidl
+++ b/dom/webidl/SourceBuffer.webidl
@@ -35,10 +35,10 @@ interface SourceBuffer : EventTarget {
   void appendBuffer(ArrayBuffer data);
   [Throws]
   void appendBuffer(ArrayBufferView data);
   //[Throws]
   //void appendStream(Stream stream, [EnforceRange] optional unsigned long long maxSize);
   [Throws]
   void abort();
   [Throws]
-  void remove(double start, double end);
+  void remove(double start, unrestricted double end);
 };
--- a/testing/web-platform/meta/media-source/mediasource-remove.html.ini
+++ b/testing/web-platform/meta/media-source/mediasource-remove.html.ini
@@ -7,19 +7,13 @@
     expected: FAIL
 
   [Test removing the middle of appended data.]
     expected: FAIL
 
   [Test removing the end of appended data.]
     expected: FAIL
 
-  [Test remove with a NEGATIVE_INFINITY end.]
-    expected: FAIL
-
-  [Test remove with a NaN end.]
-    expected: FAIL
-
   [Test remove with a start at the duration.]
     expected:
       if (os == "win") and (version != "5.1.2600"): FAIL
       if os == "mac": FAIL