Bug 1115222 - Only call performTest once the appropriate load event is received for webconsole response header test;r=past
authorBrian Grinstead <bgrinstead@mozilla.com>
Wed, 07 Jan 2015 09:16:12 -0800
changeset 239208 1bc77d8c8681293b7baed676753f16e691dc0bd4
parent 239207 d350cd94c55177c0abe93c4f88aa76765d355cd7
child 239209 4118e045b464d00cbaa2634d5d3d7332c6b62e25
push id7472
push userraliiev@mozilla.com
push dateMon, 12 Jan 2015 20:36:27 +0000
treeherdermozilla-aurora@300ca104f8fb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspast
bugs1115222
milestone37.0a1
Bug 1115222 - Only call performTest once the appropriate load event is received for webconsole response header test;r=past
browser/devtools/webconsole/test/browser_webconsole_bug_599725_response_headers.js
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_599725_response_headers.js
+++ b/browser/devtools/webconsole/test/browser_webconsole_bug_599725_response_headers.js
@@ -11,22 +11,16 @@
 const INIT_URI = "data:text/plain;charset=utf8,hello world";
 const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-599725-response-headers.sjs";
 
 let loads = 0;
 function performTest(aRequest, aConsole)
 {
   let deferred = promise.defer();
 
-  loads++;
-  ok(aRequest, "page load was logged");
-  if (loads != 2) {
-    return;
-  }
-
   let headers = null;
 
   function readHeader(aName)
   {
     for (let header of headers) {
       if (header.name == aName) {
         return header.value;
       }
@@ -59,16 +53,21 @@ function performTest(aRequest, aConsole)
   HUDService.lastFinishedRequest.callback = null;
 
   return deferred.promise;
 }
 
 function waitForRequest() {
   let deferred = promise.defer();
   HUDService.lastFinishedRequest.callback = (req, console) => {
+    loads++;
+    ok(req, "page load was logged");
+    if (loads != 2) {
+      return;
+    }
     performTest(req, console).then(deferred.resolve);
   };
   return deferred.promise;
 }
 
 let test = asyncTest(function* () {
   let { browser } = yield loadTab(INIT_URI);