Bug 867992 - Fix for intermittent browser_webconsole_bug_630733_response_redirect_headers.js | Timed out while waiting for: 301 and 404 responses. a=test-only
authorMihai Sucan <mihai.sucan@gmail.com>
Thu, 16 Jan 2014 14:43:57 +0200
changeset 167955 33e1556c7b0d1d884fa8070b7dd5673532d8423f
parent 167954 94895bef7698a76ba569167e3873cda046025f0e
child 167956 496971f341284757e087f6e27b6343914743e1e5
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstest-only
bugs867992
milestone27.0
Bug 867992 - Fix for intermittent browser_webconsole_bug_630733_response_redirect_headers.js | Timed out while waiting for: 301 and 404 responses. a=test-only
browser/devtools/webconsole/test/browser_webconsole_bug_630733_response_redirect_headers.js
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_630733_response_redirect_headers.js
+++ b/browser/devtools/webconsole/test/browser_webconsole_bug_630733_response_redirect_headers.js
@@ -7,44 +7,36 @@
  *   Mihai Sucan <mihai.sucan@gmail.com>
  */
 
 const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-630733-response-redirect-headers.sjs";
 
 let lastFinishedRequests = {};
 let webConsoleClient;
 
-function requestDoneCallback(aHttpRequest )
-{
-  let status = aHttpRequest.response.status;
-  lastFinishedRequests[status] = aHttpRequest;
-}
-
 function consoleOpened(hud)
 {
   webConsoleClient = hud.ui.webConsoleClient;
   hud.ui.setSaveRequestAndResponseBodies(true).then(() => {
     ok(hud.ui._saveRequestAndResponseBodies,
       "The saveRequestAndResponseBodies property was successfully set.");
 
     HUDService.lastFinishedRequest.callback = requestDoneCallback;
-    waitForSuccess(waitForResponses);
     content.location = TEST_URI;
   });
+}
 
-  let waitForResponses = {
-    name: "301 and 404 responses",
-    validatorFn: function()
-    {
-      return "301" in lastFinishedRequests &&
-             "404" in lastFinishedRequests;
-    },
-    successFn: getHeaders,
-    failureFn: finishTest,
-  };
+function requestDoneCallback(aHttpRequest)
+{
+  let status = aHttpRequest.response.status;
+  lastFinishedRequests[status] = aHttpRequest;
+  if ("301" in lastFinishedRequests &&
+      "404" in lastFinishedRequests) {
+    getHeaders();
+  }
 }
 
 function getHeaders()
 {
   HUDService.lastFinishedRequest.callback = null;
 
   ok("301" in lastFinishedRequests, "request 1: 301 Moved Permanently");
   ok("404" in lastFinishedRequests, "request 2: 404 Not found");