RESOLVED INVALID 62331
IndexedDB createObjectStore should throw if options argument value is an object
https://bugs.webkit.org/show_bug.cgi?id=62331
Summary IndexedDB createObjectStore should throw if options argument value is an object
Mark Pilgrim (Google)
Reported 2011-06-08 15:01:13 PDT
Created attachment 96490 [details] test case http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#options-object-concept states "if any attribute has a getter function or its value is an object, a NOT_TRANSIENT_ERR exception must be thrown." To test this, I create a new Boolean object and use it in the options object when creating an objectstore. According to the above spec text, this should throw. Expected behavior: throw webkitIDBDatabaseException.NON_TRANSIENT_ERR Actual behavior: object store created, no exception thrown Test case attached.
Attachments
test case (1.92 KB, text/html)
2011-06-08 15:01 PDT, Mark Pilgrim (Google)
no flags
Joshua Bell
Comment 1 2011-10-14 13:39:13 PDT
The IndexedDB spec is changing to use the (new) WebIDL "dictionary" type for the option objects, and that text has been removed. My reading of WebIDL [1] and ES5 [2] is that: * Only dictionary members mentioned in the IDL are considered; ergo, extra properties on the JS object are ignored. * The [[Get]] internal method will call a getter (ES5 8.12.3) so this should be valid: db.createObjectStore('my-name', { get keyPath() { return 'my.path'; }, get autoIncrement() { return true; }, ignore_other_properties: {}, even_funky_stuff_like: document }); ... and this appears to work in Chrome 15. [1] http://dev.w3.org/2006/webapi/WebIDL/#es-dictionary [2] http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf So, marking this as invalid, although there may be some additional edge cases to consider.
Note You need to log in before you can comment on or make changes to this bug.