storage/test/unit/test_telemetry_vfs.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     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 }

mercurial