tor-browser

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

browser_net_header-request-priority.js (1150B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 /**
      7 * Tests if "Request Priority" is displayed in the header panel.
      8 */
      9 add_task(async function () {
     10  const { monitor } = await initNetMonitor(POST_RAW_URL, {
     11    requestCount: 1,
     12  });
     13 
     14  const { document } = monitor.panelWin;
     15 
     16  const waitReq = waitForNetworkEvents(monitor, 1);
     17  EventUtils.sendMouseEvent(
     18    { type: "click" },
     19    document.querySelector(".requests-list-reload-notice-button")
     20  );
     21  await waitReq;
     22 
     23  // Wait until the tab panel summary is displayed
     24  const wait = waitUntil(
     25    () => document.querySelectorAll(".tabpanel-summary-label")[0]
     26  );
     27  EventUtils.sendMouseEvent(
     28    { type: "mousedown" },
     29    document.querySelectorAll(".request-list-item")[0]
     30  );
     31  await wait;
     32 
     33  const requestPriorityHeaderExists = Array.from(
     34    document.querySelectorAll(".tabpanel-summary-label")
     35  ).some(header => header.textContent === "Request Priority");
     36  is(
     37    requestPriorityHeaderExists,
     38    true,
     39    '"Request Priority" header is displayed in the header panel.'
     40  );
     41 
     42  return teardown(monitor);
     43 });