tor-browser

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

browser_net_domain-not-found.js (1333B)


      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 that the request for a domain that is not found shows
      8 * correctly.
      9 */
     10 
     11 add_task(async function () {
     12  const URL = "https://not-existed.com/";
     13  const { monitor } = await initNetMonitor(URL, {
     14    requestCount: 1,
     15    waitForLoad: false,
     16  });
     17  info("Starting test... ");
     18 
     19  const { document, store, windowRequire } = monitor.panelWin;
     20  const Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
     21 
     22  store.dispatch(Actions.batchEnable(false));
     23 
     24  const wait = waitForNetworkEvents(monitor, 1);
     25  reloadBrowser({ waitForLoad: false });
     26  await wait;
     27 
     28  const firstItem = document.querySelectorAll(".request-list-item")[0];
     29 
     30  info("Wait for content for the transfered column to be updated");
     31  const transferredValue = await waitFor(() => {
     32    const value = firstItem.querySelector(
     33      ".requests-list-transferred"
     34    ).innerText;
     35    return value.includes("NS_ERROR") ? value : false;
     36  });
     37 
     38  is(
     39    firstItem.querySelector(".requests-list-url").innerText,
     40    URL,
     41    "The url in the displayed request is correct"
     42  );
     43  is(
     44    transferredValue,
     45    "NS_ERROR_UNKNOWN_HOST",
     46    "The error in the displayed request is correct"
     47  );
     48 
     49  await teardown(monitor);
     50 });