Title: [116513] trunk
Revision
116513
Author
[email protected]
Date
2012-05-09 04:10:53 -0700 (Wed, 09 May 2012)

Log Message

[Chromium][Forms] HTMLOptionsCollection doesn't have indexed properties on property enumeration
https://bugs.webkit.org/show_bug.cgi?id=85937

Patch by Yoshifumi Inoue <[email protected]> on 2012-05-09
Reviewed by Kentaro Hara.

Source/WebCore:

This patch adds numeric indices to properties in enumeration to HTMLOptionsCollection V8 binding
to changes Objects.keys in ECMAScript5 and for-in statement behavior for compatibility with
Firefox 12, IE9, Opera 11, and Safari 5.

Test: fast/forms/select/options-indexed-properties.html

* bindings/scripts/CodeGeneratorV8.pm:
(GenerateImplementationIndexer): Set $hasEnumerator true for interface HTMLOptionsCollection

LayoutTests:

* fast/forms/select/options-indexed-properties-expected.txt: Added.
* fast/forms/select/options-indexed-properties.html: Added.
* platform/chromium/inspector/console/console-format-collections-expected.txt: Changed for HTMLOptionCollection printed output

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (116512 => 116513)


--- trunk/LayoutTests/ChangeLog	2012-05-09 11:02:29 UTC (rev 116512)
+++ trunk/LayoutTests/ChangeLog	2012-05-09 11:10:53 UTC (rev 116513)
@@ -1,3 +1,14 @@
+2012-05-09  Yoshifumi Inoue  <[email protected]>
+
+        [Chromium][Forms] HTMLOptionsCollection doesn't have indexed properties on property enumeration
+        https://bugs.webkit.org/show_bug.cgi?id=85937
+
+        Reviewed by Kentaro Hara.
+
+        * fast/forms/select/options-indexed-properties-expected.txt: Added.
+        * fast/forms/select/options-indexed-properties.html: Added.
+        * platform/chromium/inspector/console/console-format-collections-expected.txt: Changed for HTMLOptionCollection printed output
+
 2012-05-09  Christophe Dumez  <[email protected]>
 
         [EFL] http/tests/loading/post-in-iframe-with-back-navigation.html fails

Added: trunk/LayoutTests/fast/forms/select/options-indexed-properties-expected.txt (0 => 116513)


--- trunk/LayoutTests/fast/forms/select/options-indexed-properties-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/select/options-indexed-properties-expected.txt	2012-05-09 11:10:53 UTC (rev 116513)
@@ -0,0 +1,12 @@
+
+https://bugs.webkit.org/show_bug.cgi?id=85937 - [Chromium][Forms] HTMLOptionsCollection doesn't have indexed properties on property enumeration
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS properties[0].value is "a"
+PASS properties[1].value is "b"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/forms/select/options-indexed-properties.html (0 => 116513)


--- trunk/LayoutTests/fast/forms/select/options-indexed-properties.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/select/options-indexed-properties.html	2012-05-09 11:10:53 UTC (rev 116513)
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<select id="select1">
+    <option value="a">A</option>
+    <option value="b">B</option>
+</select>
+<div id="console"></div>
+
+<script>
+description("https://bugs.webkit.org/show_bug.cgi?id=85937 - [Chromium][Forms] HTMLOptionsCollection doesn't have indexed properties on property enumeration");
+var properties = {};
+var select1 = document.getElementById("select1");
+var options = select1.options;
+for (var propertyKey in options) {
+    properties[propertyKey] = options[propertyKey];
+}
+shouldBeEqualToString('properties[0].value', "a");
+shouldBeEqualToString('properties[1].value', "b");
+</script>
+
+<script src=""
+</body>
+</html>

Modified: trunk/LayoutTests/platform/chromium/inspector/console/console-format-collections-expected.txt (116512 => 116513)


