Backed out changeset 5a9277de75b3 (bug 1188435) for test failures in test_devtools_serviceworker_interception.html | undefined assertion name
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Tue, 25 Apr 2017 16:32:26 +0200
changeset 402943 fbac633e3a8fb9cc02da9bbe7ec7f64acdd8a625
parent 402942 f59a72936f726643b20454bc08e0879a2a9978bc
child 402944 5046bec1e8ea53cf799129d1e703553e71d56476
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1188435
milestone55.0a1
backs out5a9277de75b3bb9af329350728c153c5fad1dabf
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
Backed out changeset 5a9277de75b3 (bug 1188435) for test failures in test_devtools_serviceworker_interception.html | undefined assertion name
modules/libpref/init/all.js
netwerk/base/TCPFastOpen.h
netwerk/base/TCPFastOpenLayer.cpp
netwerk/base/TCPFastOpenLayer.h
netwerk/base/moz.build
netwerk/base/nsChannelClassifier.cpp
netwerk/base/nsChannelClassifier.h
netwerk/base/nsISocketTransport.idl
netwerk/base/nsSocketTransport2.cpp
netwerk/base/nsSocketTransport2.h
netwerk/base/nsSyncStreamListener.cpp
netwerk/protocol/http/TunnelUtils.cpp
netwerk/protocol/http/moz.build
netwerk/protocol/http/nsAHttpTransaction.h
netwerk/protocol/http/nsHttpConnection.cpp
netwerk/protocol/http/nsHttpConnection.h
netwerk/protocol/http/nsHttpConnectionMgr.cpp
netwerk/protocol/http/nsHttpConnectionMgr.h
netwerk/protocol/http/nsHttpHandler.cpp
netwerk/protocol/http/nsHttpHandler.h
netwerk/protocol/http/nsHttpTransaction.cpp
netwerk/protocol/http/nsHttpTransaction.h
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -4606,19 +4606,16 @@ pref("network.tcp.keepalive.idle_time", 
 pref("network.tcp.keepalive.retry_interval", 1); // seconds
 #endif
 // Default maximum probe retransmissions.
 // Linux only; not configurable on Win and Mac; fixed at 10 and 8 respectively.
 #if defined(XP_UNIX) && !defined(XP_MACOSX)
 pref("network.tcp.keepalive.probe_count", 4);
 #endif
 
-pref("network.tcp.tcp_fastopen_enable", true);
-pref("network.tcp.tcp_fastopen_consecutive_failure_limit", 5);
-
 // Whether to disable acceleration for all widgets.
 pref("layers.acceleration.disabled", false);
 // Preference that when switched at runtime will run a series of benchmarks
 // and output the result to stderr.
 pref("layers.bench.enabled", false);
 
 #if defined(XP_WIN)
 pref("layers.gpu-process.enabled", true);
deleted file mode 100644
--- a/netwerk/base/TCPFastOpen.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef TCPFASTOPEN_H__
-#define TCPFASTOPEN_H__
-
-/**
-  * This is an abstract class for TCP Fast Open - TFO (RFC7413).
-  * It is not always safe to use Fast Open. It can be use for requests that
-  * are replayable.
-  * Middle boxes can block or reset connections that use TFO, therefore a
-  * backup connection will be prepared with a delay.
-  * In case of blocking such a connection tcp socket will terminate only after
-  * a timeout, therefore a backup connection is needed. If connection is refuse
-  * the same socketTransport will retry.
-  *
-  * This is implemented by nsHalfopenSocket.
-  **/
-
-namespace mozilla {
-namespace net {
-
-class TCPFastOpen
-{
-public:
-
-  // Check if we have a transaction that is safe to be used with TFO.
-  // Connections over TLS are always safe and some http requests (e.g. GET).
-  virtual bool FastOpenEnabled() = 0;
-  // To use TFO we need to have a transaction prepared, e.g. also have
-  // nsHttpConnection ready. This functions is call by nsSocketTransport to
-  // setup a connection.
-  virtual nsresult StartFastOpen() = 0;
-  // Inform nsHalfopenSocket whether a connection using TFO succeeded or not.
-  // This will cancel the backup connection and in case of a failure rewind
-  // the transaction.
-  virtual void FastOpenConnected(nsresult error) = 0;
-  virtual void FastOpenNotSupported() = 0;
-};
-
-}
-}
-
-#endif //TCPFASTOPEN_H__
deleted file mode 100644
--- a/netwerk/base/TCPFastOpenLayer.cpp
+++ /dev/null
@@ -1,303 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et cindent: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "TCPFastOpenLayer.h"
-#include "nsSocketTransportService2.h"
-#include "prmem.h"
-#include "prio.h"
-
-namespace mozilla {
-namespace net {
-
-static PRDescIdentity sTCPFastOpenLayerIdentity;
-static PRIOMethods    sTCPFastOpenLayerMethods;
-static PRIOMethods   *sTCPFastOpenLayerMethodsPtr = nullptr;
-
-class TCPFastOpenSecret
-{
-public:
-  TCPFastOpenSecret()
-    : mState(WAITING_FOR_CONNECT)
-    , mConnectResult(0)
-    , mFastOpenNotSupported(false)
-  {}
-
-  enum {
-    CONNECTED,
-    WAITING_FOR_CONNECTCONTINUE,
-    WAITING_FOR_FIRST_SEND,
-    WAITING_FOR_CONNECT
-  } mState;
-  PRNetAddr mAddr;
-  PRErrorCode mConnectResult;
-  bool mFastOpenNotSupported;
-};
-
-static PRStatus
-TCPFastOpenConnect(PRFileDesc *fd, const PRNetAddr *addr,
-                   PRIntervalTime timeout)
-{
-  MOZ_RELEASE_ASSERT(fd->identity == sTCPFastOpenLayerIdentity);
-  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
-
-  TCPFastOpenSecret *secret = reinterpret_cast<TCPFastOpenSecret *>(fd->secret);
-
-  SOCKET_LOG(("TCPFastOpenConnect state=%d.\n", secret->mState));
-
-  if (secret->mState != TCPFastOpenSecret::WAITING_FOR_CONNECT) {
-    PR_SetError(PR_IS_CONNECTED_ERROR, 0);
-    return PR_FAILURE;
-  }
-
-  // Remember the address we will call PR_Sendto and for that we need
-  // the address.
-  memcpy(&secret->mAddr, addr, sizeof(secret->mAddr));
-  secret->mState = TCPFastOpenSecret::WAITING_FOR_FIRST_SEND;
-
-  return PR_SUCCESS;
-}
-
-static PRInt32
-TCPFastOpenSend(PRFileDesc *fd, const void *buf, PRInt32 amount,
-                PRIntn flags, PRIntervalTime timeout)
-{
-  MOZ_RELEASE_ASSERT(fd->identity == sTCPFastOpenLayerIdentity);
-  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
-
-  TCPFastOpenSecret *secret = reinterpret_cast<TCPFastOpenSecret *>(fd->secret);
-
-  SOCKET_LOG(("TCPFastOpenSend state=%d.\n", secret->mState));
-
-  switch(secret->mState) {
-  case TCPFastOpenSecret::CONNECTED:
-    return (fd->lower->methods->send)(fd->lower, buf, amount, flags, timeout);
-  case TCPFastOpenSecret::WAITING_FOR_CONNECTCONTINUE:
-    PR_SetError(PR_WOULD_BLOCK_ERROR, 0);
-    return -1;
-  case TCPFastOpenSecret::WAITING_FOR_FIRST_SEND:
-    {
-      PRInt32 rv = (fd->lower->methods->sendto)(fd->lower, buf, amount, flags,
-                                                &secret->mAddr, timeout);
-
-      SOCKET_LOG(("TCPFastOpenSend - sendto result=%d.\n", rv));
-      if (rv > -1) {
-        secret->mState = TCPFastOpenSecret::WAITING_FOR_CONNECTCONTINUE;
-        secret->mConnectResult = PR_IN_PROGRESS_ERROR;
-        return rv;
-      }
-
-      secret->mConnectResult = PR_GetError();
-      SOCKET_LOG(("TCPFastOpenSend - sendto error=%d.\n",
-                  secret->mConnectResult));
-
-      if (secret->mConnectResult == PR_IS_CONNECTED_ERROR) {
-        secret->mState = TCPFastOpenSecret::CONNECTED;
-
-      } else if (secret->mConnectResult == PR_IN_PROGRESS_ERROR) {
-        secret->mState = TCPFastOpenSecret::WAITING_FOR_CONNECTCONTINUE;
-
-      } else if (secret->mConnectResult == PR_NOT_IMPLEMENTED_ERROR || // When a windows version does not support Fast Open it will return this error.
-                 secret->mConnectResult == PR_NOT_TCP_SOCKET_ERROR) { // SendTo will return PR_NOT_TCP_SOCKET_ERROR if TCP Fast Open is turned off on Linux.
-        // We can call connect again.
-        secret->mFastOpenNotSupported = true;
-        rv = (fd->lower->methods->connect)(fd->lower, &secret->mAddr, timeout);
-
-        if (rv == PR_SUCCESS) {
-          secret->mConnectResult = PR_IS_CONNECTED_ERROR;
-          secret->mState = TCPFastOpenSecret::CONNECTED;
-
-        } else {
-          secret->mConnectResult = PR_GetError();
-          secret->mState = TCPFastOpenSecret::WAITING_FOR_CONNECTCONTINUE;
-
-        }
-      }
-
-      // Error will be picked up by TCPFastOpenConnectResult.
-      PR_SetError(PR_WOULD_BLOCK_ERROR, 0);
-      return -1;
-    }
-  case TCPFastOpenSecret::WAITING_FOR_CONNECT:
-    PR_SetError(PR_NOT_CONNECTED_ERROR, 0);
-    return -1;
-  }
-  PR_SetError(PR_WOULD_BLOCK_ERROR, 0);
-  return PR_FAILURE;
-}
-
-static PRInt32
-TCPFastOpenWrite(PRFileDesc *fd, const void *buf, PRInt32 amount)
-{
-  return TCPFastOpenSend(fd, buf, amount, 0, PR_INTERVAL_NO_WAIT);
-}
-
-static PRInt32
-TCPFastOpenRecv(PRFileDesc *fd, void *buf, PRInt32 amount,
-                PRIntn flags, PRIntervalTime timeout)
-{
-  MOZ_RELEASE_ASSERT(fd->identity == sTCPFastOpenLayerIdentity);
-
-  TCPFastOpenSecret *secret = reinterpret_cast<TCPFastOpenSecret *>(fd->secret);
-
-  PRInt32 rv = -1;
-  switch(secret->mState) {
-  case TCPFastOpenSecret::CONNECTED:
-    rv = (fd->lower->methods->recv)(fd->lower, buf, amount, flags, timeout);
-    break;
-  case TCPFastOpenSecret::WAITING_FOR_CONNECTCONTINUE:
-  case TCPFastOpenSecret::WAITING_FOR_FIRST_SEND:
-    PR_SetError(PR_WOULD_BLOCK_ERROR, 0);
-    break;
-  case TCPFastOpenSecret::WAITING_FOR_CONNECT:
-    PR_SetError(PR_NOT_CONNECTED_ERROR, 0);
-  }
-  return rv;
-}
-
-static PRInt32
-TCPFastOpenRead(PRFileDesc *fd, void *buf, PRInt32 amount)
-{
-  return TCPFastOpenRecv(fd, buf, amount , 0, PR_INTERVAL_NO_WAIT);
-}
-
-static PRStatus
-TCPFastOpenConnectContinue(PRFileDesc *fd, PRInt16 out_flags)
-{
-  MOZ_RELEASE_ASSERT(fd->identity == sTCPFastOpenLayerIdentity);
-
-  TCPFastOpenSecret *secret = reinterpret_cast<TCPFastOpenSecret *>(fd->secret);
-
-  PRStatus rv = PR_FAILURE;
-  switch(secret->mState) {
-  case TCPFastOpenSecret::CONNECTED:
-    rv = PR_SUCCESS;
-    break;
-  case TCPFastOpenSecret::WAITING_FOR_CONNECT:
-  case TCPFastOpenSecret::WAITING_FOR_FIRST_SEND:
-    PR_SetError(PR_NOT_CONNECTED_ERROR, 0);
-    rv = PR_FAILURE;
-    break;
-  case TCPFastOpenSecret::WAITING_FOR_CONNECTCONTINUE:
-    rv = (fd->lower->methods->connectcontinue)(fd->lower, out_flags);
-
-    SOCKET_LOG(("TCPFastOpenConnectContinue result=%d.\n", rv));
-    if (rv == PR_SUCCESS) {
-      secret->mState = TCPFastOpenSecret::CONNECTED;
-    }
-  }
-  return rv;
-}
-
-static PRStatus
-TCPFastOpenClose(PRFileDesc *fd)
-{
-  if (!fd) {
-    return PR_FAILURE;
-  }
-
-  PRFileDesc* layer = PR_PopIOLayer(fd, PR_TOP_IO_LAYER);
-
-  MOZ_RELEASE_ASSERT(layer &&
-                     layer->identity == sTCPFastOpenLayerIdentity,
-                     "TCP Fast Open Layer not on top of stack");
-
-  TCPFastOpenSecret *secret = reinterpret_cast<TCPFastOpenSecret *>(layer->secret);
-  layer->secret = nullptr;
-  layer->dtor(layer);
-  delete secret;
-  return fd->methods->close(fd);
-}
-
-static PRStatus
-TCPFastOpenGetpeername (PRFileDesc *fd, PRNetAddr *addr)
-{
-  MOZ_RELEASE_ASSERT(fd);
-  MOZ_RELEASE_ASSERT(addr);
-
-  MOZ_RELEASE_ASSERT(fd->identity == sTCPFastOpenLayerIdentity);
-
-  TCPFastOpenSecret *secret = reinterpret_cast<TCPFastOpenSecret *>(fd->secret);
-  if (secret->mState == TCPFastOpenSecret::WAITING_FOR_CONNECT) {
-    PR_SetError(PR_NOT_CONNECTED_ERROR, 0);
-    return PR_FAILURE;
-  }
-
-  memcpy(addr, &secret->mAddr, sizeof(secret->mAddr));
-  return PR_SUCCESS;
-}
-
-nsresult
-AttachTCPFastOpenIOLayer(PRFileDesc *fd)
-{
-  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
-
-  if (!sTCPFastOpenLayerMethodsPtr) {
-    sTCPFastOpenLayerIdentity = PR_GetUniqueIdentity("TCPFastOpen Layer");
-    sTCPFastOpenLayerMethods = *PR_GetDefaultIOMethods();
-    sTCPFastOpenLayerMethods.connect = TCPFastOpenConnect;
-    sTCPFastOpenLayerMethods.send = TCPFastOpenSend;
-    sTCPFastOpenLayerMethods.write = TCPFastOpenWrite;
-    sTCPFastOpenLayerMethods.recv = TCPFastOpenRecv;
-    sTCPFastOpenLayerMethods.read = TCPFastOpenRead;
-    sTCPFastOpenLayerMethods.connectcontinue = TCPFastOpenConnectContinue;
-    sTCPFastOpenLayerMethods.close = TCPFastOpenClose;
-    sTCPFastOpenLayerMethods.getpeername = TCPFastOpenGetpeername;
-    sTCPFastOpenLayerMethodsPtr = &sTCPFastOpenLayerMethods;
-  }
-
-  PRFileDesc *layer = PR_CreateIOLayerStub(sTCPFastOpenLayerIdentity,
-                                           sTCPFastOpenLayerMethodsPtr);
-
-  if (!layer) {
-    return NS_ERROR_FAILURE;
-  }
-
-  TCPFastOpenSecret *secret = new TCPFastOpenSecret();
-
-  layer->secret = reinterpret_cast<PRFilePrivate *>(secret);
-
-  PRStatus status = PR_PushIOLayer(fd, PR_NSPR_IO_LAYER, layer);
-
-  if (status == PR_FAILURE) {
-    delete secret;
-    PR_DELETE(layer);
-    return NS_ERROR_FAILURE;
-  }
-  return NS_OK;
-}
-
-void
-TCPFastOpenConnectResult(PRFileDesc * fd, PRErrorCode *err,
-                         bool *fastOpenNotSupported)
-{
-  PRFileDesc *tfoFd = PR_GetIdentitiesLayer(fd, sTCPFastOpenLayerIdentity);
-  MOZ_RELEASE_ASSERT(tfoFd);
-  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
-
-  TCPFastOpenSecret *secret = reinterpret_cast<TCPFastOpenSecret *>(tfoFd->secret);
-
-  MOZ_ASSERT(secret->mState != TCPFastOpenSecret::WAITING_FOR_CONNECT);
-
-  *fastOpenNotSupported = secret->mFastOpenNotSupported;
-
-  if (secret->mState == TCPFastOpenSecret::WAITING_FOR_FIRST_SEND) {
-    // Because of the way our HttpTransaction dispatch work, it can happened
-    // that connect is not called.
-    PRInt32 rv = (tfoFd->lower->methods->connect)(tfoFd->lower, &secret->mAddr,
-                                               PR_INTERVAL_NO_WAIT);
-    if (rv == PR_SUCCESS) {
-      secret->mConnectResult = PR_IS_CONNECTED_ERROR;
-      secret->mState = TCPFastOpenSecret::CONNECTED;
-    } else {
-      secret->mConnectResult = PR_GetError();
-      secret->mState = TCPFastOpenSecret::WAITING_FOR_CONNECTCONTINUE;
-    }
-  }
-  *err = secret->mConnectResult;
-}
-
-}
-}
deleted file mode 100644
--- a/netwerk/base/TCPFastOpenLayer.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et cindent: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef TCPFastOpenLayer_h__
-#define TCPFastOpenLayer_h__
-
-#include "prerror.h"
-
-namespace mozilla {
-namespace net {
-
-nsresult AttachTCPFastOpenIOLayer(PRFileDesc *fd);
-
-// Get the result of TCP Fast Open.
-void TCPFastOpenConnectResult(PRFileDesc *fd, PRErrorCode *err,
-                              bool *fastOpenNotSupported);
-
-}
-}
-
-#endif // TCPFastOpenLayer_h__
--- a/netwerk/base/moz.build
+++ b/netwerk/base/moz.build
@@ -173,17 +173,16 @@ EXPORTS.mozilla.net += [
     'CaptivePortalService.h',
     'ChannelDiverterChild.h',
     'ChannelDiverterParent.h',
     'Dashboard.h',
     'DashboardTypes.h',
     'MemoryDownloader.h',
     'Predictor.h',
     'ReferrerPolicy.h',
-    'TCPFastOpen.h',
 ]
 
 UNIFIED_SOURCES += [
     'ArrayBufferInputStream.cpp',
     'BackgroundFileSaver.cpp',
     'CaptivePortalService.cpp',
     'ChannelDiverterChild.cpp',
     'ChannelDiverterParent.cpp',
@@ -243,17 +242,16 @@ UNIFIED_SOURCES += [
     'PollableEvent.cpp',
     'Predictor.cpp',
     'ProxyAutoConfig.cpp',
     'RedirectChannelRegistrar.cpp',
     'RequestContextService.cpp',
     'SimpleBuffer.cpp',
     'SimpleChannel.cpp',
     'StreamingProtocolService.cpp',
-    'TCPFastOpenLayer.cpp',
     'ThrottleQueue.cpp',
     'ThrottlingService.cpp',
     'Tickler.cpp',
     'TLSServerSocket.cpp',
 ]
 
 if CONFIG['MOZ_RUST'] and CONFIG['MOZ_RUST_URLPARSE']:
     EXPORTS.mozilla.net += [ 'RustURL.h' ]
--- a/netwerk/base/nsChannelClassifier.cpp
+++ b/netwerk/base/nsChannelClassifier.cpp
@@ -34,17 +34,16 @@
 #include "nsPIDOMWindow.h"
 #include "nsXULAppAPI.h"
 #include "nsQueryObject.h"
 
 #include "mozilla/ErrorNames.h"
 #include "mozilla/Logging.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/net/HttpBaseChannel.h"
-#include "mozilla/ClearOnShutdown.h"
 
 namespace mozilla {
 namespace net {
 
 //
 // MOZ_LOG=nsChannelClassifier:5
 //
 static LazyLogModule gChannelClassifierLog("nsChannelClassifier");
@@ -1012,12 +1011,10 @@ nsChannelClassifier::Observe(nsISupports
     }
 
     RemoveShutdownObserver();
   }
 
   return NS_OK;
 }
 
-#undef LOG_ENABLED
-
 } // namespace net
 } // namespace mozilla
