toolkit/components/satchel/test/unit/test_db_update_v4b.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 /* 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 file,
     3  * You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 var testnum = 0;
     7 let iter;
     9 function run_test()
    10 {
    11   do_test_pending();
    12   iter = next_test();
    13   iter.next();
    14 }
    16 function next_test()
    17 {
    18   try {
    20   // ===== test init =====
    21   var testfile = do_get_file("formhistory_v3v4.sqlite");
    22   var profileDir = dirSvc.get("ProfD", Ci.nsIFile);
    24   // Cleanup from any previous tests or failures.
    25   var destFile = profileDir.clone();
    26   destFile.append("formhistory.sqlite");
    27   if (destFile.exists())
    28     destFile.remove(false);
    30   testfile.copyTo(profileDir, "formhistory.sqlite");
    31   do_check_eq(3, getDBVersion(testfile));
    33   // ===== 1 =====
    34   testnum++;
    36   destFile = profileDir.clone();
    37   destFile.append("formhistory.sqlite");
    38   dbConnection = Services.storage.openUnsharedDatabase(destFile);
    40   // check for upgraded schema.
    41   do_check_eq(CURRENT_SCHEMA, FormHistory.schemaVersion);
    43   // Check that the index was added
    44   do_check_true(dbConnection.tableExists("moz_deleted_formhistory"));
    45   dbConnection.close();
    47   // check that an entry still exists
    48   yield countEntries("name-A", "value-A",
    49     function (num) {
    50       do_check_true(num > 0);
    51       do_test_finished();
    52     }
    53   );
    55   } catch (e) {
    56     throw "FAILED in test #" + testnum + " -- " + e;
    57   }
    58 }

mercurial