tor-browser

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

browser_net_api-calls.js (1309B)


      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 whether API call URLs (without a filename) are correctly displayed
      8 * (including Unicode)
      9 */
     10 
     11 add_task(async function () {
     12  const { tab, monitor } = await initNetMonitor(API_CALLS_URL, {
     13    requestCount: 1,
     14  });
     15  info("Starting test... ");
     16 
     17  const { document, store, windowRequire } = monitor.panelWin;
     18  const Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
     19  const { getDisplayedRequests, getSortedRequests } = windowRequire(
     20    "devtools/client/netmonitor/src/selectors/index"
     21  );
     22 
     23  store.dispatch(Actions.batchEnable(false));
     24 
     25  const REQUEST_URIS = [
     26    "https://example.com/api/fileName.xml",
     27    "https://example.com/api/file%E2%98%A2.xml",
     28    "https://example.com/api/ascii/get/",
     29    "https://example.com/api/unicode/%E2%98%A2/",
     30    "https://example.com/api/search/?q=search%E2%98%A2",
     31  ];
     32 
     33  // Execute requests.
     34  await performRequests(monitor, tab, 5);
     35 
     36  for (const [index, uri] of REQUEST_URIS.entries()) {
     37    await verifyRequestItemTarget(
     38      document,
     39      getDisplayedRequests(store.getState()),
     40      getSortedRequests(store.getState())[index],
     41      "GET",
     42      uri
     43    );
     44  }
     45 
     46  await teardown(monitor);
     47 });