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.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * Any copyright is dedicated to the Public Domain.
4 * http://creativecommons.org/licenses/publicdomain/
5 */
7 var expect = "pass";
8 var actual;
10 /*
11 * We hardcode here that GenerateBlockId limits a program to 2^20 blocks. Start
12 * with 2^19 blocks, then test 2^20 - 1 blocks, finally test the limit.
13 */
14 var s = "{}";
15 for (var i = 0; i < 21; i++)
16 s += s;
18 try {
19 eval(s);
20 actual = "pass";
21 } catch (e) {
22 actual = "fail: " + e;
23 }
25 assertEq(actual, expect);
27 s += s.slice(0, -2);
29 try {
30 eval(s);
31 actual = "pass";
32 } catch (e) {
33 actual = "fail: " + e;
34 }
36 assertEq(actual, expect);
38 s += "{}";
40 try {
41 eval(s);
42 actual = "fail: expected InternalError: program too large";
43 } catch (e) {
44 actual = (e.message == "program too large") ? "pass" : "fail: " + e;
45 }
47 assertEq(actual, expect);
49 reportCompare(0, 0, "ok");