Re: [IndexedDB] Should .add/.put/.update throw when called in read-only transaction?

On Thu, Jul 1, 2010 at 2:17 AM, Jonas Sicking <jonas@sicking.cc> wrote:
>
> Additionally, the structured clone algorithm, which defines that an
> exception should synchronously be thrown if the object is malformed,
> for example if it consists of a cyclic graph. So .add/.put/.update can
> already throw under certain circumstances.
>

This isn't actually true for the async version of our API. The current
wording is:

"If the value being stored could not be serialized by the internal
structured cloning algorithm, then an error event is fired on this
method's returned object with its code set to SERIAL_ERR and a
suitable message."

In the sync version, if the structure cloning algorithm threw, we do
throw an IDBDatabaseException with code SERIAL_ERR.

When fixing 10064,  I'll also change the spec to throw for
serialization errors in the async case.

Andrei

Received on Friday, 2 July 2010 15:14:45 UTC