haikuwebkit/LayoutTests/svg/dom/valueAsString-null-expected...

25 lines
932 B
Plaintext
Raw Permalink Normal View History

Fix null handling of SVGAngle/SVGLength.valueAsString attribute https://bugs.webkit.org/show_bug.cgi?id=160025 Reviewed by Ryosuke Niwa. Source/WebCore: Fix null handling of SVGAngle/SVGLength.valueAsString attribute to match the specification: - https://www.w3.org/TR/SVG2/types.html#InterfaceSVGAngle - https://www.w3.org/TR/SVG2/types.html#InterfaceSVGLength In particular, this patch drops [TreatNullAs=EmptyString] IDL extended attribute from this attribute. This is not supposed to change behavior given that both "" and "null" are invalid numbers and the specification says to throw a SYNTAX_ERR in this case. However, WebKit currently ignores assignments to "" instead of throwing. As a result, assigning to null will now throw instead of being ignored. The compatibility risk should be low because both Firefox and Chrome throw when assigning null. I did not change the behavior when assigning to "" because it is a bit out of scope for this patch and browsers to not seem to agree: - Firefox throws - Chrome set value to "0" - WebKit ignores the assignment The specification seems to agree with Firefox as far as I can tell given that "" is not a valid number as per: - https://www.w3.org/TR/css3-values/#numbers Test: svg/dom/valueAsString-null.html * svg/SVGAngle.idl: * svg/SVGLength.idl: LayoutTests: Add test coverage. * svg/dom/svg-element-attribute-js-null-expected.txt: * svg/dom/svg-element-attribute-js-null.xhtml: * svg/dom/valueAsString-null-expected.txt: Added. * svg/dom/valueAsString-null.html: Added. There are a couple of failures in this test because WebKit ignores assignments to "" instead of throwing. Firefox passes all the checks. Canonical link: https://commits.webkit.org/178206@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@203531 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-07-21 21:31:16 +00:00
Test assigning null to SVGAngle.valueAsString / SVGLength.valueAsString
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS angle.valueAsString is "0"
PASS angle.valueAsString = null threw exception SyntaxError: The string did not match the expected pattern..
Fix null handling of SVGAngle/SVGLength.valueAsString attribute https://bugs.webkit.org/show_bug.cgi?id=160025 Reviewed by Ryosuke Niwa. Source/WebCore: Fix null handling of SVGAngle/SVGLength.valueAsString attribute to match the specification: - https://www.w3.org/TR/SVG2/types.html#InterfaceSVGAngle - https://www.w3.org/TR/SVG2/types.html#InterfaceSVGLength In particular, this patch drops [TreatNullAs=EmptyString] IDL extended attribute from this attribute. This is not supposed to change behavior given that both "" and "null" are invalid numbers and the specification says to throw a SYNTAX_ERR in this case. However, WebKit currently ignores assignments to "" instead of throwing. As a result, assigning to null will now throw instead of being ignored. The compatibility risk should be low because both Firefox and Chrome throw when assigning null. I did not change the behavior when assigning to "" because it is a bit out of scope for this patch and browsers to not seem to agree: - Firefox throws - Chrome set value to "0" - WebKit ignores the assignment The specification seems to agree with Firefox as far as I can tell given that "" is not a valid number as per: - https://www.w3.org/TR/css3-values/#numbers Test: svg/dom/valueAsString-null.html * svg/SVGAngle.idl: * svg/SVGLength.idl: LayoutTests: Add test coverage. * svg/dom/svg-element-attribute-js-null-expected.txt: * svg/dom/svg-element-attribute-js-null.xhtml: * svg/dom/valueAsString-null-expected.txt: Added. * svg/dom/valueAsString-null.html: Added. There are a couple of failures in this test because WebKit ignores assignments to "" instead of throwing. Firefox passes all the checks. Canonical link: https://commits.webkit.org/178206@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@203531 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-07-21 21:31:16 +00:00
PASS angle.valueAsString is "0"
PASS angle.valueAsString = '10' did not throw exception.
PASS angle.valueAsString is "10"
FAIL angle.valueAsString = '' should throw an exception. Was .
PASS angle.valueAsString is "10"
PASS length.valueAsString is "0"
PASS length.valueAsString = null threw exception SyntaxError: The string did not match the expected pattern..
Fix null handling of SVGAngle/SVGLength.valueAsString attribute https://bugs.webkit.org/show_bug.cgi?id=160025 Reviewed by Ryosuke Niwa. Source/WebCore: Fix null handling of SVGAngle/SVGLength.valueAsString attribute to match the specification: - https://www.w3.org/TR/SVG2/types.html#InterfaceSVGAngle - https://www.w3.org/TR/SVG2/types.html#InterfaceSVGLength In particular, this patch drops [TreatNullAs=EmptyString] IDL extended attribute from this attribute. This is not supposed to change behavior given that both "" and "null" are invalid numbers and the specification says to throw a SYNTAX_ERR in this case. However, WebKit currently ignores assignments to "" instead of throwing. As a result, assigning to null will now throw instead of being ignored. The compatibility risk should be low because both Firefox and Chrome throw when assigning null. I did not change the behavior when assigning to "" because it is a bit out of scope for this patch and browsers to not seem to agree: - Firefox throws - Chrome set value to "0" - WebKit ignores the assignment The specification seems to agree with Firefox as far as I can tell given that "" is not a valid number as per: - https://www.w3.org/TR/css3-values/#numbers Test: svg/dom/valueAsString-null.html * svg/SVGAngle.idl: * svg/SVGLength.idl: LayoutTests: Add test coverage. * svg/dom/svg-element-attribute-js-null-expected.txt: * svg/dom/svg-element-attribute-js-null.xhtml: * svg/dom/valueAsString-null-expected.txt: Added. * svg/dom/valueAsString-null.html: Added. There are a couple of failures in this test because WebKit ignores assignments to "" instead of throwing. Firefox passes all the checks. Canonical link: https://commits.webkit.org/178206@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@203531 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-07-21 21:31:16 +00:00
PASS length.valueAsString is "0"
PASS length.valueAsString = '10' did not throw exception.
PASS length.valueAsString is "10"
FAIL length.valueAsString = '' should throw an exception. Was .
PASS length.valueAsString is "10"
PASS successfullyParsed is true
TEST COMPLETE