tor-browser

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

test_frameactor-03.js (1318B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 /**
      7 * Verify that a frame actor is properly expired when the frame goes away.
      8 */
      9 
     10 add_task(
     11  threadFrontTest(async ({ threadFront, debuggee }) => {
     12    const packet = await executeOnNextTickAndWaitForPause(
     13      () => evalCode(debuggee),
     14      threadFront
     15    );
     16    const frameActorID = packet.frame.actorID;
     17    {
     18      const { frames } = await threadFront.getFrames(0, null);
     19      ok(
     20        frames.some(f => f.actorID === frameActorID),
     21        "The paused frame is returned by getFrames"
     22      );
     23 
     24      Assert.equal(frames.length, 3, "Thread front has 3 frames");
     25    }
     26 
     27    await resumeAndWaitForPause(threadFront);
     28    await checkFramesLength(threadFront, 2);
     29    {
     30      const { frames } = await threadFront.getFrames(0, null);
     31      ok(
     32        !frames.some(f => f.actorID === frameActorID),
     33        "The paused frame is no longer returned by getFrames"
     34      );
     35 
     36      Assert.equal(frames.length, 2, "Thread front has 2 frames");
     37    }
     38    await threadFront.resume();
     39  })
     40 );
     41 
     42 function evalCode(debuggee) {
     43  debuggee.eval(
     44    "(" +
     45      function () {
     46        function stopMe() {
     47          debugger;
     48        }
     49        stopMe();
     50        debugger;
     51      } +
     52      ")()"
     53  );
     54 }