Bug 1080130 - unreferenced socket might be closed before opened. r=khuey.
authorShih-Chiang Chien <schien@mozilla.com>
Thu, 19 Mar 2015 18:21:32 +0800
changeset 263895 00cab360dc106f6bf83fb0488c35c5482f4bff85
parent 263894 b5d1278ee01b0d09ad76e523c324901973f94d8f
child 263896 cf9b6a1d22a4dda97c89f44cf7736bb2819584db
push id4718
push userraliiev@mozilla.com
push dateMon, 11 May 2015 18:39:53 +0000
treeherdermozilla-beta@c20c4ef55f08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskhuey
bugs1080130
milestone39.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1080130 - unreferenced socket might be closed before opened. r=khuey.
dom/network/tests/test_udpsocket.html
--- a/dom/network/tests/test_udpsocket.html
+++ b/dom/network/tests/test_udpsocket.html
@@ -307,23 +307,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() {
@@ -372,16 +372,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': [