1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
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"
11 PromiseTestUtils
.allowMatchingRejectionsGlobally(/Component not initialized/);
12 PromiseTestUtils
.allowMatchingRejectionsGlobally(/Connection closed/);
14 Services
.scriptloader
.loadSubScript(
15 "chrome://mochitests/content/browser/devtools/client/debugger/test/mochitest/shared-head.js",
20 * Tests if on clicking the stack frame, UI switches to the Debugger panel.
22 add_task(async
function () {
23 // Set a higher panel height in order to get full CodeMirror content
24 await
pushPref("devtools.toolbox.footer.height", 400);
26 const { tab
, monitor
, toolbox
} = await
initNetMonitor(POST_DATA_URL
, {
29 info("Starting test... ");
31 const { document
, store
, windowRequire
} = monitor
.panelWin
;
32 const Actions
= windowRequire("devtools/client/netmonitor/src/actions/index");
33 store
.dispatch(Actions
.batchEnable(false));
36 await
performRequests(monitor
, tab
, 2);
38 info("Clicking stack-trace tab and waiting for stack-trace panel to open");
39 const waitForTab
= waitForDOM(document
, "#stack-trace-tab");
40 // Click on the first request
41 EventUtils
.sendMouseEvent(
42 { type
: "mousedown" },
43 document
.querySelector(".request-list-item")
46 const waitForPanel
= waitForDOM(
48 "#stack-trace-panel .frame-link",
51 // Open the stack-trace tab for that request
52 document
.getElementById("stack-trace-tab").click();
55 const frameLinkNode
= document
.querySelector(".frame-link");
56 await
checkClickOnNode(toolbox
, frameLinkNode
);
58 await
teardown(monitor
);
62 * Helper function for testOpenInDebugger.
64 async
function checkClickOnNode(toolbox
, frameLinkNode
) {
65 info("checking click on node location");
67 const url
= frameLinkNode
.getAttribute("data-url");
68 ok(url
, `source url found ("${url}")`);
70 const line
= frameLinkNode
.getAttribute("data-line");
71 ok(line
, `source line found ("${line}")`);
73 // Fire the click event
74 frameLinkNode
.querySelector(".frame-link-source").click();
76 // Wait for the debugger to have fully processed the opened source
77 await toolbox
.getPanelWhenReady("jsdebugger");
78 const dbg
= createDebuggerContext(toolbox
);
79 await
waitForSelectedSource(dbg
, url
);