This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 17277 - [FileAPI] It have no clear behavior about negative index of FileList.item
Summary: [FileAPI] It have no clear behavior about negative index of FileList.item
Status: RESOLVED INVALID
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: File API (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Arun
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-01 00:47 UTC by Li Yin
Modified: 2012-06-01 07:38 UTC (History)
4 users (show)

See Also:


Attachments

Description Li Yin 2012-06-01 00:47:28 UTC
From current spec, http://www.w3.org/TR/FileAPI/#dfn-filelist
MUST return the indexth File object in the FileList. If there is no indexth File object in the FileList, then this method must return null.
But when the index is negative number, string, null, or undefined and so on, what should be returned, whether it should raise exception or return null directly.

Currently, webkit based browser and firefox have the different behavior.
Comment 1 Li Yin 2012-06-01 00:53:43 UTC
According to the idl.
interface FileList {
      getter File? item(unsigned long index);
      readonly attribute unsigned long length;
};
unsigned long index represents the negative number is not expected.
So, webkit based browser raises exception when the index is negative.
Comment 2 Glenn Maynard 2012-06-01 01:48:06 UTC
First, you want http://dev.w3.org/2006/webapi/FileAPI/#dfn-filelist.  You almost never want "TR" links; if you find yourself on one, click the "latest editor's draft" link at the top.

The behavior of unsigned long is defined by WebIDL.  http://dev.w3.org/2006/webapi/WebIDL/#es-unsigned-long
Comment 3 Ms2ger 2012-06-01 07:38:41 UTC
WebKit bug. Converting to an 'unsigned long' should wrap modulo 2**32.