tor-browser

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

browser_markup_anonymous_04.js (1222B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 // Test native anonymous content in the markupview with
      7 // devtools.inspector.showAllAnonymousContent set to true
      8 const TEST_URL = URL_ROOT + "doc_markup_anonymous.html";
      9 const PREF = "devtools.inspector.showAllAnonymousContent";
     10 
     11 add_task(async function () {
     12  Services.prefs.setBoolPref(PREF, true);
     13 
     14  const { inspector } = await openInspectorForURL(TEST_URL);
     15 
     16  const native = await getNodeFront("#native", inspector);
     17 
     18  // Markup looks like: <div><input type="file"></div>
     19  const nativeChildren = await inspector.walker.children(native);
     20  is(nativeChildren.nodes.length, 1, "Children returned from walker");
     21 
     22  info("Checking the input element");
     23  const child = nativeChildren.nodes[0];
     24  ok(!child.isNativeAnonymous, "<input type=file> is not anonymous");
     25 
     26  const grandchildren = await inspector.walker.children(child);
     27  is(
     28    grandchildren.nodes.length,
     29    2,
     30    "<input type=file> has native anonymous children"
     31  );
     32 
     33  for (const node of grandchildren.nodes) {
     34    ok(node.isNativeAnonymous, "Child is native anonymous");
     35    await isEditingMenuDisabled(node, inspector);
     36  }
     37 });