Re: [indexeddb] Using WebIDL Dictionary in IDBObjectStore.createIndex for optionalParameters

On Mon, Jun 6, 2011 at 12:03 PM, Israel Hilerio <> wrote:
> Have you considered using the WebIDL dictionary definition as a mechanism to define the optional parameters in the IDBDatabase.createObjectStore method?
> Advantages at using the dictionary definition on WebIDL for optional parameters:
> . Provides a fixed, ordered set of key-value pairs
> . Removes the need to walk the hierarchy chain to determine if these attributes are available
> . Provides default values for each of its key-value pairs
> . Enables an extensible pattern to add new capabilities in the future
> I believe this will change our current method definition to the following:
> dictionary IDBOptionalParameters {
>    DOMString? keyPath = null;
>    boolean? autoIncrement = false;
> };
> IDBIndex   createIndex (in DOMString name, in DOMString keyPath, in optional IDBOptionalParameters optionalParameters) raises (IDBDatabaseException);

We definitely should do this. The reason we didn't originally was that
WebIDL didn't have dictionaries when the current text was written. In
fact, one of the reasons that WebIDL added dictionaries was to allow
IndexedDB to use them :).

The one outstanding issue that I know about is that we want IndexedDB
to throw if any unknown parameters are specified. I don't know if
WebIDL dictionaries support those yet. Or if it's something that we
can specify in prose.

/ Jonas

Received on Monday, 6 June 2011 20:59:49 UTC