tor-browser

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

browser_front_parentFront.js (1091B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 // Test the Front's parentFront attribute returns the correct parent front.
      7 
      8 const TEST_URL = `data:text/html;charset=utf-8,<div id="test"></div>`;
      9 
     10 add_task(async function () {
     11  const tab = await addTab(TEST_URL);
     12  const target = await createAndAttachTargetForTab(tab);
     13 
     14  const inspectorFront = await target.getFront("inspector");
     15  const walker = inspectorFront.walker;
     16  const pageStyleFront = await inspectorFront.getPageStyle();
     17  const nodeFront = await walker.querySelector(walker.rootNode, "#test");
     18 
     19  is(
     20    inspectorFront.parentFront,
     21    target,
     22    "Got the correct parentFront from the InspectorFront."
     23  );
     24  is(
     25    walker.parentFront,
     26    inspectorFront,
     27    "Got the correct parentFront from the WalkerFront."
     28  );
     29  is(
     30    pageStyleFront.parentFront,
     31    inspectorFront,
     32    "Got the correct parentFront from the PageStyleFront."
     33  );
     34  is(
     35    nodeFront.parentFront,
     36    walker,
     37    "Got the correct parentFront from the NodeFront."
     38  );
     39 });