Bug 1609858. Stop using NS_ERROR_DOM_TYPE_ERR in TimingParams. r=smaug

It's causing us to throw weird DOMExceptions instead of actual TypeErrors.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Boris Zbarsky 2020-01-17 09:55:27 +00:00
Родитель b7040f1383
Коммит ceac9fe278
2 изменённых файлов: 8 добавлений и 7 удалений

Просмотреть файл

@ -48,7 +48,8 @@ TimingParams TimingParams::FromOptionsType(const OptionsType& aOptions,
result.mDuration.emplace(
StickyTimeDuration::FromMilliseconds(durationInMs));
} else {
aRv.Throw(NS_ERROR_DOM_TYPE_ERR);
nsPrintfCString error("Duration value %f is less than 0", durationInMs);
aRv.ThrowTypeError(NS_ConvertUTF8toUTF16(error));
return result;
}
result.Update();

Просмотреть файл

@ -41,7 +41,7 @@ test(t => {
test(t => {
for (const invalidEasing of gInvalidEasings) {
assert_throws(new TypeError, () => {
assert_throws_js(TypeError, () => {
new KeyframeEffect(target, null, { easing: invalidEasing });
}, `TypeError is thrown for easing '${invalidEasing}'`);
}
@ -57,7 +57,7 @@ test(t => {
`resulting composite for '${composite}'`);
}
for (const composite of gBadKeyframeCompositeValueTests) {
assert_throws(new TypeError, () => {
assert_throws_js(TypeError, () => {
new KeyframeEffect(target, getKeyframe(composite));
});
}
@ -76,7 +76,7 @@ test(t => {
`resulting composite for '${composite}'`);
}
for (const composite of gBadKeyframeCompositeValueTests) {
assert_throws(new TypeError, () => {
assert_throws_js(TypeError, () => {
new KeyframeEffect(target, getKeyframes(composite));
});
}
@ -92,7 +92,7 @@ test(t => {
`resulting composite for '${composite}'`);
}
for (const composite of gBadOptionsCompositeValueTests) {
assert_throws(new TypeError, () => {
assert_throws_js(TypeError, () => {
new KeyframeEffect(target, {
left: ['10px', '20px']
}, { composite: composite });
@ -117,7 +117,7 @@ for (const subtest of gKeyframesTests) {
for (const subtest of gInvalidKeyframesTests) {
test(t => {
assert_throws(new TypeError, () => {
assert_throws_js(TypeError, () => {
new KeyframeEffect(target, subtest.input);
});
}, `KeyframeEffect constructor throws with ${subtest.desc}`);
@ -169,7 +169,7 @@ for (const subtest of gKeyframeEffectOptionTests) {
for (const subtest of gInvalidKeyframeEffectOptionTests) {
test(t => {
assert_throws(new TypeError, () => {
assert_throws_js(TypeError, () => {
new KeyframeEffect(target, { left: ['10px', '20px'] }, subtest.input);
});
}, `Invalid KeyframeEffect option by ${subtest.desc}`);