michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: */ michael@0: michael@0: function run_test() michael@0: { michael@0: var test; michael@0: // zipW is an uninitialised zipwriter at this point. michael@0: try { michael@0: test = zipW.file; michael@0: do_throw("Should have thrown uninitialized error."); michael@0: } michael@0: catch (e) { michael@0: do_check_eq(e.result, Components.results.NS_ERROR_NOT_INITIALIZED); michael@0: } michael@0: michael@0: try { michael@0: test = zipW.comment; michael@0: do_throw("Should have thrown uninitialized error."); michael@0: } michael@0: catch (e) { michael@0: do_check_eq(e.result, Components.results.NS_ERROR_NOT_INITIALIZED); michael@0: } michael@0: michael@0: try { michael@0: zipW.comment = "test"; michael@0: do_throw("Should have thrown uninitialized error."); michael@0: } michael@0: catch (e) { michael@0: do_check_eq(e.result, Components.results.NS_ERROR_NOT_INITIALIZED); michael@0: } michael@0: michael@0: try { michael@0: zipW.addEntryDirectory("test", 0, false); michael@0: do_throw("Should have thrown uninitialized error."); michael@0: } michael@0: catch (e) { michael@0: do_check_eq(e.result, Components.results.NS_ERROR_NOT_INITIALIZED); michael@0: } michael@0: michael@0: try { michael@0: zipW.addEntryFile("test", Ci.nsIZipWriter.COMPRESSION_DEFAULT, tmpDir, false); michael@0: do_throw("Should have thrown uninitialized error."); michael@0: } michael@0: catch (e) { michael@0: do_check_eq(e.result, Components.results.NS_ERROR_NOT_INITIALIZED); michael@0: } michael@0: michael@0: try { michael@0: zipW.removeEntry("test", false); michael@0: do_throw("Should have thrown uninitialized error."); michael@0: } michael@0: catch (e) { michael@0: do_check_eq(e.result, Components.results.NS_ERROR_NOT_INITIALIZED); michael@0: } michael@0: michael@0: try { michael@0: zipW.processQueue(null, null); michael@0: do_throw("Should have thrown uninitialized error."); michael@0: } michael@0: catch (e) { michael@0: do_check_eq(e.result, Components.results.NS_ERROR_NOT_INITIALIZED); michael@0: } michael@0: michael@0: try { michael@0: zipW.close(); michael@0: do_throw("Should have thrown uninitialized error."); michael@0: } michael@0: catch (e) { michael@0: do_check_eq(e.result, Components.results.NS_ERROR_NOT_INITIALIZED); michael@0: } michael@0: }