Testcase
-------------------
function testcase() {
var arrObj = [];
Object.defineProperty(arrObj, "length", {writable: false});
return dataPropertyAttributesAreCorrect(arrObj, "length", 0, false, false, false);
}
-------------------
ES5.1 15.4.5.2 length:
The length property is not configurable, so do an Object.defineProperty on it has no effect (or throw on strict mode).
Anyway, length cannot be made non-writable.
Still need to verify this completely (i.e., re-review 8.12.9), but I think you're correct here.
Hi David, the reason I didn't originally modify the test and close this is because while I agreed with your expectation intuitively, ES5.1 didn't seem to match up. After taking the time to thoroughly research this, ES5.1 states:
1. Object.defineProperty ends up calling 15.4.5.1
2. Step 3.a.i of 15.4.5.1 ends up calling 8.12.9
3. 8.12.9 states that a transition from Writable===true to Writable===false on a non-configurable property is actually OK
Spent two hours second-guessing this and looking for a flaw in either 8.12.9 *or* my interpretation, but there is none. ES5.1 actually allows Writable properties to become non-Writable when the property is non-Configurable!
I've filed a bug for Table 5 of ES5.1 to be fixed - see https://bugs.ecmascript.org/show_bug.cgi?id=100.