Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
4 /**
5 * Test if request and response body logging stays on after opening the console.
6 */
8 function test() {
9 initNetMonitor(JSON_LONG_URL).then(([aTab, aDebuggee, aMonitor]) => {
10 info("Starting test... ");
12 let { L10N, NetMonitorView } = aMonitor.panelWin;
13 let { RequestsMenu } = NetMonitorView;
15 RequestsMenu.lazyUpdate = false;
17 function verifyRequest(aOffset) {
18 verifyRequestItemTarget(RequestsMenu.getItemAtIndex(aOffset),
19 "GET", CONTENT_TYPE_SJS + "?fmt=json-long", {
20 status: 200,
21 statusText: "OK",
22 type: "json",
23 fullMimeType: "text/json; charset=utf-8",
24 size: L10N.getFormatStr("networkMenu.sizeKB", L10N.numberWithDecimals(85975/1024, 2)),
25 time: true
26 });
27 }
29 waitForNetworkEvents(aMonitor, 1).then(() => {
30 verifyRequest(0);
32 aMonitor._toolbox.once("webconsole-selected", () => {
33 aMonitor._toolbox.once("netmonitor-selected", () => {
35 waitForNetworkEvents(aMonitor, 1).then(() => {
36 waitForNetworkEvents(aMonitor, 1).then(() => {
37 verifyRequest(1);
38 teardown(aMonitor).then(finish);
39 });
41 // Perform another batch of requests.
42 aDebuggee.performRequests();
43 });
45 // Reload debugee.
46 aDebuggee.location.reload();
47 });
49 // Switch back to the netmonitor.
50 aMonitor._toolbox.selectTool("netmonitor");
51 });
53 // Switch to the webconsole.
54 aMonitor._toolbox.selectTool("webconsole");
55 });
57 // Perform first batch of requests.
58 aDebuggee.performRequests();
59 });
60 }