[Webkit-unassigned] [Bug 62288] IndexedDB createObjectStore should throw if key path contains a space

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jul 5 06:47:13 PDT 2011


https://bugs.webkit.org/show_bug.cgi?id=62288





--- Comment #17 from Kentaro Hara <haraken at google.com>  2011-07-05 06:47:13 PST ---
What exception should be returned when null or undefined is passed to createObjectStore() or createIndex() is debatable.

Mark said that TypeError is best (see https://bugs.webkit.org/show_bug.cgi?id=62414), but I guess that NON_TRANSIENT_ERR may be best (and I do so in my latest patch). There is no definite reason but the reasons are as follows:

- The specification (http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#widl-IDBDatabase-createObjectStore-IDBObjectStore-DOMString-name-Object-optionalParameters) says that |keypath| must not be nullable, but does not specify what exception should be thrown when |keypath| is nullable. However, according to the specification, other APIs can throw a kind of database exception when null or undefined is passed to the APIs. For example, bound() throws DATA_ERR, lowerBound() throws DATA_ERR, cmp() throws NON_TRANSIENT_ERR, when null or undefined is passed. In addition, the specification requires that creaetObjectStore() should throw NON_TRANSIENT_ERR when a keypath is string but is not a valid keypath. Thus, I guess that it is not so strange to throw NON_TRANSIENT_ERR for null and undefined cases too.

- As far as I see, there seems to be no place that is trying to throw TypeError from WebCore. Actually, I could not find the exception code for TypeError anywhere in xxxxxxException.h. Maybe we have to write a code for throwing TypeError for each JavaScript engine, provided that we really want to throw TypeError (see https://bugs.webkit.org/show_bug.cgi?id=62414). 

- FYI: Firefox behaves as follows:

createObjectStore(): NS_ERROR_XPC_NOT_ENOUGH_ARGS exception

createObjectStore(null): NS_ERROR_DOM_INDEXEDDB_NON_TRANSIENT_ERR exception

createObjectStore(undefined): NS_ERROR_DOM_INDEXEDDB_NON_TRANSIENT_ERR exception

createIndex("name", {keyPath: undefined}): no exception (definitely wrong!)

createIndex("name", {keyPath: null}): no exception (definitely wrong!)

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list