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.
michael@0 | 1 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 3 | |
michael@0 | 4 | /** |
michael@0 | 5 | * Test if request and response body logging stays on after opening the console. |
michael@0 | 6 | */ |
michael@0 | 7 | |
michael@0 | 8 | function test() { |
michael@0 | 9 | initNetMonitor(JSON_LONG_URL).then(([aTab, aDebuggee, aMonitor]) => { |
michael@0 | 10 | info("Starting test... "); |
michael@0 | 11 | |
michael@0 | 12 | let { L10N, NetMonitorView } = aMonitor.panelWin; |
michael@0 | 13 | let { RequestsMenu } = NetMonitorView; |
michael@0 | 14 | |
michael@0 | 15 | RequestsMenu.lazyUpdate = false; |
michael@0 | 16 | |
michael@0 | 17 | function verifyRequest(aOffset) { |
michael@0 | 18 | verifyRequestItemTarget(RequestsMenu.getItemAtIndex(aOffset), |
michael@0 | 19 | "GET", CONTENT_TYPE_SJS + "?fmt=json-long", { |
michael@0 | 20 | status: 200, |
michael@0 | 21 | statusText: "OK", |
michael@0 | 22 | type: "json", |
michael@0 | 23 | fullMimeType: "text/json; charset=utf-8", |
michael@0 | 24 | size: L10N.getFormatStr("networkMenu.sizeKB", L10N.numberWithDecimals(85975/1024, 2)), |
michael@0 | 25 | time: true |
michael@0 | 26 | }); |
michael@0 | 27 | } |
michael@0 | 28 | |
michael@0 | 29 | waitForNetworkEvents(aMonitor, 1).then(() => { |
michael@0 | 30 | verifyRequest(0); |
michael@0 | 31 | |
michael@0 | 32 | aMonitor._toolbox.once("webconsole-selected", () => { |
michael@0 | 33 | aMonitor._toolbox.once("netmonitor-selected", () => { |
michael@0 | 34 | |
michael@0 | 35 | waitForNetworkEvents(aMonitor, 1).then(() => { |
michael@0 | 36 | waitForNetworkEvents(aMonitor, 1).then(() => { |
michael@0 | 37 | verifyRequest(1); |
michael@0 | 38 | teardown(aMonitor).then(finish); |
michael@0 | 39 | }); |
michael@0 | 40 | |
michael@0 | 41 | // Perform another batch of requests. |
michael@0 | 42 | aDebuggee.performRequests(); |
michael@0 | 43 | }); |
michael@0 | 44 | |
michael@0 | 45 | // Reload debugee. |
michael@0 | 46 | aDebuggee.location.reload(); |
michael@0 | 47 | }); |
michael@0 | 48 | |
michael@0 | 49 | // Switch back to the netmonitor. |
michael@0 | 50 | aMonitor._toolbox.selectTool("netmonitor"); |
michael@0 | 51 | }); |
michael@0 | 52 | |
michael@0 | 53 | // Switch to the webconsole. |
michael@0 | 54 | aMonitor._toolbox.selectTool("webconsole"); |
michael@0 | 55 | }); |
michael@0 | 56 | |
michael@0 | 57 | // Perform first batch of requests. |
michael@0 | 58 | aDebuggee.performRequests(); |
michael@0 | 59 | }); |
michael@0 | 60 | } |