tor-browser

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

browser_dbg-inline-exceptions.js (1271B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
      4 
      5 // This test checks the appearance of an inline exception
      6 // and the content of the exception tooltip.
      7 
      8 "use strict";
      9 
     10 add_task(async function () {
     11  const dbg = await initDebugger("doc-exceptions.html");
     12  await selectSource(dbg, "exceptions.js");
     13 
     14  info("Hovers over the inline exception mark text.");
     15  await assertInlineExceptionPreview(dbg, 85, 10, {
     16    fields: [
     17      [
     18        "inlineExc",
     19        "https://example.com/browser/devtools/client/debugger/test/mochitest/examples/exceptions.js:85",
     20      ],
     21      [
     22        "<anonymous>",
     23        "https://example.com/browser/devtools/client/debugger/test/mochitest/examples/exceptions.js:88",
     24      ],
     25    ],
     26    result: 'TypeError: "abc".push is not a function',
     27    expression: "push",
     28  });
     29 
     30  const excLineEls = findAllElementsWithSelector(dbg, ".line-exception");
     31  const excTextMarkEls = findAllElementsWithSelector(
     32    dbg,
     33    ".mark-text-exception"
     34  );
     35 
     36  is(excLineEls.length, 1, "The editor has one exception line");
     37  is(excTextMarkEls.length, 1, "One token is marked as an exception.");
     38 });