Re: ArrayBuffer neutering

2014-05-22 Thread Dmitry Lomov
On Wed, May 21, 2014 at 9:04 PM, Allen Wirfs-Brock al...@wirfs-brock.comwrote: Yes, as currently spec'ed [[Get]] and [[Set]] operations upon TypedArray instances throw if the backing ArrayBuffer has been neutered. But the reason is in

Re: ArrayBuffer neutering

2014-05-22 Thread Dmitry Lomov
On Wed, May 21, 2014 at 8:51 PM, C. Scott Ananian ecmascr...@cscott.netwrote: On Wed, May 21, 2014 at 9:59 AM, Dmitry Lomov dslo...@chromium.orgwrote: I think it would be weird if some of them fail hard and some would behave as if the length is zero. Consistency is always good. Why fail hard

Re: ArrayBuffer neutering

2014-05-22 Thread Allen Wirfs-Brock
On May 22, 2014, at 4:01 AM, Dmitry Lomov wrote: Wait, am I reading this correctly that after a backing array buffer is neutered, accesses to typed arrays within [0...original length) should throw and accesses outside that range should continue to return 'undefined'? This is

Re: ArrayBuffer neutering

2014-05-22 Thread Boris Zbarsky
On 5/22/14, 12:16 PM, Allen Wirfs-Brock wrote: Out-of-bounds access have also been observed in non-Emscripten code, for example [1] [2]. Out-of-bounds reads are very common in code that works with canvas imagedata, because a lot of image-processing algorithms want to examine adjacent pixels,

Re: ArrayBuffer neutering

2014-05-22 Thread Allen Wirfs-Brock
On May 22, 2014, at 9:28 AM, Boris Zbarsky wrote: On 5/22/14, 12:16 PM, Allen Wirfs-Brock wrote: Out-of-bounds access have also been observed in non-Emscripten code, for example [1] [2]. Out-of-bounds reads are very common in code that works with canvas imagedata, because a lot of

Re: ArrayBuffer neutering

2014-05-21 Thread Anne van Kesteren
On Wed, May 21, 2014 at 2:10 AM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: Why didn't you provide a isNeutered predicate? Note that per http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interfaces.html#transferable there's more objects that can be neutered. Once

Re: ArrayBuffer neutering

2014-05-21 Thread Dmitry Lomov
On Wed, May 21, 2014 at 2:10 AM, Allen Wirfs-Brock al...@wirfs-brock.comwrote: below On May 20, 2014, at 4:28 PM, Kenneth Russell wrote: On Tue, May 20, 2014 at 9:40 AM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: On May 20, 2014, at 8:37 AM, Anne van Kesteren wrote: On Tue, May

Re: ArrayBuffer neutering

2014-05-21 Thread Allen Wirfs-Brock
On May 21, 2014, at 2:02 AM, Dmitry Lomov wrote: Finally, I note that the current Khronos spec. doesn't provide much guidance in this regard. The thing it has that is most similar to the other array methods is the 'subarray' method and it doesn't explicitly say anything about

Re: ArrayBuffer neutering

2014-05-21 Thread Dmitry Lomov
On Wed, May 21, 2014 at 5:19 PM, Allen Wirfs-Brock al...@wirfs-brock.comwrote: On May 21, 2014, at 2:02 AM, Dmitry Lomov wrote: Finally, I note that the current Khronos spec. doesn't provide much guidance in this regard. The thing it has that is most similar to the other array methods

Re: ArrayBuffer neutering

2014-05-21 Thread Allen Wirfs-Brock
On May 21, 2014, at 9:59 AM, Dmitry Lomov wrote: On Wed, May 21, 2014 at 5:19 PM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: On May 21, 2014, at 2:02 AM, Dmitry Lomov wrote: Finally, I note that the current Khronos spec. doesn't provide much guidance in this regard.

Re: ArrayBuffer neutering

2014-05-21 Thread Kenneth Russell
On Tue, May 20, 2014 at 5:10 PM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: below On May 20, 2014, at 4:28 PM, Kenneth Russell wrote: On Tue, May 20, 2014 at 9:40 AM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: On May 20, 2014, at 8:37 AM, Anne van Kesteren wrote: On Tue, May 20,

Re: ArrayBuffer neutering

2014-05-21 Thread C. Scott Ananian
On Wed, May 21, 2014 at 9:59 AM, Dmitry Lomov dslo...@chromium.org wrote: I think it would be weird if some of them fail hard and some would behave as if the length is zero. Consistency is always good. Why fail hard is more desirable? It is desirable because it allows for more efficient

Re: ArrayBuffer neutering

2014-05-21 Thread Jeremy Martin
I think it is better to have one legacy method that behaves differently from all the other (new) methods then to maintain consistency by introducing 20+ new bug farms. Is it too late (or too unexpected) for aTypedArray.subarray(aNeuteredObject)to throw in new contexts (i.e., modules,

Re: ArrayBuffer neutering

2014-05-21 Thread Allen Wirfs-Brock
On May 21, 2014, at 5:51 PM, Jeremy Martin wrote: I think it is better to have one legacy method that behaves differently from all the other (new) methods then to maintain consistency by introducing 20+ new bug farms. Is it too late (or too unexpected) for

ArrayBuffer neutering

2014-05-20 Thread Anne van Kesteren
ArrayBuffer instances whose [[ArrayBufferData]] is null are considered to be neutered However, most algorithms only check for it being undefined (and sometimes missing). In addition, the behavior defined seems incompatible with what is in browsers:

Re: ArrayBuffer neutering

2014-05-20 Thread Allen Wirfs-Brock
On May 20, 2014, at 7:37 AM, Anne van Kesteren wrote: ArrayBuffer instances whose [[ArrayBufferData]] is null are considered to be neutered However, most algorithms only check for it being undefined (and sometimes missing). The operations on ArrayBuffers all have lines that are the

Re: ArrayBuffer neutering

2014-05-20 Thread Anne van Kesteren
On Tue, May 20, 2014 at 5:25 PM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: The ES6 TypedArray/ArrayBuffer spec. was written closely following the Khronos spec. which is pretty vague about what happens when an ArrayBuffer is neutered. If you go through

Re: ArrayBuffer neutering

2014-05-20 Thread Allen Wirfs-Brock
On May 20, 2014, at 8:37 AM, Anne van Kesteren wrote: On Tue, May 20, 2014 at 5:25 PM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: The ES6 TypedArray/ArrayBuffer spec. was written closely following the Khronos spec. which is pretty vague about what happens when an ArrayBuffer is

Re: ArrayBuffer neutering

2014-05-20 Thread Kenneth Russell
On Tue, May 20, 2014 at 9:40 AM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: On May 20, 2014, at 8:37 AM, Anne van Kesteren wrote: On Tue, May 20, 2014 at 5:25 PM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: The ES6 TypedArray/ArrayBuffer spec. was written closely following the

Re: ArrayBuffer neutering

2014-05-20 Thread Allen Wirfs-Brock
below On May 20, 2014, at 4:28 PM, Kenneth Russell wrote: On Tue, May 20, 2014 at 9:40 AM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: On May 20, 2014, at 8:37 AM, Anne van Kesteren wrote: On Tue, May 20, 2014 at 5:25 PM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: The ES6