Bug 1256022 - backout f57f85dc94e4 r=backout

This commit is contained in:
Patrick McManus 2016-03-23 13:06:05 -04:00
Родитель 78cb6a4c07
Коммит 0e38e0d4ae
4 изменённых файлов: 11 добавлений и 50 удалений

Просмотреть файл

@ -162,7 +162,6 @@ TCPSocket::TCPSocket(nsIGlobalObject* aGlobal, const nsAString& aHost, uint16_t
, mSuspendCount(0)
, mTrackingNumber(0)
, mWaitingForStartTLS(false)
, mObserversActive(false)
#ifdef MOZ_WIDGET_GONK
, mTxBytes(0)
, mRxBytes(0)
@ -180,13 +179,6 @@ TCPSocket::TCPSocket(nsIGlobalObject* aGlobal, const nsAString& aHost, uint16_t
TCPSocket::~TCPSocket()
{
if (mObserversActive) {
nsCOMPtr<nsIObserverService> obs = do_GetService("@mozilla.org/observer-service;1");
if (obs) {
obs->RemoveObserver(this, "inner-window-destroyed");
obs->RemoveObserver(this, "profile-change-net-teardown");
}
}
}
nsresult
@ -266,9 +258,7 @@ TCPSocket::Init()
{
nsCOMPtr<nsIObserverService> obs = do_GetService("@mozilla.org/observer-service;1");
if (obs) {
mObserversActive = true;
obs->AddObserver(this, "inner-window-destroyed", true); // weak reference
obs->AddObserver(this, "profile-change-net-teardown", true); // weak ref
obs->AddObserver(this, "inner-window-destroyed", true);
}
if (XRE_GetProcessType() == GeckoProcessType_Content) {
@ -386,7 +376,6 @@ NS_IMETHODIMP
CopierCallbacks::OnStopRequest(nsIRequest* aRequest, nsISupports* aContext, nsresult aStatus)
{
mOwner->NotifyCopyComplete(aStatus);
mOwner = nullptr;
return NS_OK;
}
} // unnamed namespace
@ -453,10 +442,7 @@ TCPSocket::NotifyCopyComplete(nsresult aStatus)
}
if (mReadyState == TCPReadyState::Closing) {
if (mSocketOutputStream) {
mSocketOutputStream->Close();
mSocketOutputStream = nullptr;
}
mSocketOutputStream->Close();
mReadyState = TCPReadyState::Closed;
FireEvent(NS_LITERAL_STRING("close"));
}
@ -648,9 +634,6 @@ TCPSocket::MaybeReportErrorAndCloseIfOpen(nsresult status) {
if (mReadyState == TCPReadyState::Closed) {
return NS_OK;
}
// go through ::Closing state and then mark ::Closed
Close();
mReadyState = TCPReadyState::Closed;
if (NS_FAILED(status)) {
@ -775,19 +758,11 @@ TCPSocket::Close()
}
uint32_t count = 0;
if (mMultiplexStream) {
mMultiplexStream->GetCount(&count);
}
mMultiplexStream->GetCount(&count);
if (!count) {
if (mSocketOutputStream) {
mSocketOutputStream->Close();
mSocketOutputStream = nullptr;
}
}
if (mSocketInputStream) {
mSocketInputStream->Close();
mSocketInputStream = nullptr;
mSocketOutputStream->Close();
}
mSocketInputStream->Close();
}
void
@ -980,9 +955,6 @@ TCPSocket::Constructor(const GlobalObject& aGlobal,
nsresult
TCPSocket::CreateInputStreamPump()
{
if (!mSocketInputStream) {
return NS_ERROR_NOT_AVAILABLE;
}
nsresult rv;
mInputStreamPump = do_CreateInstance("@mozilla.org/network/input-stream-pump;1", &rv);
NS_ENSURE_SUCCESS(rv, rv);
@ -1204,10 +1176,13 @@ TCPSocket::Observe(nsISupports* aSubject, const char* aTopic, const char16_t* aD
}
if (innerID == mInnerWindowID) {
nsCOMPtr<nsIObserverService> obs = do_GetService("@mozilla.org/observer-service;1");
if (obs) {
obs->RemoveObserver(this, "inner-window-destroyed");
}
Close();
}
} else if (!strcmp(aTopic, "profile-change-net-teardown")) {
Close();
}
return NS_OK;

Просмотреть файл

@ -239,8 +239,6 @@ private:
// The buffered data awaiting the TLS upgrade to finish.
nsTArray<nsCOMPtr<nsIInputStream>> mPendingDataAfterStartTLS;
bool mObserversActive;
#ifdef MOZ_WIDGET_GONK
// Number of bytes sent.
uint32_t mTxBytes;

Просмотреть файл

@ -26,9 +26,6 @@ function runTest() {
ok(new TCPSocket('localhost', 80), "TCPSocket constructor should work for content that has the tcp-socket permission");
ok(navigator.mozTCPSocket.open('localhost', 80), "navigator.mozTCPSocket.open should work for content that has the tcp-socket permission");
// This just helps the test harness clean up quickly
SpecialPowers.forceCC();
SpecialPowers.forceGC();
SimpleTest.finish();
}
</script>

Просмотреть файл

@ -40,8 +40,6 @@ Test of legacy navigator interface for opening TCPSocket/TCPServerSocket.
-1);
listeningServer.onconnect = function(ev) {
ok(true, "got server connect");
listeningServer.close();
listeningServer = null;
ev.socket.close()
}
@ -50,14 +48,7 @@ Test of legacy navigator interface for opening TCPSocket/TCPServerSocket.
clientSocket.onopen = function() { ok(true, "got client open"); }
clientSocket.onclose = function() {
ok(true, "got client close");
clientSocket.close();
clientSocket = null;
setTimeout(function() {
// This just helps the test harness clean up quickly
SpecialPowers.forceCC();
SpecialPowers.forceGC();
SimpleTest.finish();
}, 0);
SimpleTest.finish();
}
}
</script>