IndexedDB: undefined parameters

We were looking at Opera's w3c-test submissions, and noticed that several
of them use a pattern like:

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

or:

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
appropriate.

[1]
http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#widl-IDBObjectStore-openCursor-IDBRequest-any-range-DOMString-direction
[2] http://dev.w3.org/2006/webapi/WebIDL/#TreatUndefinedAs

Received on Tuesday, 9 October 2012 17:52:59 UTC