[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] Typed Array spec updates: strawman proposals



On Fri, Apr 22, 2011 at 9:20 PM, Kenneth Russell <kbr@google.com> wrote:

The Typed Array editors' draft has been updated:

http://www.khronos.org/registry/typedarray/specs/latest/

with changes supporting the following functionality:

Â- Ability to copy sections of an ArrayBuffer
Â- Read-only ArrayBuffers
Â- Support for zero-copy data transfer via postMessage by defining the
behavior of ArrayBuffers and ArrayBufferViews under structured clone

This breaks specs that use structured clone within getter operations:

 http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#history-traversal
 http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#object-store-retrieval-operation
 http://dev.w3.org/html5/webstorage/#dom-storage-getitem

For example, it causes "x = localStorage.arrayBuffer" to clear the arrayBuffer within localStorage as a side-effect of retrieving it, which is clearly unintended.

Structured clone is a const operation; making a structured clone of something doesn't modify it. You're changing a fundamental property of structured clone, which isn't a change one spec should be making to another spec. (Has Ian Hickson been involved in this discussion?)

It also effectively changes every setter API that uses structured clone, changing them into functions that modify their arguments as well.

It's also generally inconvenient. For example, if I have an object describing the current state and I want to stash it in History, I now have to be very careful to copy off any ArrayBuffers within it before doing so, and to update any references to those buffers. I can currently say "history.pushState(anything, title, url)" without having to care about what "anything" is and whether it might be modified; please don't break that.

--
Glenn Maynard