tor-browser

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

browser_application_panel_telemetry-unregister-worker.js (1250B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 const TAB_URL = URL_ROOT + "resources/service-workers/simple.html";
      7 
      8 // check telemetry for unregistering a service worker
      9 add_task(async function () {
     10  await enableApplicationPanel();
     11 
     12  const { panel, tab, commands } = await openNewTabAndApplicationPanel(TAB_URL);
     13  const doc = panel.panelWin.document;
     14 
     15  selectPage(panel, "service-workers");
     16 
     17  setupTelemetryTest();
     18 
     19  info("Wait until the service worker appears in the application panel");
     20  await waitUntil(() => getWorkerContainers(doc).length === 1);
     21 
     22  const workerContainer = getWorkerContainers(doc)[0];
     23 
     24  info("Wait until the unregister button is displayed for the service worker");
     25  await waitUntil(() => workerContainer.querySelector(".js-unregister-button"));
     26  info("Click the unregister button");
     27  const button = workerContainer.querySelector(".js-unregister-button");
     28  button.click();
     29 
     30  checkTelemetryEvent({ method: "unregister_worker" });
     31 
     32  // clean up and close the tab
     33  await unregisterAllWorkers(commands.client, doc);
     34  info("Closing the tab.");
     35  await commands.client.waitForRequestsToSettle();
     36  await BrowserTestUtils.removeTab(tab);
     37 });