ArrayCreate should use the default [[DefineOwnProperty]] internal method instead of Array's

Yusuke Suzuki utatane.tea at gmail.com
Sun Jun 24 06:45:33 PDT 2012


Hello everyone,

In 15.4 ArrayCreate algorithm step 7, we use [[DefineOwnProperty]] of A.

 Call the [[DefineOwnProperty]] internal method of A with arguments
> "length", Property Desciptor {[[Value]]: length, [[Writable]]: true,
> [[Enumerable]]: false, [[Configurable]]: false}, and false.


ArrayCreate set A's [[DefineOwnProperty]] to 15.4.5.1 method in step 4, so
step 7 calls 15.4.5.1 Array's [[DefineOwnProperty]].

Array's [[DefineOwnProperty]] assumes that 'length' property is always set.
Seeing 15.4.5.1 step 1

Let oldLenDesc be the result of calling the [[GetOwnProperty]] internal
> method of A passing "length" as the argument. The result will never be
> undefined or an accessor descriptor because Array objects are created with
> a length data property that cannot be deleted or reconfigured.


But, in ArrayCreate phase (step 7), A's 'length' property is not set yet.
Then assertion in 15.4.5.1 step 1 always fails.

So we should use the default [[DefineOwnProperty]] internal method instead
of Array's.
I suggest modifying ArrayCreate step 7,

Call the default [[DefineOwnProperty]] internal method (8.12.9) on A with
arguments "length", Property Desciptor {[[Value]]: length, [[Writable]]:
true, [[Enumerable]]: false, [[Configurable]]: false}, and false.

Regards,
Yusuke Suzuki
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120624/5dc842c2/attachment.html>


More information about the es-discuss mailing list