modules/libjar/zipwriter/test/unit/test_bug433248.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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  */
     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   }
    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   }
    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   }
    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   }
    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   }
    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   }
    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   }
    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 }

mercurial