Backed out changeset 5e586fc7af16 (bug 1527890) for causing leaks on a CLOSED TREE

This commit is contained in:
Coroiu Cristina
2019-02-14 22:14:41 +02:00
parent 89d54a7d20
commit 70e5f1aeac
2 changed files with 11 additions and 25 deletions

View File

@@ -2839,14 +2839,8 @@ nsresult WebSocketChannel::ApplyForAdmission() {
// Called after both OnStartRequest and OnTransportAvailable have
// executed. This essentially ends the handshake and starts the websockets
// protocol state machine.
nsresult WebSocketChannel::CallStartWebsocketData() {
LOG(("WebSocketChannel::CallStartWebsocketData() %p", this));
MOZ_ASSERT(NS_IsMainThread(), "not main thread");
if (mOpenTimer) {
mOpenTimer->Cancel();
mOpenTimer = nullptr;
}
nsresult WebSocketChannel::StartWebsocketData() {
nsresult rv;
if (!IsOnTargetThread()) {
return mTargetThread->Dispatch(
@@ -2855,12 +2849,6 @@ nsresult WebSocketChannel::CallStartWebsocketData() {
NS_DISPATCH_NORMAL);
}
return StartWebsocketData();
}
nsresult WebSocketChannel::StartWebsocketData() {
nsresult rv;
{
MutexAutoLock lock(mMutex);
LOG(("WebSocketChannel::StartWebsocketData() %p", this));
@@ -3177,6 +3165,7 @@ WebSocketChannel::Notify(nsITimer *timer) {
LOG(("WebSocketChannel:: Expecting Server Close - Timed Out\n"));
AbortSession(NS_ERROR_NET_TIMEOUT);
} else if (timer == mOpenTimer) {
MOZ_ASSERT(!mGotUpgradeOK, "Open Timer after open complete");
MOZ_ASSERT(NS_IsMainThread(), "not main thread");
mOpenTimer = nullptr;
@@ -3608,7 +3597,7 @@ WebSocketChannel::OnTransportAvailable(nsISocketTransport *aTransport,
// is pending
nsWSAdmissionManager::OnConnected(this);
return CallStartWebsocketData();
return StartWebsocketData();
}
if (mIsServerSide) {
@@ -3651,7 +3640,7 @@ WebSocketChannel::OnTransportAvailable(nsISocketTransport *aTransport,
}
}
return CallStartWebsocketData();
return StartWebsocketData();
}
return NS_OK;
@@ -3666,6 +3655,11 @@ WebSocketChannel::OnStartRequest(nsIRequest *aRequest, nsISupports *aContext) {
MOZ_ASSERT(NS_IsMainThread(), "not main thread");
MOZ_ASSERT(!mGotUpgradeOK, "OTA duplicated");
if (mOpenTimer) {
mOpenTimer->Cancel();
mOpenTimer = nullptr;
}
if (mStopped) {
LOG(("WebSocketChannel::OnStartRequest: Channel Already Done\n"));
AbortSession(NS_ERROR_CONNECTION_REFUSED);
@@ -3838,7 +3832,7 @@ WebSocketChannel::OnStartRequest(nsIRequest *aRequest, nsISupports *aContext) {
// is pending
nsWSAdmissionManager::OnConnected(this);
return CallStartWebsocketData();
return StartWebsocketData();
}
return NS_OK;
@@ -3851,13 +3845,6 @@ WebSocketChannel::OnStopRequest(nsIRequest *aRequest, nsISupports *aContext,
aRequest, mHttpChannel.get(), static_cast<uint32_t>(aStatusCode)));
MOZ_ASSERT(NS_IsMainThread(), "not main thread");
// OnTransportAvailable won't be called if the request is stopped with
// an error. Abort the session now instead of waiting for timeout.
if (NS_FAILED(aStatusCode) && !mRecvdHttpUpgradeTransport) {
AbortSession(aStatusCode);
return NS_OK;
}
ReportConnectionTelemetry();
// This is the end of the HTTP upgrade transaction, the