[webkit-reviews] review granted: [Bug 206019] Setting currentScale to non-finite values should throw TypeError : [Attachment 387258] Patch
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Sat Jan 11 12:50:51 PST 2020
Dean Jackson <dino at apple.com> has granted Sunny He <sunny_he at apple.com>'s
request for review:
Bug 206019: Setting currentScale to non-finite values should throw TypeError
https://bugs.webkit.org/show_bug.cgi?id=206019
Attachment 387258: Patch
https://bugs.webkit.org/attachment.cgi?id=387258&action=review
--- Comment #5 from Dean Jackson <dino at apple.com> ---
Comment on attachment 387258
--> https://bugs.webkit.org/attachment.cgi?id=387258
Patch
View in context: https://bugs.webkit.org/attachment.cgi?id=387258&action=review
> LayoutTests/svg/dom/set-currentScale-nonfinite.html:24
> + try {
> + svgvar.currentScale = undefined;
> + testFailed('set currentScale to undefined without error');
> + } catch(e) {
> + if (e instanceof TypeError)
> + testPassed('set currentScale to undefined throws TypeError');
> + }
> + shouldBe('svgvar.currentScale', '1.0');
This is fine, but maybe you could have avoided the duplication:
const testIncorrectScaleValue = (value, description) => {
try {
svgvar.currentScale = value;
testFailed(`Setting currentScale to ${description} should have thrown an
exception.`);
} catch (e) {
if (e instanceof TypeError)
testPassed(`Setting currentScale to ${description} threw an
exception.`);
}
shouldBe('svgvar.currentScale', '1.0');
};
testIncorrectScaleValue(undefined, "undefined");
testIncorrectScaleValue(NaN, "NaN");
testIncorrectScaleValue(Infinity, "Infinity");
testIncorrectScaleValue("a", "a string");
More information about the webkit-reviews
mailing list