toolkit/components/places/tests/migration/head_migration.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 const Ci = Components.interfaces;
     5 const Cc = Components.classes;
     6 const Cr = Components.results;
     7 const Cu = Components.utils;
     9 Cu.import("resource://gre/modules/Services.jsm");
    11 // Import common head.
    12 let (commonFile = do_get_file("../head_common.js", false)) {
    13   let uri = Services.io.newFileURI(commonFile);
    14   Services.scriptloader.loadSubScript(uri.spec, this);
    15 }
    17 // Put any other stuff relative to this test folder below.
    19 const kDBName = "places.sqlite";
    21 /**
    22  * Sets the database to use for the given test.  This should be the very first
    23  * thing we do otherwise, this database will not be used!
    24  *
    25  * @param aFileName
    26  *        The filename of the database to use.  This database must exist in
    27  *        toolkit/components/places/tests/migration!
    28  */
    29 function setPlacesDatabase(aFileName)
    30 {
    31   let file = do_get_file(aFileName);
    33   // Ensure that our database doesn't already exist.
    34   let (dbFile = gProfD.clone()) {
    35     dbFile.append(kDBName);
    36     do_check_false(dbFile.exists());
    37   }
    39   file.copyToFollowingLinks(gProfD, kDBName);
    40 }

mercurial