Title: [119466] trunk
Revision
119466
Author
[email protected]
Date
2012-06-05 01:12:59 -0700 (Tue, 05 Jun 2012)

Log Message

IETC: FileList.item(-1) should return null instead of raising
https://bugs.webkit.org/show_bug.cgi?id=77899

Patch by Li Yin <[email protected]> on 2012-06-05
Reviewed by Kentaro Hara.

Source/WebCore:

IETC: http://samples.msdn.microsoft.com/ietestcenter/fileapi/filelist.htm
Accroding to http://es5.github.com/#x9.6
When the index is negative, it should not raise exception.
Firefox and IE returns null when there is not indexth File object.

Test: fast/files/file-list-test.html

* fileapi/FileList.idl:

LayoutTests:

IETC: http://samples.msdn.microsoft.com/ietestcenter/fileapi/filelist.htm
Ref: http://es5.github.com/#x9.6
Some index values have been covered in this test, including negative index,
undefined, null, normal index(0~length-1), more than length index.

* fast/files/file-list-test-expected.txt:
* fast/files/file-list-test.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (119465 => 119466)


--- trunk/LayoutTests/ChangeLog	2012-06-05 07:38:56 UTC (rev 119465)
+++ trunk/LayoutTests/ChangeLog	2012-06-05 08:12:59 UTC (rev 119466)
@@ -1,3 +1,18 @@
+2012-06-05  Li Yin  <[email protected]>
+
+        IETC: FileList.item(-1) should return null instead of raising
+        https://bugs.webkit.org/show_bug.cgi?id=77899
+
+        Reviewed by Kentaro Hara.
+
+        IETC: http://samples.msdn.microsoft.com/ietestcenter/fileapi/filelist.htm
+        Ref: http://es5.github.com/#x9.6
+        Some index values have been covered in this test, including negative index,
+        undefined, null, normal index(0~length-1), more than length index.
+
+        * fast/files/file-list-test-expected.txt:
+        * fast/files/file-list-test.html:
+
 2012-06-05  Adam Barth  <[email protected]>
 
         EventHandler shouldn't dispatch fake mousemove events when scrolling on devices that don't have a mouse

Modified: trunk/LayoutTests/fast/files/file-list-test-expected.txt (119465 => 119466)


--- trunk/LayoutTests/fast/files/file-list-test-expected.txt	2012-06-05 07:38:56 UTC (rev 119465)
+++ trunk/LayoutTests/fast/files/file-list-test-expected.txt	2012-06-05 08:12:59 UTC (rev 119466)
@@ -9,7 +9,16 @@
 PASS files.item(0).name is "UTF8.txt"
 PASS files.item(1) instanceof File is true
 PASS files.item(1).name is "UTF8-2.txt"
-PASS files.item(999) is null
+PASS files.item(2) is null
+PASS files.item(-1) is null
+PASS files.item(0) === files.item(4294967296) is true
+PASS files.item(1) === files.item(4294967297) is true
+PASS files.item(2) === files.item(4294967298) is true
+PASS files.item(-1) === files.item(4294967295) is true
+PASS files.item(-4294967295) === files.item(1) is true
+PASS files.item(-4294967296) === files.item(0) is true
+PASS files.item(null) === files.item(0) is true
+PASS files.item(undefined) === files.item(0) is true
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/files/file-list-test.html (119465 => 119466)


--- trunk/LayoutTests/fast/files/file-list-test.html	2012-06-05 07:38:56 UTC (rev 119465)
+++ trunk/LayoutTests/fast/files/file-list-test.html	2012-06-05 08:12:59 UTC (rev 119466)
@@ -10,19 +10,29 @@
 <script>
 description("Test the attribute of FileList.");
 
+debug("Start");
+
 function onInputFileChange(files)
 {
     window.files = files;
-    debug("Start");
     shouldBe("files.length", "2");
     shouldBeTrue("files.item(0) instanceof File");
-    shouldBeEqualToString('files.item(0).name', 'UTF8.txt');
+    shouldBeEqualToString("files.item(0).name", "UTF8.txt");
     shouldBeTrue("files.item(1) instanceof File");
-    shouldBeEqualToString('files.item(1).name', 'UTF8-2.txt');
-    shouldBeNull("files.item(999)");
+    shouldBeEqualToString("files.item(1).name", "UTF8-2.txt");
+    shouldBeNull("files.item(2)");
+    shouldBeNull("files.item(-1)");
+    shouldBeTrue("files.item(0) === files.item(4294967296)");
+    shouldBeTrue("files.item(1) === files.item(4294967297)");
+    shouldBeTrue("files.item(2) === files.item(4294967298)");
+    shouldBeTrue("files.item(-1) === files.item(4294967295)");
+    shouldBeTrue("files.item(-4294967295) === files.item(1)");
+    shouldBeTrue("files.item(-4294967296) === files.item(0)");
+    shouldBeTrue("files.item(null) === files.item(0)");
+    shouldBeTrue("files.item(undefined) === files.item(0)");
 }
 
-eventSender.beginDragWithFiles(['resources/UTF8.txt', 'resources/UTF8-2.txt']);
+eventSender.beginDragWithFiles(["resources/UTF8.txt", "resources/UTF8-2.txt"]);
 eventSender.mouseMoveTo(10, 10);
 eventSender.mouseUp();
 

Modified: trunk/Source/WebCore/ChangeLog (119465 => 119466)


--- trunk/Source/WebCore/ChangeLog	2012-06-05 07:38:56 UTC (rev 119465)
+++ trunk/Source/WebCore/ChangeLog	2012-06-05 08:12:59 UTC (rev 119466)
@@ -1,3 +1,19 @@
+2012-06-05  Li Yin  <[email protected]>
+
+        IETC: FileList.item(-1) should return null instead of raising
+        https://bugs.webkit.org/show_bug.cgi?id=77899
+
+        Reviewed by Kentaro Hara.
+
+        IETC: http://samples.msdn.microsoft.com/ietestcenter/fileapi/filelist.htm
+        Accroding to http://es5.github.com/#x9.6
+        When the index is negative, it should not raise exception.
+        Firefox and IE returns null when there is not indexth File object.
+
+        Test: fast/files/file-list-test.html
+
+        * fileapi/FileList.idl:
+
 2012-06-05  Adam Barth  <[email protected]>
 
         EventHandler shouldn't dispatch fake mousemove events when scrolling on devices that don't have a mouse

Modified: trunk/Source/WebCore/fileapi/FileList.idl (119465 => 119466)


--- trunk/Source/WebCore/fileapi/FileList.idl	2012-06-05 07:38:56 UTC (rev 119465)
+++ trunk/Source/WebCore/fileapi/FileList.idl	2012-06-05 08:12:59 UTC (rev 119466)
@@ -30,7 +30,7 @@
         JSNoStaticTables
     ] FileList {
         readonly attribute unsigned long length;
-        File item(in [IsIndex] unsigned long index);
+        File item(in unsigned long index);
     };
 
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to