Commit 394672c4 authored by Andrew Sutherland's avatar Andrew Sutherland
Browse files

Bug 1329245 - Part 3: Don't attempt to connect to closed port on OS X, it's flakey. r=bkelly

--HG--
extra : rebase_source : e7c27185c671f8d2eae81ddfc66318c7fe1a1a31
parent 7cbbdb02
Loading
Loading
Loading
Loading
+17 −7
Original line number Diff line number Diff line
'use strict';

Components.utils.import("resource://gre/modules/Services.jsm");
// Bug 788960 and later bug 1329245 have taught us that attempting to connect to
// a port that is not listening or is no longer listening fails to consistently
// result in the error (or any) event we expect on Darwin/OSX/"OS X".
const isOSX = (Services.appinfo.OS === "Darwin");
const testConnectingToNonListeningPort = !isOSX;

const SERVER_BACKLOG = -1;

const SOCKET_EVENTS = ['open', 'data', 'drain', 'error', 'close'];
@@ -411,6 +418,8 @@ function* test_basics() {
  // we tell it to.
  listeningServer.close();

  // (We don't run this check on OS X where it's flakey; see definition up top.)
  if (testConnectingToNonListeningPort) {
    // - try and connect, get an error
    clientSocket = createSocket('127.0.0.1', serverPort,
                                { binaryType: 'arraybuffer' });
@@ -419,5 +428,6 @@ function* test_basics() {
    is(clientSocket.readyState, 'closed',
       'client readyState should be closed after the failure to connect');
  }
}

add_task(test_basics);