tor-browser

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

test_not_found.js (574B)


      1 // Should report file not found on non-existent files
      2 
      3 const { NetUtil } = ChromeUtils.importESModule(
      4  "resource://gre/modules/NetUtil.sys.mjs"
      5 );
      6 const path = "data/test_bug333423.zip";
      7 
      8 function run_test() {
      9  var spec = "jar:" + Services.io.newFileURI(do_get_file(path)).spec + "!/";
     10  var channel = NetUtil.newChannel({
     11    uri: spec + "file_that_isnt_in.archive",
     12    loadUsingSystemPrincipal: true,
     13  });
     14  try {
     15    channel.open();
     16    do_throw("Failed to report that file doesn't exist");
     17  } catch (e) {
     18    Assert.equal(e.name, "NS_ERROR_FILE_NOT_FOUND");
     19  }
     20 }