[IndexedDB] Null argument for optionalParameters?

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?
optionalParameters

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?

Thoughts?

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