tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_bug433248.js (1738B)


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