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

mercurial