W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2011

RE: [indexeddb] Handling negative parameters for the advance method

From: Israel Hilerio <israelh@microsoft.com>
Date: Sat, 13 Aug 2011 00:49:40 +0000
To: "Jonas Sicking (jonas@sicking.cc)" <jonas@sicking.cc>
CC: "public-webapps@w3.org" <public-webapps@w3.org>, Jim Wordelman <jaword@microsoft.com>, Adam Herchenroether <aherchen@microsoft.com>, "Victor Ngo" <vicngo@microsoft.com>
Message-ID: <F695AF7AA77CC745A271AD0F61BBC61E3D1FE882@TK5EX14MBXC113.redmond.corp.microsoft.com>
On Friday, August 12, 2011 3:17 PM, Jonas Sicking wrote:
> On Fri, Aug 12, 2011 at 2:34 PM, Israel Hilerio <israelh@microsoft.com>
> wrote:
> > Since advance is intended to always move the cursor forward, it seems we
> want to only support positive parameter values.  Therefore, I would suggest
> we change its signature to:
> >
> > void advance (in unsigned int count);
> >
> > If a developer specifies a negative number for it, we could throw an
> IDBDatabaseException with a value of NON_TRANSIENT_ERR.  A value of zero
> will do nothing.
> >
> > I also noticed that the webIDL spec doesn't define int or unsigned int.  It
> seems we should be using long (for int) and unsigned long (unsigned int).
> >
> > Do you agree?
> 
> Yup. Though I think WebIDL will take care of the handling for when the
> author specifies a negative value. I.e. WebIDL will specify what exception to
> throw, so we don't need to. Similar to how WebIDL specifies what exception
> to throw if the author specifies too few parameters, or parameters of the
> wrong type.
> 
> / Jonas

After researching a bit, there are no exceptions defined in WebIDL when passing a negative number to an unsigned long parameter.  The value is always converted to some type of positive value.  This will result in some erratic behavior that won't generate an exception.  The good news is that there is no exception that needs to be thrown :-).

I will work with Eliot to make the changes to the spec and to change all "int" references to "long".

Israel
Received on Saturday, 13 August 2011 00:50:19 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:47 GMT