tor-browser

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

browser_net_headers-link_clickable.js (1288B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 /**
      7 * Test if links in headers panel are clickable.
      8 */
      9 
     10 add_task(async function () {
     11  const { tab, monitor } = await initNetMonitor(JSON_LONG_URL, {
     12    requestCount: 1,
     13  });
     14  info("Starting test... ");
     15 
     16  const { document, store, windowRequire } = monitor.panelWin;
     17  const Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
     18 
     19  store.dispatch(Actions.batchEnable(false));
     20 
     21  await performRequests(monitor, tab, 1);
     22 
     23  info("Selecting first request");
     24  EventUtils.sendMouseEvent(
     25    { type: "mousedown" },
     26    document.querySelectorAll(".request-list-item")[0]
     27  );
     28 
     29  info("Waiting for request and response headers");
     30  await waitForRequestData(store, ["requestHeaders", "responseHeaders"]);
     31 
     32  const headerLink = document.querySelector(".objectBox-string .url");
     33  const expectedURL =
     34    "http://example.com/browser/devtools/client/netmonitor/test/html_json-long-test-page.html";
     35  const onTabOpen = BrowserTestUtils.waitForNewTab(gBrowser, expectedURL, true);
     36 
     37  info("Click on a first link in Headers panel");
     38  headerLink.click();
     39  await onTabOpen;
     40 
     41  ok(onTabOpen, "New tab opened from link");
     42 
     43  return teardown(monitor);
     44 });