Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
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/. */
5 Components.utils.import("resource://gre/modules/Services.jsm");
7 const Cc = Components.classes;
8 const Ci = Components.interfaces;
9 const Cr = Components.results;
11 do_get_profile();
13 do_register_cleanup(function() {
14 Services.obs.notifyObservers(null, "quit-application", null);
15 });
17 var dirSvc = Cc["@mozilla.org/file/directory_service;1"].
18 getService(Ci.nsIProperties);
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 }
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 }
36 cleanup();