Title: [203788] trunk
Revision
203788
Author
[email protected]
Date
2016-07-27 13:51:41 -0700 (Wed, 27 Jul 2016)

Log Message

First parameter to indexed property getters should be mandatory
https://bugs.webkit.org/show_bug.cgi?id=160259

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

Rebaseline W3C test now that more checks are passing.

* web-platform-tests/html/dom/interfaces-expected.txt:

Source/WebCore:

First parameter to indexed property getters should be mandatory:
- https://heycam.github.io/webidl/#idl-indexed-properties

No new tests, rebaselined existing tests.

* Modules/gamepad/deprecated/GamepadList.idl:
* bindings/js/JSHTMLAllCollectionCustom.cpp:
(WebCore::JSHTMLAllCollection::item):
* css/CSSRuleList.idl:
* css/CSSValueList.idl:
* css/StyleSheetList.idl:
* css/WebKitCSSFilterValue.idl:
* css/WebKitCSSTransformValue.idl:
* dom/ClientRectList.idl:
* dom/DOMStringList.idl:
* dom/DataTransferItemList.idl:
* html/HTMLAllCollection.idl:
* plugins/DOMMimeTypeArray.idl:
* plugins/DOMPlugin.idl:
* plugins/DOMPluginArray.idl:

LayoutTests:

Update existing tests to reflect behavior change.

* fast/css/webkit-keyframes-crash.html:
* fast/dom/non-numeric-values-numeric-parameters-expected.txt:
* fast/dom/script-tests/non-numeric-values-numeric-parameters.js:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (203787 => 203788)


--- trunk/LayoutTests/ChangeLog	2016-07-27 20:05:43 UTC (rev 203787)
+++ trunk/LayoutTests/ChangeLog	2016-07-27 20:51:41 UTC (rev 203788)
@@ -1,3 +1,16 @@
+2016-07-27  Chris Dumez  <[email protected]>
+
+        First parameter to indexed property getters should be mandatory
+        https://bugs.webkit.org/show_bug.cgi?id=160259
+
+        Reviewed by Ryosuke Niwa.
+
+        Update existing tests to reflect behavior change.
+
+        * fast/css/webkit-keyframes-crash.html:
+        * fast/dom/non-numeric-values-numeric-parameters-expected.txt:
+        * fast/dom/script-tests/non-numeric-values-numeric-parameters.js:
+
 2016-07-27  Ryan Haddad  <[email protected]>
 
         Land test expectations for rdar://problem/27574303.

Modified: trunk/LayoutTests/fast/css/webkit-keyframes-crash.html (203787 => 203788)


--- trunk/LayoutTests/fast/css/webkit-keyframes-crash.html	2016-07-27 20:05:43 UTC (rev 203787)
+++ trunk/LayoutTests/fast/css/webkit-keyframes-crash.html	2016-07-27 20:51:41 UTC (rev 203788)
@@ -9,7 +9,7 @@
 
         function main(){
             var e = window.document.styleSheets[0].cssRules[0];
-            e.cssRules.item().parentStyleSheet.removeRule();
+            e.cssRules.item(0).parentStyleSheet.removeRule();
             e.name = 'bar';
             document.getElementById('console').innerHTML = "PASSED";
         }

Modified: trunk/LayoutTests/fast/dom/non-numeric-values-numeric-parameters-expected.txt (203787 => 203788)


--- trunk/LayoutTests/fast/dom/non-numeric-values-numeric-parameters-expected.txt	2016-07-27 20:05:43 UTC (rev 203787)
+++ trunk/LayoutTests/fast/dom/non-numeric-values-numeric-parameters-expected.txt	2016-07-27 20:51:41 UTC (rev 203788)
@@ -13,13 +13,13 @@
 PASS nonNumericPolicy('document.createTextNode("a").replaceData(0, x, "b")') is 'any type allowed'
 PASS nonNumericPolicy('createCSSMediaRule().insertRule(ruleText, x)') is 'any type allowed'
 PASS nonNumericPolicy('createCSSMediaRule().deleteRule(x)') is 'any type allowed'
