tor-browser

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

test_ignore_caught_exceptions.js (1425B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 /**
      7 * Test that setting ignoreCaughtExceptions will cause the debugger to ignore
      8 * caught exceptions, but not uncaught ones.
      9 */
     10 
     11 add_task(
     12  threadFrontTest(
     13    async ({ threadFront, debuggee, commands }) => {
     14      await executeOnNextTickAndWaitForPause(
     15        () => evaluateTestCode(debuggee),
     16        threadFront
     17      );
     18 
     19      await commands.threadConfigurationCommand.updateConfiguration({
     20        pauseOnExceptions: true,
     21        ignoreCaughtExceptions: true,
     22      });
     23      await resume(threadFront);
     24      const paused = await waitForPause(threadFront);
     25      Assert.equal(paused.why.type, "exception");
     26      equal(paused.frame.where.line, 6, "paused at throw");
     27 
     28      await resume(threadFront);
     29    },
     30    {
     31      // Bug 1508289, exception tests fails in worker scope
     32      doNotRunWorker: true,
     33    }
     34  )
     35 );
     36 
     37 function evaluateTestCode(debuggee) {
     38  // prettier-ignore
     39  try {
     40  Cu.evalInSandbox(`                    // 1
     41   debugger;                            // 2
     42   try {                                // 3
     43     throw "foo";                       // 4
     44   } catch (e) {}                       // 5
     45   throw "bar";                         // 6
     46  `,                                    // 7
     47    debuggee,
     48    "1.8",
     49    "test_pause_exceptions-03.js",
     50    1
     51  );
     52  } catch (e) {}
     53 }