1 // Copyright 2014 the V8 project authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 function produce_object() { 6 var real_length = 1; 7 function set_length() { real_length = "boom"; } 8 function get_length() { return real_length; } 9 var o = { __proto__:Array.prototype , 0:"x" }; 10 Object.defineProperty(o, "length", { set:set_length, get:get_length }) 11 return o; 12 } 13 14 assertEquals(2, produce_object().push("y")); 15 assertEquals(2, produce_object().unshift("y")); 16