[Bug 20582] Definitions of "valid key" and key comparison are underdefined and not compatible with WebIDL

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

--- Comment #4 from Joshua Bell <jsbell@chromium.org> ---
(In reply to comment #3)
> Structured cloning is defined to work on ES values, not on WebIDL values
> last I checked.  If it doesn't say that clearly, it really should.  When it
> says Array it means it the way it's meant in ECMA-262: things whose internal
> [[Class]] is Array.
> 
> I would probably be OK with IndexedDB clearly defining that it's working on
> ES values, and really has nothing to do with WebIDL.  It's mixing the two
> that's a problem, since getting a WebIDL anything out of an ES value
> involves type-coercion in various ways.

That seems like the best approach (and what I was leading towards in my #2).

> > 3) getters - the structured clone algorithm is similarly underdefined here, 
> 
> How so?  It seems quite clearly defined. 

My bad. I was assuming that "the goal" was to define spec interaction with
scripts in terms of WebIDL. 

> > 6, 7) comparison - I believe all implementations act AS IF they have
> > performed a structured clone on the key value after validity is asserted and
> > the clone is used rather than the original object for all further operations.
> 
> OK.  If that's how it works and if the spec explicitly defines the exact
> point in time when the structured clones happen, that would resolve issues 6
> and 7. 

So, in summary:

* Change section 3.1.3 to describe keys in terms of ECMA-262 not WebIDL,
borrowing text from HTML structured clone algorithm where appropriate. 3.1.4
should be updated as well.

* Change operations that take explicit key values to state that they act "as
if" a structured clone of the key value is made, and specify ordering. E.g. for
IDBFactory.cmp(key1, key2), specify that key1 is effectively cloned before
key2, and for IDBObjectStore.put(value, key) the clone is done when the method
is called, not when the asynchronous task is executed.

(IIRC we put in explicit text in add/put/update about cloning the value to
ensure that the clone was made at call time, for similar reasons.)

None of these should impact implementations as they should effectively be doing
this under the hood already, although test for these edges will probably turn
up some inconsistencies.

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

Received on Wednesday, 9 January 2013 17:31:29 UTC