modules/libjar/test/unit/test_not_found.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/modules/libjar/test/unit/test_not_found.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,18 @@
     1.4 +// Should report file not found on non-existent files
     1.5 +
     1.6 +const Cc = Components.classes;
     1.7 +const Ci = Components.interfaces;
     1.8 +const path = "data/test_bug333423.zip";
     1.9 +
    1.10 +function run_test() {
    1.11 +  var ios = Cc["@mozilla.org/network/io-service;1"].
    1.12 +            getService(Ci.nsIIOService);
    1.13 +  var spec = "jar:" + ios.newFileURI(do_get_file(path)).spec + "!/";
    1.14 +  var channel = ios.newChannel(spec + "file_that_isnt_in.archive", null, null);
    1.15 +  try {
    1.16 +    instr = channel.open();
    1.17 +    do_throw("Failed to report that file doesn't exist")
    1.18 +  } catch (e) {
    1.19 +      do_check_true(e.name == "NS_ERROR_FILE_NOT_FOUND")
    1.20 +  }
    1.21 +}

mercurial