-PASS nonNumericPolicy('createCSSRuleList().item(x)') is 'any type allowed'
+PASS nonNumericPolicy('createCSSRuleList().item(x)') is 'any type allowed (but not omitted)'
 PASS nonNumericPolicy('createCSSStyleDeclaration().item(x)') is 'any type allowed (but not omitted)'
 PASS nonNumericPolicy('createCSSStyleSheet().insertRule(ruleText, x)') is 'any type allowed'
 PASS nonNumericPolicy('createCSSStyleSheet().deleteRule(x)') is 'any type allowed (but not omitted)'
 PASS nonNumericPolicy('createCSSStyleSheet().addRule(selector, styleText, x)') is 'any type allowed'
 PASS nonNumericPolicy('createCSSStyleSheet().removeRule(x)') is 'any type allowed'
-PASS nonNumericPolicy('createCSSValueList().item(x)') is 'any type allowed'
+PASS nonNumericPolicy('createCSSValueList().item(x)') is 'any type allowed (but not omitted)'
 PASS nonNumericPolicy('document.elementFromPoint(x, 0)') is 'any type allowed'
 PASS nonNumericPolicy('document.elementFromPoint(0, x)') is 'any type allowed'
 PASS nonNumericPolicy('document.body.scrollByLines(x)') is 'any type allowed'
@@ -62,7 +62,7 @@
 PASS nonNumericPolicy('getSelection().setPosition(document, x)') is 'any type allowed'
 PASS nonNumericPolicy('getSelection().extend(document, x)') is 'any type allowed'
 PASS nonNumericPolicy('getSelection().getRangeAt(x)') is 'any type allowed'
-PASS nonNumericPolicy('document.styleSheets.item(x)') is 'any type allowed'
+PASS nonNumericPolicy('document.styleSheets.item(x)') is 'any type allowed (but not omitted)'
 PASS nonNumericPolicy('document.createTextNode("a").splitText(x)') is 'any type allowed (but not omitted)'
 PASS nonNumericPolicy('document.createTreeWalker(document, x, null, false)') is 'any type allowed'
 PASS nonNumericPolicy('document.createEvent("UIEvent").initUIEvent("a", false, false, null, x)') is 'any type allowed'

Modified: trunk/LayoutTests/fast/dom/script-tests/non-numeric-values-numeric-parameters.js (203787 => 203788)


--- trunk/LayoutTests/fast/dom/script-tests/non-numeric-values-numeric-parameters.js	2016-07-27 20:05:43 UTC (rev 203787)
+++ trunk/LayoutTests/fast/dom/script-tests/non-numeric-values-numeric-parameters.js	2016-07-27 20:51:41 UTC (rev 203788)
@@ -200,7 +200,7 @@
 
 // CSSRuleList
 
-shouldBe("nonNumericPolicy('createCSSRuleList().item(x)')", "'any type allowed'");
+shouldBe("nonNumericPolicy('createCSSRuleList().item(x)')", "'any type allowed (but not omitted)'");
 
 // CSSStyleDeclaration
 
@@ -215,7 +215,7 @@
 
 // CSSValueList
 
-shouldBe("nonNumericPolicy('createCSSValueList().item(x)')", "'any type allowed'");
+shouldBe("nonNumericPolicy('createCSSValueList().item(x)')", "'any type allowed (but not omitted)'");
 
 // Document
 
@@ -323,7 +323,7 @@
 
 // StyleSheetList
 
-shouldBe("nonNumericPolicy('document.styleSheets.item(x)')", "'any type allowed'");
+shouldBe("nonNumericPolicy('document.styleSheets.item(x)')", "'any type allowed (but not omitted)'");
 
 // Text
 

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (203787 => 203788)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2016-07-27 20:05:43 UTC (rev 203787)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2016-07-27 20:51:41 UTC (rev 203788)
@@ -1,5 +1,16 @@
 2016-07-27  Chris Dumez  <[email protected]>
 
