storage/test/unit/test_bug-429521.js

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 function setup() 
     6 {
     7     getOpenedDatabase().createTable("t1", "x TEXT");
     9     var stmt = createStatement("INSERT INTO t1 (x) VALUES ('/mozilla.org/20070129_1/Europe/Berlin')");
    10     stmt.execute();
    11     stmt.finalize();
    12 }
    14 function test_bug429521() 
    15 {
    16     var stmt = createStatement(
    17         "SELECT DISTINCT(zone) FROM ("+
    18             "SELECT x AS zone FROM t1 WHERE x LIKE '/mozilla.org%'" +
    19         ");");
    21     print("*** test_bug429521: started");
    23     try {
    24         while (stmt.executeStep()) {
    25             print("*** test_bug429521: step() Read wrapper.row.zone");
    27             // BUG: the print commands after the following statement
    28             // are never executed. Script stops immediately.
    29             var tzId = stmt.row.zone;
    31             print("*** test_bug429521: step() Read wrapper.row.zone finished");
    32         }
    33     } catch (e) {
    34         print("*** test_bug429521: " + e);
    35     }
    37     print("*** test_bug429521: finished");
    39     stmt.finalize();
    40 }
    42 function run_test()
    43 {
    44   setup();
    46   test_bug429521();
    48   cleanup();
    49 }

mercurial