Bug 1144602 - Preconnect test handler should only count 1 syn. r+a=test-only
authorPatrick McManus <mcmanus@ducksong.com>
Fri, 22 May 2015 12:04:50 -0400
changeset 274728 872a53f0dbae0df9fbd56a11b536891c6d9b720e
parent 274727 1642ba0f72b4a14b27f8079d64b82e3501192efe
child 274729 262c4775bdd21101f4f7ed3db90d985bf7029d65
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1144602
milestone40.0a2
Bug 1144602 - Preconnect test handler should only count 1 syn. r+a=test-only
netwerk/test/mochitests/test_rel_preconnect.html
--- a/netwerk/test/mochitests/test_rel_preconnect.html
+++ b/netwerk/test/mochitests/test_rel_preconnect.html
@@ -28,16 +28,17 @@ TestServer.prototype = {
             iid.equals(Ci.nsISupports))
             return this;
         throw Cr.NS_ERROR_NO_INTERFACE;
     },
     onSocketAccepted: function(socket, trans) {
         try { socket.close(); } catch(e) {}
         try { trans.close(); } catch(e) {}
         ok(true, "received connect");
+        srv.listener.close();
         setTimeout(srv.nextTest, 0);
     },
     onStopListening: function(socket) {}
 };
 
 var originalLimit = SpecialPowers.getIntPref("network.http.speculative-parallel-limit");
 
 function testElement()
@@ -49,30 +50,28 @@ function testElement()
   link.rel = "preconnect";
   link.href = "//localhost:" +  srv.listener.port;
   document.head.appendChild(link);
 }
 
 function testHeader()
 {
   // test the http link response header
-  srv.listener.close();
   srv = new TestServer(testDone);
   var xhr = new XMLHttpRequest();
   xhr.open("GET", 'rel_preconnect.sjs', false);
   xhr.setRequestHeader("X-Link", "//localhost:" + srv.listener.port);
   xhr.send();
   is(xhr.status, 200, 'xhr cool');
 }
 
 function testDone()
 {
   SpecialPowers.setIntPref("network.http.speculative-parallel-limit",
                             originalLimit);
-  srv.listener.close();
   SimpleTest.finish();
 }
 
 </script>
 </head>
 <body onload="testElement();">
 <p id="display"></p>
 <div id="content" style="display: none"></div>