[Bug 17681] [IndexedDB] Operations that raise multiple exceptions types should define order

https://www.w3.org/Bugs/Public/show_bug.cgi?id=17681

--- Comment #8 from Joshua Bell <jsbell@chromium.org> ---
(In reply to comment #7)
> I do think it would be good to define all exception orders though.

I still agree, and again Chrome is willing and able to change orders to match
other implementations.

> One way to do it would be to have a global list that defines some sort of
> priority based on exception type. So if both a TransactionInactiveError and
> a ReadOnlyError test is failing, we always throw ReadOnlyError. And if
> ReadOnlyError and DataError both are possible, then we throw DataError.
> 
> Or something like that.

I wrote up a script to test this. As it stands now, there no overall ordering
in Chrome's implementation. A > B means A is thrown instead of B if both error
conditions are true:

IDBDatabase.createObjectStore(): InvalidStateError > ConstraintError >
SyntaxError > InvalidAccessError
IDBDatabase.deleteObjectStore(): InvalidStateError > NotFoundError
IDBDatabase.transaction(): InvalidStateError > NotFoundError >
InvalidAccessError*
IDBObjectStore.add(): InvalidStateError > TransactionInactiveError >
ReadOnlyError > DataError > DataCloneError
IDBObjectStore.clear(): InvalidStateError > TransactionInactiveError >
ReadOnlyError
IDBObjectStore.count(): DataError > InvalidStateError >
TransactionInactiveError
IDBObjectStore.createIndex(): InvalidStateError > TransactionInactiveError >
SyntaxError > ConstraintError > InvalidAccessError
IDBObjectStore.delete(): DataError > InvalidStateError >
TransactionInactiveError > ReadOnlyError
IDBObjectStore.deleteIndex(): InvalidStateError > TransactionInactiveError >
NotFoundError
IDBObjectStore.get(): DataError > InvalidStateError > TransactionInactiveError
IDBObjectStore.index(): InvalidStateError > TransactionInactiveError
IDBObjectStore.openCursor(): DataError > InvalidStateError >
TransactionInactiveError
IDBObjectStore.put(): InvalidStateError > TransactionInactiveError >
ReadOnlyError > DataError > DataCloneError
IDBIndex.count(): DataError > InvalidStateError > TransactionInactiveError
IDBIndex.get(): DataError > InvalidStateError > TransactionInactiveError
IDBIndex.getKey(): DataError > InvalidStateError > TransactionInactiveError
IDBIndex.openCursor(): DataError > InvalidStateError > TransactionInactiveError
IDBIndex.openKeyCursor(): DataError > InvalidStateError >
TransactionInactiveError
IDBCursor.advance(): InvalidStateError > TransactionInactiveError
IDBCursor.continue(): DataError > TransactionInactiveError > InvalidStateError
IDBCursor.delete(): TransactionInactiveError > ReadOnlyError >
InvalidStateError
IDBCursor.update(): InvalidStateError > TransactionInactiveError >
ReadOnlyError > DataError > DataCloneError
IDBTransaction.objectStore(): InvalidStateError > NotFoundError

* NOTE: Can't cause both NotFoundError and InvalidAccessError at the same time
in IDBDatabase.transaction()

The script is a bit mind-numbing to read but I can clean it up and share it if
there's interest.

>From quick code inspection, the ordering anomalies (e.g. sometimes DataError >
InvalidStateError, sometimes DataError < InvalidStateError) would be easy to
fix. There's not much logic behind the above ordering, and I'd love an excuse
to clean it up.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Friday, 22 March 2013 19:09:19 UTC