tor-browser

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

test_framearguments-01.js (1143B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 /**
      7 * Check a frame actor's arguments property.
      8 */
      9 
     10 add_task(
     11  threadFrontTest(async ({ threadFront, debuggee }) => {
     12    const packet = await executeOnNextTickAndWaitForPause(
     13      () => evalCode(debuggee),
     14      threadFront
     15    );
     16 
     17    const args = packet.frame.arguments;
     18    Assert.equal(args.length, 6);
     19    Assert.equal(args[0], 42);
     20    Assert.equal(args[1], true);
     21    Assert.equal(args[2], "nasu");
     22    Assert.equal(args[3].type, "null");
     23    Assert.equal(args[4].type, "undefined");
     24    Assert.equal(args[5].type, "object");
     25    Assert.equal(args[5].class, "Object");
     26    Assert.ok(!!args[5].actor);
     27 
     28    await threadFront.resume();
     29  })
     30 );
     31 
     32 function evalCode(debuggee) {
     33  debuggee.eval(
     34    "(" +
     35      function () {
     36        // These arguments are tested.
     37        // eslint-disable-next-line no-unused-vars
     38        function stopMe(number, bool, string, null_, undef, object) {
     39          debugger;
     40        }
     41        stopMe(42, true, "nasu", null, undefined, { foo: "bar" });
     42      } +
     43      ")()"
     44  );
     45 }