michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: /** michael@0: * Tests if very large response contents are just displayed as plain text. michael@0: */ michael@0: michael@0: function test() { michael@0: initNetMonitor(CUSTOM_GET_URL).then(([aTab, aDebuggee, aMonitor]) => { michael@0: info("Starting test... "); michael@0: michael@0: // This test could potentially be slow because over 100 KB of stuff michael@0: // is going to be requested and displayed in the source editor. michael@0: requestLongerTimeout(2); michael@0: michael@0: let { document, Editor, NetMonitorView } = aMonitor.panelWin; michael@0: let { RequestsMenu } = NetMonitorView; michael@0: michael@0: RequestsMenu.lazyUpdate = false; michael@0: michael@0: waitForNetworkEvents(aMonitor, 1).then(() => { michael@0: verifyRequestItemTarget(RequestsMenu.getItemAtIndex(0), michael@0: "GET", CONTENT_TYPE_SJS + "?fmt=html-long", { michael@0: status: 200, michael@0: statusText: "OK" michael@0: }); michael@0: michael@0: aMonitor.panelWin.once(aMonitor.panelWin.EVENTS.RESPONSE_BODY_DISPLAYED, () => { michael@0: NetMonitorView.editor("#response-content-textarea").then((aEditor) => { michael@0: ok(aEditor.getText().match(/^

/), michael@0: "The text shown in the source editor is incorrect."); michael@0: is(aEditor.getMode(), Editor.modes.text, michael@0: "The mode active in the source editor is incorrect."); michael@0: michael@0: teardown(aMonitor).then(finish); michael@0: }); michael@0: }); michael@0: michael@0: EventUtils.sendMouseEvent({ type: "mousedown" }, michael@0: document.getElementById("details-pane-toggle")); michael@0: EventUtils.sendMouseEvent({ type: "mousedown" }, michael@0: document.querySelectorAll("#details-pane tab")[3]); michael@0: }); michael@0: michael@0: aDebuggee.performRequests(1, CONTENT_TYPE_SJS + "?fmt=html-long"); michael@0: }); michael@0: michael@0: // This test uses a lot of memory, so force a GC to help fragmentation. michael@0: info("Forcing GC after netmonitor test."); michael@0: Cu.forceGC(); michael@0: }