+        First parameter to indexed property getters should be mandatory
+        https://bugs.webkit.org/show_bug.cgi?id=160259
+
+        Reviewed by Ryosuke Niwa.
+
+        Rebaseline W3C test now that more checks are passing.
+
+        * web-platform-tests/html/dom/interfaces-expected.txt:
+
+2016-07-27  Chris Dumez  <[email protected]>
+
         First parameter to Document.execCommand() / queryCommand*() should be mandatory
         https://bugs.webkit.org/show_bug.cgi?id=160258
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt (203787 => 203788)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt	2016-07-27 20:05:43 UTC (rev 203787)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt	2016-07-27 20:51:41 UTC (rev 203788)
@@ -888,8 +888,8 @@
 PASS HTMLAllCollection interface: existence and properties of interface prototype object 
 PASS HTMLAllCollection interface: existence and properties of interface prototype object's "constructor" property 
 PASS HTMLAllCollection interface: attribute length 
-FAIL HTMLAllCollection interface: operation item(unsigned long) assert_equals: property has wrong .length expected 1 but got 0
-FAIL HTMLAllCollection interface: operation item(DOMString) assert_equals: property has wrong .length expected 1 but got 0
+PASS HTMLAllCollection interface: operation item(unsigned long) 
+PASS HTMLAllCollection interface: operation item(DOMString) 
 PASS HTMLAllCollection interface: operation namedItem(DOMString) 
 FAIL HTMLAllCollection must be primary interface of document.all assert_equals: wrong typeof object expected "function" but got "undefined"
 FAIL Stringification of document.all assert_equals: wrong typeof object expected "function" but got "undefined"
@@ -5716,7 +5716,7 @@
 PASS PluginArray interface: existence and properties of interface prototype object's "constructor" property 
 PASS PluginArray interface: operation refresh(boolean) 
 PASS PluginArray interface: attribute length 
-FAIL PluginArray interface: operation item(unsigned long) assert_equals: property has wrong .length expected 1 but got 0
+PASS PluginArray interface: operation item(unsigned long) 
 FAIL PluginArray interface: operation namedItem(DOMString) assert_equals: property has wrong .length expected 1 but got 0
 PASS MimeTypeArray interface: existence and properties of interface object 
 PASS MimeTypeArray interface object length 
@@ -5724,7 +5724,7 @@
 PASS MimeTypeArray interface: existence and properties of interface prototype object 
 PASS MimeTypeArray interface: existence and properties of interface prototype object's "constructor" property 
 PASS MimeTypeArray interface: attribute length 
-FAIL MimeTypeArray interface: operation item(unsigned long) assert_equals: property has wrong .length expected 1 but got 0
+PASS MimeTypeArray interface: operation item(unsigned long) 
 FAIL MimeTypeArray interface: operation namedItem(DOMString) assert_equals: property has wrong .length expected 1 but got 0
 PASS Plugin interface: existence and properties of interface object 
 PASS Plugin interface object length 
@@ -5735,7 +5735,7 @@
 PASS Plugin interface: attribute description 
 PASS Plugin interface: attribute filename 
 PASS Plugin interface: attribute length 
-FAIL Plugin interface: operation item(unsigned long) assert_equals: property has wrong .length expected 1 but got 0
+PASS Plugin interface: operation item(unsigned long) 
 FAIL Plugin interface: operation namedItem(DOMString) assert_equals: property has wrong .length expected 1 but got 0
 PASS MimeType interface: existence and properties of interface object 
 PASS MimeType interface object length 

Modified: trunk/Source/WebCore/ChangeLog (203787 => 203788)


