| OLD | NEW |
| (Empty) |
| 1 description('Test that if an arrity check causes a stack overflow, the exception
goes to the right catch'); | |
| 2 | |
| 3 function funcWith20Args(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, | |
| 4 arg9, arg10, arg11, arg12, arg13, arg14, arg15, | |
| 5 arg16, arg17, arg18, arg19, arg20) | |
| 6 { | |
| 7 debug("ERROR: Shouldn't arrive in 20 arg function!"); | |
| 8 } | |
| 9 | |
| 10 var gotRightCatch = false, gotWrongCatch1 = false, gotWrongCatch2 = false; | |
| 11 | |
| 12 function test1() | |
| 13 { | |
| 14 try { | |
| 15 test2(); | |
| 16 } catch (err) { | |
| 17 // Should get here because of stack overflow, | |
| 18 // now cause a stack overflow exception due to arrity processing | |
| 19 try { | |
| 20 var dummy = new RegExp('a|b|c'); | |
| 21 } catch(err) { | |
| 22 gotWrongCatch1 = true; | |
| 23 } | |
| 24 | |
| 25 try { | |
| 26 funcWith20Args(1, 2, 3); | |
| 27 } catch (err2) { | |
| 28 gotRightCatch = true; | |
| 29 } | |
| 30 } | |
| 31 } | |
| 32 | |
| 33 function test2() | |
| 34 { | |
| 35 try { | |
| 36 var dummy = new Date(); | |
| 37 } catch(err) { | |
| 38 gotWrongCatch2 = true; | |
| 39 } | |
| 40 | |
| 41 try { | |
| 42 test1(); | |
| 43 } catch (err) { | |
| 44 // Should get here because of stack overflow, | |
| 45 // now cause a stack overflow exception due to arrity processing | |
| 46 try { | |
| 47 funcWith20Args(1, 2, 3, 4, 5, 6); | |
| 48 } catch (err2) { | |
| 49 gotRightCatch = true; | |
| 50 } | |
| 51 } | |
| 52 } | |
| 53 | |
| 54 test1(); | |
| 55 | |
| 56 shouldBeTrue("gotRightCatch"); | |
| 57 shouldBeFalse("gotWrongCatch1"); | |
| 58 shouldBeFalse("gotWrongCatch2"); | |
| OLD | NEW |