michael@0: function f(arr, v) michael@0: { michael@0: arr.push(v); michael@0: } michael@0: michael@0: function basic(out) michael@0: { michael@0: // Use a much-greater capacity than the eventual non-writable length. michael@0: var a = out.a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]; michael@0: Object.defineProperty(a, "length", { writable: false, value: 6 }); michael@0: michael@0: f(a, 99); michael@0: } michael@0: michael@0: var obj = {}; michael@0: var a; michael@0: michael@0: try michael@0: { michael@0: basic(obj); michael@0: throw new Error("didn't throw!"); michael@0: } michael@0: catch (e) michael@0: { michael@0: assertEq(e instanceof TypeError, true, "expected TypeError, got " + e); michael@0: michael@0: a = obj.a; michael@0: assertEq(a.hasOwnProperty(6), false); michael@0: assertEq(a[6], undefined); michael@0: assertEq(a.length, 6); michael@0: }