--- trunk/Source/WebCore/ChangeLog	2016-07-27 20:05:43 UTC (rev 203787)
+++ trunk/Source/WebCore/ChangeLog	2016-07-27 20:51:41 UTC (rev 203788)
@@ -1,3 +1,31 @@
+2016-07-27  Chris Dumez  <[email protected]>
+
+        First parameter to indexed property getters should be mandatory
+        https://bugs.webkit.org/show_bug.cgi?id=160259
+
+        Reviewed by Ryosuke Niwa.
+
+        First parameter to indexed property getters should be mandatory:
+        - https://heycam.github.io/webidl/#idl-indexed-properties
+
+        No new tests, rebaselined existing tests.
+
+        * Modules/gamepad/deprecated/GamepadList.idl:
+        * bindings/js/JSHTMLAllCollectionCustom.cpp:
+        (WebCore::JSHTMLAllCollection::item):
+        * css/CSSRuleList.idl:
+        * css/CSSValueList.idl:
+        * css/StyleSheetList.idl:
+        * css/WebKitCSSFilterValue.idl:
+        * css/WebKitCSSTransformValue.idl:
+        * dom/ClientRectList.idl:
+        * dom/DOMStringList.idl:
+        * dom/DataTransferItemList.idl:
+        * html/HTMLAllCollection.idl:
+        * plugins/DOMMimeTypeArray.idl:
+        * plugins/DOMPlugin.idl:
+        * plugins/DOMPluginArray.idl:
+
 2016-07-27  Javier Fernandez  <[email protected]>
 
         [css-grid] The isValidTransition function must not alter the GridSizingData object

Modified: trunk/Source/WebCore/Modules/gamepad/deprecated/GamepadList.idl (203787 => 203788)


--- trunk/Source/WebCore/Modules/gamepad/deprecated/GamepadList.idl	2016-07-27 20:05:43 UTC (rev 203787)
+++ trunk/Source/WebCore/Modules/gamepad/deprecated/GamepadList.idl	2016-07-27 20:51:41 UTC (rev 203788)
@@ -29,6 +29,6 @@
     ImplementationLacksVTable,
 ] interface GamepadList {
     readonly attribute unsigned long length;
-    getter Gamepad item(optional unsigned long index = 0);
+    getter Gamepad item(unsigned long index);
 };
 

Modified: trunk/Source/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp (203787 => 203788)


--- trunk/Source/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp	2016-07-27 20:05:43 UTC (rev 203787)
+++ trunk/Source/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp	2016-07-27 20:51:41 UTC (rev 203788)
@@ -104,9 +104,13 @@
 
 JSValue JSHTMLAllCollection::item(ExecState& state)
 {
-    if (Optional<uint32_t> index = parseIndex(*state.argument(0).toString(&state)->value(&state).impl()))
+    if (UNLIKELY(state.argumentCount() < 1))
+        return state.vm().throwException(&state, createNotEnoughArgumentsError(&state));
+
+    String argument = state.uncheckedArgument(0).toWTFString(&state);
+    if (Optional<uint32_t> index = parseIndex(*argument.impl()))
         return toJS(&state, globalObject(), wrapped().item(index.value()));
-    return namedItems(state, this, Identifier::fromString(&state, state.argument(0).toString(&state)->value(&state)));
+    return namedItems(state, this, Identifier::fromString(&state, argument));
 }
 
 JSValue JSHTMLAllCollection::namedItem(ExecState& state)

Modified: trunk/Source/WebCore/css/CSSRuleList.idl (203787 => 203788)


--- trunk/Source/WebCore/css/CSSRuleList.idl	2016-07-27 20:05:43 UTC (rev 203787)
+++ trunk/Source/WebCore/css/CSSRuleList.idl	2016-07-27 20:51:41 UTC (rev 203788)
@@ -28,7 +28,7 @@
     CustomIsReachable,
     SkipVTableValidation,
 ] interface CSSRuleList {
-    readonly attribute unsigned long    length;
-    getter CSSRule item(optional unsigned long index = 0);
+    readonly attribute unsigned long length;
+    getter CSSRule item(unsigned long index);
 };
 

Modified: trunk/Source/WebCore/css/CSSValueList.idl (203787 => 203788)


