blob: 77f1f0dca9d67499948650204af2ede8f48c13a9 (
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
|
/* 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;
registerCleanupFunction(async function () {
await new Promise(resolve => {
Services.clearData.deleteData(Ci.nsIClearDataService.CLEAR_ALL, () =>
resolve()
);
});
});
add_task(async function task() {
await pushPref("devtools.webconsole.filter.netxhr", true);
const hud = await openNewTabAndConsole(TEST_URI);
const currentTab = gBrowser.selectedTab;
const toolbox = gDevTools.getToolboxForTab(currentTab);
const xhrUrl = TEST_PATH + "test-data.json";
const onMessage = waitForMessageByType(hud, xhrUrl, ".network");
// Fire an XHR POST request.
SpecialPowers.spawn(gBrowser.selectedBrowser, [], function () {
content.wrappedJSObject.testXhrGet();
});
const { node: messageNode } = await onMessage;
ok(messageNode, "Network message found.");
// Expand network log
info("Click on XHR message to display network detail panel");
messageNode.querySelector(".url").click();
const headersTab = await waitFor(() =>
messageNode.querySelector("#headers-tab")
);
ok(headersTab, "Headers tab is available");
// Wait for all network RDP request to be finished and have updated the UI
await waitUntil(() =>
messageNode.querySelector("#headers-panel .headers-overview")
);
info("Focus header tab and hit Escape");
headersTab.focus();
EventUtils.sendKey("ESCAPE", toolbox.win);
await waitFor(() => !messageNode.querySelector(".network-info"));
ok(true, "The detail panel was closed on escape");
});
|