Bug 885982 - Part 4: Remove all traces of JS implementation. r=asuth
authorJosh Matthews <josh@joshmatthews.net>
Sun, 20 Sep 2015 05:57:15 -0400
changeset 296056 e6895a6883048a7166d9ce5e3917da27f3fb67c7
parent 296055 7877ab6c64ca511513120de41818fc97162ddc5d
child 296057 f7106fa308e5e621d08020b211509b9ef9b1e33e
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersasuth
bugs885982
milestone43.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 885982 - Part 4: Remove all traces of JS implementation. r=asuth
b2g/installer/package-manifest.in
browser/installer/package-manifest.in
dom/network/TCPServerSocket.js
dom/network/TCPServerSocketChild.cpp
dom/network/TCPSocket.js
dom/network/TCPSocket.manifest
dom/network/TCPSocketParent.cpp
dom/network/TCPSocketParent.h
dom/network/TCPSocketParentIntermediary.js
dom/network/interfaces/moz.build
dom/network/interfaces/nsIDOMTCPServerSocket.idl
dom/network/interfaces/nsIDOMTCPSocket.idl
dom/network/interfaces/nsITCPServerSocketChild.idl
dom/network/interfaces/nsITCPServerSocketParent.idl
dom/network/interfaces/nsITCPSocketChild.idl
dom/network/interfaces/nsITCPSocketParent.idl
dom/network/moz.build
dom/network/tests/test_tcpsocket_enabled_no_perm.html
mobile/android/b2gdroid/installer/package-manifest.in
mobile/android/installer/package-manifest.in
--- a/b2g/installer/package-manifest.in
+++ b/b2g/installer/package-manifest.in
@@ -674,21 +674,16 @@
 @RESPATH@/components/HCIEventTransactionSystemMessageConfigurator.js
 
 @RESPATH@/components/Activities.manifest
 @RESPATH@/components/ActivityProxy.js
 @RESPATH@/components/ActivityRequestHandler.js
 @RESPATH@/components/ActivityWrapper.js
 @RESPATH@/components/ActivityMessageConfigurator.js
 
-@RESPATH@/components/TCPSocket.js
-@RESPATH@/components/TCPServerSocket.js
-@RESPATH@/components/TCPSocketParentIntermediary.js
-@RESPATH@/components/TCPSocket.manifest
-
 @RESPATH@/components/Payment.js
 @RESPATH@/components/PaymentFlowInfo.js
 @RESPATH@/components/PaymentProvider.js
 @RESPATH@/components/Payment.manifest
 
 @RESPATH@/components/DownloadsAPI.js
 @RESPATH@/components/DownloadsAPI.manifest
 
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -562,21 +562,16 @@
 
 #ifndef RELEASE_BUILD
 @RESPATH@/components/InterAppComm.manifest
 @RESPATH@/components/InterAppCommService.js
 @RESPATH@/components/InterAppConnection.js
 @RESPATH@/components/InterAppMessagePort.js
 #endif
 
-@RESPATH@/components/TCPSocket.js
-@RESPATH@/components/TCPServerSocket.js
-@RESPATH@/components/TCPSocketParentIntermediary.js
-@RESPATH@/components/TCPSocket.manifest
-
 #ifdef MOZ_ACTIVITIES
 @RESPATH@/components/SystemMessageCache.js
 @RESPATH@/components/SystemMessageInternal.js
 @RESPATH@/components/SystemMessageManager.js
 @RESPATH@/components/SystemMessageManager.manifest
 
 @RESPATH@/components/Activities.manifest
 @RESPATH@/components/ActivityProxy.js
deleted file mode 100644
--- a/dom/network/TCPServerSocket.js
+++ /dev/null
@@ -1,187 +0,0 @@
-/* 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/. */
-
-"use strict";
-
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cu = Components.utils;
-const Cr = Components.results;
-const CC = Components.Constructor;
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-
-const ServerSocket = CC(
-        '@mozilla.org/network/server-socket;1', 'nsIServerSocket', 'init'),
-      TCPSocketInternal = Cc[
-        '@mozilla.org/tcp-socket;1'].createInstance(Ci.nsITCPSocketInternal);
-
-/*
- * Debug logging function
- */
-
-var debug = true;
-function LOG(msg) {
-  if (debug) {
-    dump("TCPServerSocket: " + msg + "\n");
-  }
-}
-
-/*
- * nsIDOMTCPServerSocket object
- */
-
-function TCPServerSocket() {
-  this._localPort = 0;
-  this._binaryType = null;
-
-  this._onconnect = null;
-  this._onerror = null;
-
-  this._inChild = false;
-  this._neckoTCPServerSocket = null;
-  this._serverBridge = null;
-  this.useWin = null;
-}
-
-// When this API moves to WebIDL and these __exposedProps__ go away, remove
-// this call here and remove the API from XPConnect.
-Cu.skipCOWCallableChecks();
-
-TCPServerSocket.prototype = {
-  __exposedProps__: {
-    localPort: 'r',
-    onconnect: 'rw',
-    onerror: 'rw'
-  },
-  get localPort() {
-    return this._localPort;
-  },
-  get onconnect() {
-    return this._onconnect;
-  },
-  set onconnect(f) {
-    this._onconnect = f;
-  },
-  get onerror() {
-    return this._onerror;
-  },
-  set onerror(f) {
-    this._onerror = f;
-  },
-
-  _callListenerAcceptCommon: function tss_callListenerAcceptCommon(socket) {
-    if (this._onconnect) {
-      try {
-        this["onconnect"].call(null, socket);
-      } catch (e) {
-        socket.close();
-      }
-    }
-    else {
-      socket.close();
-      dump("Received unexpected connection!");
-    }
-  },
-  init: function tss_init(aWindowObj) {
-    this.useWin = aWindowObj;
-  },
-
-  /* nsITCPServerSocketInternal method */
-  listen: function tss_listen(localPort, options, backlog) {
-    this._inChild = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime)
-                       .processType != Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
-    this._binaryType = options.binaryType;
-
-    if (this._inChild) {
-      if (this._serverBridge == null) {
-        this._serverBridge = Cc["@mozilla.org/tcp-server-socket-child;1"]
-                                .createInstance(Ci.nsITCPServerSocketChild);
-        this._serverBridge.listen(this, localPort, backlog, options.binaryType);
-      }
-      else {
-        throw new Error("Child TCPServerSocket has already listening. \n");
-      }
-    }
-    else {
-      if (this._neckoTCPServerSocket == null) {
-        this._neckoTCPServerSocket = new ServerSocket(localPort, false, backlog);
-        this._localPort = this._neckoTCPServerSocket.port;
-        this._neckoTCPServerSocket.asyncListen(this);
-      }
-      else {
-        throw new Error("Parent TCPServerSocket has already listening. \n");
-      }
-    }
-  },
-
-  callListenerAccept: function tss_callListenerSocket(socketChild) {
-    // this method is called at child process when the socket is accepted at parent process.
-    let socket = TCPSocketInternal.createAcceptedChild(socketChild, this._binaryType, this.useWin);
-    this._callListenerAcceptCommon(socket);
-  },
-
-  callListenerError: function tss_callListenerError(message, filename, lineNumber, columnNumber) {
-    if (this._onerror) {
-      var type = "error";
-      var error = new Error(message, filename, lineNumber, columnNumber);
-
-      this["onerror"].call(null, new TCPSocketEvent(type, this, error));
-    }
-  },
-  /* end nsITCPServerSocketInternal method */
-
-  close: function tss_close() {
-    if (this._inChild) {
-      this._serverBridge.close();
-      return;
-    }
-
-    /* Close ServerSocket */
-    if (this._neckoTCPServerSocket) {
-      this._neckoTCPServerSocket.close();
-    }
-  },
-
-  // nsIServerSocketListener (Triggered by _neckoTCPServerSocket.asyncListen)
-  onSocketAccepted: function tss_onSocketAccepted(server, trans) {
-    // precondition: this._inChild == false
-    try {
-      let that = TCPSocketInternal.createAcceptedParent(trans, this._binaryType,
-                                                        this.useWin);
-      this._callListenerAcceptCommon(that);
-    }
-    catch(e) {
-      trans.close(Cr.NS_BINDING_ABORTED);
-    }
-  },
-
-  // nsIServerSocketListener (Triggered by _neckoTCPServerSocket.asyncListen)
-  onStopListening: function tss_onStopListening(server, status) {
-    if (status != Cr.NS_BINDING_ABORTED) {
-      throw new Error("Server socket was closed by unexpected reason.");
-    }
-    this._neckoTCPServerSocket = null;
-  },
-
-  classID: Components.ID("{73065eae-27dc-11e2-895a-000c29987aa2}"),
-
-  classInfo: XPCOMUtils.generateCI({
-    classID: Components.ID("{73065eae-27dc-11e2-895a-000c29987aa2}"),
-    classDescription: "Server TCP Socket",
-    interfaces: [
-      Ci.nsIDOMTCPServerSocket,
-      Ci.nsISupportsWeakReference
-    ],
-    flags: Ci.nsIClassInfo.DOM_OBJECT,
-  }),
-
-  QueryInterface: XPCOMUtils.generateQI([
-    Ci.nsIDOMTCPServerSocket,
-    Ci.nsITCPServerSocketInternal,
-    Ci.nsISupportsWeakReference
-  ])
-}
-
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([TCPServerSocket]);
--- a/dom/network/TCPServerSocketChild.cpp
+++ b/dom/network/TCPServerSocketChild.cpp
@@ -5,17 +5,16 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "TCPServerSocketChild.h"
 #include "TCPSocketChild.h"
 #include "TCPServerSocket.h"
 #include "mozilla/net/NeckoChild.h"
 #include "mozilla/dom/PBrowserChild.h"
 #include "mozilla/dom/TabChild.h"
