tor-browser

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

browser_dbg-inline-exceptions-position.js (1392B)


      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 function waitForElementsWithSelector(dbg, selector) {
     11  return waitFor(() => {
     12    const elems = findAllElementsWithSelector(dbg, selector);
     13    if (!elems.length) {
     14      return false;
     15    }
     16    return elems;
     17  });
     18 }
     19 
     20 add_task(async function () {
     21  const dbg = await initDebugger("doc-exception-position.html");
     22 
     23  await selectSource(dbg, "exception-position-1.js");
     24  let elems = await waitForElementsWithSelector(dbg, ".mark-text-exception");
     25  is(elems.length, 1);
     26  is(elems[0].textContent, "a1");
     27 
     28  await selectSource(dbg, "exception-position-2.js");
     29  elems = await waitForElementsWithSelector(dbg, ".mark-text-exception");
     30  is(elems.length, 1);
     31  is(elems[0].textContent, "a2");
     32 
     33  await selectSource(dbg, "exception-position-3.js");
     34  elems = await waitForElementsWithSelector(dbg, ".mark-text-exception");
     35  is(elems.length, 1);
     36  is(elems[0].textContent, "a3");
     37 
     38  await selectSource(dbg, "exception-position-4.js");
     39  elems = await waitForElementsWithSelector(dbg, ".mark-text-exception");
     40  is(elems.length, 1);
     41  is(elems[0].textContent, "a4");
     42 });