--- trunk/LayoutTests/platform/chromium/inspector/console/console-format-collections-expected.txt	2012-05-09 11:02:29 UTC (rev 116512)
+++ trunk/LayoutTests/platform/chromium/inspector/console/console-format-collections-expected.txt	2012-05-09 11:10:53 UTC (rev 116513)
@@ -11,7 +11,7 @@
 
 [<select id="sel" name="sel">…</select>] console-format-collections.html:15
 [<script src="" <script src="" <script>…</script>] console-format-collections.html:19
-[undefined × 2] console-format-collections.html:23
+[<option value="1">one</option>, <option value="2">two</option>] console-format-collections.html:23
 [<html>…</html>, <head>…</head>, <script src="" <script src="" <script>…</script>, <body _onload_="onload()">…</body>, <p>
 Tests that console nicely formats HTML Collections and NodeLists.
 </p>, <div style="display:none">…</div>, <form id="f">…</form>, <select id="sel" name="sel">…</select>, <option value="1">one</option>, <option value="2">two</option>, <input type="radio" name="x" value="x1">, <input type="radio" name="x" value="x2">] console-format-collections.html:27

Modified: trunk/Source/WebCore/ChangeLog (116512 => 116513)


--- trunk/Source/WebCore/ChangeLog	2012-05-09 11:02:29 UTC (rev 116512)
+++ trunk/Source/WebCore/ChangeLog	2012-05-09 11:10:53 UTC (rev 116513)
@@ -1,3 +1,19 @@
+2012-05-09  Yoshifumi Inoue  <[email protected]>
+
+        [Chromium][Forms] HTMLOptionsCollection doesn't have indexed properties on property enumeration
+        https://bugs.webkit.org/show_bug.cgi?id=85937
+
+        Reviewed by Kentaro Hara.
+
+        This patch adds numeric indices to properties in enumeration to HTMLOptionsCollection V8 binding
+        to changes Objects.keys in ECMAScript5 and for-in statement behavior for compatibility with
+        Firefox 12, IE9, Opera 11, and Safari 5.
+
+        Test: fast/forms/select/options-indexed-properties.html
+
+        * bindings/scripts/CodeGeneratorV8.pm:
+        (GenerateImplementationIndexer): Set $hasEnumerator true for interface HTMLOptionsCollection
+
 2012-05-09  Shinya Kawanaka  <[email protected]>
 
         Position should be able to have ShadowRoot as a container.

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (116512 => 116513)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2012-05-09 11:02:29 UTC (rev 116512)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2012-05-09 11:10:53 UTC (rev 116513)
@@ -2124,11 +2124,6 @@
     my $hasCustomSetter = $dataNode->extendedAttributes->{"CustomIndexedSetter"} && !$dataNode->extendedAttributes->{"NumericIndexedGetter"};
     my $hasGetter = $dataNode->extendedAttributes->{"IndexedGetter"} || $dataNode->extendedAttributes->{"CustomGetOwnPropertySlot"};
 
-    # FIXME: Find a way to not have to special-case HTMLOptionsCollection.
-    if ($interfaceName eq "HTMLOptionsCollection") {
-        $hasGetter = 1;
-    }
-
     # FIXME: Investigate and remove this nastinesss. In V8, named property handling and indexer handling are apparently decoupled,
     # which means that object[X] where X is a number doesn't reach named property indexer. So we need to provide
     # simplistic, mirrored indexer handling in addition to named property handling.
@@ -2140,6 +2135,14 @@
         }
     }
 
+    my $hasEnumerator = !$isSpecialCase && IsNodeSubType($dataNode);
+
+    # FIXME: Find a way to not have to special-case HTMLOptionsCollection.
+    if ($interfaceName eq "HTMLOptionsCollection") {
+        $hasEnumerator = 1;
+        $hasGetter = 1;
+    }
+
     if (!$hasGetter) {
         return;
     }
@@ -2181,7 +2184,6 @@
     }
 
     my $hasDeleter = $dataNode->extendedAttributes->{"CustomDeleteProperty"};
-    my $hasEnumerator = !$isSpecialCase && IsNodeSubType($dataNode);
     my $setOn = "Instance";
 
     # V8 has access-check callback API (see ObjectTemplate::SetAccessCheckCallbacks) and it's used on DOMWindow
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to