[Webkit-unassigned] [Bug 206019] Setting currentScale to non-finite values should throw TypeError

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Jan 11 12:50:51 PST 2020


https://bugs.webkit.org/show_bug.cgi?id=206019

Dean Jackson <dino at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #387258|review?                     |review+
              Flags|                            |

--- 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");

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20200111/f780b6bc/attachment.htm>


More information about the webkit-unassigned mailing list