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

Re: [Public WebGL] TypedArray constructors and zero length

On Thu, Jun 10, 2010 at 06:44, Cedric Vivier <cedricv@neonux.com> wrote:
>> While -1 will convert
>> to a large number, implementations are expected to attempt the
>> allocation, fail, and return a buffer with zero length.
> Are you implying TypedArray construction can never fail then ?
> IF returning a zero-length array is the behavior only when "a large
> number" is passed, how implementations should differentiate "a large
> number" which couldn't be allocated from "out of memory (within the
> resource limits of the Javascript context or GC)" ?

FWIW I wrote some tests on this today, Mozilla has the sane behavior
of throwing an exception ("invalid array size") when length is
negative while WebKit swaps like crazy attempting to allocate
memory... and in the end returns "undefined".

If we do not simply go for changing length type in constructors (only
[1]) to 'long', I guess we should somehow specify stricter conversion
rules in WebIDL so that passing an out of range value to a unsigned
parameter throws as expected (and therefore provide consistent defined


[1] : other attributes are not an issue since they are "readonly" or
have specified behavior wrt values are out of range (e.g slice,...),
the issue is only present for constructor as it is an "in" value.
You are currently subscribed to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email: