Bug 1004104 - Disable caching when running netmonitor tests to hopefully fix some timeouts. r=dcamp, a=test-only
authorVictor Porof <vporof@mozilla.com>
Thu, 12 Jun 2014 12:16:59 -0400
changeset 208178 00f079c876f6
parent 208177 d1e5cb0fbe70
child 208179 bce84b70da30
push id3754
push userryanvm@gmail.com
push date2014-07-28 15:24 +0000
treeherdermozilla-beta@61b30b605194 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdcamp, test-only
bugs1004104
milestone32.0
Bug 1004104 - Disable caching when running netmonitor tests to hopefully fix some timeouts. r=dcamp, a=test-only
browser/devtools/netmonitor/test/browser_net_copy_as_curl.js
browser/devtools/netmonitor/test/browser_net_cyrillic-02.js
browser/devtools/netmonitor/test/browser_net_simple-request-data.js
browser/devtools/netmonitor/test/browser_net_simple-request-details.js
browser/devtools/netmonitor/test/head.js
browser/devtools/netmonitor/test/html_content-type-test-page.html
browser/devtools/netmonitor/test/html_content-type-without-cache-test-page.html
browser/devtools/netmonitor/test/html_copy-as-curl.html
browser/devtools/netmonitor/test/html_curl-utils.html
browser/devtools/netmonitor/test/html_custom-get-page.html
browser/devtools/netmonitor/test/html_cyrillic-test-page.html
browser/devtools/netmonitor/test/html_filter-test-page.html
browser/devtools/netmonitor/test/html_infinite-get-page.html
browser/devtools/netmonitor/test/html_json-custom-mime-test-page.html
browser/devtools/netmonitor/test/html_json-long-test-page.html
browser/devtools/netmonitor/test/html_json-malformed-test-page.html
browser/devtools/netmonitor/test/html_json-text-mime-test-page.html
browser/devtools/netmonitor/test/html_jsonp-test-page.html
browser/devtools/netmonitor/test/html_navigate-test-page.html
browser/devtools/netmonitor/test/html_params-test-page.html
browser/devtools/netmonitor/test/html_post-data-test-page.html
browser/devtools/netmonitor/test/html_post-raw-test-page.html
browser/devtools/netmonitor/test/html_post-raw-with-headers-test-page.html
browser/devtools/netmonitor/test/html_simple-test-page.html
browser/devtools/netmonitor/test/html_single-get-page.html
browser/devtools/netmonitor/test/html_sorting-test-page.html
browser/devtools/netmonitor/test/html_statistics-test-page.html
browser/devtools/netmonitor/test/html_status-codes-test-page.html
browser/devtools/netmonitor/test/sjs_content-type-test-server.sjs
browser/devtools/netmonitor/test/sjs_simple-test-server.sjs
browser/devtools/netmonitor/test/sjs_sorting-test-server.sjs
browser/devtools/netmonitor/test/sjs_status-codes-test-server.sjs
--- a/browser/devtools/netmonitor/test/browser_net_copy_as_curl.js
+++ b/browser/devtools/netmonitor/test/browser_net_copy_as_curl.js
@@ -34,18 +34,19 @@ function test() {
       '-H "Accept-Encoding: gzip, deflate"',
       '-H "X-Custom-Header-1: Custom value"',
       '-H "X-Custom-Header-2: 8.8.8.8"',
       '-H "X-Custom-Header-3: Mon, 3 Mar 2014 11:11:11 GMT"',
       '-H "Referer: ' + CURL_URL + '"',
       '-H "Connection: keep-alive"'
     ].join(" ");
 
