Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 function f(arr, v)
2 {
3 arr.push(v);
4 }
6 function basic(out)
7 {
8 // Use a much-greater capacity than the eventual non-writable length.
9 var a = out.a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
10 Object.defineProperty(a, "length", { writable: false, value: 6 });
12 f(a, 99);
13 }
15 var obj = {};
16 var a;
18 try
19 {
20 basic(obj);
21 throw new Error("didn't throw!");
22 }
23 catch (e)
24 {
25 assertEq(e instanceof TypeError, true, "expected TypeError, got " + e);
27 a = obj.a;
28 assertEq(a.hasOwnProperty(6), false);
29 assertEq(a[6], undefined);
30 assertEq(a.length, 6);
31 }