Bug 1096089 - Make end argument an unrestricted double as per spec. r=cajbir, r=bholley, a=lsblakk
authorJean-Yves Avenard <jyavenard@mozilla.com>
Wed, 25 Feb 2015 20:35:44 +1100
changeset 247808 6e54bae0865380b5ff464cc000d79d0b016d972b
parent 247807 49c8f23aad9b52c75ba1812d4723a3d5d5d4faa1
child 247809 884b4f4c4d6798c39ea19727218956c53aa39c54
push id7687
push userryanvm@gmail.com
push dateFri, 27 Feb 2015 20:50:15 +0000
treeherdermozilla-aurora@8eb183538181 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscajbir, bholley, lsblakk
bugs1096089
milestone38.0a2
Bug 1096089 - Make end argument an unrestricted double as per spec. r=cajbir, r=bholley, a=lsblakk 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