tor-browser

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

browser_inspector_highlighter-autohide-config_02.js (1429B)


      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 "use strict";
      6 
      7 // Test that configuring two different highlighters to autohide
      8 // will not overwrite each other's timers.
      9 add_task(async function () {
     10  info("Loading the test document and opening the inspector");
     11  const { inspector } = await openInspectorForURL(
     12    "data:text/html;charset=utf-8,<p id='one'>TEST 1</p>"
     13  );
     14 
     15  const HALF_SECOND = 500;
     16  const nodeFront = await getNodeFront("#one", inspector);
     17 
     18  const waitForShowEvents = waitForNEvents(
     19    inspector.highlighters,
     20    "highlighter-shown",
     21    2
     22  );
     23  const waitForHideEvents = waitForNEvents(
     24    inspector.highlighters,
     25    "highlighter-hidden",
     26    2
     27  );
     28 
     29  info("Show Box Model Highlighter, then hide after half a second");
     30  inspector.highlighters.showHighlighterTypeForNode(
     31    inspector.highlighters.TYPES.BOXMODEL,
     32    nodeFront,
     33    { duration: HALF_SECOND }
     34  );
     35 
     36  info("Show Selector Highlighter, then hide after half a second");
     37  inspector.highlighters.showHighlighterTypeForNode(
     38    inspector.highlighters.TYPES.SELECTOR,
     39    nodeFront,
     40    { selector: "#one", duration: HALF_SECOND }
     41  );
     42 
     43  info("Waiting for 2 highlighter-shown and 2 highlighter-hidden events");
     44  await Promise.all([waitForShowEvents, waitForHideEvents]);
     45 });