Bug 1080130 - Unreferenced socket might be closed before opened. r=khuey, a=test-only
authorShih-Chiang Chien <schien@mozilla.com>
Thu, 19 Mar 2015 18:21:32 +0800
changeset 252104 b6a4dca0edc9
parent 252103 45961b7d67dc
child 252105 d56b6d648c01
push id701
push userryanvm@gmail.com
push date2015-03-25 00:23 +0000
treeherdermozilla-release@7ec23d08cf32 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskhuey, test-only
bugs1080130
milestone37.0
Bug 1080130 - Unreferenced socket might be closed before opened. r=khuey, a=test-only
dom/network/tests/test_udpsocket.html
--- a/dom/network/tests/test_udpsocket.html
+++ b/dom/network/tests/test_udpsocket.html
@@ -319,23 +319,23 @@ function testCloseBeforeOpened() {
   return socket.close().then(function() {
     ok(true, 'expected closedPromise to be resolved');
   }).then(socket.opened);
 }
 
 function testOpenWithoutClose() {
   info('test for open without close');
 
-  let opened = [];
+  let closed = [];
   for (let i = 0; i < 50; i++) {
     let socket = new UDPSocket();
-    opened.push(socket.opened);
+    closed.push(socket.closed);
   }
 
-  return Promise.all(opened);
+  return Promise.all(closed);
 }
 
 function testBFCache() {
   info('test for bfcache behavior');
 
   let socket = new UDPSocket();
 
   return socket.opened.then(function() {
@@ -384,16 +384,20 @@ function runTest() {
   .then(testOpenFailed)
   .then(testSendBeforeOpen)
   .then(testCloseBeforeOpened)
   .then(testOpenWithoutClose)
   .then(testBFCache)
   .then(function() {
     info('test finished');
     SimpleTest.finish();
+  })
+  .catch(function(err) {
+    ok(false, 'test failed due to: ' + err);
+    SimpleTest.finish();
   });
 }
 
 window.addEventListener('load', function () {
   SpecialPowers.pushPermissions([
     {type: 'udp-socket', allow: true, context: document}], function() {
     SpecialPowers.pushPrefEnv({
       'set': [