Bug 932179 - Part 3: Fix intermittent timeout in browser_net_security-state.js. r=vporof
authorSami Jaktholm <sjakthol@outlook.com>
Wed, 07 Jan 2015 09:38:00 +0200
changeset 249086 14d1166ae92bc795a6f4a6aec2a493beeda1f094
parent 249085 7f0b79f1904f19d0fd666d7eb0c5f188bee3a5ae
child 249087 b7cb3b5da58d6966d852f4f0d978933816377d6c
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvporof
bugs932179
milestone37.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 932179 - Part 3: Fix intermittent timeout in browser_net_security-state.js. r=vporof
browser/devtools/netmonitor/test/browser.ini
browser/devtools/netmonitor/test/browser_net_security-details.js
browser/devtools/netmonitor/test/browser_net_security-icon-click.js
browser/devtools/netmonitor/test/browser_net_security-state.js
browser/devtools/netmonitor/test/browser_net_security-tab-deselect.js
browser/devtools/netmonitor/test/browser_net_security-tab-visibility.js
browser/devtools/netmonitor/test/head.js
browser/devtools/netmonitor/test/sjs_cors-test-server.sjs
browser/devtools/netmonitor/test/sjs_https-redirect-test-server.sjs
--- a/browser/devtools/netmonitor/test/browser.ini
+++ b/browser/devtools/netmonitor/test/browser.ini
@@ -21,16 +21,17 @@ support-files =
   html_post-raw-with-headers-test-page.html
   html_simple-test-page.html
   html_sorting-test-page.html
   html_statistics-test-page.html
   html_status-codes-test-page.html
   html_copy-as-curl.html
   html_curl-utils.html
   sjs_content-type-test-server.sjs
+  sjs_cors-test-server.sjs
   sjs_https-redirect-test-server.sjs
   sjs_simple-test-server.sjs
   sjs_sorting-test-server.sjs
   sjs_status-codes-test-server.sjs
   test-image.png
 
 [browser_net_aaa_leaktest.js]
 [browser_net_accessibility-01.js]