--- a/netwerk/base/nsChannelClassifier.h
+++ b/netwerk/base/nsChannelClassifier.h
@@ -1,16 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsChannelClassifier_h__
 #define nsChannelClassifier_h__
 
-#include "nsIObserver.h"
 #include "nsIURIClassifier.h"
 #include "nsCOMPtr.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/Maybe.h"
 
 class nsIChannel;
 class nsIHttpChannelInternal;
 class nsIDocument;
--- a/netwerk/base/nsISocketTransport.idl
+++ b/netwerk/base/nsISocketTransport.idl
@@ -8,25 +8,23 @@
 interface nsIInterfaceRequestor;
 interface nsINetAddr;
 
 %{ C++
 #include "mozilla/BasePrincipal.h"
 namespace mozilla {
 namespace net {
 union NetAddr;
-class TCPFastOpen;
 }
 }
 %}
 native NetAddr(mozilla::net::NetAddr);
 [ptr] native NetAddrPtr(mozilla::net::NetAddr);
 native OriginAttributes(mozilla::OriginAttributes);
 [ref] native const_OriginAttributesRef(const mozilla::OriginAttributes);
-[ptr] native TCPFastOpenPtr(mozilla::net::TCPFastOpen);
 
 /**
  * nsISocketTransport
  *
  * NOTE: Connection setup is triggered by opening an input or output stream,
  * it does not start on its own. Completion of the connection setup is
  * indicated by a STATUS_CONNECTED_TO notification to the event sink (if set).
  *
@@ -255,11 +253,9 @@ interface nsISocketTransport : nsITransp
     /**
      * TCP keepalive configuration (support varies by platform).
      * Note that the attribute as well as the setter can only accessed
      * in the socket thread.
      */
     attribute boolean keepaliveEnabled;
     void setKeepaliveVals(in long keepaliveIdleTime,
                           in long keepaliveRetryInterval);
-
-    [noscript] void setFastOpenCallback(in TCPFastOpenPtr aFastOpen);
 };
--- a/netwerk/base/nsSocketTransport2.cpp
+++ b/netwerk/base/nsSocketTransport2.cpp
@@ -29,17 +29,16 @@
 #include "nsISocketProvider.h"
 #include "nsISSLSocketControl.h"
 #include "nsIPipe.h"
 #include "nsIClassInfoImpl.h"
 #include "nsURLHelper.h"
 #include "nsIDNSService.h"
 #include "nsIDNSRecord.h"
 #include "nsICancelable.h"
-#include "TCPFastOpenLayer.h"
 #include <algorithm>
 
 #include "nsPrintfCString.h"
 #include "xpcpublic.h"
 
 #if defined(XP_WIN)
 #include "ShutdownLayer.h"
 #endif
