browser_console_netlogging.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
  2. /* Any copyright is dedicated to the Public Domain.
  3. * http://creativecommons.org/publicdomain/zero/1.0/ */
  4. // Tests that network log messages bring up the network panel.
  5. "use strict";
  6. const TEST_NETWORK_REQUEST_URI =
  7. "http://example.com/browser/devtools/client/webconsole/test/" +
  8. "test-network-request.html";
  9. add_task(function* () {
  10. let finishedRequest = waitForFinishedRequest(({ request }) => {
  11. return request.url === TEST_NETWORK_REQUEST_URI;
  12. });
  13. const hud = yield loadPageAndGetHud(TEST_NETWORK_REQUEST_URI,
  14. "browserConsole");
  15. let request = yield finishedRequest;
  16. ok(request, "Page load was logged");
  17. let client = hud.ui.webConsoleClient;
  18. let args = [request.actor];
  19. const postData = yield getPacket(client, "getRequestPostData", args);
  20. const responseContent = yield getPacket(client, "getResponseContent", args);
  21. is(request.request.url, TEST_NETWORK_REQUEST_URI,
  22. "Logged network entry is page load");
  23. is(request.request.method, "GET", "Method is correct");
  24. ok(!postData.postData.text, "No request body was stored");
  25. ok(postData.postDataDiscarded, "Request body was discarded");
  26. ok(!responseContent.content.text, "No response body was stored");
  27. ok(responseContent.contentDiscarded || request.fromCache,
  28. "Response body was discarded or response came from the cache");
  29. });