Bug 1609861 part 4. Stop using NS_ERROR_DOM_TYPE_ERR in appendWindowStart/End setters. r=jya

Differential Revision: https://phabricator.services.mozilla.com/D60222

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Boris Zbarsky 2020-01-17 11:39:30 +00:00
parent 85ffb59181
commit 5740554e85
2 changed files with 14 additions and 14 deletions

View File

@ -143,7 +143,7 @@ void SourceBuffer::SetAppendWindowStart(double aAppendWindowStart,
}
if (aAppendWindowStart < 0 ||
aAppendWindowStart >= mCurrentAttributes.GetAppendWindowEnd()) {
aRv.Throw(NS_ERROR_DOM_TYPE_ERR);
aRv.ThrowTypeError(u"Invalid appendWindowStart value");
return;
}
mCurrentAttributes.SetAppendWindowStart(aAppendWindowStart);
@ -160,7 +160,7 @@ void SourceBuffer::SetAppendWindowEnd(double aAppendWindowEnd,
}
if (IsNaN(aAppendWindowEnd) ||
aAppendWindowEnd <= mCurrentAttributes.GetAppendWindowStart()) {
aRv.Throw(NS_ERROR_DOM_TYPE_ERR);
aRv.ThrowTypeError(u"Invalid appendWindowEnd value");
return;
}
mCurrentAttributes.SetAppendWindowEnd(aAppendWindowEnd);

View File

@ -33,51 +33,51 @@
assert_true(sourceBuffer != null, "New SourceBuffer returned");
sourceBuffer.appendWindowEnd = 500.0;
assert_throws(new TypeError(),
assert_throws_js(TypeError,
function() { sourceBuffer.appendWindowStart = Number.NEGATIVE_INFINITY; },
"set appendWindowStart throws an exception for Number.NEGATIVE_INFINITY.");
assert_throws(new TypeError(),
assert_throws_js(TypeError,
function() { sourceBuffer.appendWindowStart = Number.POSITIVE_INFINITY; },
"set appendWindowStart throws an exception for Number.POSITIVE_INFINITY.");
assert_throws(new TypeError(),
assert_throws_js(TypeError,
function() { sourceBuffer.appendWindowStart = Number.NaN; },
"set appendWindowStart throws an exception for Number.NaN.");
assert_throws(new TypeError(),
assert_throws_js(TypeError,
function() { sourceBuffer.appendWindowStart = 600.0; },
"set appendWindowStart throws an exception when greater than appendWindowEnd.");
assert_throws(new TypeError(),
assert_throws_js(TypeError,
function() { sourceBuffer.appendWindowStart = sourceBuffer.appendWindowEnd; },
"set appendWindowStart throws an exception when equal to appendWindowEnd.");
assert_throws(new TypeError(),
assert_throws_js(TypeError,
function() { sourceBuffer.appendWindowEnd = sourceBuffer.appendWindowStart; },
"set appendWindowEnd throws an exception when equal to appendWindowStart.");
assert_throws(new TypeError(),
assert_throws_js(TypeError,
function() { sourceBuffer.appendWindowEnd = sourceBuffer.appendWindowStart - 1; },
"set appendWindowEnd throws an exception if less than appendWindowStart.");
assert_throws(new TypeError(),
assert_throws_js(TypeError,
function() { sourceBuffer.appendWindowStart = -100.0; },
"set appendWindowStart throws an exception when less than 0.");
assert_throws(new TypeError(),
assert_throws_js(TypeError,
function() { sourceBuffer.appendWindowEnd = -100.0; },
"set appendWindowEnd throws an exception when less than 0.");
assert_throws(new TypeError(),
assert_throws_js(TypeError,
function() { sourceBuffer.appendWindowEnd = Number.NaN; },
"set appendWindowEnd throws an exception if NaN.");
assert_throws(new TypeError(),
assert_throws_js(TypeError,
function() { sourceBuffer.appendWindowEnd = undefined; },
"set appendWindowEnd throws an exception if undefined.");
assert_throws({name: "TypeError"},
assert_throws_js(TypeError,
function() { sourceBuffer.appendWindowStart = undefined; },
"set appendWindowStart throws an exception if undefined.");