-    const EXPECTED_RESULT = Services.appinfo.OS == "WINNT" ?
-                            EXPECTED_WIN_RESULT : EXPECTED_POSIX_RESULT;
+    const EXPECTED_RESULT = Services.appinfo.OS == "WINNT"
+      ? EXPECTED_WIN_RESULT
+      : EXPECTED_POSIX_RESULT;
 
     let { NetMonitorView } = aMonitor.panelWin;
     let { RequestsMenu } = NetMonitorView;
 
     RequestsMenu.lazyUpdate = false;
 
     waitForNetworkEvents(aMonitor, 1).then(() => {
       let requestItem = RequestsMenu.getItemAtIndex(0);
--- a/browser/devtools/netmonitor/test/browser_net_cyrillic-02.js
+++ b/browser/devtools/netmonitor/test/browser_net_cyrillic-02.js
@@ -26,17 +26,17 @@ function test() {
         document.getElementById("details-pane-toggle"));
       EventUtils.sendMouseEvent({ type: "mousedown" },
         document.querySelectorAll("#details-pane tab")[3]);
 
       let RESPONSE_BODY_DISPLAYED = aMonitor.panelWin.EVENTS.RESPONSE_BODY_DISPLAYED;
       waitFor(aMonitor.panelWin, RESPONSE_BODY_DISPLAYED).then(() =>
         NetMonitorView.editor("#response-content-textarea")
       ).then((aEditor) => {
-        is(aEditor.getText().indexOf("\u044F"), 302, // я
+        is(aEditor.getText().indexOf("\u044F"), 486, // я
           "The text shown in the source editor is incorrect.");
         is(aEditor.getMode(), Editor.modes.html,
           "The mode active in the source editor is incorrect.");
 
         teardown(aMonitor).then(finish);
       });
     });
 
--- a/browser/devtools/netmonitor/test/browser_net_simple-request-data.js
+++ b/browser/devtools/netmonitor/test/browser_net_simple-request-data.js
@@ -81,20 +81,18 @@ function test() {
       verifyRequestItemTarget(requestItem, "GET", SIMPLE_SJS);
     });
 
     aMonitor.panelWin.once(aMonitor.panelWin.EVENTS.RECEIVED_REQUEST_HEADERS, () => {
       let requestItem = RequestsMenu.getItemAtIndex(0);
 
       ok(requestItem.attachment.requestHeaders,
         "There should be a requestHeaders attachment available.");
-      ok(requestItem.attachment.requestHeaders.headers.length >= 6,
+      is(requestItem.attachment.requestHeaders.headers.length, 8,
         "The requestHeaders attachment has an incorrect |headers| property.");
-      // Can't test for an exact total number of headers, because it seems to
-      // vary across pgo/non-pgo builds.
       isnot(requestItem.attachment.requestHeaders.headersSize, 0,
         "The requestHeaders attachment has an incorrect |headersSize| property.");
       // Can't test for the exact request headers size because the value may
       // vary across platforms ("User-Agent" header differs).
 
       verifyRequestItemTarget(requestItem, "GET", SIMPLE_SJS);
     });
 
@@ -113,19 +111,19 @@ function test() {
       ok(false, "Trap listener: this request doesn't have any post data.")
     });
 
     aMonitor.panelWin.once(aMonitor.panelWin.EVENTS.RECEIVED_RESPONSE_HEADERS, () => {
       let requestItem = RequestsMenu.getItemAtIndex(0);
 
       ok(requestItem.attachment.responseHeaders,
         "There should be a responseHeaders attachment available.");
-      is(requestItem.attachment.responseHeaders.headers.length, 6,
+      is(requestItem.attachment.responseHeaders.headers.length, 9,
         "The responseHeaders attachment has an incorrect |headers| property.");
-      is(requestItem.attachment.responseHeaders.headersSize, 173,
+      is(requestItem.attachment.responseHeaders.headersSize, 255,
         "The responseHeaders attachment has an incorrect |headersSize| property.");
 
       verifyRequestItemTarget(requestItem, "GET", SIMPLE_SJS);
     });
 
     aMonitor.panelWin.once(aMonitor.panelWin.EVENTS.RECEIVED_RESPONSE_COOKIES, () => {
       let requestItem = RequestsMenu.getItemAtIndex(0);
 
@@ -141,17 +139,17 @@ function test() {
       let requestItem = RequestsMenu.getItemAtIndex(0);
 
       is(requestItem.attachment.httpVersion, "HTTP/1.1",
         "The httpVersion attachment has an incorrect value.");
       is(requestItem.attachment.status, "200",
         "The status attachment has an incorrect value.");
       is(requestItem.attachment.statusText, "Och Aye",
         "The statusText attachment has an incorrect value.");
-      is(requestItem.attachment.headersSize, 173,
+      is(requestItem.attachment.headersSize, 255,
         "The headersSize attachment has an incorrect value.");
 
       verifyRequestItemTarget(requestItem, "GET", SIMPLE_SJS, {
         status: "200",
         statusText: "Och Aye"
       });
     });
 
--- a/browser/devtools/netmonitor/test/browser_net_simple-request-details.js
+++ b/browser/devtools/netmonitor/test/browser_net_simple-request-details.js
@@ -58,76 +58,74 @@ function test() {
         "GET", "The method summary value is incorrect.");
       is(tabpanel.querySelector("#headers-summary-status-circle").getAttribute("code"),
         "200", "The status summary code is incorrect.");
       is(tabpanel.querySelector("#headers-summary-status-value").getAttribute("value"),
         "200 Och Aye", "The status summary value is incorrect.");
 
       is(tabpanel.querySelectorAll(".variables-view-scope").length, 2,
         "There should be 2 header scopes displayed in this tabpanel.");
-      ok(tabpanel.querySelectorAll(".variable-or-property").length >= 12,
-        "There should be at least 12 header values displayed in this tabpanel.");
-      // Can't test for an exact total number of headers, because it seems to
-      // vary across pgo/non-pgo builds.
+      is(tabpanel.querySelectorAll(".variable-or-property").length, 17,
+        "There should be 17 header values displayed in this tabpanel.");
 
       is(tabpanel.querySelectorAll(".variables-view-empty-notice").length, 0,
         "The empty notice should not be displayed in this tabpanel.");
 
       let responseScope = tabpanel.querySelectorAll(".variables-view-scope")[0];
       let requestScope = tabpanel.querySelectorAll(".variables-view-scope")[1];
 
       is(responseScope.querySelector(".name").getAttribute("value"),
         L10N.getStr("responseHeaders") + " (" +
-        L10N.getFormatStr("networkMenu.sizeKB", L10N.numberWithDecimals(173/1024, 3)) + ")",
+        L10N.getFormatStr("networkMenu.sizeKB", L10N.numberWithDecimals(255/1024, 3)) + ")",
         "The response headers scope doesn't have the correct title.");
 
       ok(requestScope.querySelector(".name").getAttribute("value").contains(
         L10N.getStr("requestHeaders") + " (0"),
         "The request headers scope doesn't have the correct title.");
       // Can't test for full request headers title because the size may
       // vary across platforms ("User-Agent" header differs). We're pretty
       // sure it's smaller than 1 MB though, so it starts with a 0.
 
       is(responseScope.querySelectorAll(".variables-view-variable .name")[0].getAttribute("value"),
-        "Connection", "The first response header name was incorrect.");
+        "Cache-Control", "The first response header name was incorrect.");
       is(responseScope.querySelectorAll(".variables-view-variable .value")[0].getAttribute("value"),
-        "\"close\"", "The first response header value was incorrect.");
+        "\"no-cache, no-store, must-revalidate\"", "The first response header value was incorrect.");
       is(responseScope.querySelectorAll(".variables-view-variable .name")[1].getAttribute("value"),
-        "Content-Length", "The second response header name was incorrect.");
+        "Connection", "The second response header name was incorrect.");
       is(responseScope.querySelectorAll(".variables-view-variable .value")[1].getAttribute("value"),
-        "\"12\"", "The second response header value was incorrect.");
+        "\"close\"", "The second response header value was incorrect.");
       is(responseScope.querySelectorAll(".variables-view-variable .name")[2].getAttribute("value"),
-        "Content-Type", "The third response header name was incorrect.");
+        "Content-Length", "The third response header name was incorrect.");
       is(responseScope.querySelectorAll(".variables-view-variable .value")[2].getAttribute("value"),
-        "\"text/plain; charset=utf-8\"", "The third response header value was incorrect.");
-      is(responseScope.querySelectorAll(".variables-view-variable .name")[5].getAttribute("value"),
+        "\"12\"", "The third response header value was incorrect.");
+      is(responseScope.querySelectorAll(".variables-view-variable .name")[3].getAttribute("value"),
+        "Content-Type", "The fourth response header name was incorrect.");
+      is(responseScope.querySelectorAll(".variables-view-variable .value")[3].getAttribute("value"),
+        "\"text/plain; charset=utf-8\"", "The fourth response header value was incorrect.");
+      is(responseScope.querySelectorAll(".variables-view-variable .name")[8].getAttribute("value"),
         "foo-bar", "The last response header name was incorrect.");
