tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 5720777005817d7ac8075193c21ec785371dc99e
parent 4c666a1188496f5f38b2ffd9fac8c93f55de9af8
Author: Dan Baker <dbaker@mozilla.com>
Date:   Thu, 23 Oct 2025 15:19:19 -0600

Bug 1995393 - Vendor libwebrtc from ad873017aa

Upstream commit: https://webrtc.googlesource.com/src/+/ad873017aa32c2e3d2f8a3a44832ad2b205d7ed3
    Allow to propagate clock into DtlsTransport using Environment

    Deprecate constructor that doesn't provide Environment, postpone direct
    usage of the Environment until that constructor can be deleted.

    Bug: webrtc:42223992
    Change-Id: I98151e3248f334dac592152f78d50196dbead008
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/404440
    Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
    Reviewed-by: Per Kjellander <perkj@webrtc.org>
    Cr-Commit-Position: refs/heads/main@{#45339}

Diffstat:
Mthird_party/libwebrtc/README.mozilla.last-vendor | 4++--
Mthird_party/libwebrtc/moz-patch-stack/p0003.patch | 2+-
Mthird_party/libwebrtc/moz-patch-stack/s0102.patch | 2+-
Mthird_party/libwebrtc/p2p/BUILD.gn | 2++
Mthird_party/libwebrtc/p2p/dtls/dtls_ice_integrationtest.cc | 3+--
Mthird_party/libwebrtc/p2p/dtls/dtls_transport.cc | 5++++-
Mthird_party/libwebrtc/p2p/dtls/dtls_transport.h | 30+++++++++++++++++++++++++++++-
Mthird_party/libwebrtc/p2p/dtls/dtls_transport_unittest.cc | 5+++--
Mthird_party/libwebrtc/pc/BUILD.gn | 1+
Mthird_party/libwebrtc/pc/dtls_srtp_transport_integrationtest.cc | 24+++++++++++++++---------
Mthird_party/libwebrtc/pc/jsep_transport_controller.cc | 5++---
Mthird_party/libwebrtc/pc/jsep_transport_controller.h | 3---
Mthird_party/libwebrtc/pc/peer_connection.cc | 1-
13 files changed, 61 insertions(+), 26 deletions(-)

diff --git a/third_party/libwebrtc/README.mozilla.last-vendor b/third_party/libwebrtc/README.mozilla.last-vendor @@ -1,4 +1,4 @@ # ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc -libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-23T21:16:24.603041+00:00. +libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-23T21:19:08.686935+00:00. # base of lastest vendoring -34d8ff1ba0 +ad873017aa diff --git a/third_party/libwebrtc/moz-patch-stack/p0003.patch b/third_party/libwebrtc/moz-patch-stack/p0003.patch @@ -35,7 +35,7 @@ Cr-Branched-From: 9bd64751d9b3b35a820cb72c9029993e218146a1-refs/heads/main@{#452 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/p2p/dtls/dtls_ice_integrationtest.cc b/p2p/dtls/dtls_ice_integrationtest.cc -index 2d539e2e22..1e42998d4f 100644 +index 339238d664..1610f0002a 100644 --- a/p2p/dtls/dtls_ice_integrationtest.cc +++ b/p2p/dtls/dtls_ice_integrationtest.cc @@ -127,11 +127,7 @@ class DtlsIceIntegrationTest : public ::testing::TestWithParam<std::tuple< diff --git a/third_party/libwebrtc/moz-patch-stack/s0102.patch b/third_party/libwebrtc/moz-patch-stack/s0102.patch @@ -601,7 +601,7 @@ index 0d68cb4b29..43a7a2e8d8 100644 import("../../webrtc.gni") diff --git a/pc/BUILD.gn b/pc/BUILD.gn -index 0c5df79fb4..70075055cf 100644 +index f48ba6e784..1122d4b66e 100644 --- a/pc/BUILD.gn +++ b/pc/BUILD.gn @@ -30,8 +30,8 @@ diff --git a/third_party/libwebrtc/p2p/BUILD.gn b/third_party/libwebrtc/p2p/BUILD.gn @@ -287,6 +287,7 @@ rtc_library("dtls_transport") { "../api:scoped_refptr", "../api:sequence_checker", "../api/crypto:options", + "../api/environment", "../api/rtc_event_log", "../api/task_queue:pending_task_safety_flag", "../api/transport:ecn_marking", @@ -1274,6 +1275,7 @@ if (rtc_include_tests) { "../rtc_base/network:sent_packet", "../rtc_base/third_party/sigslot", "../system_wrappers:metrics", + "../test:create_test_environment", "../test:create_test_field_trials", "../test:test_support", "../test:wait_until", diff --git a/third_party/libwebrtc/p2p/dtls/dtls_ice_integrationtest.cc b/third_party/libwebrtc/p2p/dtls/dtls_ice_integrationtest.cc @@ -170,8 +170,7 @@ class DtlsIceIntegrationTest : public ::testing::TestWithParam<std::tuple< &field_trials); } ep.dtls = std::make_unique<DtlsTransportInternalImpl>( - ep.ice.get(), crypto_options, - /*event_log=*/nullptr, std::get<2>(GetParam())); + ep.env, ep.ice.get(), crypto_options, std::get<2>(GetParam())); // Enable(or disable) the dtls_in_stun parameter before // DTLS is negotiated. diff --git a/third_party/libwebrtc/p2p/dtls/dtls_transport.cc b/third_party/libwebrtc/p2p/dtls/dtls_transport.cc @@ -24,6 +24,7 @@ #include "api/array_view.h" #include "api/crypto/crypto_options.h" #include "api/dtls_transport_interface.h" +#include "api/environment/environment.h" #include "api/rtc_error.h" #include "api/rtc_event_log/rtc_event_log.h" #include "api/scoped_refptr.h" @@ -191,11 +192,13 @@ void StreamInterfaceChannel::Close() { } DtlsTransportInternalImpl::DtlsTransportInternalImpl( + std::optional<Environment> env, IceTransportInternal* ice_transport, const CryptoOptions& crypto_options, RtcEventLog* event_log, SSLProtocolVersion max_version) - : component_(ice_transport->component()), + : env_(std::move(env)), + component_(ice_transport->component()), ice_transport_(ice_transport), downward_(nullptr), srtp_ciphers_(crypto_options.GetSupportedDtlsSrtpCryptoSuites()), diff --git a/third_party/libwebrtc/p2p/dtls/dtls_transport.h b/third_party/libwebrtc/p2p/dtls/dtls_transport.h @@ -23,6 +23,7 @@ #include "api/array_view.h" #include "api/crypto/crypto_options.h" #include "api/dtls_transport_interface.h" +#include "api/environment/environment.h" #include "api/rtc_error.h" #include "api/rtc_event_log/rtc_event_log.h" #include "api/scoped_refptr.h" @@ -123,11 +124,28 @@ class DtlsTransportInternalImpl : public DtlsTransportInternal { // // `event_log` is an optional RtcEventLog for logging state changes. It should // outlive the DtlsTransport. + [[deprecated("bugs.webrtc.org/42223992")]] DtlsTransportInternalImpl( IceTransportInternal* ice_transport, const CryptoOptions& crypto_options, RtcEventLog* event_log, - SSLProtocolVersion max_version = SSL_PROTOCOL_DTLS_12); + SSLProtocolVersion max_version = SSL_PROTOCOL_DTLS_12) + : DtlsTransportInternalImpl(std::nullopt, + ice_transport, + crypto_options, + event_log, + max_version) {} + + DtlsTransportInternalImpl( + const Environment& env, + IceTransportInternal* ice_transport, + const CryptoOptions& crypto_options, + SSLProtocolVersion max_version = SSL_PROTOCOL_DTLS_12) + : DtlsTransportInternalImpl(env, + ice_transport, + crypto_options, + &env.event_log(), + max_version) {} ~DtlsTransportInternalImpl() override; @@ -244,6 +262,13 @@ class DtlsTransportInternalImpl : public DtlsTransportInternal { bool WasDtlsCompletedByPiggybacking(); private: + // Temporary constructor to unify deprecated and new one. + DtlsTransportInternalImpl(std::optional<Environment> env, + IceTransportInternal* ice_transport, + const CryptoOptions& crypto_options, + RtcEventLog* event_log, + SSLProtocolVersion max_version); + void ConnectToIceTransport(); void OnWritableState(PacketTransportInternal* transport); @@ -271,6 +296,9 @@ class DtlsTransportInternalImpl : public DtlsTransportInternal { const ReceivedIpPacket& packet)> callback); void PeriodicRetransmitDtlsPacketUntilDtlsConnected(); + // TODO: bugs.webrtc.org/42223992 - Make non-optional when deprecated + // constructor is removed. + const std::optional<Environment> env_; RTC_NO_UNIQUE_ADDRESS SequenceChecker thread_checker_; const int component_; diff --git a/third_party/libwebrtc/p2p/dtls/dtls_transport_unittest.cc b/third_party/libwebrtc/p2p/dtls/dtls_transport_unittest.cc @@ -53,6 +53,7 @@ #include "rtc_base/ssl_stream_adapter.h" #include "rtc_base/third_party/sigslot/sigslot.h" #include "rtc_base/thread.h" +#include "test/create_test_environment.h" #include "test/gmock.h" #include "test/gtest.h" #include "test/wait_until.h" @@ -138,8 +139,8 @@ class DtlsTestClient : public sigslot::has_slots<> { }); dtls_transport_ = std::make_unique<DtlsTransportInternalImpl>( - fake_ice_transport_.get(), crypto_options, - /*event_log=*/nullptr, ssl_max_version_); + CreateTestEnvironment(), fake_ice_transport_.get(), crypto_options, + ssl_max_version_); // Note: Certificate may be null here if testing passthrough. dtls_transport_->SetLocalCertificate(certificate_); dtls_transport_->SignalWritableState.connect( diff --git a/third_party/libwebrtc/pc/BUILD.gn b/third_party/libwebrtc/pc/BUILD.gn @@ -2218,6 +2218,7 @@ if (rtc_include_tests && !build_with_chromium) { "../rtc_base/network:sent_packet", "../rtc_base/third_party/sigslot", "../system_wrappers:metrics", + "../test:create_test_environment", "../test:create_test_field_trials", "../test:run_loop", "../test:test_main", diff --git a/third_party/libwebrtc/pc/dtls_srtp_transport_integrationtest.cc b/third_party/libwebrtc/pc/dtls_srtp_transport_integrationtest.cc @@ -17,7 +17,7 @@ #include "absl/strings/str_cat.h" #include "api/crypto/crypto_options.h" #include "api/dtls_transport_interface.h" -#include "api/field_trials.h" +#include "api/environment/environment.h" #include "api/scoped_refptr.h" #include "api/test/rtc_error_matchers.h" #include "api/units/time_delta.h" @@ -39,13 +39,16 @@ #include "rtc_base/ssl_identity.h" #include "rtc_base/ssl_stream_adapter.h" #include "rtc_base/thread.h" -#include "test/create_test_field_trials.h" +#include "test/create_test_environment.h" #include "test/gmock.h" #include "test/gtest.h" #include "test/wait_until.h" -const int kRtpAuthTagLen = 10; -static const int kTimeout = 10000; +namespace webrtc { +namespace { + +constexpr int kRtpAuthTagLen = 10; +constexpr int kTimeout = 10000; /* A test using a DTLS-SRTP transport on one side and * SrtpTransport+DtlsTransport on the other side, connected by a @@ -60,8 +63,8 @@ class DtlsSrtpTransportIntegrationTest : public ::testing::Test { server_dtls_transport_(MakeDtlsTransport(server_ice_transport_.get())), client_certificate_(MakeCertificate()), server_certificate_(MakeCertificate()), - dtls_srtp_transport_(false, field_trials_), - srtp_transport_(false, field_trials_) { + dtls_srtp_transport_(false, env_.field_trials()), + srtp_transport_(false, env_.field_trials()) { dtls_srtp_transport_.SetDtlsTransports(server_dtls_transport_.get(), nullptr); srtp_transport_.SetRtpPacketTransport(client_ice_transport_.get()); @@ -96,8 +99,8 @@ class DtlsSrtpTransportIntegrationTest : public ::testing::Test { std::unique_ptr<webrtc::DtlsTransportInternalImpl> MakeDtlsTransport( webrtc::FakeIceTransport* ice_transport) { return std::make_unique<webrtc::DtlsTransportInternalImpl>( - ice_transport, webrtc::CryptoOptions(), - /*event_log=*/nullptr, webrtc::SSL_PROTOCOL_DTLS_12); + env_, ice_transport, webrtc::CryptoOptions(), + webrtc::SSL_PROTOCOL_DTLS_12); } void SetRemoteFingerprintFromCert( webrtc::DtlsTransportInternalImpl* transport, @@ -220,7 +223,7 @@ class DtlsSrtpTransportIntegrationTest : public ::testing::Test { private: webrtc::AutoThread main_thread_; webrtc::ScopedFakeClock fake_clock_; - webrtc::FieldTrials field_trials_ = webrtc::CreateTestFieldTrials(); + const Environment env_ = CreateTestEnvironment(); std::unique_ptr<webrtc::FakeIceTransport> client_ice_transport_; std::unique_ptr<webrtc::FakeIceTransport> server_ice_transport_; @@ -249,3 +252,6 @@ TEST_F(DtlsSrtpTransportIntegrationTest, SendRtpFromDtlsSrtpToSrtp) { SetupClientKeysManually(); SendRtpPacketFromDtlsSrtpToSrtp(); } + +} // namespace +} // namespace webrtc diff --git a/third_party/libwebrtc/pc/jsep_transport_controller.cc b/third_party/libwebrtc/pc/jsep_transport_controller.cc @@ -482,7 +482,7 @@ JsepTransportController::CreateIceTransport(const std::string& transport_name, init.set_port_allocator(port_allocator_); init.set_async_dns_resolver_factory(async_dns_resolver_factory_); init.set_lna_permission_factory(lna_permission_factory_); - init.set_event_log(config_.event_log); + init.set_event_log(&env_.event_log()); init.set_field_trials(&env_.field_trials()); auto transport = config_.ice_transport_factory->CreateIceTransport( transport_name, component, std::move(init)); @@ -504,8 +504,7 @@ JsepTransportController::CreateDtlsTransport(const ContentInfo& content_info, ice, config_.crypto_options, config_.ssl_max_version); } else { dtls = std::make_unique<DtlsTransportInternalImpl>( - ice, config_.crypto_options, config_.event_log, - config_.ssl_max_version); + env_, ice, config_.crypto_options, config_.ssl_max_version); } RTC_DCHECK(dtls); diff --git a/third_party/libwebrtc/pc/jsep_transport_controller.h b/third_party/libwebrtc/pc/jsep_transport_controller.h @@ -32,7 +32,6 @@ #include "api/local_network_access_permission.h" #include "api/peer_connection_interface.h" #include "api/rtc_error.h" -#include "api/rtc_event_log/rtc_event_log.h" #include "api/scoped_refptr.h" #include "api/sequence_checker.h" #include "api/transport/data_channel_transport_interface.h" @@ -42,7 +41,6 @@ #include "media/base/codec.h" #include "modules/rtp_rtcp/source/rtp_packet_received.h" #include "p2p/base/ice_transport_internal.h" -#include "p2p/base/p2p_transport_channel.h" #include "p2p/base/packet_transport_internal.h" #include "p2p/base/port.h" #include "p2p/base/port_allocator.h" @@ -130,7 +128,6 @@ class JsepTransportController : public PayloadTypeSuggester, // Initial value for whether DtlsTransport reset causes a reset // of SRTP parameters. bool active_reset_srtp_params = false; - RtcEventLog* event_log = nullptr; // Factory for SCTP transports. SctpTransportFactoryInterface* sctp_factory = nullptr; diff --git a/third_party/libwebrtc/pc/peer_connection.cc b/third_party/libwebrtc/pc/peer_connection.cc @@ -695,7 +695,6 @@ JsepTransportController* PeerConnection::InitializeTransportController_n( config.transport_observer = this; config.rtcp_handler = InitializeRtcpCallback(); config.un_demuxable_packet_handler = InitializeUnDemuxablePacketHandler(); - config.event_log = &env_.event_log(); #if defined(ENABLE_EXTERNAL_AUTH) config.enable_external_auth = true; #endif