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 5function newArrayWithGetter() { 6 var arr = [1, 2, 3]; 7 Object.defineProperty(arr, '1', { 8 get: function() { delete this[1]; return undefined; }, 9 configurable: true 10 }); 11 return arr; 12} 13 14var a = newArrayWithGetter(); 15var s = a.slice(1); 16assertTrue('0' in s); 17 18// Sparse case should hit the same code as above due to presence of the getter. 19a = newArrayWithGetter(); 20a[0xffff] = 4; 21s = a.slice(1); 22assertTrue('0' in s); 23 24a = newArrayWithGetter(); 25a.shift(); 26assertTrue('0' in a); 27 28a = newArrayWithGetter(); 29a.unshift(0); 30assertTrue('2' in a); 31