Tue, 06 Jan 2015 21:39:09 +0100
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.
michael@0 | 1 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | * http://creativecommons.org/licenses/publicdomain/ */ |
michael@0 | 3 | |
michael@0 | 4 | // Testcase for bug 365166 - crash [@ strlen] calling |
michael@0 | 5 | // mozIStorageStatement::getColumnName of a statement created with |
michael@0 | 6 | // "PRAGMA user_version" or "PRAGMA schema_version" |
michael@0 | 7 | function run_test() { |
michael@0 | 8 | test('user'); |
michael@0 | 9 | test('schema'); |
michael@0 | 10 | |
michael@0 | 11 | function test(param) |
michael@0 | 12 | { |
michael@0 | 13 | var colName = param + "_version"; |
michael@0 | 14 | var sql = "PRAGMA " + colName; |
michael@0 | 15 | |
michael@0 | 16 | var file = getTestDB(); |
michael@0 | 17 | var storageService = Components.classes["@mozilla.org/storage/service;1"]. |
michael@0 | 18 | getService(Components.interfaces.mozIStorageService); |
michael@0 | 19 | var conn = storageService.openDatabase(file); |
michael@0 | 20 | var statement = conn.createStatement(sql); |
michael@0 | 21 | try { |
michael@0 | 22 | // This shouldn't crash: |
michael@0 | 23 | do_check_eq(statement.getColumnName(0), colName); |
michael@0 | 24 | } finally { |
michael@0 | 25 | statement.reset(); |
michael@0 | 26 | statement.finalize(); |
michael@0 | 27 | } |
michael@0 | 28 | } |
michael@0 | 29 | } |