Bug 1144715 - Socket might be closed by GC before lower layer failure. r=khuey
authorShih-Chiang Chien <schien@mozilla.com>
Mon, 23 Mar 2015 20:06:00 -0400
changeset 266099 82488f820486adfe49e5ee34a764d3c4a5245fce
parent 266098 ab32e77962e2b18b490aae1e5e201751fbd7e91c
child 266100 7975148c93c9e8a547448b46f47d9e471f79507b
push id830
push userraliiev@mozilla.com
push dateFri, 19 Jun 2015 19:24:37 +0000
treeherdermozilla-release@932614382a68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskhuey
bugs1144715
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 1144715 - Socket might be closed by GC before lower layer failure. r=khuey CLOSED TREE
dom/network/tests/test_udpsocket.html
--- a/dom/network/tests/test_udpsocket.html
+++ b/dom/network/tests/test_udpsocket.html
@@ -269,16 +269,17 @@ function testInvalidUDPOptions() {
 function testOpenFailed() {
   info('test for falied on open');
 
   //according to RFC5737, address block 192.0.2.0/24 should not be used in both local and public contexts
   let socket = new UDPSocket({localAddress: '192.0.2.0'});
 
   return socket.opened.then(function() {
     ok(false, 'should not resolve openedPromise while fail to bind socket');
+    socket.close();
   }).catch(function(reason) {
     is(reason.name, 'NetworkError', 'expected openedPromise to be rejected while fail to bind socket');
   });
 }
 
 function testSendBeforeOpen() {
   info('test for send before open');
 
@@ -286,17 +287,19 @@ function testSendBeforeOpen() {
 
   try {
     socket.send(HELLO_WORLD, '127.0.0.1', 9);
     ok(false, 'unexpect to send successfully');
   } catch (e) {
     ok(true, 'expected send fail before openedPromise is resolved');
   }
 
-  return socket.opened;
+  return socket.opened.then(function() {
+    socket.close();
+  });
 }
 
 function testCloseBeforeOpened() {
   info('test for close socket before opened');
 
   let socket = new UDPSocket();
   socket.opened.then(function() {
     ok(false, 'should not resolve openedPromise if it has already been closed');