tor-browser

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

browser_target_support.js (888B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 // Test support methods on Target, such as `hasActor` and `getTrait`.
      5 
      6 async function testTarget(client, target) {
      7  is(
      8    target.hasActor("inspector"),
      9    true,
     10    "target.hasActor() true when actor exists."
     11  );
     12  is(
     13    target.hasActor("notreal"),
     14    false,
     15    "target.hasActor() false when actor does not exist."
     16  );
     17 
     18  is(
     19    target.getTrait("giddyup"),
     20    undefined,
     21    "target.getTrait() returns undefined when trait does not exist"
     22  );
     23 
     24  close(target, client);
     25 }
     26 
     27 // Ensure target is closed if client is closed directly
     28 function test() {
     29  waitForExplicitFinish();
     30 
     31  getParentProcessActors(testTarget);
     32 }
     33 
     34 function close(target, client) {
     35  target.on("target-destroyed", () => {
     36    ok(true, "Target was destroyed");
     37    finish();
     38  });
     39  client.close();
     40 }