[Bug 23332] Support Binary Keys

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

--- Comment #6 from Joshua Bell <jsbell@google.com> ---
(In reply to Joran Greef from comment #5)
> 
> Therefore it would be useful to be able to pass the binary key in as an
> offset and size into an existing Uint8array which might contain other data
> (i.e. the value itself), without forcing the end-user to have to slice that
> existing Uint8array first. If there's no offset and size argument when
> passing in the binary key, then the offset would be 0 and the size would be
> the length of the Uint8array.

A Uint8Array is already a view onto an ArrayBuffer. If you have an existing
large Uint8Array called |big| you can use:

var slice = new Uint8Array(big.buffer, offset, length);

... to specify a subset without making a copy.

Behind the scenes, an IDB implementation is likely going to make a copy of the
bytes of the key, but a caller should be able to do:

store.put(big, new UInt8Array(big.buffer, offset, length));

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

Received on Friday, 4 October 2013 17:24:16 UTC