Microdata: names.item() must return null for out of range indexes.
https://bugs.webkit.org/show_bug.cgi?id=97898

Reviewed by Kentaro Hara.

Source/WebCore: 

DOMStringList.item() must return null for an invalid index.
Spec: http://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMStringList
Removed [IsIndex] extended IDL attribute from item() method's index
parameter in DOMStringList interface.
Firefox and Opera's behavior is consistent with the spec. Both
returns null for invalid index.

Test: fast/dom/MicroData/names-item-out-of-range-index.html

* dom/DOMStringList.idl:

LayoutTests: 

Added test case to ensure names.item() behavior for out of range indexes.

* fast/dom/MicroData/names-item-out-of-range-index-expected.txt: Added.
* fast/dom/MicroData/names-item-out-of-range-index.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk/LayoutTests@130026 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/ChangeLog b/ChangeLog
index d1820db..2c43b81 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2012-10-01  Arko Saha  <arko@motorola.com>
+
+        Microdata: names.item() must return null for out of range indexes.
+        https://bugs.webkit.org/show_bug.cgi?id=97898
+
+        Reviewed by Kentaro Hara.
+
+        Added test case to ensure names.item() behavior for out of range indexes.
+
+        * fast/dom/MicroData/names-item-out-of-range-index-expected.txt: Added.
+        * fast/dom/MicroData/names-item-out-of-range-index.html: Added.
+
 2012-10-01  Yoshifumi Inoue  <yosin@chromium.org>
 
         [Forms] Multiple fields week input UI
diff --git a/fast/dom/MicroData/names-item-out-of-range-index-expected.txt b/fast/dom/MicroData/names-item-out-of-range-index-expected.txt
new file mode 100644
index 0000000..709d36d
--- /dev/null
+++ b/fast/dom/MicroData/names-item-out-of-range-index-expected.txt
@@ -0,0 +1,15 @@
+This test verifies properties.names.item(index) behavior for out-of-range index.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Test itemType[index]
+PASS element.properties.names.item(0) is null
+PASS element.properties.names.item(-1) is null
+PASS element.properties.names.item(0) is 'foo'
+PASS element.properties.names.item(1) is null
+PASS element.properties.names.item(-1) is null
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/fast/dom/MicroData/names-item-out-of-range-index.html b/fast/dom/MicroData/names-item-out-of-range-index.html
new file mode 100644
index 0000000..28a4fac
--- /dev/null
+++ b/fast/dom/MicroData/names-item-out-of-range-index.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<div itemscope id="mydiv"></div>
+<script>
+description("This test verifies properties.names.item(index) behavior for out-of-range index.");
+
+debug("Test itemType[index]");
+var element = document.getElementById("mydiv");
+shouldBeNull("element.properties.names.item(0)");
+shouldBeNull("element.properties.names.item(-1)");
+element.innerHTML = "<div itemprop='foo'></div";
+shouldBe("element.properties.names.item(0)", "'foo'");
+shouldBeNull("element.properties.names.item(1)");
+shouldBeNull("element.properties.names.item(-1)");
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>