Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* |
michael@0 | 2 | * Any copyright is dedicated to the Public Domain. |
michael@0 | 3 | * http://creativecommons.org/licenses/publicdomain/ |
michael@0 | 4 | */ |
michael@0 | 5 | |
michael@0 | 6 | //----------------------------------------------------------------------------- |
michael@0 | 7 | var BUGNUMBER = 672854; |
michael@0 | 8 | var summary = |
michael@0 | 9 | "Syntax errors at the end of |for| statement header parts shouldn't cause " + |
michael@0 | 10 | "crashes"; |
michael@0 | 11 | |
michael@0 | 12 | print(BUGNUMBER + ": " + summary); |
michael@0 | 13 | |
michael@0 | 14 | /************** |
michael@0 | 15 | * BEGIN TEST * |
michael@0 | 16 | **************/ |
michael@0 | 17 | |
michael@0 | 18 | function checkSyntaxError(str) |
michael@0 | 19 | { |
michael@0 | 20 | try |
michael@0 | 21 | { |
michael@0 | 22 | var f = Function("for(w in\\"); |
michael@0 | 23 | throw new Error("didn't throw, returned " + f); |
michael@0 | 24 | } |
michael@0 | 25 | catch (e) |
michael@0 | 26 | { |
michael@0 | 27 | assertEq(e instanceof SyntaxError, true, |
michael@0 | 28 | "expected SyntaxError, got " + e); |
michael@0 | 29 | } |
michael@0 | 30 | } |
michael@0 | 31 | |
michael@0 | 32 | checkSyntaxError("for(var w in \\"); |
michael@0 | 33 | checkSyntaxError("for(w in \\"); |
michael@0 | 34 | checkSyntaxError("for(var w\\"); |
michael@0 | 35 | checkSyntaxError("for(w\\"); |
michael@0 | 36 | checkSyntaxError("for(var w;\\"); |
michael@0 | 37 | checkSyntaxError("for(w;\\"); |
michael@0 | 38 | checkSyntaxError("for(var w; w >\\"); |
michael@0 | 39 | checkSyntaxError("for(w; w >\\"); |
michael@0 | 40 | checkSyntaxError("for(var w; w > 3;\\"); |
michael@0 | 41 | checkSyntaxError("for(w; w > 3;\\"); |
michael@0 | 42 | checkSyntaxError("for(var w; w > 3; 5\\"); |
michael@0 | 43 | checkSyntaxError("for(w; w > 3; 5\\"); |
michael@0 | 44 | checkSyntaxError("for(var w; w > 3; 5foo"); |
michael@0 | 45 | checkSyntaxError("for(w; w > 3; 5foo"); |
michael@0 | 46 | |
michael@0 | 47 | /******************************************************************************/ |
michael@0 | 48 | |
michael@0 | 49 | reportCompare(true, true); |
michael@0 | 50 | |
michael@0 | 51 | print("Tests complete!"); |