tor-browser

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

browser_net_view-source-debugger.js (1936B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 // There are shutdown issues for which multiple rejections are left uncaught.
      7 // See bug 1018184 for resolving these issues.
      8 const { PromiseTestUtils } = ChromeUtils.importESModule(
      9  "resource://testing-common/PromiseTestUtils.sys.mjs"
     10 );
     11 PromiseTestUtils.allowMatchingRejectionsGlobally(/Component not initialized/);
     12 PromiseTestUtils.allowMatchingRejectionsGlobally(/Connection closed/);
     13 
     14 /**
     15 * Tests if on clicking the stack frame, UI switches to the Debugger panel.
     16 */
     17 add_task(async function () {
     18  // Set a higher panel height in order to get full CodeMirror content
     19  await pushPref("devtools.toolbox.footer.height", 400);
     20 
     21  const { tab, monitor, toolbox } = await initNetMonitor(POST_DATA_URL, {
     22    requestCount: 1,
     23  });
     24  info("Starting test... ");
     25 
     26  const { document, store, windowRequire } = monitor.panelWin;
     27  const Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
     28  store.dispatch(Actions.batchEnable(false));
     29 
     30  // Execute requests.
     31  await performRequests(monitor, tab, 2);
     32 
     33  info("Clicking stack-trace tab and waiting for stack-trace panel to open");
     34  const waitForTab = waitForDOM(document, "#stack-trace-tab");
     35  // Click on the first request
     36  EventUtils.sendMouseEvent(
     37    { type: "mousedown" },
     38    document.querySelector(".request-list-item")
     39  );
     40  await waitForTab;
     41  const waitForPanel = waitForDOM(
     42    document,
     43    "#stack-trace-panel .frame-link",
     44    3 // Note: This does not include the chrome frames
     45  );
     46  // Open the stack-trace tab for that request
     47  document.getElementById("stack-trace-tab").click();
     48  await waitForPanel;
     49 
     50  const frameLinkNode = document.querySelector(".frame-link");
     51  await clickAndAssertFrameLinkNode(toolbox, frameLinkNode, {
     52    url: POST_DATA_URL,
     53    line: 49,
     54    column: 15,
     55  });
     56 
     57  await teardown(monitor);
     58 });