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.
1 /* Any copyright is dedicated to the Public Domain.
2 * http://creativecommons.org/publicdomain/zero/1.0/
3 */
5 // Make sure that there are telemetry entries created by sqlite io
7 function run_sql(d, sql) {
8 var stmt = d.createStatement(sql)
9 stmt.execute()
10 stmt.finalize();
11 }
13 function new_file(name)
14 {
15 var file = dirSvc.get("ProfD", Ci.nsIFile);
16 file.append(name);
17 return file;
18 }
19 function run_test()
20 {
21 const Telemetry = Cc["@mozilla.org/base/telemetry;1"].getService(Ci.nsITelemetry);
22 let read_hgram = Telemetry.getHistogramById("MOZ_SQLITE_OTHER_READ_B");
23 let old_sum = read_hgram.snapshot().sum;
24 const file = new_file("telemetry.sqlite");
25 var d = getDatabase(file);
26 run_sql(d, "CREATE TABLE bloat(data varchar)");
27 run_sql(d, "DROP TABLE bloat")
28 do_check_true(read_hgram.snapshot().sum > old_sum)
29 }