regress-350268.js (1508B)
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 = 350268; 8 var summary = 'new Function with unbalanced braces'; 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 f; 23 24 try 25 { 26 expect = 'SyntaxError'; 27 actual = 'No Error'; 28 f = new Function("}"); 29 } 30 catch(ex) 31 { 32 actual = ex.name; 33 } 34 reportCompare(expect, actual, summary + ": }"); 35 36 try 37 { 38 expect = 'SyntaxError'; 39 actual = 'No Error'; 40 f = new Function("}}}}}"); 41 } 42 catch(ex) 43 { 44 actual = ex.name; 45 } 46 reportCompare(expect, actual, summary + ": }}}}}"); 47 48 try 49 { 50 expect = 'SyntaxError'; 51 actual = 'No Error'; 52 f = new Function("alert(6); } alert(5);"); 53 } 54 catch(ex) 55 { 56 actual = ex.name; 57 } 58 reportCompare(expect, actual, summary + ": alert(6); } alert(5);"); 59 60 try 61 { 62 expect = 'SyntaxError'; 63 actual = 'No Error'; 64 f = new Function("} {"); 65 } 66 catch(ex) 67 { 68 actual = ex.name; 69 } 70 reportCompare(expect, actual, summary + ": } {"); 71 }