Drop non-standard [IsIndex] WebKit IDL extended attribute
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Sep 2015 01:48:38 +0000 (01:48 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Sep 2015 01:48:38 +0000 (01:48 +0000)
commitae0943c0f0c463796e2b244760ade936583a927e
treef42f281762c294769a75f38a427d51c7e7e0d4c0
parent0ec5529564f454bdbe5cb7f0b843bf19150f3228
Drop non-standard [IsIndex] WebKit IDL extended attribute
https://bugs.webkit.org/show_bug.cgi?id=149122
<rdar://problem/22547139>

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Rebaseline several W3C DOM tests now that more checks are passing.

* web-platform-tests/dom/nodes/CharacterData-deleteData-expected.txt:
* web-platform-tests/dom/nodes/CharacterData-replaceData-expected.txt:
* web-platform-tests/dom/nodes/CharacterData-substringData-expected.txt:

Source/WebCore:

Drop non-standard [IsIndex] WebKit IDL extended attribute. This attribute
causes us to throw an IndexSizeError if the input value is negative. Web
IDL supports no such thing. Instead Web IDL supports:
1. Default behavior: the input value wraps around if it does not fit.
2. [EnforceRange]: A TypeError is thrown if the input value does not fit [1].
3. [Clamp]: The input value will be clamped if it does not fit [2].

Our bindings generator supports all three. We don't need the non-standard
[IsIndex].

We previously used [IsIndex] in places where we're supposed to wrap around
as per Web IDL. Therefore, we threw for negative values but other browsers
don't. For e.g., CharacterData.substringData(offset, -1) is supposed to
return the substring from offset to the end of the string. It does so in
Firefox and Chrome. However, WebKit was throwing an Exception.

This change impacts the CharacterData and the SVGTextContentElement
API. The compatibility risk is low because we were throwing an exception
for negative values and we now wrap the value around instead, as other
browsers do.

No new tests, already covered by existing tests.

[1] https://heycam.github.io/webidl/#EnforceRange
[2] https://heycam.github.io/webidl/#Clamp

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateParametersCheck): Deleted.
* bindings/scripts/IDLAttributes.txt:
* bindings/scripts/test/JS/JSTestEventTarget.cpp:
(WebCore::jsTestEventTargetPrototypeFunctionItem):
* bindings/scripts/test/TestEventTarget.idl:
* dom/CharacterData.cpp:
(WebCore::CharacterData::deleteData):
(WebCore::CharacterData::replaceData):
* dom/CharacterData.idl:
* dom/ClientRectList.idl:
* svg/SVGTextContentElement.cpp:
(WebCore::SVGTextContentElement::getSubStringLength):
(WebCore::SVGTextContentElement::selectSubString):
* svg/SVGTextContentElement.idl:

LayoutTests:

* dom/html/level1/core/hc_characterdataindexsizeerrdeletedatacountnegative-expected.txt:
* dom/html/level1/core/hc_characterdataindexsizeerrreplacedatacountnegative-expected.txt:
* dom/html/level1/core/hc_characterdataindexsizeerrsubstringcountnegative-expected.txt:
* dom/xhtml/level1/core/hc_characterdataindexsizeerrdeletedatacountnegative-expected.txt:
* dom/xhtml/level1/core/hc_characterdataindexsizeerrreplacedatacountnegative-expected.txt:
* dom/xhtml/level1/core/hc_characterdataindexsizeerrsubstringcountnegative-expected.txt:
Rebaseline outdated DOM tests that are now failing.

* svg/custom/getSubStringLength-expected.txt:
* svg/custom/script-tests/getSubStringLength.js:
* svg/custom/script-tests/selectSubString.js:
* svg/custom/selectSubString-expected.txt:
Update existing SVG tests that were expecting an exception if the nchars
parameter in the SVGTextContentElement API is negative. I have verified
that Chrome and Firefox do not throw for these either.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@189770 268f45cc-cd09-0410-ab3c-d52691b4dbfc
25 files changed:
LayoutTests/ChangeLog
LayoutTests/dom/html/level1/core/hc_characterdataindexsizeerrdeletedatacountnegative-expected.txt
LayoutTests/dom/html/level1/core/hc_characterdataindexsizeerrreplacedatacountnegative-expected.txt
LayoutTests/dom/html/level1/core/hc_characterdataindexsizeerrsubstringcountnegative-expected.txt
LayoutTests/dom/xhtml/level1/core/hc_characterdataindexsizeerrdeletedatacountnegative-expected.txt
LayoutTests/dom/xhtml/level1/core/hc_characterdataindexsizeerrreplacedatacountnegative-expected.txt
LayoutTests/dom/xhtml/level1/core/hc_characterdataindexsizeerrsubstringcountnegative-expected.txt
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/dom/nodes/CharacterData-deleteData-expected.txt
LayoutTests/imported/w3c/web-platform-tests/dom/nodes/CharacterData-replaceData-expected.txt
LayoutTests/imported/w3c/web-platform-tests/dom/nodes/CharacterData-substringData-expected.txt
LayoutTests/svg/custom/getSubStringLength-expected.txt
LayoutTests/svg/custom/script-tests/getSubStringLength.js
LayoutTests/svg/custom/script-tests/selectSubString.js
LayoutTests/svg/custom/selectSubString-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bindings/scripts/IDLAttributes.txt
Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp
Source/WebCore/bindings/scripts/test/TestEventTarget.idl
Source/WebCore/dom/CharacterData.cpp
Source/WebCore/dom/CharacterData.idl
Source/WebCore/dom/ClientRectList.idl
Source/WebCore/svg/SVGTextContentElement.cpp
Source/WebCore/svg/SVGTextContentElement.idl