Yes, it is intentional and was allowed to enable the "freezing" of objects that
already had non-configurable properties. MarkM can probably provide some
specific use cases in the context of secure sandboxes.
Allen
On Jan 5, 2011, at 1:38 PM, Peter Hallam wrote:
> In 8.12.9 [[DefineOwnProperty]]
>
> Step 10.a.i:
>
> "Reject, if the [[Writable]] field of current is false and the [[Writable]]
> field of Desc is true."
>
> This specifically allows making a non-configurable writable property read
> only.
>
> For example:
>
> var obj = {};
> Object.defineOwnProperty(obj, 'p', {value: 'foo', writable: true:,
> configurable: false});
> Object.defineOwnProperty(obj, 'p', {writable: false});
>
> The spec explicitly allows the second call to succeed. Is that intentional?
> If so, what was the rationale?
>
> Allowing changes to the value of the writable flag on the property violates
> my intuition for configurable:false.
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss