1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/modules/libjar/zipwriter/test/unit/test_bug433248.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,73 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.7 + */ 1.8 + 1.9 +function run_test() 1.10 +{ 1.11 + var test; 1.12 + // zipW is an uninitialised zipwriter at this point. 1.13 + try { 1.14 + test = zipW.file; 1.15 + do_throw("Should have thrown uninitialized error."); 1.16 + } 1.17 + catch (e) { 1.18 + do_check_eq(e.result, Components.results.NS_ERROR_NOT_INITIALIZED); 1.19 + } 1.20 + 1.21 + try { 1.22 + test = zipW.comment; 1.23 + do_throw("Should have thrown uninitialized error."); 1.24 + } 1.25 + catch (e) { 1.26 + do_check_eq(e.result, Components.results.NS_ERROR_NOT_INITIALIZED); 1.27 + } 1.28 + 1.29 + try { 1.30 + zipW.comment = "test"; 1.31 + do_throw("Should have thrown uninitialized error."); 1.32 + } 1.33 + catch (e) { 1.34 + do_check_eq(e.result, Components.results.NS_ERROR_NOT_INITIALIZED); 1.35 + } 1.36 + 1.37 + try { 1.38 + zipW.addEntryDirectory("test", 0, false); 1.39 + do_throw("Should have thrown uninitialized error."); 1.40 + } 1.41 + catch (e) { 1.42 + do_check_eq(e.result, Components.results.NS_ERROR_NOT_INITIALIZED); 1.43 + } 1.44 + 1.45 + try { 1.46 + zipW.addEntryFile("test", Ci.nsIZipWriter.COMPRESSION_DEFAULT, tmpDir, false); 1.47 + do_throw("Should have thrown uninitialized error."); 1.48 + } 1.49 + catch (e) { 1.50 + do_check_eq(e.result, Components.results.NS_ERROR_NOT_INITIALIZED); 1.51 + } 1.52 + 1.53 + try { 1.54 + zipW.removeEntry("test", false); 1.55 + do_throw("Should have thrown uninitialized error."); 1.56 + } 1.57 + catch (e) { 1.58 + do_check_eq(e.result, Components.results.NS_ERROR_NOT_INITIALIZED); 1.59 + } 1.60 + 1.61 + try { 1.62 + zipW.processQueue(null, null); 1.63 + do_throw("Should have thrown uninitialized error."); 1.64 + } 1.65 + catch (e) { 1.66 + do_check_eq(e.result, Components.results.NS_ERROR_NOT_INITIALIZED); 1.67 + } 1.68 + 1.69 + try { 1.70 + zipW.close(); 1.71 + do_throw("Should have thrown uninitialized error."); 1.72 + } 1.73 + catch (e) { 1.74 + do_check_eq(e.result, Components.results.NS_ERROR_NOT_INITIALIZED); 1.75 + } 1.76 +}