toolkit/components/downloads/test/schema_migration/head_migration.js

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:d63142c6b175
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
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 Components.utils.import("resource://gre/modules/Services.jsm");
6
7 const Cc = Components.classes;
8 const Ci = Components.interfaces;
9 const Cr = Components.results;
10
11 do_get_profile();
12
13 do_register_cleanup(function() {
14 Services.obs.notifyObservers(null, "quit-application", null);
15 });
16
17 var dirSvc = Cc["@mozilla.org/file/directory_service;1"].
18 getService(Ci.nsIProperties);
19
20 function importDatabaseFile(aFName)
21 {
22 var file = do_get_file(aFName);
23 var newFile = dirSvc.get("ProfD", Ci.nsIFile);
24 file.copyTo(newFile, "downloads.sqlite");
25 }
26
27 function cleanup()
28 {
29 // removing database
30 var dbFile = dirSvc.get("ProfD", Ci.nsIFile);
31 dbFile.append("downloads.sqlite");
32 if (dbFile.exists())
33 try { dbFile.remove(true); } catch(e) { /* stupid windows box */ }
34 }
35
36 cleanup();
37

mercurial