Bug 1458673 - In start and stop methods of AudioBufferSourceNode change the throw error to align with the spec. r=dminor
authorAlex Chronopoulos <achronop@gmail.com>
Thu, 03 May 2018 11:40:34 +0200
changeset 472895 654e81aa75d11605e94e3e9f3a48fd9d48d9b7ac
parent 472894 abda1ead1561b2085c610bf5161081d36bfd1f44
child 472896 2d910b41bff477568a84ab3c65656cb744b2ae84
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdminor
bugs1458673
milestone61.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 1458673 - In start and stop methods of AudioBufferSourceNode change the throw error to align with the spec. r=dminor MozReview-Commit-ID: 7CwazXg1JWm
dom/media/webaudio/AudioBufferSourceNode.cpp
--- a/dom/media/webaudio/AudioBufferSourceNode.cpp
+++ b/dom/media/webaudio/AudioBufferSourceNode.cpp
@@ -697,19 +697,19 @@ AudioBufferSourceNode::WrapObject(JSCont
 {
   return AudioBufferSourceNodeBinding::Wrap(aCx, this, aGivenProto);
 }
 
 void
 AudioBufferSourceNode::Start(double aWhen, double aOffset,
                              const Optional<double>& aDuration, ErrorResult& aRv)
 {
-  if (!WebAudioUtils::IsTimeValid(aWhen) ||
+  if (!WebAudioUtils::IsTimeValid(aWhen) || aOffset < 0 ||
       (aDuration.WasPassed() && !WebAudioUtils::IsTimeValid(aDuration.Value()))) {
-    aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
+    aRv.Throw(NS_ERROR_RANGE_ERR);
     return;
   }
 
   if (mStartCalled) {
     aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
     return;
   }
   mStartCalled = true;
@@ -800,17 +800,17 @@ AudioBufferSourceNode::SendOffsetAndDura
 
   MarkActive();
 }
 
 void
 AudioBufferSourceNode::Stop(double aWhen, ErrorResult& aRv)
 {
   if (!WebAudioUtils::IsTimeValid(aWhen)) {
-    aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
+    aRv.Throw(NS_ERROR_RANGE_ERR);
     return;
   }
 
   if (!mStartCalled) {
     aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
     return;
   }