Re: [IndexedDB] Null argument for optionalParameters?

2012-06-26 Thread Ms2ger

On 06/26/2012 07:15 PM, Boris Zbarsky wrote:

On 6/26/12 12:59 PM, Joshua Bell wrote:

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?


No, but there have definitely been proposals (from me and Jonas at
least) that WebIDL treat null, undefined, not passed, and {} as exactly
identical for optional dictionary arguments...


This was fixed yesterday over in bug 16725; [1] see the spec. [2]

HTH
Ms2ger

[1] https://www.w3.org/Bugs/Public/show_bug.cgi?id=16725
[2] http://dev.w3.org/2006/webapi/WebIDL/#es-dictionary




Re: [IndexedDB] Null argument for optionalParameters?

2012-06-26 Thread Boris Zbarsky

On 6/26/12 12:59 PM, Joshua Bell wrote:

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?


No, but there have definitely been proposals (from me and Jonas at 
least) that WebIDL treat null, undefined, not passed, and {} as exactly 
identical for optional dictionary arguments...


-Boris



[IndexedDB] Null argument for optionalParameters?

2012-06-26 Thread Joshua Bell
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?