-#include "nsIDOMTCPSocket.h"
 #include "nsJSUtils.h"
 #include "jsfriendapi.h"
 
 using mozilla::net::gNeckoChild;
 
 namespace mozilla {
 namespace dom {
 
deleted file mode 100644
--- a/dom/network/TCPSocket.js
+++ /dev/null
@@ -1,1005 +0,0 @@
-/* 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/. */
-
-"use strict";
-
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cu = Components.utils;
-const Cr = Components.results;
-const CC = Components.Constructor;
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-
-const InputStreamPump = CC(
-        "@mozilla.org/network/input-stream-pump;1", "nsIInputStreamPump", "init"),
-      AsyncStreamCopier = CC(
-        "@mozilla.org/network/async-stream-copier;1", "nsIAsyncStreamCopier", "init"),
-      ScriptableInputStream = CC(
-        "@mozilla.org/scriptableinputstream;1", "nsIScriptableInputStream", "init"),
-      BinaryInputStream = CC(
-        "@mozilla.org/binaryinputstream;1", "nsIBinaryInputStream", "setInputStream"),
-      StringInputStream = CC(
-        '@mozilla.org/io/string-input-stream;1', 'nsIStringInputStream'),
-      ArrayBufferInputStream = CC(
-        '@mozilla.org/io/arraybuffer-input-stream;1', 'nsIArrayBufferInputStream'),
-      MultiplexInputStream = CC(
-        '@mozilla.org/io/multiplex-input-stream;1', 'nsIMultiplexInputStream');
-const TCPServerSocket = CC(
-        "@mozilla.org/tcp-server-socket;1", "nsITCPServerSocketInternal", "init");
-
-const kCONNECTING = 'connecting';
-const kOPEN = 'open';
-const kCLOSING = 'closing';
-const kCLOSED = 'closed';
-const kRESUME_ERROR = 'Calling resume() on a connection that was not suspended.';
-
-const BUFFER_SIZE = 65536;
-const NETWORK_STATS_THRESHOLD = 65536;
-
-// XXX we have no TCPError implementation right now because it's really hard to
-// do on b2g18.  On mozilla-central we want a proper TCPError that ideally
-// sub-classes DOMError.  Bug 867872 has been filed to implement this and
-// contains a documented TCPError.webidl that maps all the error codes we use in
-// this file to slightly more readable explanations.
-function createTCPError(aWindow, aErrorName, aErrorType) {
-  return new (aWindow ? aWindow.DOMError : DOMError)(aErrorName);
-}
-
-
-/*
- * Debug logging function
- */
-
-var debug = false;
-function LOG(msg) {
-  if (debug)
-    dump("TCPSocket: " + msg + "\n");
-}
-
-/*
- * nsITCPSocketEvent object
- */
-
-function TCPSocketEvent(type, sock, data) {
-  this._type = type;
-  this._target = sock;
-  this._data = data;
-}
-
-// When this API moves to WebIDL and these __exposedProps__ go away, remove
-// this call here and remove the API from XPConnect.
-Cu.skipCOWCallableChecks();
-
-TCPSocketEvent.prototype = {
-  __exposedProps__: {
-    type: 'r',
-    target: 'r',
-    data: 'r',
-    // Promise::ResolveInternal tries to check if the thing being resolved is
-    // itself a promise through the presence of "then".  Accordingly, we list
-    // it as an exposed property, although we return undefined for it.
-    // Bug 882123 covers making TCPSocket be a proper event target with proper
-    // events.
-    then: 'r'
-  },
-  get type() {
-    return this._type;
-  },
-  get target() {
-    return this._target;
-  },
-  get data() {
-    return this._data;
-  },
-  get then() {
-    return undefined;
-  }
-}
-
-/*
- * nsIDOMTCPSocket object
- */
-
-function TCPSocket() {
-  this._readyState = kCLOSED;
-
-  this._onopen = null;
-  this._ondrain = null;
-  this._ondata = null;
-  this._onerror = null;
-  this._onclose = null;
-
-  this._binaryType = "string";
-
-  this._host = "";
-  this._port = 0;
-  this._ssl = false;
-
-  this.useWin = null;
-}
-
-TCPSocket.prototype = {
-  __exposedProps__: {
-    open: 'r',
-    host: 'r',
-    port: 'r',
-    ssl: 'r',
-    bufferedAmount: 'r',
-    suspend: 'r',
-    resume: 'r',
-    close: 'r',
-    send: 'r',
-    readyState: 'r',
-    binaryType: 'r',
-    listen: 'r',
-    onopen: 'rw',
-    ondrain: 'rw',
-    ondata: 'rw',
-    onerror: 'rw',
-    onclose: 'rw'
-  },
-  // The binary type, "string" or "arraybuffer"
-  _binaryType: null,
-
-  // Internal
-  _hasPrivileges: null,
-
-  // Raw socket streams
-  _transport: null,
-  _socketInputStream: null,
-  _socketOutputStream: null,
-
-  // Input stream machinery
-  _inputStreamPump: null,
-  _inputStreamScriptable: null,
-  _inputStreamBinary: null,
-
-  // Output stream machinery
-  _multiplexStream: null,
-  _multiplexStreamCopier: null,
-
-  _asyncCopierActive: false,
-  _waitingForDrain: false,
-  _suspendCount: 0,
-
-  // Reported parent process buffer
-  _bufferedAmount: 0,
-
-  // IPC socket actor
-  _socketBridge: null,
-
-  // StartTLS
-  _waitingForStartTLS: false,
-  _pendingDataAfterStartTLS: [],
-
-  // Used to notify when update bufferedAmount is updated.
-  _onUpdateBufferedAmount: null,
-  _trackingNumber: 0,
-
-#ifdef MOZ_WIDGET_GONK
-  // Network statistics (Gonk-specific feature)
-  _txBytes: 0,
-  _rxBytes: 0,
-  _appId: Ci.nsIScriptSecurityManager.NO_APP_ID,
-  _inBrowser: false,
-  _activeNetworkInfo: null,
-#endif
-
-  // Public accessors.
-  get readyState() {
-    return this._readyState;
-  },
-  get binaryType() {
-    return this._binaryType;
-  },
-  get host() {
-    return this._host;
-  },
-  get port() {
-    return this._port;
-  },
-  get ssl() {
-    return this._ssl;
-  },
-  get bufferedAmount() {
-    if (this._inChild) {
-      return this._bufferedAmount;
-    }
-    return this._multiplexStream.available();
-  },
-  get onopen() {
-    return this._onopen;
-  },
-  set onopen(f) {
-    this._onopen = f;
-  },
-  get ondrain() {
-    return this._ondrain;
-  },
-  set ondrain(f) {
-    this._ondrain = f;
-  },
-  get ondata() {
-    return this._ondata;
-  },
-  set ondata(f) {
-    this._ondata = f;
-  },
-  get onerror() {
-    return this._onerror;
-  },
-  set onerror(f) {
-    this._onerror = f;
-  },
-  get onclose() {
-    return this._onclose;
-  },
-  set onclose(f) {
-    this._onclose = f;
-  },
-
-  _activateTLS: function() {
-    let securityInfo = this._transport.securityInfo
-          .QueryInterface(Ci.nsISSLSocketControl);
-    securityInfo.StartTLS();
-  },
-
-  // Helper methods.
-  _createTransport: function ts_createTransport(host, port, sslMode) {
-    let options;
-    if (sslMode === 'ssl') {
-      options = ['ssl'];
-    } else {
-      options = ['starttls'];
-    }
-    return Cc["@mozilla.org/network/socket-transport-service;1"]
-             .getService(Ci.nsISocketTransportService)
-             .createTransport(options, 1, host, port, null);
-  },
-
-  _sendBufferedAmount: function ts_sendBufferedAmount() {
-    if (this._onUpdateBufferedAmount) {
-      this._onUpdateBufferedAmount(this.bufferedAmount, this._trackingNumber);
-    }
-  },
-
-  _ensureCopying: function ts_ensureCopying() {
-    let self = this;
-    if (this._asyncCopierActive) {
-      return;
-    }
-    this._asyncCopierActive = true;
-    this._multiplexStreamCopier.asyncCopy({
-      onStartRequest: function ts_output_onStartRequest() {
-      },
-      onStopRequest: function ts_output_onStopRequest(request, context, status) {
-        self._asyncCopierActive = false;
-        self._multiplexStream.removeStream(0);
-        self._sendBufferedAmount();
-
-        if (!Components.isSuccessCode(status)) {
-          // Note that we can/will get an error here as well as in the
-          // onStopRequest for inbound data.
-          self._maybeReportErrorAndCloseIfOpen(status);
-          return;
-        }
-
-        if (self._multiplexStream.count) {
-          self._ensureCopying();
-        } else {
-          // If we are waiting for initiating starttls, we can begin to
-          // activate tls now.
-          if (self._waitingForStartTLS && self._readyState == kOPEN) {
-            self._activateTLS();
-            self._waitingForStartTLS = false;
-            // If we have pending data, we should send them, or fire
-            // a drain event if we are waiting for it.
-            if (self._pendingDataAfterStartTLS.length > 0) {
-              while (self._pendingDataAfterStartTLS.length)
-                self._multiplexStream.appendStream(self._pendingDataAfterStartTLS.shift());
-              self._ensureCopying();
-              return;
-            }
-          }
-
-          // If we have a callback to update bufferedAmount, we let child to
-          // decide whether ondrain should be dispatched.
-          if (self._waitingForDrain && !self._onUpdateBufferedAmount) {
-            self._waitingForDrain = false;
-            self.callListener("drain");
-          }
-          if (self._readyState === kCLOSING) {
-            self._socketOutputStream.close();
-            self._readyState = kCLOSED;
-            self.callListener("close");
-          }
-        }
-      }
-    }, null);
-  },
-
-  _initStream: function ts_initStream(binaryType) {
-    this._binaryType = binaryType;
-    this._socketInputStream = this._transport.openInputStream(0, 0, 0);
-    this._socketOutputStream = this._transport.openOutputStream(
-      Ci.nsITransport.OPEN_UNBUFFERED, 0, 0);
-
-    // If the other side is not listening, we will
-    // get an onInputStreamReady callback where available
-    // raises to indicate the connection was refused.
-    this._socketInputStream.asyncWait(
-      this, this._socketInputStream.WAIT_CLOSURE_ONLY, 0, Services.tm.currentThread);
-
-    if (this._binaryType === "arraybuffer") {
-      this._inputStreamBinary = new BinaryInputStream(this._socketInputStream);
-    } else {
-      this._inputStreamScriptable = new ScriptableInputStream(this._socketInputStream);
-    }
-
-    this._multiplexStream = new MultiplexInputStream();
-
-    this._multiplexStreamCopier = new AsyncStreamCopier(
-      this._multiplexStream,
-      this._socketOutputStream,
-      // (nsSocketTransport uses gSocketTransportService)
-      Cc["@mozilla.org/network/socket-transport-service;1"]
-        .getService(Ci.nsIEventTarget),
-      /* source buffered */ true, /* sink buffered */ false,
-      BUFFER_SIZE, /* close source*/ false, /* close sink */ false);
-  },
-
-#ifdef MOZ_WIDGET_GONK
-  // Helper method for collecting network statistics.
-  // Note this method is Gonk-specific.
-  _saveNetworkStats: function ts_saveNetworkStats(enforce) {
-    if (this._txBytes <= 0 && this._rxBytes <= 0) {
-      // There is no traffic at all. No need to save statistics.
-      return;
-    }
-
-    // If "enforce" is false, the traffic amount is saved to NetworkStatsServiceProxy
-    // only when the total amount exceeds the predefined threshold value.
-    // The purpose is to avoid too much overhead for collecting statistics.
-    let totalBytes = this._txBytes + this._rxBytes;
-    if (!enforce && totalBytes < NETWORK_STATS_THRESHOLD) {
-      return;
-    }
-
-    let nssProxy = Cc["@mozilla.org/networkstatsServiceProxy;1"]
-                     .getService(Ci.nsINetworkStatsServiceProxy);
-    if (!nssProxy) {
-      LOG("Error: Ci.nsINetworkStatsServiceProxy service is not available.");
-      return;
-    }
-    nssProxy.saveAppStats(this._appId, this._inBrowser, this._activeNetworkInfo,
-                          Date.now(), this._rxBytes, this._txBytes, false);
-
-    // Reset the counters once the statistics is saved to NetworkStatsServiceProxy.
-    this._txBytes = this._rxBytes = 0;
-  },
-  // End of helper method for network statistics.
-#endif
-
-  callListener: function ts_callListener(type, data) {
-    if (!this["on" + type])
-      return;
-
-    this["on" + type].call(null, new TCPSocketEvent(type, this, data || ""));
-  },
-
-  /* nsITCPSocketInternal methods */
-  callListenerError: function ts_callListenerError(type, name) {
-    // XXX we're not really using TCPError at this time, so there's only a name
-    // attribute to pass.
-    this.callListener(type, createTCPError(this.useWin, name));
-  },
-
-  callListenerData: function ts_callListenerString(type, data) {
-    this.callListener(type, data);
-  },
-
-  callListenerArrayBuffer: function ts_callListenerArrayBuffer(type, data) {
-    this.callListener(type, data);
-  },
-
-  callListenerVoid: function ts_callListenerVoid(type) {
-    this.callListener(type);
-  },
-
-  /**
-   * This method is expected to be called by TCPSocketChild to update child's
-   * readyState.
-   */
-  updateReadyState: function ts_updateReadyState(readyState) {
-    if (!this._inChild) {
-      LOG("Calling updateReadyState in parent, which should only be called " +
-          "in child");
-      return;
-    }
-    this._readyState = readyState;
-  },
-
-  updateBufferedAmount: function ts_updateBufferedAmount(bufferedAmount, trackingNumber) {
-    if (trackingNumber != this._trackingNumber) {
-      LOG("updateBufferedAmount is called but trackingNumber is not matched " +
-          "parent's trackingNumber: " + trackingNumber + ", child's trackingNumber: " +
-          this._trackingNumber);
-      return;
-    }
-    this._bufferedAmount = bufferedAmount;
-    if (bufferedAmount == 0) {
-      if (this._waitingForDrain) {
-        this._waitingForDrain = false;
-        this.callListener("drain");
-      }
-    } else {
-      LOG("bufferedAmount is updated but haven't reaches zero. bufferedAmount: " +
-          bufferedAmount);
-    }
-  },
-
-  createAcceptedParent: function ts_createAcceptedParent(transport, binaryType, windowObject) {
-    let that = new TCPSocket();
-    that._transport = transport;
-    that._initStream(binaryType);
-
-    // ReadyState is kOpen since accepted transport stream has already been connected
-    that._readyState = kOPEN;
-    that._inputStreamPump = new InputStreamPump(that._socketInputStream, -1, -1, 0, 0, false);
-    that._inputStreamPump.asyncRead(that, null);
-
-    // Grab host/port from SocketTransport.
-    that._host = transport.host;
-    that._port = transport.port;
-    that.useWin = windowObject;
-
-    return that;
-  },
-
-  createAcceptedChild: function ts_createAcceptedChild(socketChild, binaryType, windowObject) {
-    let that = new TCPSocket();
-
-    that._binaryType = binaryType;
-    that._inChild = true;
-    that._readyState = kOPEN;
-    socketChild.setSocketAndWindow(that, windowObject);
-    that._socketBridge = socketChild;
-    that._host = socketChild.host;
-    that._port = socketChild.port;
-    that.useWin = windowObject;
-
-    return that;
-  },
-
-  setAppId: function ts_setAppId(appId) {
-#ifdef MOZ_WIDGET_GONK
-    this._appId = appId;
-#else
-    // Do nothing because _appId only exists on Gonk-specific platform.
-#endif
-  },
-
-  setInBrowser: function ts_setInBrowser(inBrowser) {
-#ifdef MOZ_WIDGET_GONK
-    this._inBrowser = inBrowser;
-#else
-    // Do nothing.
-#endif
-  },
-
-  setOnUpdateBufferedAmountHandler: function(aFunction) {
-    if (typeof(aFunction) == 'function') {
-      this._onUpdateBufferedAmount = aFunction;
-    } else {
-      throw new Error("only function can be passed to " +
-                      "setOnUpdateBufferedAmountHandler");
-    }
-  },
-
-  /**
-   * Handle the requst of sending data and update trackingNumber from
-   * child.
-   * This function is expected to be called by TCPSocketChild.
-   */
-  onRecvSendFromChild: function(data, byteOffset, byteLength, trackingNumber) {
-    this._trackingNumber = trackingNumber;
-    this.send(data, byteOffset, byteLength);
-  },
-
-  /* end nsITCPSocketInternal methods */
-
-  initWindowless: function ts_initWindowless() {
-    try {
-      return Services.prefs.getBoolPref("dom.mozTCPSocket.enabled");
-    } catch (e) {
-      // no pref means return false
-      return false;
-    }
-  },
-
-  init: function ts_init(aWindow) {
-    if (!this.initWindowless())
-      return null;
-
-    let principal = aWindow.document.nodePrincipal;
-    let secMan = Cc["@mozilla.org/scriptsecuritymanager;1"]
-                   .getService(Ci.nsIScriptSecurityManager);
-
-    let perm = principal == secMan.getSystemPrincipal()
-                 ? Ci.nsIPermissionManager.ALLOW_ACTION
-                 : Services.perms.testExactPermissionFromPrincipal(principal, "tcp-socket");
-
-    this._hasPrivileges = perm == Ci.nsIPermissionManager.ALLOW_ACTION;
-
-    let util = aWindow.QueryInterface(
-      Ci.nsIInterfaceRequestor
-    ).getInterface(Ci.nsIDOMWindowUtils);
-
-    this.useWin = XPCNativeWrapper.unwrap(aWindow);
-    this.innerWindowID = util.currentInnerWindowID;
-    LOG("window init: " + this.innerWindowID);
-  },
-
-  observe: function(aSubject, aTopic, aData) {
-    if (aTopic == "inner-window-destroyed") {
-      let wId = aSubject.QueryInterface(Ci.nsISupportsPRUint64).data;
-      if (wId == this.innerWindowID) {
-        LOG("inner-window-destroyed: " + this.innerWindowID);
-
-        // This window is now dead, so we want to clear the callbacks
-        // so that we don't get a "can't access dead object" when the
-        // underlying stream goes to tell us that we are closed
-        this.onopen = null;
-        this.ondrain = null;
-        this.ondata = null;
-        this.onerror = null;
-        this.onclose = null;
-
-        this.useWin = null;
-
-        // Clean up our socket
-        this.close();
-      }
-    }
-  },
-
-  // nsIDOMTCPSocket
-  open: function ts_open(host, port, options) {
-    this._inChild = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime)
-                       .processType != Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
-    LOG("content process: " + (this._inChild ? "true" : "false"));
-
-    // in the testing case, init won't be called and
-    // hasPrivileges will be null. We want to proceed to test.
-    if (this._hasPrivileges !== true && this._hasPrivileges !== null) {
-      throw new Error("TCPSocket does not have permission in this context.\n");
-    }
-    let that = new TCPSocket();
-
-    that.useWin = this.useWin;
-    that.innerWindowID = this.innerWindowID;
-    that._inChild = this._inChild;
-
-    LOG("window init: " + that.innerWindowID);
-    Services.obs.addObserver(that, "inner-window-destroyed", true);
-
-    LOG("startup called");
-    LOG("Host info: " + host + ":" + port);
-
-    that._readyState = kCONNECTING;
-    that._host = host;
-    that._port = port;
-    if (options !== undefined) {
-      if (options.useSecureTransport) {
-          that._ssl = 'ssl';
-      } else {
-          that._ssl = false;
-      }
-      that._binaryType = options.binaryType || that._binaryType;
-    }
-
-    LOG("SSL: " + that.ssl);
-
-    if (this._inChild) {
-      that._socketBridge = Cc["@mozilla.org/tcp-socket-child;1"]
-                             .createInstance(Ci.nsITCPSocketChild);
-      that._socketBridge.sendOpen(that, host, port, !!that._ssl,
-                                  that._binaryType, this.useWin, this.useWin || this);
-      return that;
-    }
-
-    let transport = that._transport = this._createTransport(host, port, that._ssl);
-    transport.setEventSink(that, Services.tm.currentThread);
-    that._initStream(that._binaryType);
-
-#ifdef MOZ_WIDGET_GONK
-    // Set _activeNetworkInfo, which is only required for network statistics.
-    // Note that nsINetworkManager, as well as nsINetworkStatsServiceProxy, is
-    // Gonk-specific.
-    let networkManager = Cc["@mozilla.org/network/manager;1"].getService(Ci.nsINetworkManager);
-    if (networkManager) {
-      that._activeNetworkInfo = networkManager.activeNetworkInfo;
-    }
-#endif
-
-    return that;
-  },
-
-  upgradeToSecure: function ts_upgradeToSecure() {
-    if (this._readyState !== kOPEN) {
-      throw new Error("Socket not open.");
-    }
-    if (this._ssl == 'ssl') {
-      // Already SSL
-      return;
-    }
-
-    this._ssl = 'ssl';
-
-    if (this._inChild) {
-      this._socketBridge.sendStartTLS();
-      return;
-    }
-
-    if (this._multiplexStream.count == 0) {
-      this._activateTLS();
-    } else {
-      this._waitingForStartTLS = true;
-    }
-  },
-
-  listen: function ts_listen(localPort, options, backlog) {
-    // in the testing case, init won't be called and
-    // hasPrivileges will be null. We want to proceed to test.
-    if (this._hasPrivileges !== true && this._hasPrivileges !== null) {
-      throw new Error("TCPSocket does not have permission in this context.\n");
-    }
-    let that = new TCPServerSocket(this.useWin);
-
-    options = options || { binaryType : this.binaryType };
-    backlog = backlog || -1;
-    that.listen(localPort, options, backlog);
-    return that;
-  },
-
-  close: function ts_close() {
-    if (this._readyState === kCLOSED || this._readyState === kCLOSING)
-      return;
-
-    LOG("close called");
-    this._readyState = kCLOSING;
-
-    if (this._inChild) {
-      this._socketBridge.sendClose();
-      return;
-    }
-
-    if (!this._multiplexStream.count) {
-      this._socketOutputStream.close();
-    }
-    this._socketInputStream.close();
-  },
-
-  send: function ts_send(data, byteOffset, byteLength) {
-    if (this._readyState !== kOPEN) {
-      throw new Error("Socket not open.");
-    }
-
-    if (this._binaryType === "arraybuffer") {
-      byteLength = byteLength || data.byteLength;
-    } else {
-      data = data.toString();
-      byteLength = data.length;
-    }
-
-    if (this._inChild) {
-      this._socketBridge.sendSend(data, byteOffset, byteLength, ++this._trackingNumber);
-    }
-
-    let newBufferedAmount = this.bufferedAmount + byteLength;
-    let bufferFull = newBufferedAmount >= BUFFER_SIZE;
-
-    if (bufferFull) {
-      // If we buffered more than some arbitrary amount of data,
-      // (65535 right now) we should tell the caller so they can
-      // wait until ondrain is called if they so desire. Once all the
-      // buffered data has been written to the socket, ondrain is
-      // called.
-      this._waitingForDrain = true;
-    }
-
-    if (this._inChild) {
-      // In child, we just add buffer length to our bufferedAmount and let
-      // parent to update our bufferedAmount when data have been sent.
-      this._bufferedAmount = newBufferedAmount;
-      return !bufferFull;
-    }
-
-    let new_stream;
-    if (this._binaryType === "arraybuffer") {
-      new_stream = new ArrayBufferInputStream();
-      new_stream.setData(data, byteOffset, byteLength);
-    } else {
-      new_stream = new StringInputStream();
-      new_stream.setData(data, byteLength);
-    }
-
-    if (this._waitingForStartTLS) {
-      // When we are waiting for starttls, new_stream is added to pendingData
-      // and will be appended to multiplexStream after tls had been set up.
-      this._pendingDataAfterStartTLS.push(new_stream);
-    } else {
-      this._multiplexStream.appendStream(new_stream);
-    }
-
-    this._ensureCopying();
-
-#ifdef MOZ_WIDGET_GONK
-    // Collect transmitted amount for network statistics.
-    this._txBytes += byteLength;
-    this._saveNetworkStats(false);
-#endif
-
-    return !bufferFull;
-  },
-
-  suspend: function ts_suspend() {
-    if (this._inChild) {
-      this._socketBridge.sendSuspend();
-      return;
-    }
-
-    if (this._inputStreamPump) {
-      this._inputStreamPump.suspend();
-    } else {
-      ++this._suspendCount;
-    }
-  },
-
-  resume: function ts_resume() {
-    if (this._inChild) {
-      this._socketBridge.sendResume();
-      return;
-    }
-
-    if (this._inputStreamPump) {
-      this._inputStreamPump.resume();
-    } else if (this._suspendCount < 1) {
-      throw new Error(kRESUME_ERROR);
-    } else {
-      --this._suspendCount;
-    }
-  },
-
-  _maybeReportErrorAndCloseIfOpen: function(status) {
-#ifdef MOZ_WIDGET_GONK
-    // Save network statistics once the connection is closed.
-    // For now this function is Gonk-specific.
-    this._saveNetworkStats(true);
-#endif
-
-    // If we're closed, we've already reported the error or just don't need to
-    // report the error.
-    if (this._readyState === kCLOSED)
-      return;
-    this._readyState = kCLOSED;
-
-    if (!Components.isSuccessCode(status)) {
-      // Convert the status code to an appropriate error message.  Raw constants
-      // are used inline in all cases for consistency.  Some error codes are
-      // available in Components.results, some aren't.  Network error codes are
-      // effectively stable, NSS error codes are officially not, but we have no
-      // symbolic way to dynamically resolve them anyways (other than an ability
-      // to determine the error class.)
-      let errName, errType;
-      // security module? (and this is an error)
-      if ((status & 0xff0000) === 0x5a0000) {
-        const nsINSSErrorsService = Ci.nsINSSErrorsService;
-        let nssErrorsService = Cc['@mozilla.org/nss_errors_service;1']
-                                 .getService(nsINSSErrorsService);
-        let errorClass;
-        // getErrorClass will throw a generic NS_ERROR_FAILURE if the error code is
-        // somehow not in the set of covered errors.
-        try {
-          errorClass = nssErrorsService.getErrorClass(status);
-        }
-        catch (ex) {
-          errorClass = 'SecurityProtocol';
-        }
-        switch (errorClass) {
-          case nsINSSErrorsService.ERROR_CLASS_SSL_PROTOCOL:
-            errType = 'SecurityProtocol';
-            break;
-          case nsINSSErrorsService.ERROR_CLASS_BAD_CERT:
-            errType = 'SecurityCertificate';
-            break;
-          // no default is required; the platform impl automatically defaults to
-          // ERROR_CLASS_SSL_PROTOCOL.
-        }
-
-        // NSS_SEC errors (happen below the base value because of negative vals)
-        if ((status & 0xffff) <
-            Math.abs(nsINSSErrorsService.NSS_SEC_ERROR_BASE)) {
-          // The bases are actually negative, so in our positive numeric space, we
-          // need to subtract the base off our value.
-          let nssErr = Math.abs(nsINSSErrorsService.NSS_SEC_ERROR_BASE) -
-                         (status & 0xffff);
-          switch (nssErr) {
-            case 11: // SEC_ERROR_EXPIRED_CERTIFICATE, sec(11)
-              errName = 'SecurityExpiredCertificateError';
-              break;
-            case 12: // SEC_ERROR_REVOKED_CERTIFICATE, sec(12)
-              errName = 'SecurityRevokedCertificateError';
-              break;
-            // per bsmith, we will be unable to tell these errors apart very soon,
-            // so it makes sense to just folder them all together already.
-            case 13: // SEC_ERROR_UNKNOWN_ISSUER, sec(13)
-            case 20: // SEC_ERROR_UNTRUSTED_ISSUER, sec(20)
-            case 21: // SEC_ERROR_UNTRUSTED_CERT, sec(21)
-            case 36: // SEC_ERROR_CA_CERT_INVALID, sec(36)
-              errName = 'SecurityUntrustedCertificateIssuerError';
-              break;
-            case 90: // SEC_ERROR_INADEQUATE_KEY_USAGE, sec(90)
-              errName = 'SecurityInadequateKeyUsageError';
-              break;
-            case 176: // SEC_ERROR_CERT_SIGNATURE_ALGORITHM_DISABLED, sec(176)
-              errName = 'SecurityCertificateSignatureAlgorithmDisabledError';
-              break;
-            default:
-              errName = 'SecurityError';
-              break;
-          }
-        }
-        // NSS_SSL errors
-        else {
-          let sslErr = Math.abs(nsINSSErrorsService.NSS_SSL_ERROR_BASE) -
-                         (status & 0xffff);
-          switch (sslErr) {
-            case 3: // SSL_ERROR_NO_CERTIFICATE, ssl(3)
-              errName = 'SecurityNoCertificateError';
-              break;
-            case 4: // SSL_ERROR_BAD_CERTIFICATE, ssl(4)
-              errName = 'SecurityBadCertificateError';
-              break;
-            case 8: // SSL_ERROR_UNSUPPORTED_CERTIFICATE_TYPE, ssl(8)
-              errName = 'SecurityUnsupportedCertificateTypeError';
-              break;
-            case 9: // SSL_ERROR_UNSUPPORTED_VERSION, ssl(9)
-              errName = 'SecurityUnsupportedTLSVersionError';
-              break;
-            case 12: // SSL_ERROR_BAD_CERT_DOMAIN, ssl(12)
-              errName = 'SecurityCertificateDomainMismatchError';
-              break;
-            default:
-              errName = 'SecurityError';
-              break;
-          }
-        }
-      }
-      // must be network
-      else {
-        errType = 'Network';
-        switch (status) {
-          // connect to host:port failed
-          case 0x804B000C: // NS_ERROR_CONNECTION_REFUSED, network(13)
-            errName = 'ConnectionRefusedError';
-            break;
-          // network timeout error
-          case 0x804B000E: // NS_ERROR_NET_TIMEOUT, network(14)
-            errName = 'NetworkTimeoutError';
-            break;
-          // hostname lookup failed
-          case 0x804B001E: // NS_ERROR_UNKNOWN_HOST, network(30)
-            errName = 'DomainNotFoundError';
-            break;
-          case 0x804B0047: // NS_ERROR_NET_INTERRUPT, network(71)
-            errName = 'NetworkInterruptError';
-            break;
-          default:
-            errName = 'NetworkError';
-            break;
-        }
-      }
-      let err = createTCPError(this.useWin, errName, errType);
-      this.callListener("error", err);
-    }
-    this.callListener("close");
-  },
-
-  // nsITransportEventSink (Triggered by transport.setEventSink)
-  onTransportStatus: function ts_onTransportStatus(
-    transport, status, progress, max) {
-    if (status === Ci.nsISocketTransport.STATUS_CONNECTED_TO) {
-      this._readyState = kOPEN;
-      this.callListener("open");
-
-      this._inputStreamPump = new InputStreamPump(
-        this._socketInputStream, -1, -1, 0, 0, false
-      );
-
-      while (this._suspendCount--) {
-        this._inputStreamPump.suspend();
-      }
-
-      this._inputStreamPump.asyncRead(this, null);
-    }
-  },
-
-  // nsIAsyncInputStream (Triggered by _socketInputStream.asyncWait)
-  // Only used for detecting connection refused
-  onInputStreamReady: function ts_onInputStreamReady(input) {
-    try {
-      input.available();
-    } catch (e) {
-      // NS_ERROR_CONNECTION_REFUSED
-      this._maybeReportErrorAndCloseIfOpen(0x804B000C);
-    }
-  },
-
-  // nsIRequestObserver (Triggered by _inputStreamPump.asyncRead)
-  onStartRequest: function ts_onStartRequest(request, context) {
-  },
-
-  // nsIRequestObserver (Triggered by _inputStreamPump.asyncRead)
-  onStopRequest: function ts_onStopRequest(request, context, status) {
-    let buffered_output = this._multiplexStream.count !== 0;
-
-    this._inputStreamPump = null;
-
-    let statusIsError = !Components.isSuccessCode(status);
-
-    if (buffered_output && !statusIsError) {
-      // If we have some buffered output still, and status is not an
-      // error, the other side has done a half-close, but we don't
-      // want to be in the close state until we are done sending
-      // everything that was buffered. We also don't want to call onclose
-      // yet.
-      return;
-    }
-
-    // We call this even if there is no error.
-    this._maybeReportErrorAndCloseIfOpen(status);
-  },
-
-  // nsIStreamListener (Triggered by _inputStreamPump.asyncRead)
-  onDataAvailable: function ts_onDataAvailable(request, context, inputStream, offset, count) {
-    if (this._binaryType === "arraybuffer") {
-      let buffer = new (this.useWin ? this.useWin.ArrayBuffer : ArrayBuffer)(count);
-      this._inputStreamBinary.readArrayBuffer(count, buffer);
-      this.callListener("data", buffer);
-    } else {
-      this.callListener("data", this._inputStreamScriptable.read(count));
-    }
-
-#ifdef MOZ_WIDGET_GONK
-    // Collect received amount for network statistics.
-    this._rxBytes += count;
-    this._saveNetworkStats(false);
-#endif
-  },
-
-  classID: Components.ID("{cda91b22-6472-11e1-aa11-834fec09cd0a}"),
-
-  classInfo: XPCOMUtils.generateCI({
-    classID: Components.ID("{cda91b22-6472-11e1-aa11-834fec09cd0a}"),
-    contractID: "@mozilla.org/tcp-socket;1",
-    classDescription: "Client TCP Socket",
-    interfaces: [
-      Ci.nsIDOMTCPSocket,
-    ],
-    flags: Ci.nsIClassInfo.DOM_OBJECT,
-  }),
-
-  QueryInterface: XPCOMUtils.generateQI([
-    Ci.nsIDOMTCPSocket,
-    Ci.nsITCPSocketInternal,
-    Ci.nsIDOMGlobalPropertyInitializer,
-    Ci.nsIObserver,
-    Ci.nsISupportsWeakReference
-  ])
-}
-
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([TCPSocket]);
deleted file mode 100644
--- a/dom/network/TCPSocket.manifest
+++ /dev/null
@@ -1,12 +0,0 @@
-# TCPSocket.js
-component {cda91b22-6472-11e1-aa11-834fec09cd0a} TCPSocket.js
-contract @mozilla.org/tcp-socket;1 {cda91b22-6472-11e1-aa11-834fec09cd0a}
-category JavaScript-navigator-property mozTCPSocket @mozilla.org/tcp-socket;1
-
-# TCPSocketParentIntermediary.js
-component {afa42841-a6cb-4a91-912f-93099f6a3d18} TCPSocketParentIntermediary.js
-contract @mozilla.org/tcp-socket-intermediary;1 {afa42841-a6cb-4a91-912f-93099f6a3d18}
-
-# TCPServerSocket.js
-component {73065eae-27dc-11e2-895a-000c29987aa2} TCPServerSocket.js
-contract @mozilla.org/tcp-server-socket;1 {73065eae-27dc-11e2-895a-000c29987aa2}
--- a/dom/network/TCPSocketParent.cpp
+++ b/dom/network/TCPSocketParent.cpp
@@ -3,17 +3,16 @@
 /* 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 "TCPSocketParent.h"
 #include "jsapi.h"
 #include "jsfriendapi.h"
 #include "nsJSUtils.h"
-#include "nsIDOMTCPSocket.h"
 #include "mozilla/unused.h"
 #include "mozilla/AppProcessChecker.h"
 #include "mozilla/net/NeckoCommon.h"
 #include "mozilla/net/PNeckoParent.h"
 #include "mozilla/dom/ContentParent.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/dom/TabParent.h"
 #include "mozilla/HoldDropJSObjects.h"
--- a/dom/network/TCPSocketParent.h
+++ b/dom/network/TCPSocketParent.h
@@ -4,20 +4,18 @@
  * 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 mozilla_dom_TCPSocketParent_h
 #define mozilla_dom_TCPSocketParent_h
 
 #include "mozilla/dom/TCPSocketBinding.h"
 #include "mozilla/net/PTCPSocketParent.h"
-#include "nsITCPSocketParent.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsCOMPtr.h"
-#include "nsIDOMTCPSocket.h"
 #include "js/TypeDecls.h"
 #include "mozilla/net/OfflineObserver.h"
 
 #define TCPSOCKETPARENT_CID \
   { 0x4e7246c6, 0xa8b3, 0x426d, { 0x9c, 0x17, 0x76, 0xda, 0xb1, 0xe1, 0xe1, 0x4a } }
 
 namespace mozilla {
 namespace dom {
deleted file mode 100644
--- a/dom/network/TCPSocketParentIntermediary.js
+++ /dev/null
@@ -1,117 +0,0 @@
-/* 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/. */
-
-"use strict";
-
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cu = Components.utils;
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-
-function TCPSocketParentIntermediary() {
-}
-
-TCPSocketParentIntermediary.prototype = {
-  _setCallbacks: function(aParentSide, socket) {
-    aParentSide.initJS(this);
-    this._socket = socket;
-
-    // Create handlers for every possible callback that attempt to trigger
-    // corresponding callbacks on the child object.
-    // ondrain event is not forwarded, since the decision of firing ondrain
-    // is made in child.
-    ["open", "data", "error", "close"].forEach(
-      function(p) {
-        socket["on" + p] = function(data) {
-          aParentSide.sendEvent(p, data.data, socket.readyState,
-                                socket.bufferedAmount);
-        };
-      }
-    );
-  },
-
-  _onUpdateBufferedAmountHandler: function(aParentSide, aBufferedAmount, aTrackingNumber) {
-    aParentSide.sendUpdateBufferedAmount(aBufferedAmount, aTrackingNumber);
-  },
-
-  open: function(aParentSide, aHost, aPort, aUseSSL, aBinaryType,
-                 aAppId, aInBrowser) {
-    let baseSocket = Cc["@mozilla.org/tcp-socket;1"].createInstance(Ci.nsIDOMTCPSocket);
-    let socket = baseSocket.open(aHost, aPort, {useSecureTransport: aUseSSL, binaryType: aBinaryType});
-    if (!socket)
-      return null;
-
-    let socketInternal = socket.QueryInterface(Ci.nsITCPSocketInternal);
-    socketInternal.setAppId(aAppId);
-    socketInternal.setInBrowser(aInBrowser);
-
-    // Handle parent's request to update buffered amount.
-    socketInternal.setOnUpdateBufferedAmountHandler(
-      this._onUpdateBufferedAmountHandler.bind(this, aParentSide));
-
-    // Handlers are set to the JS-implemented socket object on the parent side.
-    this._setCallbacks(aParentSide, socket);
-    return socket;
-  },
-
-  listen: function(aTCPServerSocketParent, aLocalPort, aBacklog, aBinaryType,
-                   aAppId, aInBrowser) {
-    let baseSocket = Cc["@mozilla.org/tcp-socket;1"].createInstance(Ci.nsIDOMTCPSocket);
-    let serverSocket = baseSocket.listen(aLocalPort, { binaryType: aBinaryType }, aBacklog);
-    if (!serverSocket)
-      return null;
-
-    let localPort = serverSocket.localPort;
-
-    serverSocket["onconnect"] = function(socket) {
-      var socketParent = Cc["@mozilla.org/tcp-socket-parent;1"]
-                            .createInstance(Ci.nsITCPSocketParent);
-      var intermediary = new TCPSocketParentIntermediary();
-
-      let socketInternal = socket.QueryInterface(Ci.nsITCPSocketInternal);
-      socketInternal.setAppId(aAppId);
-      socketInternal.setInBrowser(aInBrowser);
-      socketInternal.setOnUpdateBufferedAmountHandler(
-        intermediary._onUpdateBufferedAmountHandler.bind(intermediary, socketParent));
-
-      // Handlers are set to the JS-implemented socket object on the parent side,
-      // so that the socket parent object can communicate data
-      // with the corresponding socket child object through IPC.
-      intermediary._setCallbacks(socketParent, socket);
-      // The members in the socket parent object are set with arguments,
-      // so that the socket parent object can communicate data
-      // with the JS socket object on the parent side via the intermediary object.
-      socketParent.setSocketAndIntermediary(socket, intermediary);
-      aTCPServerSocketParent.sendCallbackAccept(socketParent);
-    };
-
-    serverSocket["onerror"] = function(data) {
-        var error = data.data;
-
-        aTCPServerSocketParent.sendCallbackError(error.message, error.filename,
-                                                 error.lineNumber, error.columnNumber);
-    };
-
-    return serverSocket;
-  },
-
-  onRecvSendString: function(aData, aTrackingNumber) {
-    let socketInternal = this._socket.QueryInterface(Ci.nsITCPSocketInternal);
-    return socketInternal.onRecvSendFromChild(aData, 0, 0, aTrackingNumber);
-  },
-
-  onRecvSendArrayBuffer: function(aData, aTrackingNumber) {
-    let socketInternal = this._socket.QueryInterface(Ci.nsITCPSocketInternal);
-    return socketInternal.onRecvSendFromChild(aData, 0, aData.byteLength,
-                                              aTrackingNumber);
-  },
-
-  classID: Components.ID("{afa42841-a6cb-4a91-912f-93099f6a3d18}"),
-  QueryInterface: XPCOMUtils.generateQI([
-    Ci.nsITCPSocketIntermediary
-  ])
-};
-
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([TCPSocketParentIntermediary]);
--- a/dom/network/interfaces/moz.build
+++ b/dom/network/interfaces/moz.build
@@ -1,22 +1,16 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # 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/.
 
 XPIDL_SOURCES += [
-    'nsIDOMTCPServerSocket.idl',
-    'nsIDOMTCPSocket.idl',
     'nsIMozNavigatorNetwork.idl',
-    'nsITCPServerSocketChild.idl',
-    'nsITCPServerSocketParent.idl',
-    'nsITCPSocketChild.idl',
-    'nsITCPSocketParent.idl',
     'nsIUDPSocketChild.idl',
 ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
     XPIDL_SOURCES += [
         'nsIDOMNetworkStatsManager.idl',
         'nsINetworkStatsServiceProxy.idl',
     ]
deleted file mode 100644
--- a/dom/network/interfaces/nsIDOMTCPServerSocket.idl
+++ /dev/null
@@ -1,92 +0,0 @@
-/* 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 "domstubs.idl"
-#include "nsITCPSocketChild.idl"
-
-// Bug 797561 - Expose a server tcp socket API to web applications
-/**
- * nsIDOMTCPServerSocket
- *
- * An interface to a server socket that can accept incoming connections for gaia apps.
- */
-[scriptable, uuid(821638a1-5327-416d-8031-668764f2ec04)]
-interface nsIDOMTCPServerSocket : nsISupports
-{
-  /**
-   * The port of this server socket object.
-   */
-  readonly attribute unsigned short localPort;
-
-  /**
-   * The onconnect event handler is called when a client connection is accepted.
-   * The data attribute of the event passed to the onconnect handler will be a TCPSocket
-   * instance, which is used for communication between client and server. 
-   */
-  attribute jsval onconnect;
-
-  /**
-   * The onerror handler will be called when the listen of a server socket is aborted.
-   * The data attribute of the event passed to the onerror handler will have a
-   * description of the kind of error.
-   */
-  attribute jsval onerror;
-
-  /**
-   * Close the server socket.
-   */
-  void close();
-};
-
-/**
- * Internal interfaces for use in cross-process server-socket implementation.
- * Needed to account for multiple possible types that can be provided to
- * the socket callbacks as arguments.
- *
- * These interfaces are for calling each method from the server socket object
- * on the parent and child side for an IPC protocol implementation.
- */
-
-[scriptable, uuid(b64b1e68-4efa-497c-b0d8-69f067ad5ec8)]
-interface nsITCPServerSocketInternal : nsISupports 
-{
-  /**
-   * Initialization after creating a TCP server socket object.
-   *
-   * @param windowVal
-   *        An object to create ArrayBuffer for this window. See Bug 831107.
-   */
-  void init(in jsval windowVal);
-
-  /** 
-   * Listen on a port
-   *
-   * @param localPort 
-   *        The port of the server socket. Pass -1 to indicate no preference,
-   *        and a port will be selected automatically.
-   * @param options 
-   *        An object specifying one or more parameters which
-   *        determine the details of the socket.
-   *
-   *        binaryType: "arraybuffer" to use UInt8 array
-   *        instances in the ondata callback and as the argument
-   *        to send. Defaults to "string", to use JavaScript strings.
-   * @param backlog 
-   *        The maximum length the queue of pending connections may grow to.
-   *        This parameter may be silently limited by the operating system.
-   *        Pass -1 to use the default value.
-   */
-  void listen(in unsigned short localPort, in jsval options, in unsigned short backlog);
-
-  /**
-   * Listener for receiving an accepted socket.
-   */
-  void callListenerAccept(in nsITCPSocketChild socketChild);
-
-  /**
-   * Listener for handling an error caused in chrome process.
-   */
-  void callListenerError(in DOMString message, in DOMString filename,
-                         in uint32_t lineNumber, in uint32_t columnNumber);
-};
deleted file mode 100644
--- a/dom/network/interfaces/nsIDOMTCPSocket.idl
+++ /dev/null
@@ -1,333 +0,0 @@
-/* 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/. */
-
-/**
- * MozTCPSocket exposes a TCP client and server sockets
- * to highly privileged apps. It provides a buffered, non-blocking
- * interface for sending. For receiving, it uses an asynchronous,
- * event handler based interface.
- */
-
-#include "domstubs.idl"
-#include "nsIDOMEvent.idl"
-#include "nsITCPSocketChild.idl"
-#include "nsIDOMTCPServerSocket.idl"
-
-interface nsISocketTransport;
-
-// Bug 731746 - Allow chrome JS object to implement nsIDOMEventTarget
-// nsITCPSocket should be an nsIEventTarget but js objects
-// cannot be an nsIEventTarget yet
-// #include "nsIEventTarget.idl"
-
-// Bug 723206 - Constructors implemented in JS from IDL should be
-//              allowed to have arguments
-//
-//  Once bug 723206 will be fixed, this method could be replaced by
-//  arguments when instantiating a TCPSocket object. For example it will
-//  be possible to do (similarly to the WebSocket API):
-//    var s = new MozTCPSocket(host, port);
-
-// Bug 797561 - Expose a server tcp socket API to web applications
-
-
-[scriptable, uuid(65f6d2c8-4be6-4695-958d-0735e8935289)]
-interface nsIDOMTCPSocket : nsISupports
-{
-  /**
-   * Create and return a socket object which will attempt to connect to
-   * the given host and port.
-   *
-   * @param host The hostname of the server to connect to.
-   * @param port The port to connect to.
-   * @param options An object specifying one or more parameters which
-   *                determine the details of the socket.
-   *
-   *        useSecureTransport: true to create an SSL socket. Defaults to false.
-   *
-   *        binaryType: "arraybuffer" to use ArrayBuffer
-   *          instances in the ondata callback and as the argument
-   *          to send. Defaults to "string", to use JavaScript strings.
-   *
-   * @return The new TCPSocket instance.
-   */
-  nsIDOMTCPSocket open(in DOMString host, in unsigned short port, [optional] in jsval options);
-
-  /**
-   * Listen on a port
-   *
-   * @param localPort The port of the server socket. Pass -1 to indicate no preference,
-   *                  and a port will be selected automatically.
-   * @param options An object specifying one or more parameters which
-   *                determine the details of the socket.
-   *
-   *        binaryType: "arraybuffer" to use ArrayBuffer
-   *          instances in the ondata callback and as the argument
-   *          to send. Defaults to "string", to use JavaScript strings.
-   * @param backlog The maximum length the queue of pending connections may grow to.
-   *                This parameter may be silently limited by the operating system.
-   *                Pass -1 to use the default value.
-   *
-   * @return The new TCPServerSocket instance.
-   */
-  nsIDOMTCPServerSocket listen(in unsigned short localPort, [optional] in jsval options,
-                               [optional] in unsigned short backlog);
-
-  /**
-   * Enable secure on channel.
-   */
-  void upgradeToSecure();
-
-  /**
-   * The host of this socket object.
-   */
-  readonly attribute DOMString host;
-
-  /**
-   * The port of this socket object.
-   */
-  readonly attribute unsigned short port;
-
-  /**
-   * True if this socket object is an SSL socket.
-   */
-  readonly attribute boolean ssl;
-
-  /**
-   * The number of bytes which have previously been buffered by calls to
-   * send on this socket.
-   */
-  readonly attribute unsigned long bufferedAmount;
-
-  /**
-   * Pause reading incoming data and invocations of the ondata handler until
-   * resume is called.
-   */
-  void suspend();
-
-  /**
-   * Resume reading incoming data and invoking ondata as usual.
-   */
-  void resume();
-
-  /**
-   * Close the socket.
-   */
-  void close();
-
-  /**
-   * Write data to the socket.
-   *
-   * @param data The data to write to the socket. If
-   *             binaryType: "arraybuffer" was passed in the options
-   *             object, then this object should be an ArrayBuffer instance.
-   *             If binaryType: "string" was passed, or if no binaryType
-   *             option was specified, then this object should be an
-   *             ordinary JavaScript string.
-   * @param byteOffset The offset within the data from which to begin writing.
-   *                   Has no effect on non-ArrayBuffer data.
-   * @param byteLength The number of bytes to write. Has no effect on
-   *                   non-ArrayBuffer data.
-   *
-   * @return Send returns true or false as a hint to the caller that
-   *         they may either continue sending more data immediately, or
-   *         may want to wait until the other side has read some of the
-   *         data which has already been written to the socket before
-   *         buffering more. If send returns true, then less than 64k
-   *         has been buffered and it's safe to immediately write more.
-   *         If send returns false, then more than 64k has been buffered,
-   *         and the caller may wish to wait until the ondrain event
-   *         handler has been called before buffering more data by more
-   *         calls to send.
-   */
-  boolean send(in jsval data, [optional] in unsigned long byteOffset, [optional] in unsigned long byteLength);
-
-  /**
-   * The readyState attribute indicates which state the socket is currently
-   * in. The state will be either "connecting", "open", "closing", or "closed".
-   */
-  readonly attribute DOMString readyState;
-
-  /**
-   * The binaryType attribute indicates which mode this socket uses for
-   * sending and receiving data. If the binaryType: "arraybuffer" option
-   * was passed to the open method that created this socket, binaryType
-   * will be "arraybuffer". Otherwise, it will be "string".
-   */
-  readonly attribute DOMString binaryType;
-
-  /**
-   * The onopen event handler is called when the connection to the server
-   * has been established. If the connection is refused, onerror will be
-   * called, instead.
-   */
-  attribute jsval onopen;
-
-  /**
-   * After send has buffered more than 64k of data, it returns false to
-   * indicate that the client should pause before sending more data, to
-   * avoid accumulating large buffers. This is only advisory, and the client
-   * is free to ignore it and buffer as much data as desired, but if reducing
-   * the size of buffers is important (especially for a streaming application)
-   * ondrain will be called once the previously-buffered data has been written
-   * to the network, at which point the client can resume calling send again.
-   */
-  attribute jsval ondrain;
-
-  /**
-   * The ondata handler will be called repeatedly and asynchronously after
-   * onopen has been called, every time some data was available from the server
-   * and was read. If binaryType: "arraybuffer" was passed to open, the data
-   * attribute of the event object will be an ArrayBuffer. If not, it will be a
-   * normal JavaScript string.
-   *
-   * At any time, the client may choose to pause reading and receiving ondata
-   * callbacks, by calling the socket's suspend() method. Further invocations
-   * of ondata will be paused until resume() is called.
-   */
-  attribute jsval ondata;
-
-  /**
-   * The onerror handler will be called when there is an error. The data
-   * attribute of the event passed to the onerror handler will have a
-   * description of the kind of error.
-   *
-   * If onerror is called before onopen, the error was connection refused,
-   * and onclose will not be called. If onerror is called after onopen,
-   * the connection was lost, and onclose will be called after onerror.
-   */
-  attribute jsval onerror;
-
-  /**
-   * The onclose handler is called once the underlying network socket
-   * has been closed, either by the server, or by the client calling
-   * close.
-   *
-   * If onerror was not called before onclose, then either side cleanly
-   * closed the connection.
-   */
-  attribute jsval onclose;
-};
-
-/*
- * This interface is implemented in TCPSocket.js as an internal interfaces
- * for use in cross-process socket implementation.
- * Needed to account for multiple possible types that can be provided to
- * the socket callbacks as arguments.
- */
-[scriptable, uuid(ac2c4b69-cb79-4767-b1ce-bcf62945cd39)]
-interface nsITCPSocketInternal : nsISupports {
-  // Trigger the callback for |type| and provide a DOMError() object with the given data
-  void callListenerError(in DOMString type, in DOMString name);
-
-  // Trigger the callback for |type| and provide a string argument
-  void callListenerData(in DOMString type, in DOMString data);
-
-  // Trigger the callback for |type| and provide an ArrayBuffer argument
-  void callListenerArrayBuffer(in DOMString type, in jsval data);
-
-  // Trigger the callback for |type| with no argument
-  void callListenerVoid(in DOMString type);
-
-  // Update the DOM object's readyState.
-  // @param readyState
-  //        new ready state to be set to TCPSocket.
-  void updateReadyState(in DOMString readyState);
-
-  // Update the DOM object's bufferedAmount value with a tracking number to
-  // ensure the update request is sent after child's send() invocation.
-  // @param bufferedAmount
-  //        TCPSocket parent's bufferedAmount.
-  // @param trackingNumber
-  //        A number to ensure the bufferedAmount is updated after data
-  //        from child are sent to parent.
-  void updateBufferedAmount(in uint32_t bufferedAmount,
-                            in uint32_t trackingNumber);
-
-  // Create a socket object on the parent side.
-  // This is called in accepting any open request on the parent side.
-  // 
-  // @param transport
-  //        The accepted socket transport.
-  // @param binaryType
-  //        "arraybuffer" to use ArrayBuffer instances 
-  //        in the ondata callback and as the argument to send.
-  // @param window
-  //        An object to create ArrayBuffer for this window. See Bug 831107.
-  nsIDOMTCPSocket createAcceptedParent(in nsISocketTransport transport,
-                                       in DOMString binaryType,
-                                       in nsIDOMWindow window);
-
-  // Create a DOM socket on the child side
-  // This is called when the socket is accepted on the parent side.
-  //
-  // @param socketChild
-  //        The socket child object for the IPC implementation.
-  // @param binaryType
-  //        "arraybuffer" to use ArrayBuffer instances
-  //        in the ondata callback and as the argument to send.
-  // @param window
-  //        An object to create ArrayBuffer for this window. See Bug 831107.
-  nsIDOMTCPSocket createAcceptedChild(in nsITCPSocketChild socketChild,
-                                      in DOMString binaryType,
-                                      in nsIDOMWindow window);
-
-  // Set App ID.
-  void setAppId(in unsigned long appId);
-
-  // Set inBrowser.
-  void setInBrowser(in boolean inBrowser);
-
-  // Set a callback that handles the request from a TCP socket parent when that
-  // socket parent wants to notify that its bufferedAmount is updated.
-  void setOnUpdateBufferedAmountHandler(in jsval handler);
-
-  // Providing child process with ability to pass more arguments to parent's
-  // send() function.
-  // @param trackingNumber
-  //        To ensure the request to update bufferedAmount in child is after
-  //        lastest send() invocation from child.
-  void onRecvSendFromChild(in jsval data, in unsigned long byteOffset,
-                           in unsigned long byteLength, in unsigned long trackingNumber);
-};
-
-/**
- * nsITCPSocketEvent is the event object which is passed as the
- * first argument to all the event handler callbacks. It contains
- * the socket that was associated with the event, the type of event,
- * and the data associated with the event (if any).
- */
-
-[scriptable, uuid(0f2abcca-b483-4539-a3e8-345707f75c44)]
-interface nsITCPSocketEvent : nsISupports {
-  /**
-   * The socket object which produced this event.
-   */
-  readonly attribute nsIDOMTCPSocket target;
-
-  /**
-   * The type of this event. One of:
-   *
-   * open
-   * error
-   * data
-   * drain
-   * close
-   */
-  readonly attribute DOMString type;
-
-  /**
-   * The data related to this event, if any. In the ondata callback,
-   * data will be the bytes read from the network; if the binaryType
-   * of the socket was "arraybuffer", this value will be of type ArrayBuffer;
-   * otherwise, it will be a normal JavaScript string.
-   *
-   * In the onerror callback, data will be a string with a description
-   * of the error.
-   *
-   * In the other callbacks, data will be an empty string.
-   */
-  readonly attribute jsval data;
-};
-
deleted file mode 100644
--- a/dom/network/interfaces/nsITCPServerSocketChild.idl
+++ /dev/null
@@ -1,39 +0,0 @@
-/* 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 "domstubs.idl"
-#include "nsIDOMTCPServerSocket.idl"
-
-interface nsITCPServerSocketInternal;
-
-/**
- * Interface to allow the content process server socket to reach the IPC bridge.
- * It is used in the server socket implementation on the child side.
- */
-
-[scriptable, uuid(41a77ec8-fd86-409e-aea9-af2ca407ef8e)]
-interface nsITCPServerSocketChild : nsISupports
-{
-  /**
-   * Tell the chrome process to listen on the port with the given parameters.
-   *
-   * @param serverSocket
-   *        The server socket generated in the listen of nsIDOMTCPSocket
-   *        on the child side.
-   * @param port
-   *        The port of the server socket.
-   * @param backlog 
-   *        The maximum length the queue of pending connections may grow to.
-   * @param binaryType
-   *        "arraybuffer" to use UInt8 array instances or "string" to use String.
-   */
-  [implicit_jscontext]
-  void listen(in nsITCPServerSocketInternal serverSocket, in unsigned short port,
-              in unsigned short backlog, in DOMString binaryType);
-
-  /**
-   * Tell the chrome process to close the server socket.
-   */
-  void close();
-};
deleted file mode 100644
--- a/dom/network/interfaces/nsITCPServerSocketParent.idl
+++ /dev/null
@@ -1,42 +0,0 @@
-/* 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 "domstubs.idl"
-#include "nsITCPSocketParent.idl"
-
-interface nsIDOMTCPServerSocket;
-
-/** 
- * Interface required to allow the TCP server-socket object in the parent process
- * to talk to the parent IPC actor.
- * It is used in the server socket implementation on the parent side.
- */
-[scriptable, uuid(161ffc9f-54d3-4f21-a536-4166003d0e1d)]
-interface nsITCPServerSocketParent : nsISupports
-{
-  /**
-   * Trigger a callback in the content process when the socket accepts any request.
-   *
-   * @param socket
-   *        The socket generated in accepting any open request on the parent side.
-   */
-  void sendCallbackAccept(in nsITCPSocketParent socket);
-
-  /**
-   * Trigger a callback in the content process when an error occurs.
-   *
-   * @param message
-   *        The error message.
-   * @param filename
-   *        The file name in which the error occured.
-   * @param lineNumber
-   *        The line number in which the error occured.
-   * @param columnNumber
-   *        The column number in which the error occured.
-   */
-  void sendCallbackError(in DOMString message,
-                         in DOMString filename,
-                         in uint32_t lineNumber,
-                         in uint32_t columnNumber);
-};
deleted file mode 100644
--- a/dom/network/interfaces/nsITCPSocketChild.idl
+++ /dev/null
@@ -1,50 +0,0 @@
-/* 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 "domstubs.idl"
-
-interface nsITCPSocketInternal;
-interface nsIDOMWindow;
-
-// Interface to allow the content process socket to reach the IPC bridge.
-// Implemented in C++ as TCPSocketChild, referenced as _socketBridge in TCPSocket.js
-[scriptable, uuid(4277aff0-4c33-11e3-8f96-0800200c9a66)]
-interface nsITCPSocketChild : nsISupports
-{
-  // Tell the chrome process to open a corresponding connection with the given parameters
-  [implicit_jscontext]
-  void sendOpen(in nsITCPSocketInternal socket, in DOMString host,
-                in unsigned short port, in boolean ssl, in DOMString binaryType,
-                in nsIDOMWindow window, in jsval windowVal);
-
-  // Tell the chrome process to perform send and update the tracking number.
-  [implicit_jscontext] 
-  void sendSend(in jsval data, in unsigned long byteOffset,
-                in unsigned long byteLength, in unsigned long trackingNumber);
-
-  // Tell the chrome process to perform equivalent operations to all following methods
-  void sendResume();
-  void sendSuspend();
-  void sendClose();
-  void sendStartTLS();
-
-  /**
-   * Initialize the TCP socket on the child side for IPC. It is called from the child side,
-   * which is generated in receiving a notification of accepting any open request
-   * on the parent side. We use single implementation that works on a child process 
-   * as well as in the single process model.
-   *
-   * @param socket
-   *        The TCP socket on the child side.
-   *        This instance is connected with the child IPC side of the IPC bridge.
-   * @param windowVal
-   *        The window object on the child side to create data
-   *        as "jsval" for deserialization.
-   */
-  [implicit_jscontext]
-  void setSocketAndWindow(in nsITCPSocketInternal socket, in jsval windowVal);
-
-  readonly attribute DOMString host;
-  readonly attribute unsigned short port;
-};
deleted file mode 100644
--- a/dom/network/interfaces/nsITCPSocketParent.idl
+++ /dev/null
@@ -1,89 +0,0 @@
-/* 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 "domstubs.idl"
-
-interface nsIDOMTCPSocket;
-interface nsIDOMTCPServerSocket;
-interface nsITCPServerSocketParent;
-interface nsITCPSocketIntermediary;
-
-// Interface required to allow the TCP socket object (TCPSocket.js) in the
-// parent process to talk to the parent IPC actor, TCPSocketParent, which
-// is written in C++.
-[scriptable, uuid(6f040bf0-6852-11e3-949a-0800200c9a66)]
-interface nsITCPSocketParent : nsISupports
-{
-  [implicit_jscontext] void initJS(in jsval intermediary);
-
-  // Trigger a callback in the content process for |type|, providing a serialized
-  // argument of |data|, and update the child's readyState value with the given
-  // values.
-  //
-  // @param type
-  //        Event type: 'onopen', 'ondata', 'onerror' or 'onclose'. 'odrain' is
-  //        controlled by child.
-  // @param data
-  //        Serialized data that is passed to event handler.
-  // @param readyState
-  //        Current ready state.
-  [implicit_jscontext] void sendEvent(in DOMString type,
-                                      in jsval data,
-                                      in DOMString readyState);
-
-  // Initialize a parent socket object. It is called from the parent side socket,
-  // which is generated in accepting any open request on the parent side.
-  // The socket after being initialized will be established.
-  //
-  // @param socket
-  //        The socket on the parent side.
-  // @param intermediary
-  //        Intermediate class object. See nsITCPSocketIntermediary.
-  [implicit_jscontext] void setSocketAndIntermediary(in nsIDOMTCPSocket socket,
-                                                     in nsITCPSocketIntermediary intermediary);
-
-  // When parent's buffered amount is updated and it wants to inform child to
-  // update the bufferedAmount as well.
-  //
-  // @param bufferedAmount
-  //        The new value of bufferedAmount that is going to be set to child's
-  //        bufferedAmount.
-  // @param trackingNumber
-  //        Parent's current tracking number, reflecting the number of calls to
-  //        send() on the child process. This number is sent back to the child
-  //        to make sure the bufferedAmount updated on the child will correspond
-  //        to the latest call of send().
-  void sendUpdateBufferedAmount(in uint32_t bufferedAmount, in uint32_t trackingNumber);
-
-  readonly attribute DOMString host;
-  readonly attribute unsigned short port;
-};
-
-// Intermediate class to handle sending multiple possible data types
-// and kicking off the chrome process socket object's connection.
-// This interface is the bridge of TCPSocketParent, which is written in C++,
-// and TCPSocket, which is written in Javascript. TCPSocketParentIntermediary
-// implements nsITCPSocketIntermediary in Javascript.
-[scriptable, uuid(aa9bd46d-26bf-4ba8-9c18-ba02482c02f0)]
-interface nsITCPSocketIntermediary : nsISupports {
-  // Open the connection to the server with the given parameters
-  nsIDOMTCPSocket open(in nsITCPSocketParent parent,
-                       in DOMString host, in unsigned short port,
-                       in boolean useSSL, in DOMString binaryType,
-                       in unsigned long appId,
-                       in boolean inBrowser);
-
-  // Listen on a port
-  nsIDOMTCPServerSocket listen(in nsITCPServerSocketParent parent,
-                               in unsigned short port, in unsigned short backlog,
-                               in DOMString binaryType,
-                               in unsigned long appId,
-                               in boolean inBrowser);
-
-  // Called when received a child request to send a string.
-  void onRecvSendString(in DOMString data, in uint32_t trackingNumber);
-
-  // Called when received a child request to send an array buffer.
-  void onRecvSendArrayBuffer(in jsval data, in uint32_t trackingNumber);
-};
--- a/dom/network/moz.build
+++ b/dom/network/moz.build
@@ -43,26 +43,16 @@ UNIFIED_SOURCES += [
 ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
     EXTRA_JS_MODULES += [
         'NetworkStatsDB.jsm',
         'NetworkStatsService.jsm',
     ]
 
-EXTRA_COMPONENTS += [
-    'TCPServerSocket.js',
-    'TCPSocket.manifest',
-    'TCPSocketParentIntermediary.js',
-]
-
-EXTRA_PP_COMPONENTS += [
-    'TCPSocket.js',
-]
-
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
     EXTRA_COMPONENTS += [
         'NetworkStatsManager.js',
         'NetworkStatsManager.manifest',
         'NetworkStatsServiceProxy.js',
         'NetworkStatsServiceProxy.manifest',
     ]
     EXPORTS.mozilla.dom.network += [
--- a/dom/network/tests/test_tcpsocket_enabled_no_perm.html
+++ b/dom/network/tests/test_tcpsocket_enabled_no_perm.html
@@ -14,16 +14,16 @@
 
 /** Test to ensure TCPSocket preference being turned on does not enable
   navigator.mozTCPSocket.
 **/
 SimpleTest.waitForExplicitFinish();
 SpecialPowers.pushPrefEnv({"set": [['dom.mozTCPSocket.enabled', true]]}, runTest);
 function runTest() {
   is('TCPSocket' in this, false, "TCPSocket should not be accessible if dom.mozTCPSocket.enabled is true");
-  is('mozTCPSocket' in navigator, true, "mozTCPSocket should be accessible if dom.mozTCPSocket.enabled is true");
+  is('mozTCPSocket' in navigator, false, "mozTCPSocket should be accessible if dom.mozTCPSocket.enabled is true");
 
   SimpleTest.finish();
 }
 </script>
 </pre>
 </body>
 </html>
--- a/mobile/android/b2gdroid/installer/package-manifest.in
+++ b/mobile/android/b2gdroid/installer/package-manifest.in
@@ -418,21 +418,16 @@
 @BINPATH@/components/Activities.manifest
 @BINPATH@/components/AndroidActivitiesGlue.js
 @BINPATH@/components/ActivitiesGlue.js
 @BINPATH@/components/ActivityProxy.js
 @BINPATH@/components/ActivityRequestHandler.js
 @BINPATH@/components/ActivityWrapper.js
 @BINPATH@/components/ActivityMessageConfigurator.js
 
-@BINPATH@/components/TCPSocket.js
-@BINPATH@/components/TCPSocketParentIntermediary.js
-@BINPATH@/components/TCPServerSocket.js
-@BINPATH@/components/TCPSocket.manifest
-
 #ifdef MOZ_WEBRTC
 @BINPATH@/components/PeerConnection.js
 @BINPATH@/components/PeerConnection.manifest
 #endif
 
 #ifdef MOZ_SERVICES_HEALTHREPORT
 @BINPATH@/components/HealthReportComponents.manifest
 @BINPATH@/components/HealthReportService.js
--- a/mobile/android/installer/package-manifest.in
+++ b/mobile/android/installer/package-manifest.in
@@ -420,21 +420,16 @@
 @BINPATH@/components/ActivityWrapper.js
 @BINPATH@/components/ActivityMessageConfigurator.js
 
 @BINPATH@/components/SystemMessageInternal.js
 @BINPATH@/components/SystemMessageManager.js
 @BINPATH@/components/SystemMessageCache.js
 @BINPATH@/components/SystemMessageManager.manifest
 
-@BINPATH@/components/TCPSocket.js
-@BINPATH@/components/TCPSocketParentIntermediary.js
-@BINPATH@/components/TCPServerSocket.js
-@BINPATH@/components/TCPSocket.manifest
-
 #ifdef MOZ_WEBRTC
 @BINPATH@/components/PeerConnection.js
 @BINPATH@/components/PeerConnection.manifest
 #endif
 
 #ifdef MOZ_SERVICES_HEALTHREPORT
 @BINPATH@/components/HealthReportComponents.manifest
 @BINPATH@/components/HealthReportService.js