browser/devtools/netmonitor/test/browser_net_req-resp-bodies.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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 }

mercurial