This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 26904 - Introduce typedef for IDBKeyPath, use it
Summary: Introduce typedef for IDBKeyPath, use it
Status: RESOLVED WONTFIX
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: Indexed Database API (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: This bug has no owner yet - up for the taking
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-25 17:07 UTC by Joshua Bell
Modified: 2015-01-09 21:21 UTC (History)
3 users (show)

See Also:


Attachments

Description Joshua Bell 2014-09-25 17:07:10 UTC
The IDB spec could be simplified by adding:

typedef (DOMString or sequence<DOMString>) IDBKeyPath;

And then using it in a handful of places:

interface IDBObjectStore {
  readonly attribute IDBKeyPath? keyPath; // replacing 'any'
  IDBIndex createIndex (DOMString name, IDBKeyPath keyPath, optional IDBIndexParameters optionalParameters); // replacing explicit union
}

dictionary IDBObjectStoreParameters {
    IDBKeyPath? keyPath = null; // replacing explicit union
};

interface IDBIndex {
    readonly attribute IDBKeyPath keyPath; // replacing 'any'
}

This would not change the defined behavior at all.
Comment 1 Tab Atkins Jr. 2014-09-25 17:55:29 UTC
Per WebIDL, `sequence<Foo>` can't be used as an attribute/const/etc type.  It's only valid as an argument type or a return type.
Comment 2 Joshua Bell 2014-09-25 19:05:28 UTC
*sigh* Right. May be why we didn't do this earlier.

We could use two different typedefs, (DOMString or sequence<DOMString>) for the operation params and (DOMString or DOMString[]) for the readonly attributes. Kinda lame, though.

Not very important anyway; I'll probably punt this unless someone else feels passionate about it.