1/* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15var holey_array = [1, 2, 3, 4, 5,,,,,,]; 16print(holey_array.slice(6, 7)[0]); 17print(holey_array.slice(2, 3)[0]); 18 19(function() { 20 var array = [,]; 21 function slice() { 22 return array.slice(); 23 } 24 array.__proto__.push(5); 25 var narr = slice(); 26 print(Object.getOwnPropertyDescriptor(narr, 0)); 27})(); 28 29 30 31// This use case takes a long time, but the corresponding bug is only repeated in the debug 32let err = []; 33err.length=100; 34let err_len = 0; 35function runNearStackLimit(f) { 36 function t() { 37 try { 38 t(); 39 } catch (e) { 40 err[err_len++]=e; 41 f(); 42 } 43 }; try { 44 t(); 45 } catch (e) { } 46} 47const v7 = new Proxy(String, {}); 48function f0() { 49 v7.bind(); 50} 51runNearStackLimit(f0); 52print("runNearStackLimit test success!");