browser/devtools/netmonitor/test/browser_net_large-response.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

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  * Tests if very large response contents are just displayed as plain text.
     6  */
     8 function test() {
     9   initNetMonitor(CUSTOM_GET_URL).then(([aTab, aDebuggee, aMonitor]) => {
    10     info("Starting test... ");
    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);
    16     let { document, Editor, NetMonitorView } = aMonitor.panelWin;
    17     let { RequestsMenu } = NetMonitorView;
    19     RequestsMenu.lazyUpdate = false;
    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         });
    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.");
    35           teardown(aMonitor).then(finish);
    36         });
    37       });
    39       EventUtils.sendMouseEvent({ type: "mousedown" },
    40         document.getElementById("details-pane-toggle"));
    41       EventUtils.sendMouseEvent({ type: "mousedown" },
    42         document.querySelectorAll("#details-pane tab")[3]);
    43     });
    45     aDebuggee.performRequests(1, CONTENT_TYPE_SJS + "?fmt=html-long");
    46   });
    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 }

mercurial