tor-browser

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

test_protocol_lifecycle.js (837B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 const { Actor } = require("resource://devtools/shared/protocol/Actor.js");
      7 const { Front } = require("resource://devtools/shared/protocol/Front.js");
      8 
      9 add_task(async function () {
     10  // Front constructor expect to be provided a client object
     11  const client = {};
     12  const front = new Front(client);
     13  ok(
     14    !front.isDestroyed(),
     15    "Blank front with no actor ID is not considered as destroyed"
     16  );
     17  front.destroy();
     18  ok(front.isDestroyed(), "Front is destroyed");
     19 
     20  const actor = new Actor(null, { typeName: "actor", methods: [] });
     21  ok(
     22    !actor.isDestroyed(),
     23    "Blank actor with no actor ID is not considered as destroyed"
     24  );
     25  actor.destroy();
     26  ok(actor.isDestroyed(), "Actor is destroyed");
     27 });