--- trunk/Source/WebCore/css/CSSValueList.idl	2016-07-27 20:05:43 UTC (rev 203787)
+++ trunk/Source/WebCore/css/CSSValueList.idl	2016-07-27 20:51:41 UTC (rev 203788)
@@ -27,7 +27,7 @@
 [
     ImplementationLacksVTable,
 ] interface CSSValueList : CSSValue {
-    readonly attribute unsigned long    length;
-    getter CSSValue           item(optional unsigned long index = 0);
+    readonly attribute unsigned long length;
+    getter CSSValue item(unsigned long index);
 };
 

Modified: trunk/Source/WebCore/css/StyleSheetList.idl (203787 => 203788)


--- trunk/Source/WebCore/css/StyleSheetList.idl	2016-07-27 20:05:43 UTC (rev 203787)
+++ trunk/Source/WebCore/css/StyleSheetList.idl	2016-07-27 20:51:41 UTC (rev 203788)
@@ -23,8 +23,8 @@
     GenerateIsReachable=ImplDocument,
     ImplementationLacksVTable,
 ] interface StyleSheetList {
-    readonly attribute unsigned long    length;
-    getter StyleSheet item(optional unsigned long index = 0);
+    readonly attribute unsigned long length;
+    getter StyleSheet item(unsigned long index);
     getter CSSStyleSheet (DOMString name);
 };
 

Modified: trunk/Source/WebCore/css/WebKitCSSFilterValue.idl (203787 => 203788)


--- trunk/Source/WebCore/css/WebKitCSSFilterValue.idl	2016-07-27 20:05:43 UTC (rev 203787)
+++ trunk/Source/WebCore/css/WebKitCSSFilterValue.idl	2016-07-27 20:51:41 UTC (rev 203788)
@@ -44,5 +44,5 @@
 
     readonly attribute unsigned short operationType;
 
-    getter CSSValue (optional unsigned long index = 0);
+    getter CSSValue (unsigned long index);
 };

Modified: trunk/Source/WebCore/css/WebKitCSSTransformValue.idl (203787 => 203788)


--- trunk/Source/WebCore/css/WebKitCSSTransformValue.idl	2016-07-27 20:05:43 UTC (rev 203787)
+++ trunk/Source/WebCore/css/WebKitCSSTransformValue.idl	2016-07-27 20:51:41 UTC (rev 203788)
@@ -57,6 +57,6 @@
 
     readonly attribute unsigned short operationType;
 
-    getter CSSValue (optional unsigned long index = 0);
+    getter CSSValue (unsigned long index);
 };
 

Modified: trunk/Source/WebCore/dom/ClientRectList.idl (203787 => 203788)


--- trunk/Source/WebCore/dom/ClientRectList.idl	2016-07-27 20:05:43 UTC (rev 203787)
+++ trunk/Source/WebCore/dom/ClientRectList.idl	2016-07-27 20:51:41 UTC (rev 203788)
@@ -29,7 +29,7 @@
     ExportMacro=WEBCORE_EXPORT,
 ] interface ClientRectList {
     readonly attribute unsigned long length;
-    getter ClientRect item(optional unsigned long index = 0);
+    getter ClientRect item(unsigned long index);
     // FIXME: Fix list behavior to allow custom exceptions to be thrown.
 };
 

Modified: trunk/Source/WebCore/dom/DOMStringList.idl (203787 => 203788)


