Closed Bug 1073808 Opened 12 years ago Closed 11 years ago

Array.of overwrites non-configurable properties

Categories

(Core :: JavaScript: Standard Library, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1148750

People

(Reporter: anba, Unassigned)

References

(Blocks 1 open bug)

Details

JSObject::defineElement() allows to overwrite non-configurable properties, so it probably shouldn't be used directly in array_of(). Test case 1: --- function C() { Object.defineProperty(this, 0, {value: "v", configurable: false}); } Array.of.call(C, 1, 2, 3) --- Expected: Throws TypeError Actual: No error Test case 2: --- var obj; function C() { obj = this; Object.defineProperty(this, 0, {value: "v", configurable: false}); print(JSON.stringify(Object.getOwnPropertyDescriptor(this, 0))); } try { Array.of.call(C, 1); } catch (e) {} Object.getOwnPropertyDescriptor(obj, "0"); --- Expected: Non-configurable property is not changed Actual: Non-configurable property is changed (writable, enumerable and value are changed)
I believe a patch I'm developing for bug 1148750 fixes this.
Depends on: 1148750
André, thanks once again. I'll check in these test cases in bug 1148750, assuming you don't mind, as always.
Done.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.