@@ -175,3 +175,174 @@ try {
175175 assert ( e . message === "foo" ) ;
176176 assert ( e instanceof ReferenceError ) ;
177177}
178+
179+ try {
180+ Array . prototype . splice . call ( undefined ) ;
181+ assert ( false ) ;
182+ } catch ( e ) {
183+ assert ( e instanceof TypeError ) ;
184+ }
185+
186+ try {
187+ var o = { } ;
188+ Object . defineProperty ( o , 'toString' , { 'get' : function ( ) { throw new ReferenceError ( "foo" ) ; } } ) ;
189+ var a = { length : o }
190+ Array . prototype . splice . call ( a , function ( ) { } )
191+ assert ( false ) ;
192+ } catch ( e ) {
193+ assert ( e instanceof ReferenceError ) ;
194+ }
195+
196+ try {
197+ var o = { } ;
198+ Object . defineProperty ( o , 'toString' , { 'get' : function ( ) { throw new ReferenceError ( "foo" ) ; } } ) ;
199+ [ 1 , 2 ] . splice ( o )
200+ assert ( false ) ;
201+ } catch ( e ) {
202+ assert ( e instanceof ReferenceError ) ;
203+ }
204+
205+ try {
206+ var o = { } ;
207+ Object . defineProperty ( o , 'toString' , { 'get' : function ( ) { throw new ReferenceError ( "foo" ) ; } } ) ;
208+ [ 1 , 2 ] . splice ( 1 , o )
209+ assert ( false ) ;
210+ } catch ( e ) {
211+ assert ( e instanceof ReferenceError ) ;
212+ }
213+
214+ try {
215+ var a = [ 1 , 5 , , 2 ]
216+ Object . defineProperty ( a , '2' , { 'get' : function ( ) { throw new ReferenceError ( "foo" ) ; } } )
217+ a . splice ( 1 , 7 , 7 , 7 , 7 , 7 )
218+ assert ( false )
219+ } catch ( e ) {
220+ assert ( e instanceof ReferenceError ) ;
221+ }
222+
223+ var a = { length : 13 }
224+ Array . prototype . splice . call ( a , function ( ) { delete a } )
225+ assert ( a . length === 0 )
226+
227+ try {
228+ var a = [ 1 , 5 , 6 , 7 , 8 , 5 ]
229+ Object . defineProperty ( a , '1' , { 'get' : function ( ) { throw new ReferenceError ( "foo" ) ; } } )
230+ Object . defineProperty ( a , '0' , { 'get' : function ( ) { throw new ReferenceError ( "foo" ) ; } } )
231+ Object . defineProperty ( a , '2' , { 'get' : function ( ) { throw new ReferenceError ( "foo" ) ; } } )
232+ Array . prototype . splice . call ( a , 0 , 3 )
233+ assert ( false )
234+ } catch ( e ) {
235+ assert ( e instanceof ReferenceError ) ;
236+ }
237+
238+ try {
239+ f = function ( ) { delete arr [ 3 ] ; arr . length = 13 ; Object . defineProperty ( arr , '5' , function ( ) { } ) } ;
240+ obj = { get : f , valueOf : f , toString : f }
241+ arr = [ 1 , 2 , obj , 4 , 5 ] ;
242+ Object . defineProperty ( arr , '2' , { 'get' : f } )
243+ print ( arr )
244+ arr . splice ( 1 , 4 , obj ) ;
245+ print ( arr )
246+ } catch ( e ) { }
247+
248+ try {
249+ f = function ( ) { for ( var i = 0 ; i < arr . length ; i ++ ) { delete arr [ i ] } } ;
250+ obj = { get : f , valueOf : f , toString : f }
251+ arr = [ 1 , 2 , obj , 4 , 5 ] ;
252+ Object . defineProperty ( arr , '0' , { 'get' : f } )
253+ Object . defineProperty ( arr , '1' , { 'get' : f } )
254+ Object . defineProperty ( arr , '2' , { 'get' : f } )
255+ Object . defineProperty ( arr , '3' , { 'get' : f } )
256+ Object . defineProperty ( arr , '4' , { 'get' : f } )
257+ Object . defineProperty ( arr , '5' , { 'get' : f } )
258+ arr . splice ( 1 , 3 , obj ) ;
259+ } catch ( e ) { }
260+
261+ try {
262+ f = function ( ) { throw new TypeError ; } ;
263+ obj = { get : f , valueOf : f , toString : f }
264+ arr = [ 1 , 2 , obj , 4 , 5 ] ;
265+ Object . defineProperty ( arr , '4' , { 'get' : f } )
266+ arr . splice ( 1 , 3 , obj ) ;
267+ } catch ( e ) { }
268+
269+ try {
270+ f = function ( ) { for ( var i = 0 ; i < arr . length ; i ++ ) { delete arr [ i ] } } ;
271+ f1 = function ( ) { throw new TypeError ; } ;
272+ f2 = function ( ) { delete arr [ 2 ] ; } ;
273+ f3 = function ( ) { delete arr [ 3 ] ; } ;
274+ f4 = function ( ) { delete arr [ 4 ] ; } ;
275+ arr = [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 ] ;
276+ delete arr [ 2 ] ;
277+ delete arr [ 3 ] ;
278+ Object . defineProperty ( arr , '0' , { 'get' : f } )
279+ Object . defineProperty ( arr , '1' , { 'get' : f } )
280+ Object . defineProperty ( arr , '2' , { 'get' : f } )
281+ Object . defineProperty ( arr , '3' , { 'get' : f } )
282+ Object . defineProperty ( arr , '8' , { 'get' : f2 } )
283+ Object . defineProperty ( arr , '9' , { 'get' : f3 } )
284+ Object . defineProperty ( arr , '10' , { 'get' : f4 } )
285+ arr . splice ( 1 , 7 , 5 ) ;
286+ } catch ( e ) { }
287+
288+ try {
289+ f = function ( ) { for ( var i = 0 ; i < arr . length ; i ++ ) { delete arr [ i ] } } ;
290+ f1 = function ( ) { throw new TypeError ; } ;
291+ f2 = function ( ) { delete arr [ 2 ] ; } ;
292+ f3 = function ( ) { delete arr [ 3 ] ; } ;
293+ f4 = function ( ) { delete arr [ 4 ] ; } ;
294+ arr = [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 24 ] ;
295+ delete arr [ 2 ] ;
296+ delete arr [ 3 ] ;
297+ Object . defineProperty ( arr , '0' , { 'get' : f } )
298+ Object . defineProperty ( arr , '1' , { 'get' : f } )
299+ Object . defineProperty ( arr , '2' , { 'get' : f } )
300+ Object . defineProperty ( arr , '3' , { 'get' : f } )
301+ Object . defineProperty ( arr , '8' , { 'get' : f2 } )
302+ Object . defineProperty ( arr , '9' , { 'get' : f3 } )
303+ Object . defineProperty ( arr , '10' , { 'get' : f4 } )
304+ arr . splice ( 1 , 7 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 ) ;
305+ } catch ( e ) { }
306+
307+ try {
308+ var a = [ 1 , 5 , 6 , 7 , 8 , 5 ]
309+ Object . defineProperty ( a , '1' , { 'get' : function ( ) { throw new ReferenceError ( "foo" ) ; } } )
310+ Object . defineProperty ( a , '0' , { 'get' : function ( ) { throw new ReferenceError ( "foo" ) ; } } )
311+ Object . defineProperty ( a , '2' , { 'get' : function ( ) { throw new ReferenceError ( "foo" ) ; } } )
312+ Array . prototype . splice . call ( a , 0 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 )
313+ assert ( false )
314+ } catch ( e ) {
315+ assert ( e instanceof ReferenceError ) ;
316+ }
317+
318+ try {
319+ f = function ( ) { for ( var i = 0 ; i < arr . length ; i ++ ) { delete arr [ i ] } } ;
320+ arr = [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 24 ] ;
321+ delete arr [ 22 ] ;
322+ delete arr [ 23 ] ;
323+ Object . defineProperty ( arr , '21' , { 'get' : f } )
324+ Object . defineProperty ( arr , '22' , { 'get' : f } )
325+ Object . defineProperty ( arr , '23' , { 'get' : f } )
326+ arr . splice ( 1 , 7 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 ) ;
327+ } catch ( e ) { }
328+
329+ try {
330+ f = function ( ) { throw new TypeError ; } ;
331+ arr = [ 1 , 2 , 4 , 5 ] ;
332+ Object . defineProperty ( arr , '4' , { 'get' : f } )
333+ arr . splice ( 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 ) ;
334+ } catch ( e ) { }
335+
336+ try {
337+ f = function ( ) { delete arr [ 23 ] ; }
338+ arr = [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 24 ] ;
339+ delete arr [ 23 ] ;
340+ Object . defineProperty ( arr , '23' , { 'get' : f } )
341+ arr . splice ( 1 , 7 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 ) ;
342+ } catch ( e ) { }
343+
344+ try {
345+ arr = [ ] ;
346+ Object . defineProperty ( arr , 'length' , { value : 999 , writable : false } )
347+ arr . splice ( 1 , 2 , 4 , 5 ) ;
348+ } catch ( e ) { }
0 commit comments