tor-browser

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

browser_aboutdebugging_telemetry_basic.js (1121B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 /* import-globals-from helper-telemetry.js */
      7 Services.scriptloader.loadSubScript(
      8  CHROME_URL_ROOT + "helper-telemetry.js",
      9  this
     10 );
     11 
     12 /**
     13 * Check that telemetry events are recorded when opening and closing about debugging.
     14 */
     15 add_task(async function () {
     16  setupTelemetryTest();
     17 
     18  const { tab } = await openAboutDebugging();
     19 
     20  const openEvents = readAboutDebuggingEvents().filter(
     21    e => e.method === "open_adbg"
     22  );
     23  is(
     24    openEvents.length,
     25    1,
     26    "Exactly one open event was logged for about:debugging"
     27  );
     28  const sessionId = openEvents[0].extras.session_id;
     29  ok(!isNaN(sessionId), "Open event has a valid session id");
     30 
     31  await removeTab(tab);
     32 
     33  const closeEvents = readAboutDebuggingEvents().filter(
     34    e => e.method === "close_adbg"
     35  );
     36  is(
     37    closeEvents.length,
     38    1,
     39    "Exactly one close event was logged for about:debugging"
     40  );
     41  is(
     42    closeEvents[0].extras.session_id,
     43    sessionId,
     44    "Close event has the same session id as the open event"
     45  );
     46 });