tor-browser

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

Object-script.js (711B)


      1 var g = newGlobal({newCompartment: true});
      2 var dbg = new Debugger;
      3 var gDO = dbg.addDebuggee(g);
      4 
      5 function check(expr, expected) {
      6  print("checking " + JSON.stringify(expr) + ", expecting " +
      7        (expected ? "script" : "no script"));
      8 
      9  let completion = gDO.executeInGlobal(expr);
     10  if (completion.throw)
     11    throw completion.throw.unsafeDereference();
     12 
     13  let val = completion.return;
     14  if (expected)
     15    assertEq(val.script instanceof Debugger.Script, true);
     16  else
     17    assertEq(val.script, undefined);
     18 }
     19 
     20 check('(function g(){})', true);
     21 check('(function* h() {})', true);
     22 check('(async function j() {})', true);
     23 check('(async function* k() {})', true);
     24 check('({})', false);
     25 check('Math.atan2', false);