--- a/browser/devtools/netmonitor/test/browser_net_security-details.js
+++ b/browser/devtools/netmonitor/test/browser_net_security-details.js
@@ -9,17 +9,17 @@
 
 add_task(function* () {
   let [tab, debuggee, monitor] = yield initNetMonitor(CUSTOM_GET_URL);
   let { $, EVENTS, NetMonitorView } = monitor.panelWin;
   let { RequestsMenu, NetworkDetails } = NetMonitorView;
   RequestsMenu.lazyUpdate = false;
 
   info("Performing a secure request.");
-  debuggee.performRequests(1, "https://example.com");
+  debuggee.performRequests(1, "https://example.com" + CORS_SJS_PATH);
 
   yield waitForNetworkEvents(monitor, 1);
 
   info("Selecting the request.");
   RequestsMenu.selectedIndex = 0;
 
   info("Waiting for details pane to be updated.");
   yield monitor.panelWin.once(EVENTS.TAB_UPDATED);
--- a/browser/devtools/netmonitor/test/browser_net_security-icon-click.js
+++ b/browser/devtools/netmonitor/test/browser_net_security-icon-click.js
@@ -9,20 +9,20 @@
 
 add_task(function* () {
   let [tab, debuggee, monitor] = yield initNetMonitor(CUSTOM_GET_URL);
   let { $, EVENTS, NetMonitorView } = monitor.panelWin;
   let { RequestsMenu, NetworkDetails } = NetMonitorView;
   RequestsMenu.lazyUpdate = false;
 
   info("Requesting a resource over HTTPS.");
-  debuggee.performRequests(1, "https://example.com/request_2");
+  debuggee.performRequests(1, "https://example.com" + CORS_SJS_PATH + "?request_2");
   yield waitForNetworkEvents(monitor, 1);
 
-  debuggee.performRequests(1, "https://example.com/request_1");
+  debuggee.performRequests(1, "https://example.com" + CORS_SJS_PATH + "?request_1");
   yield waitForNetworkEvents(monitor, 1);
 
   is(RequestsMenu.itemCount, 2, "Two events event logged.");
 
   yield clickAndTestSecurityIcon();
 
   info("Selecting headers panel again.");
   NetworkDetails.widget.selectedIndex = 0;
--- a/browser/devtools/netmonitor/test/browser_net_security-state.js
+++ b/browser/devtools/netmonitor/test/browser_net_security-state.js
@@ -57,22 +57,22 @@ add_task(function* () {
     // the request with security issues interfere with waitForNetworkEvents.
     info("Waiting for request to complete.");
     yield done;
 
     // Next perform a request over HTTP. If done the other way around the latter
     // occasionally hangs waiting for event timings that don't seem to appear...
     done = waitForNetworkEvents(monitor, 1);
     info("Requesting a resource over HTTP.");
-    debuggee.performRequests(1, "http://test1.example.com");
+    debuggee.performRequests(1, "http://test1.example.com" + CORS_SJS_PATH);
     yield done;
 
     done = waitForNetworkEvents(monitor, 1);
     info("Requesting a resource over HTTPS.");
-    debuggee.performRequests(1, "https://example.com");
+    debuggee.performRequests(1, "https://example.com" + CORS_SJS_PATH);
     yield done;
 
     is(RequestsMenu.itemCount, 3, "Three events logged.");
   }
 
   /**
    * Returns a promise that's resolved once a request with security issues is
    * completed.
--- a/browser/devtools/netmonitor/test/browser_net_security-tab-deselect.js
+++ b/browser/devtools/netmonitor/test/browser_net_security-tab-deselect.js
@@ -10,18 +10,18 @@
 
 add_task(function* () {
   let [tab, debuggee, monitor] = yield initNetMonitor(CUSTOM_GET_URL);
   let { $, EVENTS, NetMonitorView } = monitor.panelWin;
   let { RequestsMenu, NetworkDetails } = NetMonitorView;
   RequestsMenu.lazyUpdate = false;
 
   info("Performing requests.");
-  debuggee.performRequests(1, "https://example.com");
-  debuggee.performRequests(1, "http://example.com");
+  debuggee.performRequests(1, "https://example.com" + CORS_SJS_PATH);
+  debuggee.performRequests(1, "http://example.com" + CORS_SJS_PATH);
   yield waitForNetworkEvents(monitor, 2);
 
   info("Selecting secure request.");
   RequestsMenu.selectedIndex = 0;
 
   info("Selecting security tab.");
   NetworkDetails.widget.selectedIndex = 5;
 
--- a/browser/devtools/netmonitor/test/browser_net_security-tab-visibility.js
+++ b/browser/devtools/netmonitor/test/browser_net_security-tab-visibility.js
@@ -6,23 +6,23 @@
 /**
  * Test that security details tab is visible only when it should.
  */
 
 add_task(function* () {
   const TEST_DATA = [
     {
       desc: "http request",
-      uri: "http://example.com",
+      uri: "http://example.com" + CORS_SJS_PATH,
       visibleOnNewEvent: false,
       visibleOnSecurityInfo: false,
       visibleOnceComplete: false,
     }, {
       desc: "working https request",
-      uri: "https://example.com",
+      uri: "https://example.com" + CORS_SJS_PATH,
       visibleOnNewEvent: false,
       visibleOnSecurityInfo: true,
       visibleOnceComplete: true,
     }, {
       desc: "broken https request",
       uri: "https://nocert.example.com",
       isBroken: true,
       visibleOnNewEvent: false,
--- a/browser/devtools/netmonitor/test/head.js
+++ b/browser/devtools/netmonitor/test/head.js
@@ -39,16 +39,17 @@ const STATISTICS_URL = EXAMPLE_URL + "ht
 const CURL_URL = EXAMPLE_URL + "html_copy-as-curl.html";
 const CURL_UTILS_URL = EXAMPLE_URL + "html_curl-utils.html";
 
 const SIMPLE_SJS = EXAMPLE_URL + "sjs_simple-test-server.sjs";
 const CONTENT_TYPE_SJS = EXAMPLE_URL + "sjs_content-type-test-server.sjs";
 const STATUS_CODES_SJS = EXAMPLE_URL + "sjs_status-codes-test-server.sjs";
 const SORTING_SJS = EXAMPLE_URL + "sjs_sorting-test-server.sjs";
 const HTTPS_REDIRECT_SJS = EXAMPLE_URL + "sjs_https-redirect-test-server.sjs";
+const CORS_SJS_PATH = "/browser/browser/devtools/netmonitor/test/sjs_cors-test-server.sjs";
 
 const TEST_IMAGE = EXAMPLE_URL + "test-image.png";
 const TEST_IMAGE_DATA_URI = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAHWSURBVHjaYvz//z8DJQAggJiQOe/fv2fv7Oz8rays/N+VkfG/iYnJfyD/1+rVq7ffu3dPFpsBAAHEAHIBCJ85c8bN2Nj4vwsDw/8zQLwKiO8CcRoQu0DxqlWrdsHUwzBAAIGJmTNnPgYa9j8UqhFElwPxf2MIDeIrKSn9FwSJoRkAEEAM0DD4DzMAyPi/G+QKY4hh5WAXGf8PDQ0FGwJ22d27CjADAAIIrLmjo+MXA9R2kAHvGBA2wwx6B8W7od6CeQcggKCmCEL8bgwxYCbUIGTDVkHDBia+CuotgACCueD3TDQN75D4xmAvCoK9ARMHBzAw0AECiBHkAlC0Mdy7x9ABNA3obAZXIAa6iKEcGlMVQHwWyjYuL2d4v2cPg8vZswx7gHyAAAK7AOif7SAbOqCmn4Ha3AHFsIDtgPq/vLz8P4MSkJ2W9h8ggBjevXvHDo4FQUQg/kdypqCg4H8lUIACnQ/SOBMYI8bAsAJFPcj1AAEEjwVQqLpAbXmH5BJjqI0gi9DTAAgDBBCcAVLkgmQ7yKCZxpCQxqUZhAECCJ4XgMl493ug21ZD+aDAXH0WLM4A9MZPXJkJIIAwTAR5pQMalaCABQUULttBGCCAGCnNzgABBgAMJ5THwGvJLAAAAABJRU5ErkJggg==";
 
 gDevTools.testing = true;
 SimpleTest.registerCleanupFunction(() => {
   gDevTools.testing = false;
 });
new file mode 100644
--- /dev/null
+++ b/browser/devtools/netmonitor/test/sjs_cors-test-server.sjs
@@ -0,0 +1,16 @@
+/* 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("Access-Control-Allow-Origin", "*", false);
+
+  response.setHeader("Content-Type", "text/plain; charset=utf-8", false);
+
+  response.write("Access-Control-Allow-Origin: *");
+}
--- a/browser/devtools/netmonitor/test/sjs_https-redirect-test-server.sjs
+++ b/browser/devtools/netmonitor/test/sjs_https-redirect-test-server.sjs
@@ -1,16 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 function handleRequest(request, response) {
   response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
   response.setHeader("Pragma", "no-cache");
   response.setHeader("Expires", "0");
 
+  response.setHeader("Access-Control-Allow-Origin", "*", false);
 
   if (request.scheme === "http") {
     response.setStatusLine(request.httpVersion, 302, "Found");
     response.setHeader("Location", "https://" + request.host + request.path);
   } else {
     response.setStatusLine(request.httpVersion, 200, "OK");
     response.write("Page was accessed over HTTPS!");
   }