--- trunk/Source/WebCore/dom/DOMStringList.idl	2016-07-27 20:05:43 UTC (rev 203787)
+++ trunk/Source/WebCore/dom/DOMStringList.idl	2016-07-27 20:51:41 UTC (rev 203788)
@@ -28,7 +28,7 @@
     ImplementationLacksVTable,
 ] interface DOMStringList {
     readonly attribute unsigned long length;
-    getter DOMString? item(optional unsigned long index = 0);
+    getter DOMString? item(unsigned long index);
 
     // FIXME: Using "undefined" as default parameter value is wrong.
     boolean contains(optional DOMString string = "undefined");

Modified: trunk/Source/WebCore/dom/DataTransferItemList.idl (203787 => 203788)


--- trunk/Source/WebCore/dom/DataTransferItemList.idl	2016-07-27 20:05:43 UTC (rev 203787)
+++ trunk/Source/WebCore/dom/DataTransferItemList.idl	2016-07-27 20:51:41 UTC (rev 203788)
@@ -35,7 +35,7 @@
     ImplementationLacksVTable,
 ] interface DataTransferItemList {
     readonly attribute long length;
-    getter DataTransferItem item(optional unsigned long index = 0);
+    getter DataTransferItem item(unsigned long index);
 
     void clear();
     void add(File? file);

Modified: trunk/Source/WebCore/html/HTMLAllCollection.idl (203787 => 203788)


--- trunk/Source/WebCore/html/HTMLAllCollection.idl	2016-07-27 20:05:43 UTC (rev 203787)
+++ trunk/Source/WebCore/html/HTMLAllCollection.idl	2016-07-27 20:51:41 UTC (rev 203788)
@@ -29,7 +29,7 @@
     GenerateIsReachable=ImplOwnerNodeRoot,
 ] interface HTMLAllCollection {
     readonly attribute unsigned long length;
-    [Custom] getter Element item(optional unsigned long index);
+    [Custom] getter Element item(unsigned long index);
     [Custom] getter Element namedItem(DOMString name);
     // FIXME: This should return an HTMLAllCollection.
     NodeList tags(DOMString name);

Modified: trunk/Source/WebCore/plugins/DOMMimeTypeArray.idl (203787 => 203788)


--- trunk/Source/WebCore/plugins/DOMMimeTypeArray.idl	2016-07-27 20:05:43 UTC (rev 203787)
+++ trunk/Source/WebCore/plugins/DOMMimeTypeArray.idl	2016-07-27 20:51:41 UTC (rev 203788)
@@ -23,7 +23,7 @@
     InterfaceName=MimeTypeArray,
 ] interface DOMMimeTypeArray {
     readonly attribute unsigned long length;
-    getter DOMMimeType item(optional unsigned long index = 0);
+    getter DOMMimeType item(unsigned long index);
 
     // FIXME: Using "undefined" as default parameter value is wrong.
     getter DOMMimeType namedItem(optional DOMString name = "undefined");

Modified: trunk/Source/WebCore/plugins/DOMPlugin.idl (203787 => 203788)


--- trunk/Source/WebCore/plugins/DOMPlugin.idl	2016-07-27 20:05:43 UTC (rev 203787)
+++ trunk/Source/WebCore/plugins/DOMPlugin.idl	2016-07-27 20:51:41 UTC (rev 203788)
@@ -25,7 +25,7 @@
     readonly attribute DOMString filename;
     readonly attribute DOMString description;
     readonly attribute unsigned long length;
-    getter DOMMimeType item(optional unsigned long index = 0);
+    getter DOMMimeType item(unsigned long index);
 
     // FIXME: Using "undefined" as default parameter value is wrong.
     getter DOMMimeType namedItem(optional DOMString name = "undefined");

Modified: trunk/Source/WebCore/plugins/DOMPluginArray.idl (203787 => 203788)


--- trunk/Source/WebCore/plugins/DOMPluginArray.idl	2016-07-27 20:05:43 UTC (rev 203787)
+++ trunk/Source/WebCore/plugins/DOMPluginArray.idl	2016-07-27 20:51:41 UTC (rev 203788)
@@ -23,7 +23,7 @@
     InterfaceName=PluginArray,
 ] interface DOMPluginArray {
     readonly attribute unsigned long length;
-    getter DOMPlugin item(optional unsigned long index = 0);
+    getter DOMPlugin item(unsigned long index);
 
     // FIXME: Using "undefined" as default parameter value is wrong.
     getter DOMPlugin namedItem(optional DOMString name = "undefined");
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to