regress-350312.js (1480B)
1 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 //----------------------------------------------------------------------------- 7 var BUGNUMBER = 350312; 8 var summary = 'Accessing wrong stack slot with nested catch/finally'; 9 var actual = ''; 10 var expect = ''; 11 12 13 //----------------------------------------------------------------------------- 14 test(); 15 //----------------------------------------------------------------------------- 16 17 function test() 18 { 19 printBugNumber(BUGNUMBER); 20 printStatus (summary); 21 22 var iter; 23 function* gen() 24 { 25 try { 26 yield iter; 27 } catch (e) { 28 if (e != null) 29 throw e; 30 actual += 'CATCH,'; 31 print("CATCH"); 32 } finally { 33 actual += 'FINALLY'; 34 print("FINALLY"); 35 } 36 } 37 38 expect = 'FINALLY'; 39 actual = ''; 40 (iter = gen()).next().value.return(); 41 reportCompare(expect, actual, summary); 42 43 expect = 'FINALLY'; 44 actual = ''; 45 try 46 { 47 (iter = gen()).next().value.throw(1); 48 } 49 catch(ex) 50 { 51 } 52 reportCompare(expect, actual, summary); 53 54 expect = 'CATCH,FINALLY'; 55 actual = ''; 56 try 57 { 58 (iter = gen()).next().value.throw(null); 59 } 60 catch(ex) 61 { 62 } 63 reportCompare(expect, actual, summary); 64 65 reportCompare((iter = gen()).next().value.next().value, undefined, summary); 66 }