17d3e7fc4b65010eabe860313ee0c64f50843f6e3Ben Murdoch// Copyright 2011 the V8 project authors. All rights reserved. 27d3e7fc4b65010eabe860313ee0c64f50843f6e3Ben Murdoch// Redistribution and use in source and binary forms, with or without 37d3e7fc4b65010eabe860313ee0c64f50843f6e3Ben Murdoch// modification, are permitted provided that the following conditions are 47d3e7fc4b65010eabe860313ee0c64f50843f6e3Ben Murdoch// met: 57d3e7fc4b65010eabe860313ee0c64f50843f6e3Ben Murdoch// 67d3e7fc4b65010eabe860313ee0c64f50843f6e3Ben Murdoch// * Redistributions of source code must retain the above copyright 77d3e7fc4b65010eabe860313ee0c64f50843f6e3Ben Murdoch// notice, this list of conditions and the following disclaimer. 87d3e7fc4b65010eabe860313ee0c64f50843f6e3Ben Murdoch// * Redistributions in binary form must reproduce the above 97d3e7fc4b65010eabe860313ee0c64f50843f6e3Ben Murdoch// copyright notice, this list of conditions and the following 107d3e7fc4b65010eabe860313ee0c64f50843f6e3Ben Murdoch// disclaimer in the documentation and/or other materials provided 117d3e7fc4b65010eabe860313ee0c64f50843f6e3Ben Murdoch// with the distribution. 127d3e7fc4b65010eabe860313ee0c64f50843f6e3Ben Murdoch// * Neither the name of Google Inc. nor the names of its 137d3e7fc4b65010eabe860313ee0c64f50843f6e3Ben Murdoch// contributors may be used to endorse or promote products derived 147d3e7fc4b65010eabe860313ee0c64f50843f6e3Ben Murdoch// from this software without specific prior written permission. 157d3e7fc4b65010eabe860313ee0c64f50843f6e3Ben Murdoch// 167d3e7fc4b65010eabe860313ee0c64f50843f6e3Ben Murdoch// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 177d3e7fc4b65010eabe860313ee0c64f50843f6e3Ben Murdoch// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 187d3e7fc4b65010eabe860313ee0c64f50843f6e3Ben Murdoch// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 197d3e7fc4b65010eabe860313ee0c64f50843f6e3Ben Murdoch// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 207d3e7fc4b65010eabe860313ee0c64f50843f6e3Ben Murdoch// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 217d3e7fc4b65010eabe860313ee0c64f50843f6e3Ben Murdoch// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 227d3e7fc4b65010eabe860313ee0c64f50843f6e3Ben Murdoch// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 237d3e7fc4b65010eabe860313ee0c64f50843f6e3Ben Murdoch// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 247d3e7fc4b65010eabe860313ee0c64f50843f6e3Ben Murdoch// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 257d3e7fc4b65010eabe860313ee0c64f50843f6e3Ben Murdoch// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 267d3e7fc4b65010eabe860313ee0c64f50843f6e3Ben Murdoch// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 277d3e7fc4b65010eabe860313ee0c64f50843f6e3Ben Murdoch 287d3e7fc4b65010eabe860313ee0c64f50843f6e3Ben Murdoch// Test that the Array length accessor correctly deals with non-array 297d3e7fc4b65010eabe860313ee0c64f50843f6e3Ben Murdoch// receivers. 307d3e7fc4b65010eabe860313ee0c64f50843f6e3Ben Murdoch 317d3e7fc4b65010eabe860313ee0c64f50843f6e3Ben Murdoch// Create an object with an array as the prototype. 327d3e7fc4b65010eabe860313ee0c64f50843f6e3Ben Murdochvar o = Object.create([]); 337d3e7fc4b65010eabe860313ee0c64f50843f6e3Ben Murdoch 347d3e7fc4b65010eabe860313ee0c64f50843f6e3Ben Murdoch// Check that writing the length property of the non-array object 357d3e7fc4b65010eabe860313ee0c64f50843f6e3Ben Murdoch// works as expected. 367d3e7fc4b65010eabe860313ee0c64f50843f6e3Ben Murdochvar value = "asdf"; 377d3e7fc4b65010eabe860313ee0c64f50843f6e3Ben Murdocho.length = value; 387d3e7fc4b65010eabe860313ee0c64f50843f6e3Ben MurdochassertEquals(value, o.length); 39