tor-browser

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

browser_ysod_telemetry.js (1129B)


      1 "use strict";
      2 
      3 const { TelemetryTestUtils } = ChromeUtils.importESModule(
      4  "resource://testing-common/TelemetryTestUtils.sys.mjs"
      5 );
      6 
      7 add_task(async function test_popup_opened() {
      8  Services.telemetry.clearEvents();
      9 
     10  const PAGE_URL = getRootDirectory(gTestPath) + "broken_xml.xhtml";
     11  let viewSourceTab = await BrowserTestUtils.openNewForegroundTab(
     12    gBrowser,
     13    PAGE_URL
     14  );
     15 
     16  let content = await SpecialPowers.spawn(
     17    viewSourceTab.linkedBrowser,
     18    [],
     19    async function () {
     20      return content.document.documentElement.innerHTML;
     21    }
     22  );
     23 
     24  ok(content.includes("XML"), "Document shows XML error");
     25 
     26  TelemetryTestUtils.assertEvents(
     27    [
     28      {
     29        method: "shown",
     30        object: "ysod",
     31        value: PAGE_URL.substr(0, 80),
     32        extra: {
     33          error_code: "11",
     34          location: "3:12",
     35          last_line: "    <title>&nonExistingEntity;</title>",
     36          last_line_len: "38",
     37          hidden: "false",
     38          destroyed: "false",
     39        },
     40      },
     41    ],
     42    {
     43      category: "ysod",
     44    },
     45    { process: "parent" }
     46  );
     47  BrowserTestUtils.removeTab(viewSourceTab);
     48 });