NEW 113425
Structured clone does not preserve array lengths
https://bugs.webkit.org/show_bug.cgi?id=113425
Summary Structured clone does not preserve array lengths
Elliott Sprehn
Reported 2013-03-27 10:48:51 PDT
ex. postMessage(new Array(10), '*'); onmessage = function(event) { console.log(event.data.length); // should be 10, but 0 in webkit. });
Attachments
Elliott Sprehn
Comment 1 2013-03-27 10:50:46 PDT
Relevant spec text: http://www.w3.org/html/wg/drafts/html/master/infrastructure.html#safe-passing-of-structured-data If input is an Array object Let output be a newly constructed empty Array object whose length is equal to the length of input. This means that the length of sparse arrays is preserved.
Elliott Sprehn
Comment 2 2013-03-27 11:28:06 PDT
This looks like a one line fix for v8: virtual bool completeSparseArray(uint32_t numProperties, uint32_t length, v8::Handle<v8::Value>* value) has array = v8::Array::New(); and completely ignores the length value. We should do ::New(length) instead.
Note You need to log in before you can comment on or make changes to this bug.