tor-browser

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

test_gre_resources.js (785B)


      1 // test that things that are expected to be in gre-resources are still there
      2 
      3 "use strict";
      4 
      5 function wrapInputStream(input) {
      6  var nsIScriptableInputStream = Ci.nsIScriptableInputStream;
      7  var factory = Cc["@mozilla.org/scriptableinputstream;1"];
      8  var wrapper = factory.createInstance(nsIScriptableInputStream);
      9  wrapper.init(input);
     10  return wrapper;
     11 }
     12 
     13 function check_file(file) {
     14  var channel = NetUtil.newChannel({
     15    uri: "resource://gre-resources/" + file,
     16    loadUsingSystemPrincipal: true,
     17  });
     18  try {
     19    let instr = wrapInputStream(channel.open());
     20    Assert.ok(!!instr.read(1024).length);
     21  } catch (e) {
     22    do_throw("Failed to read " + file + " from gre-resources:" + e);
     23  }
     24 }
     25 
     26 function run_test() {
     27  for (let file of ["ua.css"]) {
     28    check_file(file);
     29  }
     30 }