W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2012

IndexedDB: undefined parameters

From: Joshua Bell <jsbell@chromium.org>
Date: Tue, 9 Oct 2012 10:52:27 -0700
Message-ID: <CAD649j5w2yb=M=vrBTROZrK+-fiSbJag11DxhC+NqWuZGPCpZQ@mail.gmail.com>
To: public-webapps@w3.org
We were looking at Opera's w3c-test submissions, and noticed that several
of them use a pattern like:

request = index.openCursor(undefined, 'prev');


opts = {};
request = index.openCursor(opts.range, opts.direction);

In Chrome, these throw DataError per our interpretation of the spec: "If
the range parameter is specified but is not a valid key or a key range,
this method throws a DOMException of type DataError." [1]

Looking at WebIDL, "If it is specified as [TreatUndefinedAs=Missing] on an
optional operation argument, then an explicit undefined value will cause
the function call to be treated as if the argument had been omitted." [2]

The IDB spec does not have [TreatUndefinedAs=Missing] specified on
openCursor()'s arguments (or anywhere else), so I believe Chrome's behavior
here is correct. Am I misunderstanding how WebIDL specifies explicit
undefined values should be handled here? Or, perhaps more helpfully for
users, should we sprinkle [TreatUndefinedAs=Missing] into the spec as

[2] http://dev.w3.org/2006/webapi/WebIDL/#TreatUndefinedAs
Received on Tuesday, 9 October 2012 17:52:59 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:26:49 UTC