Bug 1399300 - Backed out changeset a51cf9c048a1 (bug 910207) a=backout

MozReview-Commit-ID: 3l6B9n7VM1o
This commit is contained in:
Valentin Gosu 2017-09-13 10:51:18 +02:00
Родитель 73e4408ece
Коммит acc302eb58
11 изменённых файлов: 2 добавлений и 128 удалений

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

@ -237,11 +237,6 @@ interface nsISocketTransport : nsITransport
*/
const unsigned long BE_CONSERVATIVE = (1 << 7);
/**
* This transport has been created by a speculative connection attempt.
*/
const unsigned long SPECULATIVE = (1 << 8);
/**
* An opaque flags for non-standard behavior of the TLS system.
* It is unlikely this will need to be set outside of telemetry studies

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

@ -1263,12 +1263,8 @@ nsSocketTransport::BuildSocket(PRFileDesc *&fd, bool &proxyTransparent, bool &us
}
// don't call into PSM while holding mLock!!
nsCOMPtr<nsISSLSocketControl> secCtrl(do_QueryInterface(secinfo));
if (secCtrl) {
if (mConnectionFlags & nsISocketTransport::SPECULATIVE) {
secCtrl->SetSpeculative(true);
}
if (secCtrl)
secCtrl->SetNotificationCallbacks(callbacks);
}
// remember if socket type is SSL so we can ProxyStartSSL if need be.
usingSSL = isSSL;
}

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

@ -956,18 +956,6 @@ nsHttpConnection::CanReuse()
return false;
}
if (!mExperienced) {
uint32_t flags = 0;
mSocketTransport->GetConnectionFlags(&flags);
if (flags & nsISocketTransport::SPECULATIVE) {
if (gHttpHandler->ConnMgr()->IsSpeculativeConnectDisabled(mConnInfo)) {
LOG(("nsHttpConnection::CanReuse %p can't reuse because speculative"
" connections are disabled for this host", this));
return false;
}
}
}
bool canReuse;
if (mSpdySession) {
canReuse = mSpdySession->CanReuse();

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

@ -85,7 +85,6 @@ public:
MOZ_MUST_USE nsresult CreateWildCard(nsHttpConnectionInfo **outParam);
const char *ProxyHost() const { return mProxyInfo ? mProxyInfo->Host().get() : nullptr; }
const nsCString& GetProxyHost() const { return mProxyInfo ? mProxyInfo->Host() : EmptyCString(); }
int32_t ProxyPort() const { return mProxyInfo ? mProxyInfo->Port() : -1; }
const char *ProxyType() const { return mProxyInfo ? mProxyInfo->Type() : nullptr; }
const char *ProxyUsername() const { return mProxyInfo ? mProxyInfo->Username().get() : nullptr; }

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

@ -3232,32 +3232,6 @@ bool nsHttpConnectionMgr::IsConnEntryUnderPressure(nsHttpConnectionInfo *connInf
return transactions && !transactions->IsEmpty();
}
void nsHttpConnectionMgr::DontPreconnect(nsACString const & host, int32_t port)
{
MOZ_ASSERT(OnSocketThread(), "not on socket thread");
for (auto iter = mCT.Iter(); !iter.Done(); iter.Next()) {
RefPtr<nsConnectionEntry> ent = iter.Data();
nsHttpConnectionInfo* info = ent->mConnInfo;
if ((info->GetOrigin() == host && info->OriginPort() == port) ||
(info->ProxyInfo() && info->GetProxyHost() == host && info->ProxyPort() == port)) {
LOG(("nsHttpConnectionMgr::DontPreconnect disabling preconnects on %s",
info->HashKey().get()));
ent->mDisallowPreconnects = true;
}
}
}
bool nsHttpConnectionMgr::IsSpeculativeConnectDisabled(nsHttpConnectionInfo *connInfo)
{
nsConnectionEntry *ent = mCT.GetWeak(connInfo->HashKey());
return ent && ent->mDisallowPreconnects;
}
bool nsHttpConnectionMgr::IsThrottleTickerNeeded()
{
LOG(("nsHttpConnectionMgr::IsThrottleTickerNeeded"));
@ -3701,11 +3675,6 @@ nsHttpConnectionMgr::OnMsgSpeculativeConnect(int32_t, ARefBase *param)
nsConnectionEntry *ent =
GetOrCreateConnectionEntry(args->mTrans->ConnectionInfo(), false);
if (ent->mDisallowPreconnects) {
LOG((" explicitely disabled for this host:port"));
return;
}
uint32_t parallelSpeculativeConnectLimit =
gHttpHandler->ParallelSpeculativeConnectLimit();
bool ignoreIdle = false;
@ -3925,10 +3894,6 @@ nsHalfOpenSocket::SetupStreams(nsISocketTransport **transport,
tmpFlags |= nsISocketTransport::DISABLE_RFC1918;
}
if (mSpeculative) {
tmpFlags |= nsISocketTransport::SPECULATIVE;
}
if (!isBackup && mEnt->mUseFastOpen) {
socketTransport->SetFastOpenCallback(this);
}
@ -4993,7 +4958,6 @@ nsConnectionEntry::nsConnectionEntry(nsHttpConnectionInfo *ci)
, mPreferIPv6(false)
, mUsedForConnection(false)
, mDoNotDestroy(false)
, mDisallowPreconnects(false)
{
MOZ_COUNT_CTOR(nsConnectionEntry);

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

@ -242,15 +242,6 @@ public:
// NOTE: relatively expensive to call, there are two hashtable lookups.
bool IsConnEntryUnderPressure(nsHttpConnectionInfo*);
// This disables preconnecting for all existing connection entries matching
// the host and port. Existing speculative connections that have never been
// used will not be used.
void DontPreconnect(nsACString const &host, int32_t port);
// The information is stored on the entry, not on conn-info (which is just
// a passive descriptor).
bool IsSpeculativeConnectDisabled(nsHttpConnectionInfo*);
uint64_t CurrentTopLevelOuterContentWindowId()
{
return mCurrentTopLevelOuterContentWindowId;
@ -328,8 +319,6 @@ private:
bool mDoNotDestroy : 1;
bool mDisallowPreconnects : 1;
// Set the IP family preference flags according the connected family
void RecordIPFamilyPreference(uint16_t family);
// Resets all flags to their default values

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

@ -2275,15 +2275,6 @@ nsHttpHandler::GetMisc(nsACString &value)
return NS_OK;
}
NS_IMETHODIMP
nsHttpHandler::DontPreconnect(nsACString const &host, int32_t port)
{
if (mConnMgr) {
mConnMgr->DontPreconnect(host, port);
}
return NS_OK;
};
//-----------------------------------------------------------------------------
// nsHttpHandler::nsIObserver
//-----------------------------------------------------------------------------

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

@ -47,12 +47,6 @@ interface nsIHttpProtocolHandler : nsIProxiedProtocolHandler
*/
[must_use] readonly attribute ACString misc;
/**
* Blocks preconnection for the given host:port
* This is used mainly to prevent client cert selection dialogs
* to pop-up too early.
*/
void dontPreconnect(in ACString host, in int32_t port);
};
%{C++

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

@ -22,13 +22,6 @@ interface nsISSLSocketControl : nsISupports {
void proxyStartSSL();
void StartTLS();
/**
* Whether this socket has been created by a speculative connection
* attempt. This will mainly prevent client certificate dialog to
* pop-up.
*/
attribute boolean speculative;
/* NPN (Next Protocol Negotiation) is a mechanism for
negotiating the protocol to be spoken inside the SSL
tunnel during the SSL handshake. The NPNList is the list

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

@ -29,7 +29,6 @@
#include "nsContentUtils.h"
#include "nsIClientAuthDialogs.h"
#include "nsIConsoleService.h"
#include "nsIHttpProtocolHandler.h"
#include "nsIPrefService.h"
#include "nsISocketProvider.h"
#include "nsIWebProgressListener.h"
@ -124,7 +123,6 @@ nsNSSSocketInfo::nsNSSSocketInfo(SharedSSLState& aState, uint32_t providerFlags,
mHandshakePending(true),
mRememberClientAuthCertificate(false),
mPreliminaryHandshakeDone(false),
mSpeculative(false),
mNPNCompleted(false),
mEarlyDataAccepted(false),
mFalseStartCallbackCalled(false),
@ -337,20 +335,6 @@ nsNSSSocketInfo::SetHandshakeCompleted()
mIsFullHandshake = false; // reset for next handshake on this connection
}
NS_IMETHODIMP
nsNSSSocketInfo::GetSpeculative(bool *aSpeculative)
{
*aSpeculative = mSpeculative;
return NS_OK;
}
NS_IMETHODIMP
nsNSSSocketInfo::SetSpeculative(bool aSpeculative)
{
mSpeculative = aSpeculative;
return NS_OK;
}
void
nsNSSSocketInfo::SetNegotiatedNPN(const char* value, uint32_t length)
{
@ -2192,22 +2176,6 @@ nsNSS_SSLGetClientAuthData(void* arg, PRFileDesc* socket,
RefPtr<nsNSSSocketInfo> info(
BitwiseCast<nsNSSSocketInfo*, PRFilePrivate*>(socket->higher->secret));
if (info->IsSpeculative()) {
MOZ_LOG(gPIPNSSLog, LogLevel::Debug,
("[%p] Blocking speculative SSL connections that ask for client cert creds\n", socket->higher));
nsCOMPtr<nsIHttpProtocolHandler> handler(
do_GetService(NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "http"));
if (handler) {
handler->DontPreconnect(info->GetHostName(), info->GetPort());
// Bail, this socket will not be used anyway.
PR_SetError(SSL_ERROR_NO_CERTIFICATE, 0);
return SECFailure;
}
}
UniqueCERTCertificate serverCert(SSL_PeerCertificate(socket));
if (!serverCert) {
MOZ_ASSERT_UNREACHABLE(
@ -2222,7 +2190,7 @@ nsNSS_SSLGetClientAuthData(void* arg, PRFileDesc* socket,
// (mHostName) in the client certificate UI.
MOZ_LOG(gPIPNSSLog, LogLevel::Debug,
("[%p] Not returning client cert due to previous join\n", socket->higher));
("[%p] Not returning client cert due to previous join\n", socket));
*pRetCert = nullptr;
*pRetKey = nullptr;
return SECSuccess;

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

@ -49,8 +49,6 @@ public:
nsresult GetFileDescPtr(PRFileDesc** aFilePtr);
nsresult SetFileDescPtr(PRFileDesc* aFilePtr);
bool IsSpeculative() { return mSpeculative; }
bool IsHandshakePending() const { return mHandshakePending; }
void SetHandshakeNotPending() { mHandshakePending = false; }
@ -186,7 +184,6 @@ private:
nsresult ActivateSSL();
nsCString mNegotiatedNPN;
bool mSpeculative;
bool mNPNCompleted;
bool mEarlyDataAccepted;
bool mFalseStartCallbackCalled;