tor-browser

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

browser_inspector_infobar_02.js (1375B)


      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 // Check the text content of the highlighter info bar for namespaced elements.
      8 
      9 const XHTML = `
     10  <!DOCTYPE html>
     11  <html xmlns="http://www.w3.org/1999/xhtml"
     12        xmlns:svg="http://www.w3.org/2000/svg">
     13    <body>
     14      <svg:svg width="100" height="100">
     15        <svg:circle cx="0" cy="0" r="5"></svg:circle>
     16      </svg:svg>
     17    </body>
     18  </html>
     19 `;
     20 
     21 const TEST_URI = "data:application/xhtml+xml;charset=utf-8," + encodeURI(XHTML);
     22 
     23 add_task(async function () {
     24  const { inspector, highlighterTestFront } =
     25    await openInspectorForURL(TEST_URI);
     26 
     27  const testData = [
     28    {
     29      selector: "svg",
     30      tag: "svg:svg",
     31    },
     32    {
     33      selector: "circle",
     34      tag: "svg:circle",
     35    },
     36  ];
     37 
     38  for (const currTest of testData) {
     39    await testNode(currTest, inspector, highlighterTestFront);
     40  }
     41 });
     42 
     43 async function testNode(test, inspector, highlighterTestFront) {
     44  info("Testing " + test.selector);
     45 
     46  await selectAndHighlightNode(test.selector, inspector);
     47 
     48  const tag = await highlighterTestFront.getHighlighterNodeTextContent(
     49    "box-model-infobar-tagname"
     50  );
     51  is(tag, test.tag, "node " + test.selector + ": tagName matches.");
     52 }