Thu, 15 Jan 2015 15:59:08 +0100
Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
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/. */
7 test();
9 function test()
10 {
11 enterFunc ("test");
13 var EXCEPTION_DATA = "String exception";
14 var e = "foo", x = "foo";
15 var caught = false;
17 printStatus ("Catchguard 'Common Scope' test.");
19 try
20 {
21 throw EXCEPTION_DATA;
22 }
23 catch (e if ((x = 1) && false))
24 {
25 reportCompare('PASS', 'FAIL',
26 "Catch block (e if ((x = 1) && false) should not " +
27 "have executed.");
28 }
29 catch (e if (x == 1))
30 {
31 caught = true;
32 }
33 catch (e)
34 {
35 reportCompare('PASS', 'FAIL',
36 "Same scope should be used across all catchguards.");
37 }
39 if (!caught)
40 reportCompare('PASS', 'FAIL',
41 "Exception was never caught.");
43 if (e != "foo")
44 reportCompare('PASS', 'FAIL',
45 "Exception data modified inside catch() scope should " +
46 "not be visible in the function scope (e ='" +
47 e + "'.)");
49 if (x != 1)
50 reportCompare('PASS', 'FAIL',
51 "Data modified in 'catchguard expression' should " +
52 "be visible in the function scope (x = '" +
53 x + "'.)");
55 reportCompare('PASS', 'PASS', 'Catchguard Common Scope test');
57 exitFunc ("test");
58 }