Backed out changeset 42d11b726217 (bug 1920941) for causing bc failures @ browser_test_marker_network_redirect.js CLOSED TREE

This commit is contained in:
Sandor Molnar 2024-09-30 13:15:37 +03:00
parent c50ec22447
commit e6e69658c1
6 changed files with 14 additions and 162 deletions

View File

@ -139,7 +139,6 @@ nsresult TlsHandshaker::InitSSLParams(bool connectingToProxy,
NS_SUCCEEDED(ssl->SetHandshakeCallbackListener(this))) {
LOG(("InitSSLParams Setting up SPDY Negotiation OK mOwner=%p",
mOwner.get()));
ReportSecureConnectionStart();
mNPNComplete = false;
}
@ -211,9 +210,18 @@ bool TlsHandshaker::EnsureNPNComplete() {
return true;
}
if (!m0RTTChecked) {
// We reuse m0RTTChecked. We want to send this status only once.
RefPtr<nsAHttpTransaction> transaction = mOwner->Transaction();
nsCOMPtr<nsISocketTransport> transport = mOwner->Transport();
if (transaction && transport) {
transaction->OnTransportStatus(transport,
NS_NET_STATUS_TLS_HANDSHAKE_STARTING, 0);
}
}
LOG(("TlsHandshaker::EnsureNPNComplete [mOwner=%p] drive TLS handshake",
mOwner.get()));
ReportSecureConnectionStart();
nsresult rv = ssl->DriveHandshake();
if (NS_FAILED(rv) && rv != NS_BASE_STREAM_WOULD_BLOCK) {
FinishNPNSetup(false, true);
@ -304,29 +312,6 @@ void TlsHandshaker::Check0RttEnabled(nsITLSSocketControl* ssl) {
}
}
void TlsHandshaker::ReportSecureConnectionStart() {
if (mSecureConnectionStartReported) {
return;
}
RefPtr<nsAHttpTransaction> transaction = mOwner->Transaction();
LOG(("ReportSecureConnectionStart transaction=%p", transaction.get()));
if (!transaction || transaction->QueryNullTransaction()) {
// When we don't have a transaction or have a NullTransaction, we need to
// store `secureConnectionStart` in nsHttpConnection::mBootstrappedTimings.
mOwner->SetEvent(NS_NET_STATUS_TLS_HANDSHAKE_STARTING);
mSecureConnectionStartReported = true;
return;
}
nsCOMPtr<nsISocketTransport> transport = mOwner->Transport();
if (transport) {
transaction->OnTransportStatus(transport,
NS_NET_STATUS_TLS_HANDSHAKE_STARTING, 0);
mSecureConnectionStartReported = true;
}
}
#ifndef ANDROID
void TlsHandshaker::EarlyDataTelemetry(int16_t tlsVersion,
bool earlyDataAccepted,

View File

@ -67,13 +67,11 @@ class TlsHandshaker : public nsITlsHandshakeCallbackListener {
virtual ~TlsHandshaker();
void Check0RttEnabled(nsITLSSocketControl* ssl);
void ReportSecureConnectionStart();
// SPDY related
bool mSetupSSLCalled{false};
bool mNPNComplete{false};
bool mSecureConnectionStartReported{false};
bool mTlsHandshakeComplitionPending{false};
// Helper variable for 0RTT handshake;
// Possible 0RTT has been checked.

View File

@ -546,9 +546,6 @@ nsresult nsHttpConnection::Activate(nsAHttpTransaction* trans, uint32_t caps,
}
}
// take ownership of the transaction
mTransaction = trans;
// Update security callbacks
nsCOMPtr<nsIInterfaceRequestor> callbacks;
trans->GetSecurityCallbacks(getter_AddRefs(callbacks));
@ -561,6 +558,9 @@ nsresult nsHttpConnection::Activate(nsAHttpTransaction* trans, uint32_t caps,
ChangeConnectionState(ConnectionState::TLS_HANDSHAKING);
}
// take ownership of the transaction
mTransaction = trans;
nsCOMPtr<nsITLSSocketControl> tlsSocketControl;
if (NS_SUCCEEDED(mSocketTransport->GetTlsSocketControl(
getter_AddRefs(tlsSocketControl))) &&
@ -2267,11 +2267,6 @@ void nsHttpConnection::CheckForTraffic(bool check) {
}
void nsHttpConnection::SetEvent(nsresult aStatus) {
LOG(("nsHttpConnection::SetEvent [this=%p status=%" PRIx32 "]\n", this,
static_cast<uint32_t>(aStatus)));
if (!mBootstrappedTimingsSet) {
mBootstrappedTimingsSet = true;
}
switch (aStatus) {
case NS_NET_STATUS_RESOLVING_HOST:
mBootstrappedTimings.domainLookupStart = TimeStamp::Now();

View File

@ -583,7 +583,7 @@ void nsHttpTransaction::SetSecurityCallbacks(
void nsHttpTransaction::OnTransportStatus(nsITransport* transport,
nsresult status, int64_t progress) {
LOG1(("nsHttpTransaction::OnTransportStatus [this=%p status=%" PRIx32
LOG1(("nsHttpTransaction::OnSocketStatus [this=%p status=%" PRIx32
" progress=%" PRId64 "]\n",
this, static_cast<uint32_t>(status), progress));

View File

@ -1,120 +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";
/* import-globals-from head_cache.js */
/* import-globals-from head_cookies.js */
/* import-globals-from head_channels.js */
/* import-globals-from head_servers.js */
var { setTimeout } = ChromeUtils.importESModule(
"resource://gre/modules/Timer.sys.mjs"
);
let h2Port;
let h3Port;
add_setup(function test_setup() {
do_get_profile();
h2Port = Services.env.get("MOZHTTP2_PORT");
Assert.notEqual(h2Port, null);
Assert.notEqual(h2Port, "");
h3Port = Services.env.get("MOZHTTP3_PORT");
Assert.notEqual(h3Port, null);
Assert.notEqual(h3Port, "");
let certdb = Cc["@mozilla.org/security/x509certdb;1"].getService(
Ci.nsIX509CertDB
);
addCertFromFile(certdb, "http2-ca.pem", "CTu,u,u");
Services.prefs.setBoolPref("network.http.http3.enable", true);
Services.prefs.setCharPref("network.dns.localDomains", "foo.example.com");
});
registerCleanupFunction(() => {
Services.prefs.clearUserPref("network.http.speculative-parallel-limit");
});
function makeChan(url) {
let chan = NetUtil.newChannel({
uri: url,
loadUsingSystemPrincipal: true,
contentPolicyType: Ci.nsIContentPolicy.TYPE_DOCUMENT,
}).QueryInterface(Ci.nsIHttpChannel);
return chan;
}
function channelOpenPromise(chan, flags) {
return new Promise(resolve => {
function finish(req, buffer) {
resolve([req, buffer]);
}
chan.asyncOpen(new ChannelListener(finish, null, flags));
});
}
async function do_test_timing(url) {
// Make sure all connections are closed before testing.
Services.obs.notifyObservers(null, "net:cancel-all-connections");
// Make sure 0RTT is not involved.
let nssComponent = Cc["@mozilla.org/psm;1"].getService(Ci.nsINSSComponent);
await nssComponent.asyncClearSSLExternalAndInternalSessionCache();
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
await new Promise(resolve => setTimeout(resolve, 1000));
let chan = makeChan(url);
let timedChannel = chan.QueryInterface(Ci.nsITimedChannel);
timedChannel.timingEnabled = true;
await channelOpenPromise(chan);
info(`secureConnectionStartTime=${timedChannel.secureConnectionStartTime}`);
info(`connectEndTime=${timedChannel.connectEndTime}`);
Assert.ok(timedChannel.secureConnectionStartTime > 0);
Assert.ok(timedChannel.connectEndTime > 0);
let handshakeTime =
timedChannel.connectEndTime - timedChannel.secureConnectionStartTime;
Assert.ok(handshakeTime > 0);
info(`handshakeTime=${handshakeTime}`);
info("perfMetrics", { handshakeTime });
}
add_task(async function test_http2() {
Services.prefs.setIntPref("network.http.speculative-parallel-limit", 6);
await do_test_timing(`https://foo.example.com:${h2Port}/server-timing`);
Services.prefs.setIntPref("network.http.speculative-parallel-limit", 0);
await do_test_timing(`https://foo.example.com:${h2Port}/server-timing`);
});
add_task(async function test_http1() {
let server = new NodeHTTPSServer();
await server.start();
registerCleanupFunction(async () => {
await server.stop();
});
await server.registerPathHandler("/test", (req, resp) => {
const output = "done";
resp.setHeader("Content-Length", output.length);
resp.writeHead(200);
resp.end(output);
});
Services.prefs.setIntPref("network.http.speculative-parallel-limit", 6);
await do_test_timing(`https://localhost:${server.port()}/test`);
Services.prefs.setIntPref("network.http.speculative-parallel-limit", 0);
await do_test_timing(`https://localhost:${server.port()}/test`);
});
add_task(async function test_http3() {
await http3_setup_tests("h3", true);
Services.prefs.setIntPref("network.http.speculative-parallel-limit", 6);
await do_test_timing(`https://foo.example.com/`);
Services.prefs.setIntPref("network.http.speculative-parallel-limit", 0);
await do_test_timing(`https://foo.example.com/`);
});

View File

@ -1158,12 +1158,6 @@ skip-if = ["os == 'android' && processor == 'x86_64'"]
["test_tls_flags_separate_connections.js"]
["test_tls_handshake_timing.js"]
skip-if = [
"os == 'android'",
"os == 'win'",
]
["test_tls_server.js"]
firefox-appdir = "browser"