-      is(responseScope.querySelectorAll(".variables-view-variable .value")[5].getAttribute("value"),
+      is(responseScope.querySelectorAll(".variables-view-variable .value")[8].getAttribute("value"),
         "\"baz\"", "The last response header value was incorrect.");
 
       is(requestScope.querySelectorAll(".variables-view-variable .name")[0].getAttribute("value"),
         "Host", "The first request header name was incorrect.");
       is(requestScope.querySelectorAll(".variables-view-variable .value")[0].getAttribute("value"),
         "\"example.com\"", "The first request header value was incorrect.");
       is(requestScope.querySelectorAll(".variables-view-variable .name")[5].getAttribute("value"),
-        "Connection", "The penultimate request header name was incorrect.");
+        "Connection", "The ante-penultimate request header name was incorrect.");
       is(requestScope.querySelectorAll(".variables-view-variable .value")[5].getAttribute("value"),
-        "\"keep-alive\"", "The penultimate request header value was incorrect.");
-
-      let lastReqHeaderName = requestScope.querySelectorAll(".variables-view-variable .name")[6];
-      let lastReqHeaderValue = requestScope.querySelectorAll(".variables-view-variable .value")[6];
-      if (lastReqHeaderName && lastReqHeaderValue) {
-        is(lastReqHeaderName.getAttribute("value"),
-          "Cache-Control", "The last request header name was incorrect.");
-        is(lastReqHeaderValue.getAttribute("value"),
-          "\"max-age=0\"", "The last request header value was incorrect.");
-      } else {
-        info("The number of request headers was 6 instead of 7. Technically, " +
-             "not a failure in this particular test, but needs investigation.");
-      }
+        "\"keep-alive\"", "The ante-penultimate request header value was incorrect.");
+      is(requestScope.querySelectorAll(".variables-view-variable .name")[6].getAttribute("value"),
+        "Pragma", "The penultimate request header name was incorrect.");
+      is(requestScope.querySelectorAll(".variables-view-variable .value")[6].getAttribute("value"),
+        "\"no-cache\"", "The penultimate request header value was incorrect.");
+      is(requestScope.querySelectorAll(".variables-view-variable .name")[7].getAttribute("value"),
+        "Cache-Control", "The last request header name was incorrect.");
+      is(requestScope.querySelectorAll(".variables-view-variable .value")[7].getAttribute("value"),
+        "\"no-cache\"", "The last request header value was incorrect.");
     }
 
     function testCookiesTab() {
       EventUtils.sendMouseEvent({ type: "mousedown" },
         document.querySelectorAll("#details-pane tab")[1]);
 
       let tab = document.querySelectorAll("#details-pane tab")[1];
       let tabpanel = document.querySelectorAll("#details-pane tabpanel")[1];
--- a/browser/devtools/netmonitor/test/head.js
+++ b/browser/devtools/netmonitor/test/head.js
@@ -92,34 +92,59 @@ function removeTab(aTab, aWindow) {
   info("Removing tab.");
 
   let targetWindow = aWindow || window;
   let targetBrowser = targetWindow.gBrowser;
 
   targetBrowser.removeTab(aTab);
 }
 
+function waitForNavigation(aTarget) {
+  let deferred = promise.defer();
+  aTarget.once("will-navigate", () => {
+    aTarget.once("navigate", () => {
+      deferred.resolve();
+    });
+  });
+  return deferred.promise;
+}
+
+function reconfigureTab(aTarget, aOptions) {
+  let deferred = promise.defer();
+  aTarget.activeTab.reconfigure(aOptions, deferred.resolve);
+  return deferred.promise;
+};
+
+function toggleCache(aTarget, aEnabled) {
+  let options = { cacheEnabled: aEnabled, performReload: true };
+  let navigationFinished = waitForNavigation(aTarget);
+  return reconfigureTab(aTarget, options).then(() => navigationFinished);
+}
+
 function initNetMonitor(aUrl, aWindow) {
   info("Initializing a network monitor pane.");
 
-  return addTab(aUrl).then((aTab) => {
+  return Task.spawn(function*() {
+    let tab = yield addTab(aUrl);
     info("Net tab added successfully: " + aUrl);
 
-    let deferred = promise.defer();
-    let debuggee = aTab.linkedBrowser.contentWindow.wrappedJSObject;
-    let target = TargetFactory.forTab(aTab);
+    let debuggee = tab.linkedBrowser.contentWindow.wrappedJSObject;
+    let target = TargetFactory.forTab(tab);
+
+    yield target.makeRemote();
+    info("Target remoted.");
 
-    gDevTools.showToolbox(target, "netmonitor").then((aToolbox) => {
-      info("Netork monitor pane shown successfully.");
+    yield toggleCache(target, false);
+    info("Network cache disabled");
 
-      let monitor = aToolbox.getCurrentPanel();
-      deferred.resolve([aTab, debuggee, monitor]);
-    });
+    let toolbox = yield gDevTools.showToolbox(target, "netmonitor");
+    info("Netork monitor pane shown successfully.");
 
-    return deferred.promise;
+    let monitor = toolbox.getCurrentPanel();
+    return [tab, debuggee, monitor];
   });
 }
 
 function restartNetMonitor(aMonitor, aNewUrl) {
   info("Restarting the specified network monitor.");
 
   let deferred = promise.defer();
   let tab = aMonitor.target.tab;
--- a/browser/devtools/netmonitor/test/html_content-type-test-page.html
+++ b/browser/devtools/netmonitor/test/html_content-type-test-page.html
@@ -1,15 +1,18 @@
 <!-- Any copyright is dedicated to the Public Domain.
      http://creativecommons.org/publicdomain/zero/1.0/ -->
 <!doctype html>
 
 <html>
   <head>
     <meta charset="utf-8"/>
+    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+    <meta http-equiv="Pragma" content="no-cache" />
+    <meta http-equiv="Expires" content="0" />
     <title>Network Monitor test page</title>
   </head>
 
   <body>
     <p>Content type test</p>
 
     <script type="text/javascript">
       function get(aAddress, aCallback) {
--- a/browser/devtools/netmonitor/test/html_content-type-without-cache-test-page.html
+++ b/browser/devtools/netmonitor/test/html_content-type-without-cache-test-page.html
@@ -1,15 +1,18 @@
 <!-- Any copyright is dedicated to the Public Domain.
      http://creativecommons.org/publicdomain/zero/1.0/ -->
 <!doctype html>
 
 <html>
   <head>
     <meta charset="utf-8"/>
+    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+    <meta http-equiv="Pragma" content="no-cache" />
+    <meta http-equiv="Expires" content="0" />
     <title>Network Monitor test page</title>
   </head>
 
   <body>
     <p>Content type test</p>
 
     <script type="text/javascript">
       function get(aAddress, aCallback) {
--- a/browser/devtools/netmonitor/test/html_copy-as-curl.html
+++ b/browser/devtools/netmonitor/test/html_copy-as-curl.html
@@ -1,15 +1,18 @@
 <!-- Any copyright is dedicated to the Public Domain.
      http://creativecommons.org/publicdomain/zero/1.0/ -->
 <!doctype html>
 
 <html>
   <head>
     <meta charset="utf-8"/>
+    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+    <meta http-equiv="Pragma" content="no-cache" />
+    <meta http-equiv="Expires" content="0" />
     <title>Network Monitor test page</title>
   </head>
 
   <body>
     <p>Performing a GET request</p>
 
     <script type="text/javascript">
       function performRequest(aUrl) {
--- a/browser/devtools/netmonitor/test/html_curl-utils.html
+++ b/browser/devtools/netmonitor/test/html_curl-utils.html
@@ -1,15 +1,18 @@
 <!-- Any copyright is dedicated to the Public Domain.
      http://creativecommons.org/publicdomain/zero/1.0/ -->
 <!doctype html>
 
 <html>
   <head>
     <meta charset="utf-8"/>
+    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+    <meta http-equiv="Pragma" content="no-cache" />
+    <meta http-equiv="Expires" content="0" />
     <title>Network Monitor test page</title>
   </head>
 
   <body>
     <p>Performing requests</p>
 
     <p>
       <canvas width="100" height="100"></canvas>
--- a/browser/devtools/netmonitor/test/html_custom-get-page.html
+++ b/browser/devtools/netmonitor/test/html_custom-get-page.html
@@ -1,15 +1,18 @@
 <!-- Any copyright is dedicated to the Public Domain.
      http://creativecommons.org/publicdomain/zero/1.0/ -->
 <!doctype html>
 
 <html>
   <head>
     <meta charset="utf-8"/>
+    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+    <meta http-equiv="Pragma" content="no-cache" />
+    <meta http-equiv="Expires" content="0" />
     <title>Network Monitor test page</title>
   </head>
 
   <body>
     <p>Performing a custom number of GETs</p>
 
     <script type="text/javascript">
       function get(aAddress, aCallback) {
--- a/browser/devtools/netmonitor/test/html_cyrillic-test-page.html
+++ b/browser/devtools/netmonitor/test/html_cyrillic-test-page.html
@@ -1,15 +1,18 @@
 <!-- Any copyright is dedicated to the Public Domain.
      http://creativecommons.org/publicdomain/zero/1.0/ -->
 <!doctype html>
 
 <html>
   <head>
     <meta charset="utf-8"/>
+    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+    <meta http-equiv="Pragma" content="no-cache" />
+    <meta http-equiv="Expires" content="0" />
     <title>Network Monitor test page</title>
   </head>
 
   <body>
     <p>Cyrillic type test</p>
     <p>Братан, ты вообще качаешься?</p>
 
     <script type="text/javascript">
--- a/browser/devtools/netmonitor/test/html_filter-test-page.html
+++ b/browser/devtools/netmonitor/test/html_filter-test-page.html
@@ -1,15 +1,18 @@
 <!-- Any copyright is dedicated to the Public Domain.
      http://creativecommons.org/publicdomain/zero/1.0/ -->
 <!doctype html>
 
 <html>
   <head>
     <meta charset="utf-8"/>
+    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+    <meta http-equiv="Pragma" content="no-cache" />
+    <meta http-equiv="Expires" content="0" />
     <title>Network Monitor test page</title>
   </head>
 
   <body>
     <p>Filtering test</p>
 
     <script type="text/javascript">
       function get(aAddress, aCallback) {
--- a/browser/devtools/netmonitor/test/html_infinite-get-page.html
+++ b/browser/devtools/netmonitor/test/html_infinite-get-page.html
@@ -1,15 +1,18 @@
 <!-- Any copyright is dedicated to the Public Domain.
      http://creativecommons.org/publicdomain/zero/1.0/ -->
 <!doctype html>
 
 <html>
   <head>
     <meta charset="utf-8"/>
+    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+    <meta http-equiv="Pragma" content="no-cache" />
+    <meta http-equiv="Expires" content="0" />
     <title>Network Monitor test page</title>
   </head>
 
   <body>
     <p>Infinite GETs</p>
 
     <script type="text/javascript">
       function get(aAddress, aCallback) {
--- a/browser/devtools/netmonitor/test/html_json-custom-mime-test-page.html
+++ b/browser/devtools/netmonitor/test/html_json-custom-mime-test-page.html
@@ -1,15 +1,18 @@
 <!-- Any copyright is dedicated to the Public Domain.
      http://creativecommons.org/publicdomain/zero/1.0/ -->
 <!doctype html>
 
 <html>
   <head>
     <meta charset="utf-8"/>
+    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+    <meta http-equiv="Pragma" content="no-cache" />
+    <meta http-equiv="Expires" content="0" />
     <title>Network Monitor test page</title>
   </head>
 
   <body>
     <p>JSONP test</p>
 
     <script type="text/javascript">
       function get(aAddress, aCallback) {
--- a/browser/devtools/netmonitor/test/html_json-long-test-page.html
+++ b/browser/devtools/netmonitor/test/html_json-long-test-page.html
@@ -1,15 +1,18 @@
 <!-- Any copyright is dedicated to the Public Domain.
      http://creativecommons.org/publicdomain/zero/1.0/ -->
 <!doctype html>
 
 <html>
   <head>
     <meta charset="utf-8"/>
+    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+    <meta http-equiv="Pragma" content="no-cache" />
+    <meta http-equiv="Expires" content="0" />
     <title>Network Monitor test page</title>
   </head>
 
   <body>
     <p>JSON long string test</p>
 
     <script type="text/javascript">
       function get(aAddress, aCallback) {
--- a/browser/devtools/netmonitor/test/html_json-malformed-test-page.html
+++ b/browser/devtools/netmonitor/test/html_json-malformed-test-page.html
@@ -1,15 +1,18 @@
 <!-- Any copyright is dedicated to the Public Domain.
      http://creativecommons.org/publicdomain/zero/1.0/ -->
 <!doctype html>
 
 <html>
   <head>
     <meta charset="utf-8"/>
+    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+    <meta http-equiv="Pragma" content="no-cache" />
+    <meta http-equiv="Expires" content="0" />
     <title>Network Monitor test page</title>
   </head>
 
   <body>
     <p>JSON malformed test</p>
 
     <script type="text/javascript">
       function get(aAddress, aCallback) {
--- a/browser/devtools/netmonitor/test/html_json-text-mime-test-page.html
+++ b/browser/devtools/netmonitor/test/html_json-text-mime-test-page.html
@@ -1,15 +1,18 @@
 <!-- Any copyright is dedicated to the Public Domain.
      http://creativecommons.org/publicdomain/zero/1.0/ -->
 <!doctype html>
 
 <html>
   <head>
     <meta charset="utf-8"/>
+    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+    <meta http-equiv="Pragma" content="no-cache" />
+    <meta http-equiv="Expires" content="0" />
     <title>Network Monitor test page</title>
   </head>
 
   <body>
     <p>JSON text test</p>
 
     <script type="text/javascript">
       function get(aAddress, aCallback) {
--- a/browser/devtools/netmonitor/test/html_jsonp-test-page.html
+++ b/browser/devtools/netmonitor/test/html_jsonp-test-page.html
@@ -1,15 +1,18 @@
 <!-- Any copyright is dedicated to the Public Domain.
      http://creativecommons.org/publicdomain/zero/1.0/ -->
 <!doctype html>
 
 <html>
   <head>
     <meta charset="utf-8"/>
+    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+    <meta http-equiv="Pragma" content="no-cache" />
+    <meta http-equiv="Expires" content="0" />
     <title>Network Monitor test page</title>
   </head>
 
   <body>
     <p>JSONP test</p>
 
     <script type="text/javascript">
       function get(aAddress, aCallback) {
--- a/browser/devtools/netmonitor/test/html_navigate-test-page.html
+++ b/browser/devtools/netmonitor/test/html_navigate-test-page.html
@@ -1,15 +1,18 @@
 <!-- Any copyright is dedicated to the Public Domain.
      http://creativecommons.org/publicdomain/zero/1.0/ -->
 <!doctype html>
 
 <html>
   <head>
     <meta charset="utf-8"/>
+    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+    <meta http-equiv="Pragma" content="no-cache" />
+    <meta http-equiv="Expires" content="0" />
     <title>Network Monitor test page</title>
   </head>
 
   <body>
     <p>Navigation test</p>
   </body>
 
 </html>
--- a/browser/devtools/netmonitor/test/html_params-test-page.html
+++ b/browser/devtools/netmonitor/test/html_params-test-page.html
@@ -1,15 +1,18 @@
 <!-- Any copyright is dedicated to the Public Domain.
      http://creativecommons.org/publicdomain/zero/1.0/ -->
 <!doctype html>
 
 <html>
   <head>
     <meta charset="utf-8"/>
+    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+    <meta http-equiv="Pragma" content="no-cache" />
+    <meta http-equiv="Expires" content="0" />
     <title>Network Monitor test page</title>
   </head>
 
   <body>
     <p>Request params type test</p>
 
     <script type="text/javascript">
       function post(aAddress, aQuery, aContentType, aPostBody) {
--- a/browser/devtools/netmonitor/test/html_post-data-test-page.html
+++ b/browser/devtools/netmonitor/test/html_post-data-test-page.html
@@ -1,15 +1,18 @@
 <!-- Any copyright is dedicated to the Public Domain.
      http://creativecommons.org/publicdomain/zero/1.0/ -->
 <!doctype html>
 
 <html>
   <head>
     <meta charset="utf-8"/>
+    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+    <meta http-equiv="Pragma" content="no-cache" />
+    <meta http-equiv="Expires" content="0" />
     <title>Network Monitor test page</title>
     <style>
       input {
         display: block;
         margin: 12px;
       }
     </style>
   </head>
--- a/browser/devtools/netmonitor/test/html_post-raw-test-page.html
+++ b/browser/devtools/netmonitor/test/html_post-raw-test-page.html
@@ -1,15 +1,18 @@
 <!-- Any copyright is dedicated to the Public Domain.
      http://creativecommons.org/publicdomain/zero/1.0/ -->
 <!doctype html>
 
 <html>
   <head>
     <meta charset="utf-8"/>
+    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+    <meta http-equiv="Pragma" content="no-cache" />
+    <meta http-equiv="Expires" content="0" />
     <title>Network Monitor test page</title>
   </head>
 
   <body>
     <p>POST raw test</p>
 
     <script type="text/javascript">
       function post(aAddress, aMessage, aCallback) {
--- a/browser/devtools/netmonitor/test/html_post-raw-with-headers-test-page.html
+++ b/browser/devtools/netmonitor/test/html_post-raw-with-headers-test-page.html
@@ -1,15 +1,18 @@
 <!-- Any copyright is dedicated to the Public Domain.
      http://creativecommons.org/publicdomain/zero/1.0/ -->
 <!doctype html>
 
 <html>
   <head>
     <meta charset="utf-8"/>
+    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+    <meta http-equiv="Pragma" content="no-cache" />
+    <meta http-equiv="Expires" content="0" />
     <title>Network Monitor test page</title>
   </head>
 
   <body>
     <p>POST raw with headers test</p>
 
     <script type="text/javascript">
       function post(aAddress, aMessage, aCallback) {
--- a/browser/devtools/netmonitor/test/html_simple-test-page.html
+++ b/browser/devtools/netmonitor/test/html_simple-test-page.html
@@ -1,15 +1,18 @@
 <!-- Any copyright is dedicated to the Public Domain.
      http://creativecommons.org/publicdomain/zero/1.0/ -->
 <!doctype html>
 
 <html>
   <head>
     <meta charset="utf-8"/>
+    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+    <meta http-equiv="Pragma" content="no-cache" />
+    <meta http-equiv="Expires" content="0" />
     <title>Network Monitor test page</title>
   </head>
 
   <body>
     <p>Simple test</p>
   </body>
 
 </html>
--- a/browser/devtools/netmonitor/test/html_single-get-page.html
+++ b/browser/devtools/netmonitor/test/html_single-get-page.html
@@ -1,15 +1,18 @@
 <!-- Any copyright is dedicated to the Public Domain.
      http://creativecommons.org/publicdomain/zero/1.0/ -->
 <!doctype html>
 
 <html>
   <head>
     <meta charset="utf-8"/>
+    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+    <meta http-equiv="Pragma" content="no-cache" />
+    <meta http-equiv="Expires" content="0" />
     <title>Network Monitor test page</title>
   </head>
 
   <body>
     <p>Performing a custom number of GETs</p>
 
     <script type="text/javascript">
       function get(aAddress, aCallback) {
@@ -20,15 +23,14 @@
           if (this.readyState == this.DONE) {
             aCallback();
           }
         };
         xhr.send(null);
       }
 
       (function performRequests() {
-        get("request_0", function() {
-        });
+        get("request_0", function() {});
       })();
     </script>
   </body>
 
 </html>
--- a/browser/devtools/netmonitor/test/html_sorting-test-page.html
+++ b/browser/devtools/netmonitor/test/html_sorting-test-page.html
@@ -1,15 +1,18 @@
 <!-- Any copyright is dedicated to the Public Domain.
      http://creativecommons.org/publicdomain/zero/1.0/ -->
 <!doctype html>
 
 <html>
   <head>
     <meta charset="utf-8"/>
+    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+    <meta http-equiv="Pragma" content="no-cache" />
+    <meta http-equiv="Expires" content="0" />
     <title>Network Monitor test page</title>
   </head>
 
   <body>
     <p>Sorting test</p>
 
     <script type="text/javascript">
       function get(aAddress, aIndex, aCallback) {
--- a/browser/devtools/netmonitor/test/html_statistics-test-page.html
+++ b/browser/devtools/netmonitor/test/html_statistics-test-page.html
@@ -1,15 +1,18 @@
 <!-- Any copyright is dedicated to the Public Domain.
      http://creativecommons.org/publicdomain/zero/1.0/ -->
 <!doctype html>
 
 <html>
   <head>
     <meta charset="utf-8"/>
+    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+    <meta http-equiv="Pragma" content="no-cache" />
+    <meta http-equiv="Expires" content="0" />
     <title>Network Monitor test page</title>
   </head>
 
   <body>
     <p>Statistics test</p>
 
     <script type="text/javascript">
       function get(aAddress) {
@@ -25,13 +28,13 @@
       get("sjs_content-type-test-server.sjs?sts=304&fmt=js");
       get("sjs_content-type-test-server.sjs?sts=304&fmt=json");
       get("sjs_content-type-test-server.sjs?sts=304&fmt=jsonp");
       get("sjs_content-type-test-server.sjs?sts=304&fmt=font");
       get("sjs_content-type-test-server.sjs?sts=304&fmt=image");
       get("sjs_content-type-test-server.sjs?sts=304&fmt=audio");
       get("sjs_content-type-test-server.sjs?sts=304&fmt=video");
       get("sjs_content-type-test-server.sjs?sts=304&fmt=flash");
-      get("test-image.png");
+      get("test-image.png?v=" + Math.random());
     </script>
   </body>
 
 </html>
--- a/browser/devtools/netmonitor/test/html_status-codes-test-page.html
+++ b/browser/devtools/netmonitor/test/html_status-codes-test-page.html
@@ -1,15 +1,18 @@
 <!-- Any copyright is dedicated to the Public Domain.
      http://creativecommons.org/publicdomain/zero/1.0/ -->
 <!doctype html>
 
 <html>
   <head>
     <meta charset="utf-8"/>
+    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+    <meta http-equiv="Pragma" content="no-cache" />
+    <meta http-equiv="Expires" content="0" />
     <title>Network Monitor test page</title>
   </head>
 
   <body>
     <p>Status codes test</p>
 
     <script type="text/javascript">
       function get(aAddress, aCallback) {
--- a/browser/devtools/netmonitor/test/sjs_content-type-test-server.sjs
+++ b/browser/devtools/netmonitor/test/sjs_content-type-test-server.sjs
@@ -8,18 +8,21 @@ function handleRequest(request, response
 
   let params = request.queryString.split("&");
   let format = (params.filter((s) => s.contains("fmt="))[0] || "").split("=")[1];
   let status = (params.filter((s) => s.contains("sts="))[0] || "").split("=")[1] || 200;
 
   let cachedCount = 0;
   let cacheExpire = 60; // seconds
 
-  function maybeMakeCached() {
+  function setCacheHeaders() {
     if (status != 304) {
+      response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
+      response.setHeader("Pragma", "no-cache");
+      response.setHeader("Expires", "0");
       return;
     }
     // Spice things up a little!
     if (cachedCount % 2) {
       response.setHeader("Cache-Control", "max-age=" + cacheExpire, false);
     } else {
       response.setHeader("Expires", Date(Date.now() + cacheExpire * 1000), false);
     }
@@ -29,154 +32,154 @@ function handleRequest(request, response
   let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
   timer.initWithCallback(() => {
     // to avoid garbage collection
     timer = null;
     switch (format) {
       case "txt": {
         response.setStatusLine(request.httpVersion, status, "DA DA DA");
         response.setHeader("Content-Type", "text/plain", false);
-        maybeMakeCached();
+        setCacheHeaders();
         response.write("Братан, ты вообще качаешься?");
         response.finish();
         break;
       }
       case "xml": {
         response.setStatusLine(request.httpVersion, status, "OK");
         response.setHeader("Content-Type", "text/xml; charset=utf-8", false);
-        maybeMakeCached();
+        setCacheHeaders();
         response.write("<label value='greeting'>Hello XML!</label>");
         response.finish();
         break;
       }
       case "html": {
         let content = params.filter((s) => s.contains("res="))[0].split("=")[1];
         response.setStatusLine(request.httpVersion, status, "OK");
         response.setHeader("Content-Type", "text/html; charset=utf-8", false);
-        maybeMakeCached();
+        setCacheHeaders();
         response.write(content || "<p>Hello HTML!</p>");
         response.finish();
         break;
       }
       case "html-long": {
         let str = new Array(102400 /* 100 KB in bytes */).join(".");
         response.setStatusLine(request.httpVersion, status, "OK");
         response.setHeader("Content-Type", "text/html; charset=utf-8", false);
-        maybeMakeCached();
+        setCacheHeaders();
         response.write("<p>" + str + "</p>");
         response.finish();
         break;
       }
       case "css": {
         response.setStatusLine(request.httpVersion, status, "OK");
         response.setHeader("Content-Type", "text/css; charset=utf-8", false);
-        maybeMakeCached();
+        setCacheHeaders();
         response.write("body:pre { content: 'Hello CSS!' }");
         response.finish();
         break;
       }
       case "js": {
         response.setStatusLine(request.httpVersion, status, "OK");
         response.setHeader("Content-Type", "application/javascript; charset=utf-8", false);
-        maybeMakeCached();
+        setCacheHeaders();
         response.write("function() { return 'Hello JS!'; }");
         response.finish();
         break;
       }
       case "json": {
         response.setStatusLine(request.httpVersion, status, "OK");
         response.setHeader("Content-Type", "application/json; charset=utf-8", false);
-        maybeMakeCached();
+        setCacheHeaders();
         response.write("{ \"greeting\": \"Hello JSON!\" }");
         response.finish();
         break;
       }
       case "jsonp": {
         let fun = params.filter((s) => s.contains("jsonp="))[0].split("=")[1];
         response.setStatusLine(request.httpVersion, status, "OK");
         response.setHeader("Content-Type", "text/json; charset=utf-8", false);
-        maybeMakeCached();
+        setCacheHeaders();
         response.write(fun + "({ \"greeting\": \"Hello JSONP!\" })");
         response.finish();
         break;
       }
       case "jsonp2": {
         let fun = params.filter((s) => s.contains("jsonp="))[0].split("=")[1];
         response.setStatusLine(request.httpVersion, status, "OK");
         response.setHeader("Content-Type", "text/json; charset=utf-8", false);
-        maybeMakeCached();
+        setCacheHeaders();
         response.write(" " + fun + " ( { \"greeting\": \"Hello weird JSONP!\" } ) ; ");
         response.finish();
         break;
       }
       case "json-long": {
         let str = "{ \"greeting\": \"Hello long string JSON!\" },";
         response.setStatusLine(request.httpVersion, status, "OK");
         response.setHeader("Content-Type", "text/json; charset=utf-8", false);
-        maybeMakeCached();
+        setCacheHeaders();
         response.write("[" + new Array(2048).join(str).slice(0, -1) + "]");
         response.finish();
         break;
       }
       case "json-malformed": {
         response.setStatusLine(request.httpVersion, status, "OK");
         response.setHeader("Content-Type", "text/json; charset=utf-8", false);
-        maybeMakeCached();
+        setCacheHeaders();
         response.write("{ \"greeting\": \"Hello malformed JSON!\" },");
         response.finish();
         break;
       }
       case "json-text-mime": {
         response.setStatusLine(request.httpVersion, status, "OK");
         response.setHeader("Content-Type", "text/plain; charset=utf-8", false);
-        maybeMakeCached();
+        setCacheHeaders();
         response.write("{ \"greeting\": \"Hello third-party JSON!\" }");
         response.finish();
         break;
       }
       case "json-custom-mime": {
         response.setStatusLine(request.httpVersion, status, "OK");
         response.setHeader("Content-Type", "text/x-bigcorp-json; charset=utf-8", false);
-        maybeMakeCached();
+        setCacheHeaders();
         response.write("{ \"greeting\": \"Hello oddly-named JSON!\" }");
         response.finish();
         break;
       }
       case "font": {
         response.setStatusLine(request.httpVersion, status, "OK");
         response.setHeader("Content-Type", "font/woff", false);
-        maybeMakeCached();
+        setCacheHeaders();
         response.finish();
         break;
       }
       case "image": {
         response.setStatusLine(request.httpVersion, status, "OK");
         response.setHeader("Content-Type", "image/png", false);
-        maybeMakeCached();
+        setCacheHeaders();
         response.finish();
         break;
       }
       case "audio": {
         response.setStatusLine(request.httpVersion, status, "OK");
         response.setHeader("Content-Type", "audio/ogg", false);
-        maybeMakeCached();
+        setCacheHeaders();
         response.finish();
         break;
       }
       case "video": {
         response.setStatusLine(request.httpVersion, status, "OK");
         response.setHeader("Content-Type", "video/webm", false);
-        maybeMakeCached();
+        setCacheHeaders();
         response.finish();
         break;
       }
       case "flash": {
         response.setStatusLine(request.httpVersion, status, "OK");
         response.setHeader("Content-Type", "application/x-shockwave-flash", false);
-        maybeMakeCached();
+        setCacheHeaders();
         response.finish();
         break;
       }
       default: {
         response.setStatusLine(request.httpVersion, 404, "Not Found");
         response.setHeader("Content-Type", "text/html; charset=utf-8", false);
         response.write("<blink>Not Found</blink>");
         response.finish();
--- a/browser/devtools/netmonitor/test/sjs_simple-test-server.sjs
+++ b/browser/devtools/netmonitor/test/sjs_simple-test-server.sjs
@@ -1,9 +1,14 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 function handleRequest(request, response) {
   response.setStatusLine(request.httpVersion, 200, "Och Aye");
+
+  response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
+  response.setHeader("Pragma", "no-cache");
+  response.setHeader("Expires", "0");
+
   response.setHeader("Content-Type", "text/plain; charset=utf-8", false);
   response.setHeader("Foo-Bar", "baz", false);
   response.write("Hello world!");
 }
--- a/browser/devtools/netmonitor/test/sjs_sorting-test-server.sjs
+++ b/browser/devtools/netmonitor/test/sjs_sorting-test-server.sjs
@@ -9,13 +9,18 @@ function handleRequest(request, response
   let params = request.queryString.split("&");
   let index = params.filter((s) => s.contains("index="))[0].split("=")[1];
 
   let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
   timer.initWithCallback(() => {
     // to avoid garbage collection
     timer = null;
     response.setStatusLine(request.httpVersion, index == 1 ? 101 : index * 100, "Meh");
+
+    response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
+    response.setHeader("Pragma", "no-cache");
+    response.setHeader("Expires", "0");
+
     response.setHeader("Content-Type", "text/" + index, false);
     response.write(new Array(index * 10).join(index)); // + 0.01 KB
     response.finish();
   }, 10, Ci.nsITimer.TYPE_ONE_SHOT); // Make sure this request takes a few ms.
 }
--- a/browser/devtools/netmonitor/test/sjs_status-codes-test-server.sjs
+++ b/browser/devtools/netmonitor/test/sjs_status-codes-test-server.sjs
@@ -25,13 +25,18 @@ function handleRequest(request, response
         break;
       case "400":
         response.setStatusLine(request.httpVersion, 404, "Not Found");
         break;
       case "500":
         response.setStatusLine(request.httpVersion, 501, "Not Implemented");
         break;
     }
+
+    response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
+    response.setHeader("Pragma", "no-cache");
+    response.setHeader("Expires", "0");
+
     response.setHeader("Content-Type", "text/plain; charset=utf-8", false);
     response.write("Hello status code " + status + "!");
     response.finish();
   }, 10, Ci.nsITimer.TYPE_ONE_SHOT); // Make sure this request takes a few ms.
 }