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 266099 d97843a2dbb5
parent 266098 7de1f8e10e19
child 266100 ce664a21fda4
push id4754
push userryanvm@gmail.com
push date2015-05-25 15:15 +0000
treeherdermozilla-beta@8b33b6374feb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1144602
milestone39.0
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>