W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2012

[IndexedDB] Null argument for optionalParameters?

From: Joshua Bell <jsbell@chromium.org>
Date: Tue, 26 Jun 2012 09:59:15 -0700
Message-ID: <CAD649j7R67+Jk-v4yyyh5HaucT6NaHn7URor_BNYhoRM73_VLw@mail.gmail.com>
To: public-webapps@w3.org
What should the behavior be in the following calls?

db.createObjectStore('storename', null);
db.createObjectStore('storename', undefined);

store.createIndex('storename', 'keypath', null);
store.createIndex('storename', 'keypath', undefined);

As a reminder, the IDL for the final argument in both methods is:

optional IDBObjectStoreParameters optionalParameters

Both Chrome 20 and Firefox 13 appears to treat null and undefined the same
as if no argument was provided (i.e. no exception). Both Chrome and Firefox
throw for arguments of type string (etc).

The arguments are marked as optional but not nullable, and there is
no [TreatUndefinedAs=Null] or [TreatUndefinedAs=Missing] attribute. My
reading of the WebIDL spec is that without these qualifiers the above calls
should throw.

If the current behavior in those two browsers is desirable (and we have
developer feedback that it is), then I believe the IDL for these arguments
needs to be amended to:

[TreatUndefinedAs=Null] optional IDBObjectStoreParameters?

All that said, this seems like a common pattern. Is there something in
WebIDL I'm not seeing that implies this behavior for dictionaries already?

Received on Tuesday, 26 June 2012 16:59:43 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:13:34 UTC