|
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 const Cc = Components.classes; |
|
6 const Ci = Components.interfaces; |
|
7 const Cu = Components.utils; |
|
8 |
|
9 var dirSvc = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties); |
|
10 var profileDir = do_get_profile(); |
|
11 |
|
12 /** |
|
13 * Removes any files that could make our tests fail. |
|
14 */ |
|
15 function cleanUp() |
|
16 { |
|
17 let files = [ |
|
18 "downloads.sqlite", |
|
19 "places.sqlite", |
|
20 "cookies.sqlite", |
|
21 "signons.sqlite", |
|
22 "permissions.sqlite" |
|
23 ]; |
|
24 |
|
25 for (let i = 0; i < files.length; i++) { |
|
26 let file = dirSvc.get("ProfD", Ci.nsIFile); |
|
27 file.append(files[i]); |
|
28 if (file.exists()) |
|
29 file.remove(false); |
|
30 } |
|
31 } |
|
32 cleanUp(); |
|
33 |
|
34 function oldDownloadManagerDisabled() |
|
35 { |
|
36 try { |
|
37 // This method throws an exception if the old Download Manager is disabled. |
|
38 Services.downloads.activeDownloadCount; |
|
39 } catch (ex) { |
|
40 return true; |
|
41 } |
|
42 return false; |
|
43 } |