tor-browser

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

browser_net_copy_response.js (983B)


      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 copying a request's response works.
      8 */
      9 
     10 add_task(async function () {
     11  const { tab, monitor } = await initNetMonitor(
     12    CONTENT_TYPE_WITHOUT_CACHE_URL,
     13    { requestCount: 1 }
     14  );
     15  info("Starting test... ");
     16 
     17  const EXPECTED_RESULT = '{ "greeting": "Hello JSON!" }';
     18 
     19  const { document } = monitor.panelWin;
     20 
     21  // Execute requests.
     22  await performRequests(monitor, tab, CONTENT_TYPE_WITHOUT_CACHE_REQUESTS);
     23 
     24  EventUtils.sendMouseEvent(
     25    { type: "mousedown" },
     26    document.querySelectorAll(".request-list-item")[3]
     27  );
     28  EventUtils.sendMouseEvent(
     29    { type: "contextmenu" },
     30    document.querySelectorAll(".request-list-item")[3]
     31  );
     32 
     33  await waitForClipboardPromise(async function setup() {
     34    await selectContextMenuItem(monitor, "request-list-context-copy-response");
     35  }, EXPECTED_RESULT);
     36 
     37  await teardown(monitor);
     38 });