blob: 5fde57566ba7f36f082ce92d63ffd0a085b7e498 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const TEST_FILE = "test-network-request.html";
const TEST_PATH =
"https://example.com/browser/devtools/client/webconsole/" + "test/browser/";
const TEST_URI = TEST_PATH + TEST_FILE;
pushPref("devtools.webconsole.filter.netxhr", true);
registerCleanupFunction(async function () {
await new Promise(resolve => {
Services.clearData.deleteData(Ci.nsIClearDataService.CLEAR_ALL, () =>
resolve()
);
});
});
add_task(async function task() {
const hud = await openNewTabAndConsole(TEST_URI);
const xhrUrl = TEST_PATH + "sjs_slow-response-test-server.sjs";
info("Fire an XHR POST request from the console.");
const { node: messageNode } = await executeAndWaitForMessageByType(
hud,
`
xhrConsole = () => testXhrPostSlowResponse();
xhrConsole();
`,
xhrUrl,
".network"
);
ok(messageNode, "Network message found.");
info("Expand the network message");
await expandXhrMessage(messageNode);
const stackTraceTab = messageNode.querySelector("#stack-trace-tab");
ok(stackTraceTab, "StackTrace tab is available");
stackTraceTab.click();
const selector = "#stack-trace-panel .frame-link";
await waitFor(() => messageNode.querySelector(selector));
const frames = [...messageNode.querySelectorAll(selector)];
is(frames.length, 4, "There's the expected frames");
const functionNames = frames.map(
f => f.querySelector(".frame-link-function-display-name").textContent
);
is(
functionNames.join("|"),
"makeXhr|testXhrPostSlowResponse|xhrConsole|<anonymous>",
"The stacktrace does not have devtools' internal frames"
);
});
function expandXhrMessage(node) {
info(
"Click on XHR message and wait for the network detail panel to be displayed"
);
node.querySelector(".url").click();
return waitFor(() => node.querySelector("#stack-trace-tab"));
}
|