tor-browser

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

test_sandbox_name.js (564B)


      1 "use strict";
      2 
      3 /**
      4 * Test that the name of a sandbox contains the name of all principals.
      5 */
      6 function test_sandbox_name() {
      7  let names = [
      8    "http://example.com/?" + Math.random(),
      9    "http://example.org/?" + Math.random()
     10  ];
     11  let sandbox = Cu.Sandbox(names);
     12  let fileName = Cu.evalInSandbox(
     13    "(new Error()).fileName",
     14    sandbox,
     15    "latest" /*js version*/,
     16    ""/*file name*/
     17  );
     18 
     19  for (let name of names) {
     20    Assert.ok(fileName.includes(name), `Name ${name} appears in ${fileName}`);
     21  }
     22 };
     23 
     24 function run_test() {
     25  test_sandbox_name();
     26 }