|
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 |
|
6 function run_test() |
|
7 { |
|
8 var test; |
|
9 // zipW is an uninitialised zipwriter at this point. |
|
10 try { |
|
11 test = zipW.file; |
|
12 do_throw("Should have thrown uninitialized error."); |
|
13 } |
|
14 catch (e) { |
|
15 do_check_eq(e.result, Components.results.NS_ERROR_NOT_INITIALIZED); |
|
16 } |
|
17 |
|
18 try { |
|
19 test = zipW.comment; |
|
20 do_throw("Should have thrown uninitialized error."); |
|
21 } |
|
22 catch (e) { |
|
23 do_check_eq(e.result, Components.results.NS_ERROR_NOT_INITIALIZED); |
|
24 } |
|
25 |
|
26 try { |
|
27 zipW.comment = "test"; |
|
28 do_throw("Should have thrown uninitialized error."); |
|
29 } |
|
30 catch (e) { |
|
31 do_check_eq(e.result, Components.results.NS_ERROR_NOT_INITIALIZED); |
|
32 } |
|
33 |
|
34 try { |
|
35 zipW.addEntryDirectory("test", 0, false); |
|
36 do_throw("Should have thrown uninitialized error."); |
|
37 } |
|
38 catch (e) { |
|
39 do_check_eq(e.result, Components.results.NS_ERROR_NOT_INITIALIZED); |
|
40 } |
|
41 |
|
42 try { |
|
43 zipW.addEntryFile("test", Ci.nsIZipWriter.COMPRESSION_DEFAULT, tmpDir, false); |
|
44 do_throw("Should have thrown uninitialized error."); |
|
45 } |
|
46 catch (e) { |
|
47 do_check_eq(e.result, Components.results.NS_ERROR_NOT_INITIALIZED); |
|
48 } |
|
49 |
|
50 try { |
|
51 zipW.removeEntry("test", false); |
|
52 do_throw("Should have thrown uninitialized error."); |
|
53 } |
|
54 catch (e) { |
|
55 do_check_eq(e.result, Components.results.NS_ERROR_NOT_INITIALIZED); |
|
56 } |
|
57 |
|
58 try { |
|
59 zipW.processQueue(null, null); |
|
60 do_throw("Should have thrown uninitialized error."); |
|
61 } |
|
62 catch (e) { |
|
63 do_check_eq(e.result, Components.results.NS_ERROR_NOT_INITIALIZED); |
|
64 } |
|
65 |
|
66 try { |
|
67 zipW.close(); |
|
68 do_throw("Should have thrown uninitialized error."); |
|
69 } |
|
70 catch (e) { |
|
71 do_check_eq(e.result, Components.results.NS_ERROR_NOT_INITIALIZED); |
|
72 } |
|
73 } |