tor-browser

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

test_threadlifetime-04.js (1345B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 /* eslint-disable no-shadow, max-nested-callbacks */
      4 
      5 "use strict";
      6 
      7 /**
      8 * Check that requesting a thread-lifetime actor twice for the same
      9 * value returns the same actor.
     10 */
     11 
     12 var gDebuggee;
     13 var gClient;
     14 var gThreadFront;
     15 
     16 add_task(
     17  threadFrontTest(
     18    async ({ threadFront, debuggee, client }) => {
     19      gThreadFront = threadFront;
     20      gClient = client;
     21      gDebuggee = debuggee;
     22      test_thread_lifetime();
     23    },
     24    { waitForFinish: true }
     25  )
     26 );
     27 
     28 function test_thread_lifetime() {
     29  gThreadFront.once("paused", async function (packet) {
     30    const pauseGrip = packet.frame.arguments[0];
     31 
     32    const response = await gClient.request({
     33      to: pauseGrip.actor,
     34      type: "threadGrip",
     35    });
     36    const threadGrip1 = response.from;
     37 
     38    const response2 = await gClient.request({
     39      to: pauseGrip.actor,
     40      type: "threadGrip",
     41    });
     42    Assert.equal(threadGrip1, response2.from);
     43    await gThreadFront.resume();
     44 
     45    threadFrontTestFinished();
     46  });
     47 
     48  gDebuggee.eval(
     49    "(" +
     50      function () {
     51        // These arguments are tested.
     52        // eslint-disable-next-line no-unused-vars
     53        function stopMe(arg1) {
     54          debugger;
     55        }
     56        stopMe({ obj: true });
     57      } +
     58      ")()"
     59  );
     60 }