|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 /** |
|
5 * Tests if very large response contents are just displayed as plain text. |
|
6 */ |
|
7 |
|
8 function test() { |
|
9 initNetMonitor(CUSTOM_GET_URL).then(([aTab, aDebuggee, aMonitor]) => { |
|
10 info("Starting test... "); |
|
11 |
|
12 // This test could potentially be slow because over 100 KB of stuff |
|
13 // is going to be requested and displayed in the source editor. |
|
14 requestLongerTimeout(2); |
|
15 |
|
16 let { document, Editor, NetMonitorView } = aMonitor.panelWin; |
|
17 let { RequestsMenu } = NetMonitorView; |
|
18 |
|
19 RequestsMenu.lazyUpdate = false; |
|
20 |
|
21 waitForNetworkEvents(aMonitor, 1).then(() => { |
|
22 verifyRequestItemTarget(RequestsMenu.getItemAtIndex(0), |
|
23 "GET", CONTENT_TYPE_SJS + "?fmt=html-long", { |
|
24 status: 200, |
|
25 statusText: "OK" |
|
26 }); |
|
27 |
|
28 aMonitor.panelWin.once(aMonitor.panelWin.EVENTS.RESPONSE_BODY_DISPLAYED, () => { |
|
29 NetMonitorView.editor("#response-content-textarea").then((aEditor) => { |
|
30 ok(aEditor.getText().match(/^<p>/), |
|
31 "The text shown in the source editor is incorrect."); |
|
32 is(aEditor.getMode(), Editor.modes.text, |
|
33 "The mode active in the source editor is incorrect."); |
|
34 |
|
35 teardown(aMonitor).then(finish); |
|
36 }); |
|
37 }); |
|
38 |
|
39 EventUtils.sendMouseEvent({ type: "mousedown" }, |
|
40 document.getElementById("details-pane-toggle")); |
|
41 EventUtils.sendMouseEvent({ type: "mousedown" }, |
|
42 document.querySelectorAll("#details-pane tab")[3]); |
|
43 }); |
|
44 |
|
45 aDebuggee.performRequests(1, CONTENT_TYPE_SJS + "?fmt=html-long"); |
|
46 }); |
|
47 |
|
48 // This test uses a lot of memory, so force a GC to help fragmentation. |
|
49 info("Forcing GC after netmonitor test."); |
|
50 Cu.forceGC(); |
|
51 } |