@@ -601,17 +600,17 @@ nsSocketOutputStream::Write(const char *
 
     PRFileDesc* fd = nullptr;
     {
         MutexAutoLock lock(mTransport->mLock);
 
         if (NS_FAILED(mCondition))
             return mCondition;
         
-        fd = mTransport->GetFD_LockedAlsoDuringFastOpen();
+        fd = mTransport->GetFD_Locked();
         if (!fd)
             return NS_BASE_STREAM_WOULD_BLOCK;
     }
 
     SOCKET_LOG(("  calling PR_Write [count=%u]\n", count));
 
     // cannot hold lock while calling NSPR.  (worried about the fact that PSM
     // synchronously proxies notifications over to the UI thread, which could
@@ -754,26 +753,24 @@ nsSocketTransport::nsSocketTransport()
     , mResolving(false)
     , mNetAddrIsSet(false)
     , mSelfAddrIsSet(false)
     , mNetAddrPreResolved(false)
     , mLock("nsSocketTransport.mLock")
     , mFD(this)
     , mFDref(0)
     , mFDconnected(false)
-    , mFDFastOpenInProgress(false)
     , mSocketTransportService(gSocketTransportService)
     , mInput(this)
     , mOutput(this)
     , mQoSBits(0x00)
     , mKeepaliveEnabled(false)
     , mKeepaliveIdleTimeS(-1)
     , mKeepaliveRetryIntervalS(-1)
     , mKeepaliveProbeCount(-1)
-    , mFastOpenCallback(nullptr)
 {
     SOCKET_LOG(("creating nsSocketTransport @%p\n", this));
 
     mTimeouts[TIMEOUT_CONNECT]    = UINT16_MAX; // no timeout
     mTimeouts[TIMEOUT_READ_WRITE] = UINT16_MAX; // no timeout
 }
 
 nsSocketTransport::~nsSocketTransport()
@@ -1494,83 +1491,36 @@ nsSocketTransport::InitiateSocket()
     // We use PRIntervalTime here because we need
     // nsIOService::LastOfflineStateChange time and
     // nsIOService::LastConectivityChange time to be atomic.
     PRIntervalTime connectStarted = 0;
     if (gSocketTransportService->IsTelemetryEnabledAndNotSleepPhase()) {
         connectStarted = PR_IntervalNow();
     }
 
-    bool tfo = false;
-    if (fd && mFastOpenCallback &&
-        mFastOpenCallback->FastOpenEnabled()) {
-        if (NS_SUCCEEDED(AttachTCPFastOpenIOLayer(fd))) {
-            tfo = true;
-            SOCKET_LOG(("nsSocketTransport::InitiateSocket TCP Fast Open "
-                        "started [this=%p]\n", this));
-        }
-    }
-
-    bool connectCalled = true; // This is only needed for telemetry.
     status = PR_Connect(fd, &prAddr, NS_SOCKET_CONNECT_TIMEOUT);
-    PRErrorCode code = PR_GetError();
-    if ((status == PR_SUCCESS) && tfo) {
-        {
-            MutexAutoLock lock(mLock);
-            mFDFastOpenInProgress = true;
-        }
-        SOCKET_LOG(("Using TCP Fast Open."));
-        rv = mFastOpenCallback->StartFastOpen();
-        status = PR_FAILURE;
-        connectCalled = false;
-        bool fastOpenNotSupported = false;
-
-        TCPFastOpenConnectResult(fd, &code, &fastOpenNotSupported);
-        SOCKET_LOG(("called StartFastOpen - code=%d; fastOpen is %s "
-                    "supported.\n", code,
-                    fastOpenNotSupported ? "not" : ""));
-
-        if (fastOpenNotSupported) {
-          // When TCP_FastOpen is turned off on the local host
-          // SendTo will return PR_NOT_TCP_SOCKET_ERROR. This is only
-          // on Linux.
-          // If a windows version does not support Fast Open, the return value
-          // will be PR_NOT_IMPLEMENTED_ERROR. This is only for windows 10
-          // versions older than version 1607, because we do not have subverion
-          // to check, we need to call PR_SendTo to check if it is supported.
-          mFastOpenCallback->FastOpenNotSupported();
-          mFastOpenCallback = nullptr;
-          connectCalled = true;
-          {
-              MutexAutoLock lock(mLock);
-              mFDFastOpenInProgress = false;
-          }
-        }
-    } else {
-        mFastOpenCallback = nullptr;
-    }
-
 
     if (gSocketTransportService->IsTelemetryEnabledAndNotSleepPhase() &&
-        connectStarted && connectCalled) {
+        connectStarted) {
         SendPRBlockingTelemetry(connectStarted,
             Telemetry::PRCONNECT_BLOCKING_TIME_NORMAL,
             Telemetry::PRCONNECT_BLOCKING_TIME_SHUTDOWN,
             Telemetry::PRCONNECT_BLOCKING_TIME_CONNECTIVITY_CHANGE,
             Telemetry::PRCONNECT_BLOCKING_TIME_LINK_CHANGE,
             Telemetry::PRCONNECT_BLOCKING_TIME_OFFLINE);
     }
 
     if (status == PR_SUCCESS) {
         // 
         // we are connected!
         //
         OnSocketConnected();
     }
     else {
+        PRErrorCode code = PR_GetError();
 #if defined(TEST_CONNECT_ERRORS)
         code = RandomizeConnectError(code);
 #endif
         //
         // If the PR_Connect(...) would block, then poll for a connection.
         //
         if ((PR_WOULD_BLOCK_ERROR == code) || (PR_IN_PROGRESS_ERROR == code))
             mPollFlags = (PR_POLL_EXCEPT | PR_POLL_WRITE);
@@ -1612,17 +1562,17 @@ nsSocketTransport::InitiateSocket()
             code = PR_GetOSError();
             rv = ErrorAccordingToNSPR(code);
         }
         //
         // The connection was refused...
         //
         else {
             if (gSocketTransportService->IsTelemetryEnabledAndNotSleepPhase() &&
-                connectStarted && connectStarted) {
+                connectStarted) {
                 SendPRBlockingTelemetry(connectStarted,
                     Telemetry::PRCONNECT_FAIL_BLOCKING_TIME_NORMAL,
                     Telemetry::PRCONNECT_FAIL_BLOCKING_TIME_SHUTDOWN,
                     Telemetry::PRCONNECT_FAIL_BLOCKING_TIME_CONNECTIVITY_CHANGE,
                     Telemetry::PRCONNECT_FAIL_BLOCKING_TIME_LINK_CHANGE,
                     Telemetry::PRCONNECT_FAIL_BLOCKING_TIME_OFFLINE);
             }
 
@@ -1655,81 +1605,68 @@ nsSocketTransport::RecoverFromError()
 
     nsresult rv;
 
     // OK to check this outside mLock
     NS_ASSERTION(!mFDconnected, "socket should not be connected");
 
     // all connection failures need to be reported to DNS so that the next
     // time we will use a different address if available.
-    if (!mFDFastOpenInProgress &&
-        mState == STATE_CONNECTING && mDNSRecord) {
+    if (mState == STATE_CONNECTING && mDNSRecord) {
         mDNSRecord->ReportUnusable(SocketPort());
     }
 
     // can only recover from these errors
     if (mCondition != NS_ERROR_CONNECTION_REFUSED &&
         mCondition != NS_ERROR_PROXY_CONNECTION_REFUSED &&
         mCondition != NS_ERROR_NET_TIMEOUT &&
         mCondition != NS_ERROR_UNKNOWN_HOST &&
         mCondition != NS_ERROR_UNKNOWN_PROXY_HOST)
         return false;
 
     bool tryAgain = false;
-    if (mFDFastOpenInProgress &&
-        ((mCondition == NS_ERROR_CONNECTION_REFUSED) ||
-         (mCondition == NS_ERROR_NET_TIMEOUT))) {
-        // TCP Fast Open can be blocked by middle boxes so we will retry
-        // without it.
+
+    if ((mState == STATE_CONNECTING) && mDNSRecord &&
+        mSocketTransportService->IsTelemetryEnabledAndNotSleepPhase()) {
+        if (mNetAddr.raw.family == AF_INET) {
+            Telemetry::Accumulate(Telemetry::IPV4_AND_IPV6_ADDRESS_CONNECTIVITY,
+                                  UNSUCCESSFUL_CONNECTING_TO_IPV4_ADDRESS);
+        } else if (mNetAddr.raw.family == AF_INET6) {
+            Telemetry::Accumulate(Telemetry::IPV4_AND_IPV6_ADDRESS_CONNECTIVITY,
+                                  UNSUCCESSFUL_CONNECTING_TO_IPV6_ADDRESS);
+        }
+    }
+
+    if (mConnectionFlags & (DISABLE_IPV6 | DISABLE_IPV4) &&
+        mCondition == NS_ERROR_UNKNOWN_HOST &&
+        mState == STATE_RESOLVING &&
+        !mProxyTransparentResolvesHost) {
+        SOCKET_LOG(("  trying lookup again with both ipv4/ipv6 enabled\n"));
+        mConnectionFlags &= ~(DISABLE_IPV6 | DISABLE_IPV4);
         tryAgain = true;
-        MOZ_ASSERT(mFastOpenCallback);
-        mFastOpenCallback->FastOpenConnected(mCondition);
-        mFastOpenCallback = nullptr;
-    } else {
-
-        if ((mState == STATE_CONNECTING) && mDNSRecord &&
-            mSocketTransportService->IsTelemetryEnabledAndNotSleepPhase()) {
-            if (mNetAddr.raw.family == AF_INET) {
-                Telemetry::Accumulate(Telemetry::IPV4_AND_IPV6_ADDRESS_CONNECTIVITY,
-                                      UNSUCCESSFUL_CONNECTING_TO_IPV4_ADDRESS);
-            } else if (mNetAddr.raw.family == AF_INET6) {
-                Telemetry::Accumulate(Telemetry::IPV4_AND_IPV6_ADDRESS_CONNECTIVITY,
-                                      UNSUCCESSFUL_CONNECTING_TO_IPV6_ADDRESS);
-            }
+    }
+
+    // try next ip address only if past the resolver stage...
+    if (mState == STATE_CONNECTING && mDNSRecord) {
+        nsresult rv = mDNSRecord->GetNextAddr(SocketPort(), &mNetAddr);
+        if (NS_SUCCEEDED(rv)) {
+            SOCKET_LOG(("  trying again with next ip address\n"));
+            tryAgain = true;
         }
-
-        if (mConnectionFlags & (DISABLE_IPV6 | DISABLE_IPV4) &&
-            mCondition == NS_ERROR_UNKNOWN_HOST &&
-            mState == STATE_RESOLVING &&
-            !mProxyTransparentResolvesHost) {
-            SOCKET_LOG(("  trying lookup again with both ipv4/ipv6 enabled\n"));
+        else if (mConnectionFlags & (DISABLE_IPV6 | DISABLE_IPV4)) {
+            // Drop state to closed.  This will trigger new round of DNS
+            // resolving bellow.
+            // XXX Could be optimized to only switch the flags to save duplicate
+            // connection attempts.
+            SOCKET_LOG(("  failed to connect all ipv4-only or ipv6-only hosts,"
+                        " trying lookup/connect again with both ipv4/ipv6\n"));
+            mState = STATE_CLOSED;
             mConnectionFlags &= ~(DISABLE_IPV6 | DISABLE_IPV4);
             tryAgain = true;
         }
-
-        // try next ip address only if past the resolver stage...
-        if (mState == STATE_CONNECTING && mDNSRecord) {
-            nsresult rv = mDNSRecord->GetNextAddr(SocketPort(), &mNetAddr);
-            if (NS_SUCCEEDED(rv)) {
-                SOCKET_LOG(("  trying again with next ip address\n"));
-                tryAgain = true;
-            }
-            else if (mConnectionFlags & (DISABLE_IPV6 | DISABLE_IPV4)) {
-                // Drop state to closed.  This will trigger new round of DNS
-                // resolving bellow.
-                // XXX Could be optimized to only switch the flags to save
-                // duplicate connection attempts.
-                SOCKET_LOG(("  failed to connect all ipv4-only or ipv6-only "
-                            "hosts, trying lookup/connect again with both "
-                            "ipv4/ipv6\n"));
-                mState = STATE_CLOSED;
-                mConnectionFlags &= ~(DISABLE_IPV6 | DISABLE_IPV4);
-                tryAgain = true;
-            }
-        }
     }
 
     // prepare to try again.
     if (tryAgain) {
         uint32_t msg;
 
         if (mState == STATE_CONNECTING) {
             mState = STATE_RESOLVING;
@@ -1801,35 +1738,24 @@ nsSocketTransport::OnSocketConnected()
     mPollFlags = (PR_POLL_READ | PR_POLL_WRITE | PR_POLL_EXCEPT);
     mPollTimeout = mTimeouts[TIMEOUT_READ_WRITE];
     mState = STATE_TRANSFERRING;
 
     // Set the m*AddrIsSet flags only when state has reached TRANSFERRING
     // because we need to make sure its value does not change due to failover
     mNetAddrIsSet = true;
 
-    // If a Fast Open is not in progress, mFastOpenCallback must be null.
-    MOZ_ASSERT(mFastOpenCallback || !mFastOpenCallback);
-    if (mFDFastOpenInProgress && mFastOpenCallback) {
-        // mFastOpenCallback can be null when for example h2 is negotiated on
-        // another connection to the same host and all connections are
-        // abandoned.
-        mFastOpenCallback->FastOpenConnected(NS_OK);
-        mFastOpenCallback = nullptr;
-    }
-
     // assign mFD (must do this within the transport lock), but take care not
     // to trample over mFDref if mFD is already set.
     {
         MutexAutoLock lock(mLock);
         NS_ASSERTION(mFD.IsInitialized(), "no socket");
         NS_ASSERTION(mFDref == 1, "wrong socket ref count");
         SetSocketName(mFD);
         mFDconnected = true;
-        mFDFastOpenInProgress = false;
     }
 
     // Ensure keepalive is configured correctly if previously enabled.
     if (mKeepaliveEnabled) {
         nsresult rv = SetKeepaliveEnabledInternal(true);
         if (NS_WARN_IF(NS_FAILED(rv))) {
             SOCKET_LOG(("  SetKeepaliveEnabledInternal failed rv[0x%" PRIx32 "]",
                         static_cast<uint32_t>(rv)));
@@ -1865,33 +1791,16 @@ nsSocketTransport::GetFD_Locked()
         return nullptr;
 
     if (mFD.IsInitialized())
         mFDref++;
 
     return mFD;
 }
 
-PRFileDesc *
-nsSocketTransport::GetFD_LockedAlsoDuringFastOpen()
-{
-    mLock.AssertCurrentThreadOwns();
-
-    // mFD is not available to the streams while disconnected.
-    if (!mFDconnected && !mFDFastOpenInProgress) {
-        return nullptr;
-    }
-
-    if (mFD.IsInitialized()) {
-        mFDref++;
-    }
-
-    return mFD;
-}
-
 class ThunkPRClose : public Runnable
 {
 public:
   explicit ThunkPRClose(PRFileDesc *fd) : mFD(fd) {}
 
   NS_IMETHOD Run() override
   {
     nsSocketTransport::CloseSocket(mFD,
@@ -2223,27 +2132,16 @@ nsSocketTransport::OnSocketDetached(PRFi
 
     // break any potential reference cycle between the security info object
     // and ourselves by resetting its notification callbacks object.  see
     // bug 285991 for details.
     nsCOMPtr<nsISSLSocketControl> secCtrl = do_QueryInterface(mSecInfo);
     if (secCtrl)
         secCtrl->SetNotificationCallbacks(nullptr);
 
-    // The error can happened before we start fast open. In that case do not
-    // call mFastOpenCallback->FastOpenConnected; If error happends during
-    // fast open, inform the halfOpenSocket.
-    // If we cancel the connection because backup socket was successfully
-    // connected, mFDFastOpenInProgress will be true but mFastOpenCallback
-    // will be nullptr.
-    if (mFDFastOpenInProgress && mFastOpenCallback) {
-        mFastOpenCallback->FastOpenConnected(mCondition);
-    }
-    mFastOpenCallback = nullptr;
-
     // finally, release our reference to the socket (must do this within
     // the transport lock) possibly closing the socket. Also release our
     // listeners to break potential refcount cycles.
 
     // We should be careful not to release mEventSink and mCallbacks while
     // we're locked, because releasing it might require acquiring the lock
     // again, so we just null out mEventSink and mCallbacks while we're
     // holding the lock, and let the stack based objects' destuctors take
@@ -2252,17 +2150,16 @@ nsSocketTransport::OnSocketDetached(PRFi
     nsCOMPtr<nsITransportEventSink> ourEventSink;
     {
         MutexAutoLock lock(mLock);
         if (mFD.IsInitialized()) {
             ReleaseFD_Locked(mFD);
             // flag mFD as unusable; this prevents other consumers from 
             // acquiring a reference to mFD.
             mFDconnected = false;
-            mFDFastOpenInProgress = false;
         }
 
         // We must release mCallbacks and mEventSink to avoid memory leak
         // but only when RecoverFromError() above failed. Otherwise we lose
         // link with UI and security callbacks on next connection attempt 
         // round. That would lead e.g. to a broken certificate exception page.
         if (NS_FAILED(mCondition)) {
             mCallbacks.swap(ourCallbacks);
@@ -2469,24 +2366,18 @@ nsSocketTransport::SetEventSink(nsITrans
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsSocketTransport::IsAlive(bool *result)
 {
     *result = false;
 
-    // During Fast Open we need to return true here.
-    if (mFDFastOpenInProgress) {
-        *result = true;
-        return NS_OK;
-    }
-
     nsresult conditionWhileLocked = NS_OK;
-    PRFileDescAutoLock fd(this, false, &conditionWhileLocked);
+    PRFileDescAutoLock fd(this, &conditionWhileLocked);
     if (NS_FAILED(conditionWhileLocked) || !fd.IsInitialized()) {
         return NS_OK;
     }
 
     // XXX do some idle-time based checks??
 
     char c;
     int32_t rval = PR_Recv(fd, &c, 1, PR_MSG_PEEK, 0);
@@ -2696,17 +2587,17 @@ nsSocketTransport::GetQoSBits(uint8_t *a
 {
     *aQoSBits = mQoSBits;
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsSocketTransport::GetRecvBufferSize(uint32_t *aSize)
 {
-    PRFileDescAutoLock fd(this, false);
+    PRFileDescAutoLock fd(this);
     if (!fd.IsInitialized())
         return NS_ERROR_NOT_CONNECTED;
 
     nsresult rv = NS_OK;
     PRSocketOptionData opt;
     opt.option = PR_SockOpt_RecvBufferSize;
     if (PR_GetSocketOption(fd, &opt) == PR_SUCCESS)
         *aSize = opt.value.recv_buffer_size;
@@ -2714,17 +2605,17 @@ nsSocketTransport::GetRecvBufferSize(uin
         rv = NS_ERROR_FAILURE;
 
     return rv;
 }
 
 NS_IMETHODIMP
 nsSocketTransport::GetSendBufferSize(uint32_t *aSize)
 {
-    PRFileDescAutoLock fd(this, false);
+    PRFileDescAutoLock fd(this);
     if (!fd.IsInitialized())
         return NS_ERROR_NOT_CONNECTED;
 
     nsresult rv = NS_OK;
     PRSocketOptionData opt;
     opt.option = PR_SockOpt_SendBufferSize;
     if (PR_GetSocketOption(fd, &opt) == PR_SUCCESS)
         *aSize = opt.value.send_buffer_size;
@@ -2732,34 +2623,34 @@ nsSocketTransport::GetSendBufferSize(uin
         rv = NS_ERROR_FAILURE;
 
     return rv;
 }
 
 NS_IMETHODIMP
 nsSocketTransport::SetRecvBufferSize(uint32_t aSize)
 {
-    PRFileDescAutoLock fd(this, false);
+    PRFileDescAutoLock fd(this);
     if (!fd.IsInitialized())
         return NS_ERROR_NOT_CONNECTED;
 
     nsresult rv = NS_OK;
     PRSocketOptionData opt;
     opt.option = PR_SockOpt_RecvBufferSize;
     opt.value.recv_buffer_size = aSize;
     if (PR_SetSocketOption(fd, &opt) != PR_SUCCESS)
         rv = NS_ERROR_FAILURE;
 
     return rv;
 }
 
 NS_IMETHODIMP
 nsSocketTransport::SetSendBufferSize(uint32_t aSize)
 {
-    PRFileDescAutoLock fd(this, false);
+    PRFileDescAutoLock fd(this);
     if (!fd.IsInitialized())
         return NS_ERROR_NOT_CONNECTED;
 
     nsresult rv = NS_OK;
     PRSocketOptionData opt;
     opt.option = PR_SockOpt_SendBufferSize;
     opt.value.send_buffer_size = aSize;
     if (PR_SetSocketOption(fd, &opt) != PR_SUCCESS)
@@ -2884,17 +2775,17 @@ nsSocketTransport::SetKeepaliveEnabledIn
 {
     MOZ_ASSERT(mKeepaliveIdleTimeS > 0 &&
                mKeepaliveIdleTimeS <= kMaxTCPKeepIdle);
     MOZ_ASSERT(mKeepaliveRetryIntervalS > 0 &&
                mKeepaliveRetryIntervalS <= kMaxTCPKeepIntvl);
     MOZ_ASSERT(mKeepaliveProbeCount > 0 &&
                mKeepaliveProbeCount <= kMaxTCPKeepCount);
 
-    PRFileDescAutoLock fd(this, true);
+    PRFileDescAutoLock fd(this);
     if (NS_WARN_IF(!fd.IsInitialized())) {
         return NS_ERROR_NOT_INITIALIZED;
     }
 
     // Only enable if keepalives are globally enabled, but ensure other
     // options are set correctly on the fd.
     bool enable = aEnable && mSocketTransportService->IsKeepaliveEnabled();
     nsresult rv = fd.SetKeepaliveVals(enable,
@@ -3038,17 +2929,17 @@ nsSocketTransport::SetKeepaliveVals(int3
 
     SOCKET_LOG(("nsSocketTransport::SetKeepaliveVals [%p] "
                 "keepalive %s, idle time[%ds] retry interval[%ds] "
                 "packet count[%d]",
                 this, mKeepaliveEnabled ? "enabled" : "disabled",
                 mKeepaliveIdleTimeS, mKeepaliveRetryIntervalS,
                 mKeepaliveProbeCount));
 
-    PRFileDescAutoLock fd(this, true);
+    PRFileDescAutoLock fd(this);
     if (NS_WARN_IF(!fd.IsInitialized())) {
         return NS_ERROR_NULL_POINTER;
     }
 
     rv = fd.SetKeepaliveVals(mKeepaliveEnabled,
                              mKeepaliveIdleTimeS,
                              mKeepaliveRetryIntervalS,
                              mKeepaliveProbeCount);
@@ -3367,17 +3258,10 @@ nsSocketTransport::SendPRBlockingTelemet
         Telemetry::Accumulate(aIDOffline,
                               PR_IntervalToMilliseconds(now - aStart));
     } else {
         Telemetry::Accumulate(aIDNormal,
                               PR_IntervalToMilliseconds(now - aStart));
     }
 }
 
-NS_IMETHODIMP
-nsSocketTransport::SetFastOpenCallback(TCPFastOpen *aFastOpen)
-{
-  mFastOpenCallback = aFastOpen;
-  return NS_OK;
-}
-
 } // namespace net
 } // namespace mozilla
--- a/netwerk/base/nsSocketTransport2.h
+++ b/netwerk/base/nsSocketTransport2.h
@@ -15,17 +15,16 @@
 #include "nsCOMPtr.h"
 
 #include "nsIInterfaceRequestor.h"
 #include "nsISocketTransport.h"
 #include "nsIAsyncInputStream.h"
 #include "nsIAsyncOutputStream.h"
 #include "nsIDNSListener.h"
 #include "nsIClassInfo.h"
-#include "TCPFastOpen.h"
 #include "mozilla/net/DNS.h"
 #include "nsASocketHandler.h"
 #include "mozilla/Telemetry.h"
 
 #include "prerror.h"
 #include "nsAutoPtr.h"
 
 class nsICancelable;
@@ -205,34 +204,29 @@ private:
         STATE_TRANSFERRING
     };
 
     // Safer way to get and automatically release PRFileDesc objects.
     class MOZ_STACK_CLASS PRFileDescAutoLock
     {
     public:
       explicit PRFileDescAutoLock(nsSocketTransport *aSocketTransport,
-                                  bool aAlsoDuringFastOpen,
                                   nsresult *aConditionWhileLocked = nullptr)
         : mSocketTransport(aSocketTransport)
         , mFd(nullptr)
       {
         MOZ_ASSERT(aSocketTransport);
         MutexAutoLock lock(mSocketTransport->mLock);
         if (aConditionWhileLocked) {
           *aConditionWhileLocked = mSocketTransport->mCondition;
           if (NS_FAILED(mSocketTransport->mCondition)) {
             return;
           }
         }
-        if (!aAlsoDuringFastOpen) {
-          mFd = mSocketTransport->GetFD_Locked();
-        } else {
-          mFd = mSocketTransport->GetFD_LockedAlsoDuringFastOpen();
-        }
+        mFd = mSocketTransport->GetFD_Locked();
       }
       ~PRFileDescAutoLock() {
         MutexAutoLock lock(mSocketTransport->mLock);
         if (mFd) {
           mSocketTransport->ReleaseFD_Locked(mFd);
         }
       }
       bool IsInitialized() {
@@ -380,19 +374,16 @@ private:
     //-------------------------------------------------------------------------
     // socket input/output objects.  these may be accessed on any thread with
     // the exception of some specific methods (XXX).
 
     Mutex            mLock;  // protects members in this section.
     LockedPRFileDesc mFD;
     nsrefcnt         mFDref;       // mFD is closed when mFDref goes to zero.
     bool             mFDconnected; // mFD is available to consumer when TRUE.
-    bool             mFDFastOpenInProgress; // Fast Open is in progress, so
-                                            // socket available for some
-                                            // operations.
 
     // A delete protector reference to gSocketTransportService held for lifetime
     // of 'this'. Sometimes used interchangably with gSocketTransportService due
     // to scoping.
     RefPtr<nsSocketTransportService> mSocketTransportService;
 
     nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
     nsCOMPtr<nsITransportEventSink> mEventSink;
@@ -409,17 +400,16 @@ private:
 
     // QoS setting for socket
     uint8_t mQoSBits;
 
     //
     // mFD access methods: called with mLock held.
     //
     PRFileDesc *GetFD_Locked();
-    PRFileDesc *GetFD_LockedAlsoDuringFastOpen();
     void        ReleaseFD_Locked(PRFileDesc *fd);
 
     //
     // stream state changes (called outside mLock):
     //
     void OnInputClosed(nsresult reason)
     {
         // no need to post an event if called on the socket thread
@@ -467,17 +457,14 @@ private:
     // True if keepalive has been enabled by the socket owner. Note: Keepalive
     // must also be enabled globally for it to be enabled in TCP.
     bool mKeepaliveEnabled;
 
     // Keepalive config (support varies by platform).
     int32_t mKeepaliveIdleTimeS;
     int32_t mKeepaliveRetryIntervalS;
     int32_t mKeepaliveProbeCount;
-
-    // A Fast Open callback.
-    TCPFastOpen *mFastOpenCallback;
 };
 
 } // namespace net
 } // namespace mozilla
 
 #endif // !nsSocketTransport_h__
--- a/netwerk/base/nsSyncStreamListener.cpp
+++ b/netwerk/base/nsSyncStreamListener.cpp
@@ -10,17 +10,17 @@
 
 using namespace mozilla::net;
 
 nsresult
 nsSyncStreamListener::Init()
 {
     return NS_NewPipe(getter_AddRefs(mPipeIn),
                       getter_AddRefs(mPipeOut),
-                      mozilla::net::nsIOService::gDefaultSegmentSize,
+                      nsIOService::gDefaultSegmentSize,
                       UINT32_MAX, // no size limit
                       false,
                       false);
 }
 
 nsresult
 nsSyncStreamListener::WaitForData()
 {
--- a/netwerk/protocol/http/TunnelUtils.cpp
+++ b/netwerk/protocol/http/TunnelUtils.cpp
@@ -6,17 +6,16 @@
 
 // HttpLog.h should generally be included first
 #include "HttpLog.h"
 
 #include "Http2Session.h"
 #include "nsHttp.h"
 #include "nsHttpHandler.h"
 #include "nsHttpRequestHead.h"
-#include "TCPFastOpen.h"
 #include "nsISocketProvider.h"
 #include "nsISocketProviderService.h"
 #include "nsISSLSocketControl.h"
 #include "nsISocketTransport.h"
 #include "nsISupportsPriority.h"
 #include "nsNetAddr.h"
 #include "prerror.h"
 #include "prio.h"
@@ -1622,22 +1621,16 @@ SocketTransportShim::GetQoSBits(uint8_t 
 }
 
 NS_IMETHODIMP
 SocketTransportShim::SetQoSBits(uint8_t aQoSBits)
 {
   return mWrapped->SetQoSBits(aQoSBits);
 }
 
-NS_IMETHODIMP
-SocketTransportShim::SetFastOpenCallback(TCPFastOpen *aFastOpen)
-{
-  return mWrapped->SetFastOpenCallback(aFastOpen);
-}
-
 NS_IMPL_ISUPPORTS(TLSFilterTransaction, nsITimerCallback)
 NS_IMPL_ISUPPORTS(SocketTransportShim, nsISocketTransport, nsITransport)
 NS_IMPL_ISUPPORTS(InputStreamShim, nsIInputStream, nsIAsyncInputStream)
 NS_IMPL_ISUPPORTS(OutputStreamShim, nsIOutputStream, nsIAsyncOutputStream)
 NS_IMPL_ISUPPORTS(SocketInWrapper, nsIAsyncInputStream)
 NS_IMPL_ISUPPORTS(SocketOutWrapper, nsIAsyncOutputStream)
 
 } // namespace net
--- a/netwerk/protocol/http/moz.build
+++ b/netwerk/protocol/http/moz.build
@@ -117,14 +117,8 @@ LOCAL_INCLUDES += [
     '/dom/base',
     '/netwerk/base',
 ]
 
 EXTRA_COMPONENTS += [
     'WellKnownOpportunisticUtils.js',
     'WellKnownOpportunisticUtils.manifest',
 ]
-
-if CONFIG['OS_TARGET'] == 'Darwin':
-    if CONFIG['HOST_MAJOR_VERSION'] == '15':
-        DEFINES.update(
-            HAS_CONNECTX=True,
-        )
--- a/netwerk/protocol/http/nsAHttpTransaction.h
+++ b/netwerk/protocol/http/nsAHttpTransaction.h
@@ -160,23 +160,17 @@ public:
     virtual MOZ_MUST_USE nsresult GetTransactionSecurityInfo(nsISupports **)
     {
         return NS_ERROR_NOT_IMPLEMENTED;
     }
 
     virtual void DisableSpdy() { }
     virtual void ReuseConnectionOnRestartOK(bool) { }
 
-    // Returns true if early-data or fast open is possible.
-    virtual MOZ_MUST_USE bool CanDo0RTT() {
-        return false;
-    }
-    // Returns true if early-data is possible and transaction will remember
-    // that it is in 0RTT mode (to know should it rewide transaction or not
-    // in the case of an error).
+    // Returns true if early-data is possible.
     virtual MOZ_MUST_USE bool Do0RTT() {
         return false;
     }
     // This function will be called when a tls handshake has been finished and
     // we know whether early-data that was sent has been accepted or not, e.g.
     // do we need to restart a transaction. This will be called only if Do0RTT
     // returns true.
     // If aRestart parameter is true we need to restart the transaction,
@@ -185,20 +179,16 @@ public:
     // If aAlpnChanged is true (and we were assuming http/2), we'll need to take
     // the transactions out of the session, rewind them all, and start them back
     // over as http/1 transactions
     // The function will return success or failure of the transaction restart.
     virtual MOZ_MUST_USE nsresult Finish0RTT(bool aRestart, bool aAlpnChanged) {
         return NS_ERROR_NOT_IMPLEMENTED;
     }
 
-    virtual MOZ_MUST_USE nsresult RestartOnFastOpenError() {
-        return NS_ERROR_NOT_IMPLEMENTED;
-    }
-
     virtual uint64_t TopLevelOuterContentWindowId() {
         MOZ_ASSERT(false);
         return 0;
     }
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(nsAHttpTransaction, NS_AHTTPTRANSACTION_IID)
 
--- a/netwerk/protocol/http/nsHttpConnection.cpp
+++ b/netwerk/protocol/http/nsHttpConnection.cpp
@@ -82,17 +82,16 @@ nsHttpConnection::nsHttpConnection()
     , mForceSendPending(false)
     , m0RTTChecked(false)
     , mWaitingFor0RTTResponse(false)
     , mContentBytesWritten0RTT(0)
     , mEarlyDataNegotiated(false)
     , mDid0RTTSpdy(false)
     , mResponseThrottled(false)
     , mResumeRecvOnUnthrottle(false)
-    , mFastOpen(false)
 {
     LOG(("Creating nsHttpConnection @%p\n", this));
 
     // the default timeout is for when this connection has not yet processed a
     // transaction
     static const PRIntervalTime k5Sec = PR_SecondsToInterval(5);
     mIdleTimeout =
         (k5Sec < gHttpHandler->IdleTimeout()) ? k5Sec : gHttpHandler->IdleTimeout();
@@ -378,19 +377,17 @@ nsHttpConnection::EnsureNPNComplete(nsre
     if (!m0RTTChecked) {
         // We reuse m0RTTChecked. We want to send this status only once.
         mTransaction->OnTransportStatus(mSocketTransport,
                                         NS_NET_STATUS_TLS_HANDSHAKE_STARTING,
                                         0);
     }
 
     rv = ssl->GetNegotiatedNPN(negotiatedNPN);
-    // Fast Open does not work well with TLS Early Data. TODO: dragana
-    // fix this.
-    if (!mFastOpen && !m0RTTChecked && (rv == NS_ERROR_NOT_CONNECTED) &&
+    if (!m0RTTChecked && (rv == NS_ERROR_NOT_CONNECTED) &&
         !mConnInfo->UsingProxy()) {
         // There is no ALPN info (yet!). We need to consider doing 0RTT. We
         // will do so if there is ALPN information from a previous session
         // (AlpnEarlySelection), we are using HTTP/1, and the request data can
         // be safely retried.
         m0RTTChecked = true;
         nsresult rvEarlyAlpn = ssl->GetAlpnEarlySelection(mEarlyNegotiatedALPN);
         if (NS_FAILED(rvEarlyAlpn)) {
@@ -1678,17 +1675,17 @@ nsHttpConnection::OnSocketWritable()
         } else if (!EnsureNPNComplete(rv, transactionBytes)) {
             if (NS_SUCCEEDED(rv) && !transactionBytes &&
                 NS_SUCCEEDED(mSocketOutCondition)) {
                 mSocketOutCondition = NS_BASE_STREAM_WOULD_BLOCK;
             }
         } else if (!mTransaction) {
             rv = NS_ERROR_FAILURE;
             LOG(("  No Transaction In OnSocketWritable\n"));
-        } else if (NS_SUCCEEDED(rv)) {
+        } else {
 
             // for non spdy sessions let the connection manager know
             if (!mReportedSpdy) {
                 mReportedSpdy = true;
                 MOZ_ASSERT(!mEverUsedSpdy);
                 gHttpHandler->ConnMgr()->ReportSpdyConnection(this, false);
             }
 
@@ -1723,19 +1720,16 @@ nsHttpConnection::OnSocketWritable()
                     rv = mTLSFilter->NudgeTunnel(this);
                 } else {
                     rv = mSocketOut->AsyncWait(this, 0, 0, nullptr); // continue writing
                 }
             } else {
                 rv = mSocketOutCondition;
             }
             again = false;
-        } else if (mFastOpen) {
-            rv = mSocketOut->AsyncWait(this, 0, 0, nullptr); // wait for connected event.
-            again = false;
         } else if (!transactionBytes) {
             rv = NS_OK;
 
             if (mTransaction && !mWaitingFor0RTTResponse) { // in case the ReadSegments stack called CloseTransaction()
                 //
                 // at this point we've written out the entire transaction, and now we
                 // must wait for the server's response.  we manufacture a status message
                 // here to reflect the fact that we are waiting.  this message will be
@@ -2288,34 +2282,10 @@ nsHttpConnection::CheckForTraffic(bool c
             mTrafficStamp = true;
         }
     } else {
         // mark it as not checked
         mTrafficStamp = false;
     }
 }
 
-nsAHttpTransaction *
-nsHttpConnection::CloseConnectionFastOpenTakesTooLongOrError()
-{
-    MOZ_ASSERT(!mCurrentBytesRead);
-    if (mUsingSpdyVersion) {
-        DontReuse();
-        mUsingSpdyVersion = 0;
-        mSpdySession = nullptr;
-    }
-
-    {
-        MutexAutoLock lock(mCallbacksLock);
-        mCallbacks = nullptr;
-    }
-
-    RefPtr<nsAHttpTransaction> trans = nullptr;
-    if (NS_SUCCEEDED(mTransaction->RestartOnFastOpenError())) {
-        trans = mTransaction;
-    }
-    mTransaction = nullptr;
-    Close(NS_ERROR_NET_RESET);
-    return trans;
-}
-
 } // namespace net
 } // namespace mozilla
--- a/netwerk/protocol/http/nsHttpConnection.h
+++ b/netwerk/protocol/http/nsHttpConnection.h
@@ -78,22 +78,16 @@ public:
                                nsIInterfaceRequestor *, PRIntervalTime);
 
     // Activate causes the given transaction to be processed on this
     // connection.  It fails if there is already an existing transaction unless
     // a multiplexing protocol such as SPDY is being used
     MOZ_MUST_USE nsresult Activate(nsAHttpTransaction *, uint32_t caps,
                                    int32_t pri);
 
-    void SetFastOpen(bool aFastOpen) { mFastOpen = aFastOpen; }
-    // Close this connection and return the transaction. The transaction is
-    // restarted as well. This will only happened before connection is
-    // connected.
-    nsAHttpTransaction * CloseConnectionFastOpenTakesTooLongOrError();
-
     // Close the underlying socket transport.
     void Close(nsresult reason, bool aIsShutdown = false);
 
     //-------------------------------------------------------------------------
     // XXX document when these are ok to call
 
     bool IsKeepAlive()
     {
@@ -393,18 +387,16 @@ private:
     bool                           mDid0RTTSpdy;
 
     // Reflects throttling request, effects if we resume read from the socket.
     // Accessed only on the socket thread.
     bool                           mResponseThrottled;
     // A read from the socket was requested while we where throttled, means
     // to ResumeRecv() when untrottled again. Only accessed on the socket thread.
     bool                           mResumeRecvOnUnthrottle;
-
-    bool                           mFastOpen;
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(nsHttpConnection, NS_HTTPCONNECTION_IID)
 
 } // namespace net
 } // namespace mozilla
 
 #endif // nsHttpConnection_h__
--- a/netwerk/protocol/http/nsHttpConnectionMgr.cpp
+++ b/netwerk/protocol/http/nsHttpConnectionMgr.cpp
@@ -606,17 +606,16 @@ nsHttpConnectionMgr::RemoveIdleConnectio
 
     nsConnectionEntry *ent = mCT.Get(conn->ConnectionInfo()->HashKey());
 
     if (!ent || !ent->mIdleConns.RemoveElement(conn)) {
         return NS_ERROR_UNEXPECTED;
     }
 
     mNumIdleConns--;
-    ConditionallyStopPruneDeadConnectionsTimer();
     return NS_OK;
 }
 
 nsHttpConnection *
 nsHttpConnectionMgr::FindCoalescableConnectionByHashKey(nsConnectionEntry *ent,
                                                         const nsCString &key,
                                                         bool justKidding)
 {
@@ -2874,17 +2873,16 @@ nsHttpConnectionMgr::GetOrCreateConnecti
             return wildCardEnt;
         }
     }
 
     // step 3
     if (!specificEnt) {
         RefPtr<nsHttpConnectionInfo> clone(specificCI->Clone());
         specificEnt = new nsConnectionEntry(clone);
-        specificEnt->mUseFastOpen = gHttpHandler->UseFastOpen();
         mCT.Put(clone->HashKey(), specificEnt);
     }
     return specificEnt;
 }
 
 nsresult
 ConnectionHandle::OnHeadersAvailable(nsAHttpTransaction *trans,
                                      nsHttpRequestHead *req,
@@ -3007,17 +3005,16 @@ nsHalfOpenSocket::nsHalfOpenSocket(nsCon
     , mSpeculative(speculative)
     , mIsFromPredictor(isFromPredictor)
     , mAllow1918(true)
     , mHasConnected(false)
     , mPrimaryConnectedOK(false)
     , mBackupConnectedOK(false)
     , mFreeToUse(true)
     , mPrimaryStreamStatus(NS_OK)
-    , mUsingFastOpen(false)
 {
     MOZ_ASSERT(ent && trans, "constructor with null arguments");
     LOG(("Creating nsHalfOpenSocket [this=%p trans=%p ent=%s key=%s]\n",
          this, trans, ent->mConnInfo->Origin(), ent->mConnInfo->HashKey().get()));
 
     if (speculative) {
         Telemetry::AutoCounter<Telemetry::HTTPCONNMGR_TOTAL_SPECULATIVE_CONN> totalSpeculativeConn;
         ++totalSpeculativeConn;
@@ -3124,20 +3121,16 @@ nsHalfOpenSocket::SetupStreams(nsISocket
              (isBackup && gHttpHandler->FastFallbackToIPv4())) {
         tmpFlags |= nsISocketTransport::DISABLE_IPV6;
     }
 
     if (!Allow1918()) {
         tmpFlags |= nsISocketTransport::DISABLE_RFC1918;
     }
 
-    if (!isBackup && mEnt->mUseFastOpen) {
-        socketTransport->SetFastOpenCallback(this);
-    }
-
     socketTransport->SetConnectionFlags(tmpFlags);
 
     const OriginAttributes& originAttributes = mEnt->mConnInfo->GetOriginAttributes();
     if (originAttributes != OriginAttributes()) {
         socketTransport->SetOriginAttributes(originAttributes);
     }
 
     socketTransport->SetQoSBits(gHttpHandler->GetQoSBits());
@@ -3191,19 +3184,16 @@ nsHttpConnectionMgr::nsHalfOpenSocket::S
                       getter_AddRefs(mStreamIn),
                       getter_AddRefs(mStreamOut),
                       false);
     LOG(("nsHalfOpenSocket::SetupPrimaryStream [this=%p ent=%s rv=%" PRIx32 "]",
          this, mEnt->mConnInfo->Origin(), static_cast<uint32_t>(rv)));
     if (NS_FAILED(rv)) {
         if (mStreamOut)
             mStreamOut->AsyncWait(nullptr, 0, 0, nullptr);
-        if (mSocketTransport) {
-            mSocketTransport->SetFastOpenCallback(nullptr);
-        }
         mStreamOut = nullptr;
         mStreamIn = nullptr;
         mSocketTransport = nullptr;
     }
     return rv;
 }
 
 nsresult
@@ -3228,23 +3218,17 @@ nsHttpConnectionMgr::nsHalfOpenSocket::S
     return rv;
 }
 
 void
 nsHttpConnectionMgr::nsHalfOpenSocket::SetupBackupTimer()
 {
     uint16_t timeout = gHttpHandler->GetIdleSynTimeout();
     MOZ_ASSERT(!mSynTimer, "timer already initd");
-    if (!timeout && mUsingFastOpen) {
-        timeout = 250;
-    }
-    // When using Fast Open the correct transport will be setup for sure (it is
-    // guaranteed), but it can be that it will happened a bit later.
-    if (mUsingFastOpen ||
-        (timeout && !mSpeculative)) {
+    if (timeout && !mSpeculative) {
         // Setup the timer that will establish a backup socket
         // if we do not get a writable event on the main one.
         // We do this because a lost SYN takes a very long time
         // to repair at the TCP level.
         //
         // Failure to setup the timer is something we can live with,
         // so don't return an error in that case.
         nsresult rv;
@@ -3282,17 +3266,16 @@ nsHttpConnectionMgr::nsHalfOpenSocket::A
     MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
     RefPtr<nsHalfOpenSocket> deleteProtector(this);
 
     // Tell socket (and backup socket) to forget the half open socket.
     if (mSocketTransport) {
         mSocketTransport->SetEventSink(nullptr, nullptr);
         mSocketTransport->SetSecurityCallbacks(nullptr);
-        mSocketTransport->SetFastOpenCallback(nullptr);
         mSocketTransport = nullptr;
     }
     if (mBackupTransport) {
         mBackupTransport->SetEventSink(nullptr, nullptr);
         mBackupTransport->SetSecurityCallbacks(nullptr);
         mBackupTransport = nullptr;
     }
 
@@ -3377,208 +3360,50 @@ nsHttpConnectionMgr::
 nsHalfOpenSocket::OnOutputStreamReady(nsIAsyncOutputStream *out)
 {
     MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
     MOZ_ASSERT(out == mStreamOut || out == mBackupStreamOut,
                "stream mismatch");
     LOG(("nsHalfOpenSocket::OnOutputStreamReady [this=%p ent=%s %s]\n",
          this, mEnt->mConnInfo->Origin(),
          out == mStreamOut ? "primary" : "backup"));
+    nsresult rv;
 
     gHttpHandler->ConnMgr()->RecvdConnect();
 
     CancelBackupTimer();
-    if (mConnectionNegotiatingFastOpen && mUsingFastOpen) {
-        // If fast open is used, right after a socket for the primary stream is
-        // created a nsHttpConnection is created for that socket. The connection
-        // listens for  OnOutputStreamReady not HalfOpenSocket. So this stream
-        // cannot be mStreamOut.
-        MOZ_ASSERT(out == mBackupStreamOut);
-        MOZ_ASSERT(mTransaction->IsNullTransaction());
-        // Here the backup, non-TFO connection has connected successfully,
-        // before the TFO connection.
-        //
-        // The primary, TFO connection will be cancelled and the transaction
-        // will be rewind. CloseConnectionFastOpenTakesTooLongOrError will
-        // return the rewind transaction. The transaction will be put back to
-        // the pending queue and as well connected to this halfOpenSocket.
-        // SetupConn should set up a new nsHttpConnection with the backup
-        // socketTransport and the rewind transaction.
-        mSocketTransport->SetFastOpenCallback(nullptr);
-        RefPtr<nsAHttpTransaction> trans =
-            mConnectionNegotiatingFastOpen->CloseConnectionFastOpenTakesTooLongOrError();
-        mConnectionNegotiatingFastOpen = nullptr;
-        if (trans && trans->QueryHttpTransaction()) {
-            mTransaction = trans;
-            RefPtr<PendingTransactionInfo> pendingTransInfo =
-                new PendingTransactionInfo(trans->QueryHttpTransaction());
-            pendingTransInfo->mHalfOpen =
-                do_GetWeakReference(static_cast<nsISupportsWeakReference*>(this));
-            if (trans->Caps() & NS_HTTP_URGENT_START) {
-                gHttpHandler->ConnMgr()->InsertTransactionSorted(mEnt->mUrgentStartQ,
-                                                                 pendingTransInfo);
-            } else {
-                mEnt->InsertTransaction(pendingTransInfo);
-            }
-        }
-        if (mEnt->mUseFastOpen) {
-            gHttpHandler->IncrementFastOpenConsecutiveFailureCounter();
-            mEnt->mUseFastOpen = false;
-        }
-    }
-
-    return SetupConn(out, false);
-}
-
-bool
-nsHttpConnectionMgr::
-nsHalfOpenSocket::FastOpenEnabled()
-{
-    LOG(("nsHalfOpenSocket::FastOpenEnabled [this=%p]\n", this));
-
-    if (!mEnt) {
-        return false;
-    }
-
-    if (!gHttpHandler->UseFastOpen()) {
-        // fast open was turned off.
-        LOG(("nsHalfOpenSocket::FastEnabled - fast open was turned off.\n"));
-        mEnt->mUseFastOpen = false;
-        return false;
-    }
-    // We can use FastOpen if we have a transaction or if it is ssl
-    // connection. For ssl we will use a null transaction to drive the SSL
-    // handshake to completion if there is not a pending transaction. Afterwards
-    // the connection will be 100% ready for the next transaction to use it.
-    // Make an exception for SSL tunneled HTTP proxy as the NullHttpTransaction
-    // does not know how to drive Connect.
-    RefPtr<PendingTransactionInfo> info = FindTransactionHelper(false);
-
-    if ((!info) &&
-        (!mEnt->mConnInfo->FirstHopSSL() || mEnt->mConnInfo->UsingConnect())) {
-        LOG(("nsHalfOpenSocket::FastOpenEnabled - It is a connection without "
-             "transaction and first hop is not ssl.\n"));
-        return false;
-    }
-
-    if ((info) && !mEnt->mConnInfo->FirstHopSSL()) {
-        // The following function call will check whether is possible to send
-        // data during fast open
-        if (!info->mTransaction->CanDo0RTT()) {
-            LOG(("nsHalfOpenSocket::FastOpenEnabled - it is not safe to restart "
-                 "transaction.\n"));
-            return false;
-        }
-    }
-
-    return true;
-}
-
-nsresult
-nsHttpConnectionMgr::
-nsHalfOpenSocket::StartFastOpen()
-{
-    MOZ_ASSERT(mStreamOut);
-    MOZ_ASSERT(mEnt && !mBackupTransport);
-    mUsingFastOpen = true;
-    if (mEnt && !mBackupTransport && !mSynTimer) {
-        // For Fast Open we will setup backup timer also for NullTransaction.
-        // So maybe it is not set and we need to set it here.
-        SetupBackupTimer();
-    }
-    mStreamOut->AsyncWait(nullptr, 0, 0, nullptr);
-    mSocketTransport->SetEventSink(nullptr, nullptr);
-    gHttpHandler->ConnMgr()->RecvdConnect();
-    return SetupConn(mStreamOut, true);
-}
-
-void
-nsHttpConnectionMgr::
-nsHalfOpenSocket::FastOpenConnected(nsresult aError)
-{
-    RefPtr<nsHalfOpenSocket> deleteProtector(this);
-    CancelBackupTimer();
-    if (NS_SUCCEEDED(aError)) {
-        NetAddr peeraddr;
-        if (NS_SUCCEEDED(mSocketTransport->GetPeerAddr(&peeraddr))) {
-            mEnt->RecordIPFamilyPreference(peeraddr.raw.family);
-        }
-        gHttpHandler->ResetFastOpenConsecutiveFailureCounter();
-    } else if ((aError == NS_ERROR_CONNECTION_REFUSED) ||
-               (aError == NS_ERROR_NET_TIMEOUT)) {
-        if (mEnt->mUseFastOpen) {
-            gHttpHandler->IncrementFastOpenConsecutiveFailureCounter();
-            mEnt->mUseFastOpen = false;
-        }
-        // This is called from nsSocketTransport::RecoverFromError. The
-        // socket will try connect and we need to rewind nsHttpTransaction
-        MOZ_ASSERT(mConnectionNegotiatingFastOpen);
-        DebugOnly<nsresult> rv =
-            mConnectionNegotiatingFastOpen->Transaction()->RestartOnFastOpenError();
-        MOZ_ASSERT(NS_SUCCEEDED(rv));
-    }
-    if (mConnectionNegotiatingFastOpen) {
-        mSocketTransport = nullptr;
-        mConnectionNegotiatingFastOpen = nullptr;
-    }
-}
-
-void
-nsHttpConnectionMgr::
-nsHalfOpenSocket::FastOpenNotSupported()
-{
-  MOZ_ASSERT(mUsingFastOpen);
-  RefPtr<nsHalfOpenSocket> deleteProtector(this);
-  CancelBackupTimer();
-  mUsingFastOpen = false;
-  mConnectionNegotiatingFastOpen = nullptr;
-  mSocketTransport = nullptr;
-  gHttpHandler->SetFastOpenNotSupported();
-}
-
-nsresult
-nsHttpConnectionMgr::
-nsHalfOpenSocket::SetupConn(nsIAsyncOutputStream *out,
-                            bool aFastOpen)
-{
-    MOZ_ASSERT(!aFastOpen || (out == mStreamOut));
+
     // assign the new socket to the http connection
     RefPtr<nsHttpConnection> conn = new nsHttpConnection();
-    LOG(("nsHalfOpenSocket::SetupConn "
+    LOG(("nsHalfOpenSocket::OnOutputStreamReady "
          "Created new nshttpconnection %p\n", conn.get()));
 
     // Some capabilities are needed before a transaciton actually gets
     // scheduled (e.g. how to negotiate false start)
     conn->SetTransactionCaps(mTransaction->Caps());
 
     NetAddr peeraddr;
     nsCOMPtr<nsIInterfaceRequestor> callbacks;
     mTransaction->GetSecurityCallbacks(getter_AddRefs(callbacks));
-    nsresult rv;
     if (out == mStreamOut) {
         TimeDuration rtt = TimeStamp::Now() - mPrimarySynStarted;
         rv = conn->Init(mEnt->mConnInfo,
                         gHttpHandler->ConnMgr()->mMaxRequestDelay,
                         mSocketTransport, mStreamIn, mStreamOut,
-                        mPrimaryConnectedOK || aFastOpen, callbacks,
+                        mPrimaryConnectedOK, callbacks,
                         PR_MillisecondsToInterval(
                           static_cast<uint32_t>(rtt.ToMilliseconds())));
 
-        if (!aFastOpen &&
-            NS_SUCCEEDED(mSocketTransport->GetPeerAddr(&peeraddr))) {
+        if (NS_SUCCEEDED(mSocketTransport->GetPeerAddr(&peeraddr)))
             mEnt->RecordIPFamilyPreference(peeraddr.raw.family);
-        }
 
         // The nsHttpConnection object now owns these streams and sockets
         mStreamOut = nullptr;
         mStreamIn = nullptr;
-        if (!aFastOpen) {
-            mSocketTransport = nullptr;
-        }
-        conn->SetFastOpen(aFastOpen);
+        mSocketTransport = nullptr;
     } else if (out == mBackupStreamOut) {
         TimeDuration rtt = TimeStamp::Now() - mBackupSynStarted;
         rv = conn->Init(mEnt->mConnInfo,
                         gHttpHandler->ConnMgr()->mMaxRequestDelay,
                         mBackupTransport, mBackupStreamIn, mBackupStreamOut,
                         mBackupConnectedOK, callbacks,
                         PR_MillisecondsToInterval(
                           static_cast<uint32_t>(rtt.ToMilliseconds())));
@@ -3591,27 +3416,25 @@ nsHalfOpenSocket::SetupConn(nsIAsyncOutp
         mBackupStreamIn = nullptr;
         mBackupTransport = nullptr;
     } else {
         MOZ_ASSERT(false, "unexpected stream");
         rv = NS_ERROR_UNEXPECTED;
     }
 
     if (NS_FAILED(rv)) {
-        LOG(("nsHalfOpenSocket::SetupConn "
+        LOG(("nsHalfOpenSocket::OnOutputStreamReady "
              "conn->init (%p) failed %" PRIx32 "\n",
              conn.get(), static_cast<uint32_t>(rv)));
         return rv;
     }
 
     // This half-open socket has created a connection.  This flag excludes it
     // from counter of actual connections used for checking limits.
-    if (!aFastOpen) {
-        mHasConnected = true;
-    }
+    mHasConnected = true;
 
     // if this is still in the pending list, remove it and dispatch it
     RefPtr<PendingTransactionInfo> pendingTransInfo = FindTransactionHelper(true);
     if (pendingTransInfo) {
         MOZ_ASSERT(!mSpeculative,
                    "Speculative Half Open found mTransaction");
 
         gHttpHandler->ConnMgr()->AddActiveConn(conn, mEnt);
@@ -3631,17 +3454,17 @@ nsHalfOpenSocket::SetupConn(nsIAsyncOutp
         // then form a null transaction to drive the SSL handshake to
         // completion. Afterwards the connection will be 100% ready for the next
         // transaction to use it. Make an exception for SSL tunneled HTTP proxy as the
         // NullHttpTransaction does not know how to drive Connect
         if (mEnt->mConnInfo->FirstHopSSL() &&
             !mEnt->mUrgentStartQ.Length() &&
             !mEnt->PendingQLength() &&
             !mEnt->mConnInfo->UsingConnect()) {
-            LOG(("nsHalfOpenSocket::SetupConn null transaction will "
+            LOG(("nsHalfOpenSocket::OnOutputStreamReady null transaction will "
                  "be used to finish SSL handshake on conn %p\n", conn.get()));
             RefPtr<nsAHttpTransaction> trans;
             if (mTransaction->IsNullTransaction() && !mDispatchedMTransaction) {
                 // null transactions cannot be put in the entry queue, so that
                 // explains why it is not present.
                 mDispatchedMTransaction = true;
                 trans = mTransaction;
             } else {
@@ -3649,17 +3472,17 @@ nsHalfOpenSocket::SetupConn(nsIAsyncOutp
                                                 callbacks, mCaps);
             }
 
             gHttpHandler->ConnMgr()->AddActiveConn(conn, mEnt);
             rv = gHttpHandler->ConnMgr()->
                 DispatchAbstractTransaction(mEnt, trans, mCaps, conn, 0);
         } else {
             // otherwise just put this in the persistent connection pool
-            LOG(("nsHalfOpenSocket::SetupConn no transaction match "
+            LOG(("nsHalfOpenSocket::OnOutputStreamReady no transaction match "
                  "returning conn %p to pool\n", conn.get()));
             gHttpHandler->ConnMgr()->OnMsgReclaimConnection(0, conn);
 
             // We expect that there is at least one tranasction in the pending
             // queue that can take this connection, but it can happened that
             // all transactions are blocked or they have took other idle
             // connections. In that case the connection has been added to the
             // idle queue.
@@ -3686,30 +3509,16 @@ nsHalfOpenSocket::SetupConn(nsIAsyncOutp
                     }
                     gHttpHandler->ConnMgr()->AddActiveConn(conn, mEnt);
                     rv = gHttpHandler->ConnMgr()->
                         DispatchAbstractTransaction(mEnt, trans, mCaps, conn, 0);
                 }
             }
         }
     }
-    if (aFastOpen) {
-        // If it is fast open create a new tranaction for backup stream.
-        mTransaction = new NullHttpTransaction(mEnt->mConnInfo,
-                                               callbacks, mCaps);
-
-        conn->SetFastOpen(false);
-        mConnectionNegotiatingFastOpen = conn;
-    }
-
-    // If this halfOpenConn was speculative, but at the ende the conn got a
-    // non-null transaction than this halfOpen is not speculative anymore!
-    if (conn->Transaction() && conn->Transaction()->IsNullTransaction()) {
-        mSpeculative = false;
-    }
 
     return rv;
 }
 
 // register a connection to receive CanJoinConnection() for particular
 // origin keys
 void
 nsHttpConnectionMgr::RegisterOriginCoalescingKey(nsHttpConnection *conn,
@@ -3927,17 +3736,16 @@ nsHttpConnectionMgr::
 nsConnectionEntry::nsConnectionEntry(nsHttpConnectionInfo *ci)
     : mConnInfo(ci)
     , mUsingSpdy(false)
     , mPreferIPv4(false)
     , mPreferIPv6(false)
     , mUsedForConnection(false)
 {
     MOZ_COUNT_CTOR(nsConnectionEntry);
-    mUseFastOpen = gHttpHandler->UseFastOpen();
 }
 
 bool
 nsHttpConnectionMgr::nsConnectionEntry::AvailableForDispatchNow()
 {
     if (mIdleConns.Length() && mIdleConns[0]->CanReuse()) {
         return true;
     }
--- a/netwerk/protocol/http/nsHttpConnectionMgr.h
+++ b/netwerk/protocol/http/nsHttpConnectionMgr.h
@@ -14,17 +14,16 @@
 #include "nsDataHashtable.h"
 #include "nsAutoPtr.h"
 #include "mozilla/ReentrantMonitor.h"
 #include "mozilla/TimeStamp.h"
 #include "mozilla/Attributes.h"
 #include "AlternateServices.h"
 #include "ARefBase.h"
 #include "nsWeakReference.h"
-#include "TCPFastOpen.h"
 
 #include "nsIObserver.h"
 #include "nsITimer.h"
 
 class nsIHttpUpgradeListener;
 
 namespace mozilla {
 namespace net {
@@ -270,19 +269,16 @@ private:
         bool mPreferIPv4 : 1;
         // True when we've first connected an IPv6 server for this host,
         // initially false.
         bool mPreferIPv6 : 1;
 
         // True if this connection entry has initiated a socket
         bool mUsedForConnection : 1;
 
-        // Try using TCP Fast Open.
-        bool mUseFastOpen : 1;
-
         // Set the IP family preference flags according the connected family
         void RecordIPFamilyPreference(uint16_t family);
         // Resets all flags to their default values
         void ResetIPFamilyPreference();
 
         // Return the count of pending transactions for all window ids.
         size_t PendingQLength() const;
 
@@ -319,18 +315,17 @@ private:
 
     // nsHalfOpenSocket is used to hold the state of an opening TCP socket
     // while we wait for it to establish and bind it to a connection
 
     class nsHalfOpenSocket final : public nsIOutputStreamCallback,
                                    public nsITransportEventSink,
                                    public nsIInterfaceRequestor,
                                    public nsITimerCallback,
-                                   public nsSupportsWeakReference,
-                                   public TCPFastOpen
+                                   public nsSupportsWeakReference
     {
         ~nsHalfOpenSocket();
 
     public:
         NS_DECLARE_STATIC_IID_ACCESSOR(NS_HALFOPENSOCKET_IID)
         NS_DECL_THREADSAFE_ISUPPORTS
         NS_DECL_NSIOUTPUTSTREAMCALLBACK
         NS_DECL_NSITRANSPORTEVENTSINK
@@ -366,25 +361,17 @@ private:
         void SetAllow1918(bool val) { mAllow1918 = val; }
 
         bool HasConnected() { return mHasConnected; }
 
         void PrintDiagnostics(nsCString &log);
 
         bool Claim();
         void Unclaim();
-
-        bool FastOpenEnabled() override;
-        nsresult StartFastOpen() override;
-        void FastOpenConnected(nsresult) override;
-        void FastOpenNotSupported() override;
     private:
-        nsresult SetupConn(nsIAsyncOutputStream *out,
-                           bool aFastOpen);
-
         // To find out whether |mTransaction| is still in the connection entry's
         // pending queue. If the transaction is found and |removeWhenFound| is
         // true, the transaction will be removed from the pending queue.
         already_AddRefed<PendingTransactionInfo>
         FindTransactionHelper(bool removeWhenFound);
 
         nsConnectionEntry              *mEnt;
         RefPtr<nsAHttpTransaction>     mTransaction;
@@ -427,19 +414,16 @@ private:
         bool                           mBackupConnectedOK;
 
         // A nsHalfOpenSocket can be made for a concrete non-null transaction,
         // but the transaction can be dispatch to another connection. In that
         // case we can free this transaction to be claimed by other
         // transactions.
         bool                           mFreeToUse;
         nsresult                       mPrimaryStreamStatus;
-
-        bool                           mUsingFastOpen;
-        RefPtr<nsHttpConnection>       mConnectionNegotiatingFastOpen;
     };
     friend class nsHalfOpenSocket;
 
     class PendingTransactionInfo : public ARefBase
     {
     public:
         explicit PendingTransactionInfo(nsHttpTransaction * trans)
             : mTransaction(trans)
--- a/netwerk/protocol/http/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/nsHttpHandler.cpp
@@ -49,17 +49,16 @@
 #include "nsHttpChannelAuthProvider.h"
 #include "nsServiceManagerUtils.h"
 #include "nsComponentManagerUtils.h"
 #include "nsSocketTransportService2.h"
 #include "nsIOService.h"
 #include "nsIThrottlingService.h"
 #include "nsISupportsPrimitives.h"
 #include "nsIXULRuntime.h"
-#include "nsCharSeparatedTokenizer.h"
 
 #include "mozilla/net/NeckoChild.h"
 #include "mozilla/net/NeckoParent.h"
 #include "mozilla/ipc/URIUtils.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/Unused.h"
 #include "mozilla/BasePrincipal.h"
 
@@ -96,19 +95,16 @@
 #define BROWSER_PREF_PREFIX     "browser.cache."
 #define DONOTTRACK_HEADER_ENABLED "privacy.donottrackheader.enabled"
 #define H2MANDATORY_SUITE        "security.ssl3.ecdhe_rsa_aes_128_gcm_sha256"
 #define TELEMETRY_ENABLED        "toolkit.telemetry.enabled"
 #define ALLOW_EXPERIMENTS        "network.allow-experiments"
 #define SAFE_HINT_HEADER_VALUE   "safeHint.enabled"
 #define SECURITY_PREFIX          "security."
 
-#define TCP_FAST_OPEN_ENABLE        "network.tcp.tcp_fastopen_enable"
-#define TCP_FAST_OPEN_FAILURE_LIMIT "network.tcp.tcp_fastopen_consecutive_failure_limit"
-
 #define UA_PREF(_pref) UA_PREF_PREFIX _pref
 #define HTTP_PREF(_pref) HTTP_PREF_PREFIX _pref
 #define BROWSER_PREF(_pref) BROWSER_PREF_PREFIX _pref
 
 #define NS_HTTP_PROTOCOL_FLAGS (URI_STD | ALLOWS_PROXY | ALLOWS_PROXY_HTTP | URI_LOADABLE_BY_ANYONE)
 
 //-----------------------------------------------------------------------------
 
@@ -240,95 +236,27 @@ nsHttpHandler::nsHttpHandler()
     , mTCPKeepaliveShortLivedIdleTimeS(10)
     , mTCPKeepaliveLongLivedEnabled(false)
     , mTCPKeepaliveLongLivedIdleTimeS(600)
     , mEnforceH1Framing(FRAMECHECK_BARELY)
     , mKeepEmptyResponseHeadersAsEmtpyString(false)
     , mDefaultHpackBuffer(4096)
     , mMaxHttpResponseHeaderSize(393216)
     , mFocusedWindowTransactionRatio(0.9f)
-    , mUseFastOpen(true)
-    , mFastOpenConsecutiveFailureLimit(5)
-    , mFastOpenConsecutiveFailureCounter(0)
     , mProcessId(0)
     , mNextChannelId(1)
 {
     LOG(("Creating nsHttpHandler [this=%p].\n", this));
 
     MOZ_ASSERT(!gHttpHandler, "HTTP handler already created!");
     gHttpHandler = this;
     nsCOMPtr<nsIXULRuntime> runtime = do_GetService("@mozilla.org/xre/runtime;1");
     if (runtime) {
         runtime->GetProcessID(&mProcessId);
     }
-    SetFastOpenOSSupport();
-}
-
-void
-nsHttpHandler::SetFastOpenOSSupport()
-{
-    mFastOpenSupported = false;
-#if !defined(XP_WIN) && !defined(XP_LINUX) && !defined(ANDROID) && !defined(HAS_CONNECTX)
-    return;
-#else
-
-    nsCOMPtr<nsIPropertyBag2> infoService =
-        do_GetService("@mozilla.org/system-info;1");
-    MOZ_ASSERT(infoService, "Could not find a system info service");
-    nsAutoCString version;
-    nsresult rv;
-#ifdef ANDROID
-    rv = infoService->GetPropertyAsACString(
-        NS_LITERAL_STRING("sdk_version"), version);
-#else
-    rv = infoService->GetPropertyAsACString(
-        NS_LITERAL_STRING("version"), version);
-#endif
-
-    LOG(("nsHttpHandler::SetFastOpenOSSupport version %s", version.get()));
-
-    if (NS_SUCCEEDED(rv)) {
-        // set min version minus 1.
-#ifdef XP_WIN
-        int min_version[] = {10, 0};
-#elif XP_MACOSX
-        int min_version[] = {15, 0};
-#elif ANDROID
-        int min_version[] = {4, 4};
-#elif XP_LINUX
-        int min_version[] = {3, 6};
-#endif
-        int inx = 0;
-        nsCCharSeparatedTokenizer tokenizer(version, '.');
-        while ((inx < 2) && tokenizer.hasMoreTokens()) {
-            nsAutoCString token(tokenizer.nextToken());
-            const char* nondigit = NS_strspnp("0123456789", token.get());
-            if (nondigit && *nondigit) {
-                break;
-            }
-            nsresult rv;
-            int32_t ver = token.ToInteger(&rv);
-            if (NS_FAILED(rv)) {
-                break;
-            }
-            if (ver > min_version[inx]) {
-                mFastOpenSupported = true;
-                break;
-            } else if (ver == min_version[inx] && inx == 1) {
-                mFastOpenSupported = true;
-            } else if (ver < min_version[inx]) {
-                break;
-            }
-            inx++;
-        }
-    }
-#endif
-
-    LOG(("nsHttpHandler::SetFastOpenOSSupport %s supported.\n",
-         mFastOpenSupported ? "" : "not"));
 }
 
 nsHttpHandler::~nsHttpHandler()
 {
     LOG(("Deleting nsHttpHandler [this=%p]\n", this));
 
     // make sure the connection manager is shutdown
     if (mConnMgr) {
@@ -381,18 +309,16 @@ nsHttpHandler::Init()
         prefBranch->AddObserver(BROWSER_PREF("disk_cache_ssl"), this, true);
         prefBranch->AddObserver(DONOTTRACK_HEADER_ENABLED, this, true);
         prefBranch->AddObserver(TELEMETRY_ENABLED, this, true);
         prefBranch->AddObserver(H2MANDATORY_SUITE, this, true);
         prefBranch->AddObserver(HTTP_PREF("tcp_keepalive.short_lived_connections"), this, true);
         prefBranch->AddObserver(HTTP_PREF("tcp_keepalive.long_lived_connections"), this, true);
         prefBranch->AddObserver(SAFE_HINT_HEADER_VALUE, this, true);
         prefBranch->AddObserver(SECURITY_PREFIX, this, true);
-        prefBranch->AddObserver(TCP_FAST_OPEN_ENABLE, this, true);
-        prefBranch->AddObserver(TCP_FAST_OPEN_FAILURE_LIMIT, this, true);
         PrefsChanged(prefBranch, nullptr);
     }
 
     nsHttpChannelAuthProvider::InitializePrefs();
 
     mMisc.AssignLiteral("rv:" MOZILLA_UAVERSION);
 
     mCompatFirefox.AssignLiteral("Firefox/" MOZILLA_UAVERSION);
@@ -625,32 +551,16 @@ nsHttpHandler::IsAcceptableEncoding(cons
          !PL_strcasecmp(enc, "x-gzip") || !PL_strcasecmp(enc, "x-deflate"))) {
         rv = true;
     }
     LOG(("nsHttpHandler::IsAceptableEncoding %s https=%d %d\n",
          enc, isSecure, rv));
     return rv;
 }
 
-void
-nsHttpHandler::IncrementFastOpenConsecutiveFailureCounter()
-{
-    LOG(("nsHttpHandler::IncrementFastOpenConsecutiveFailureCounter - "
-         "failed=%d failure_limit=%d", mFastOpenConsecutiveFailureCounter,
-         mFastOpenConsecutiveFailureLimit));
-    if (mFastOpenConsecutiveFailureCounter < mFastOpenConsecutiveFailureLimit) {
-        mFastOpenConsecutiveFailureCounter++;
-        if (mFastOpenConsecutiveFailureCounter == mFastOpenConsecutiveFailureLimit) {
-            LOG(("nsHttpHandler::IncrementFastOpenConsecutiveFailureCounter - "
-                 "Fast open failed too many times"));
-            SetFastOpenNotSupported();
-        }
-    }
-}
-
 nsresult
 nsHttpHandler::GetStreamConverterService(nsIStreamConverterService **result)
 {
     if (!mStreamConvSvc) {
         nsresult rv;
         nsCOMPtr<nsIStreamConverterService> service =
             do_GetService(NS_STREAMCONVERTERSERVICE_CONTRACTID, &rv);
         if (NS_FAILED(rv))
@@ -1735,33 +1645,16 @@ nsHttpHandler::PrefsChanged(nsIPrefBranc
             if (NS_SUCCEEDED(rv) && cVar) {
                 mEnforceH1Framing = FRAMECHECK_BARELY;
             } else {
                 mEnforceH1Framing = FRAMECHECK_LAX;
             }
         }
     }
 
-    if (PREF_CHANGED(TCP_FAST_OPEN_ENABLE)) {
-        rv = prefs->GetBoolPref(TCP_FAST_OPEN_ENABLE, &cVar);
-        if (NS_SUCCEEDED(rv)) {
-            mUseFastOpen = cVar;
-        }
-    }
-
-    if (PREF_CHANGED(TCP_FAST_OPEN_FAILURE_LIMIT)) {
-        rv = prefs->GetIntPref(TCP_FAST_OPEN_FAILURE_LIMIT, &val);
-        if (NS_SUCCEEDED(rv)) {
-            if (val < 0) {
-                val = 0;
-            }
-            mFastOpenConsecutiveFailureLimit = val;
-        }
-    }
-
     if (PREF_CHANGED(HTTP_PREF("keep_empty_response_headers_as_empty_string"))) {
         rv = prefs->GetBoolPref(HTTP_PREF("keep_empty_response_headers_as_empty_string"),
                                 &cVar);
         if (NS_SUCCEEDED(rv)) {
             mKeepEmptyResponseHeadersAsEmtpyString = cVar;
         }
     }
 
--- a/netwerk/protocol/http/nsHttpHandler.h
+++ b/netwerk/protocol/http/nsHttpHandler.h
@@ -159,33 +159,16 @@ public:
       return mTCPKeepaliveLongLivedEnabled;
     }
     // Returns time (secs) before first TCP keepalive probes should be sent;
     // same time used between successful keepalive probes.
     int32_t GetTCPKeepaliveLongLivedIdleTime() {
       return mTCPKeepaliveLongLivedIdleTimeS;
     }
 
-    bool UseFastOpen() { return mUseFastOpen && mFastOpenSupported; }
-    // If one of tcp connections return PR_NOT_TCP_SOCKET_ERROR while trying
-    // fast open, it means that Fast Open is turned off so we will not try again
-    // until a restart. This is only on Linux.
-    // For windows 10 we can only check whether a version of windows support
-    // Fast Open at run time, so if we get error PR_NOT_IMPLEMENTED_ERROR it
-    // means that Fast Open is not supported and we will set mFastOpenSupported
-    // to false.
-    void SetFastOpenNotSupported() { mFastOpenSupported = false; }
-
-    void IncrementFastOpenConsecutiveFailureCounter();
-
-    void ResetFastOpenConsecutiveFailureCounter()
-    {
-        mFastOpenConsecutiveFailureCounter = 0;
-    }
-
     // returns the HTTP framing check level preference, as controlled with
     // network.http.enforce-framing.http1 and network.http.enforce-framing.soft
     FrameCheckLevel GetEnforceH1Framing() { return mEnforceH1Framing; }
 
     nsHttpAuthCache     *AuthCache(bool aPrivate) {
         return aPrivate ? &mPrivateAuthCache : &mAuthCache;
     }
     nsHttpConnectionMgr *ConnMgr()   { return mConnMgr; }
@@ -399,17 +382,16 @@ private:
     MOZ_MUST_USE nsresult SetAccept(const char *);
     MOZ_MUST_USE nsresult SetAcceptLanguages();
     MOZ_MUST_USE nsresult SetAcceptEncodings(const char *, bool mIsSecure);
 
     MOZ_MUST_USE nsresult InitConnectionMgr();
 
     void     NotifyObservers(nsIHttpChannel *chan, const char *event);
 
-    void SetFastOpenOSSupport();
 private:
 
     // cached services
     nsMainThreadPtrHandle<nsIIOService>              mIOService;
     nsMainThreadPtrHandle<nsIStreamConverterService> mStreamConvSvc;
     nsMainThreadPtrHandle<nsICookieService>          mCookieService;
     nsMainThreadPtrHandle<nsISiteSecurityService>    mSSService;
     nsMainThreadPtrHandle<nsIThrottlingService>      mThrottlingService;
@@ -595,21 +577,16 @@ private:
     uint32_t mDefaultHpackBuffer;
 
     // The max size (in bytes) for received Http response header.
     uint32_t mMaxHttpResponseHeaderSize;
 
     // The ratio for dispatching transactions from the focused window.
     float mFocusedWindowTransactionRatio;
 
-    Atomic<bool, Relaxed> mUseFastOpen;
-    Atomic<bool, Relaxed> mFastOpenSupported;
-    uint32_t mFastOpenConsecutiveFailureLimit;
-    uint32_t mFastOpenConsecutiveFailureCounter;
-
 private:
     // For Rate Pacing Certain Network Events. Only assign this pointer on
     // socket thread.
     void MakeNewRequestTokenBucket();
     RefPtr<EventTokenBucket> mRequestTokenBucket;
 
 public:
     // Socket thread only
--- a/netwerk/protocol/http/nsHttpTransaction.cpp
+++ b/netwerk/protocol/http/nsHttpTransaction.cpp
@@ -2184,32 +2184,20 @@ void
 nsHttpTransaction::GetNetworkAddresses(NetAddr &self, NetAddr &peer)
 {
     MutexAutoLock lock(mLock);
     self = mSelfAddr;
     peer = mPeerAddr;
 }
 
 bool
-nsHttpTransaction::CanDo0RTT()
-{
-    if (mRequestHead->IsSafeMethod() &&
-        (!mConnection ||
-         !mConnection->IsProxyConnectInProgress())) {
-        return true;
-    }
-    return false;
-}
-
-bool
 nsHttpTransaction::Do0RTT()
 {
    if (mRequestHead->IsSafeMethod() &&
-       (!mConnection ||
-       !mConnection->IsProxyConnectInProgress())) {
+       !mConnection->IsProxyConnectInProgress()) {
      m0RTTInProgress = true;
    }
    return m0RTTInProgress;
 }
 
 nsresult
 nsHttpTransaction::Finish0RTT(bool aRestart, bool aAlpnChanged /* ignored */)
 {
@@ -2233,44 +2221,16 @@ nsHttpTransaction::Finish0RTT(bool aRest
     } else if (!mConnected) {
         // this is code that was skipped in ::ReadSegments while in 0RTT
         mConnected = true;
         mConnection->GetSecurityInfo(getter_AddRefs(mSecurityInfo));
     }
     return NS_OK;
 }
 
-nsresult
-nsHttpTransaction::RestartOnFastOpenError()
-{
-    // This will happen on connection error during Fast Open or if connect
-    // during Fast Open takes too long. So we should not have received any
-    // data!
-    MOZ_ASSERT(!mReceivedData);
-    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
-
-    LOG(("nsHttpTransaction::RestartOnFastOpenError - restarting transaction "
-         "%p\n", this));
-
-    // rewind streams in case we already wrote out the request
-    nsCOMPtr<nsISeekableStream> seekable = do_QueryInterface(mRequestStream);
-    if (seekable)
-        seekable->Seek(nsISeekableStream::NS_SEEK_SET, 0);
-        // clear old connection state...
-    mSecurityInfo = nullptr;
-
-    if (!mConnInfo->GetRoutedHost().IsEmpty()) {
-        MutexAutoLock lock(*nsHttp::GetLock());
-        RefPtr<nsHttpConnectionInfo> ci;
-        mConnInfo->CloneAsDirectRoute(getter_AddRefs(ci));
-        mConnInfo = ci;
-    }
-    return NS_OK;
-}
-
 void
 nsHttpTransaction::Refused0RTT()
 {
     LOG(("nsHttpTransaction::Refused0RTT %p\n", this));
     if (mEarlyDataDisposition == EARLY_ACCEPTED) {
         mEarlyDataDisposition = EARLY_SENT; // undo accepted state
     }
 }
--- a/netwerk/protocol/http/nsHttpTransaction.h
+++ b/netwerk/protocol/http/nsHttpTransaction.h
@@ -172,19 +172,16 @@ public:
 
     MOZ_MUST_USE bool Do0RTT() override;
     MOZ_MUST_USE nsresult Finish0RTT(bool aRestart, bool aAlpnChanged /* ignored */) override;
 
     // After Finish0RTT early data may have failed but the caller did not request
     // restart - this indicates that state for dev tools
     void Refused0RTT();
 
-    MOZ_MUST_USE bool CanDo0RTT() override;
-    MOZ_MUST_USE nsresult RestartOnFastOpenError() override;
-
     uint64_t TopLevelOuterContentWindowId() override
     {
         return mTopLevelOuterContentWindowId;
     }
 private:
     friend class DeleteHttpTransaction;
     virtual ~nsHttpTransaction();