tor-browser

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

commit e7712fe018ec4fd2f2656a509f92bbaeece2905f
parent cd54cbb82ab834524334813fdc275aae46142d11
Author: Dan Baker <dbaker@mozilla.com>
Date:   Mon,  1 Dec 2025 18:54:22 -0700

Bug 2000941 - Vendor libwebrtc from 0632af9a28

Upstream commit: https://webrtc.googlesource.com/src/+/0632af9a28e9e591947e8b82367ebaf0d867e6b7
    Require Environment to create AsyncPacketSocket with PacketSocketFactory

    This way implementations of the PacketSocketFactory can rely on
    Environment to be always provided and thus migrate to the new api.

    Bug: webrtc:42223992
    Change-Id: Id8e88fe1e9f40c4f962c90411551863a9c5ffbe6
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/408822
    Reviewed-by: Harald Alvestrand <hta@webrtc.org>
    Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
    Cr-Commit-Position: refs/heads/main@{#45613}

Diffstat:
Mthird_party/libwebrtc/README.mozilla.last-vendor | 4++--
Mthird_party/libwebrtc/api/BUILD.gn | 1+
Mthird_party/libwebrtc/api/packet_socket_factory.h | 29++++++++++++++++++++---------
Mthird_party/libwebrtc/moz-patch-stack/p0001.patch | 2+-
Mthird_party/libwebrtc/moz-patch-stack/s0027.patch | 14+++++++-------
Mthird_party/libwebrtc/moz-patch-stack/s0102.patch | 2+-
Mthird_party/libwebrtc/p2p/base/stun_port_unittest.cc | 10+++++++---
Mthird_party/libwebrtc/p2p/base/turn_port_unittest.cc | 4++--
8 files changed, 41 insertions(+), 25 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-12-02T01:51:44.556439+00:00. +libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-12-02T01:54:05.851086+00:00. # base of lastest vendoring -fd381db407 +0632af9a28 diff --git a/third_party/libwebrtc/api/BUILD.gn b/third_party/libwebrtc/api/BUILD.gn @@ -506,6 +506,7 @@ rtc_source_set("packet_socket_factory") { deps = [ ":async_dns_resolver", "../rtc_base:async_packet_socket", + "../rtc_base:checks", "../rtc_base:socket_address", "../rtc_base:ssl", "../rtc_base/system:rtc_export", diff --git a/third_party/libwebrtc/api/packet_socket_factory.h b/third_party/libwebrtc/api/packet_socket_factory.h @@ -20,6 +20,7 @@ #include "api/async_dns_resolver.h" #include "api/environment/environment.h" #include "rtc_base/async_packet_socket.h" +#include "rtc_base/checks.h" #include "rtc_base/socket_address.h" #include "rtc_base/ssl_certificate.h" #include "rtc_base/system/rtc_export.h" @@ -60,6 +61,9 @@ class RTC_EXPORT PacketSocketFactory { virtual ~PacketSocketFactory() = default; + // TODO: bugs.webrtc.org/42223992 - after Oct 10, 2025 make Create*Socket + // functions that accept Environment pure virtual, and delete legacy + // Create*Socket functions. virtual std::unique_ptr<AsyncPacketSocket> CreateUdpSocket( const Environment& /*env*/, const SocketAddress& address, @@ -87,25 +91,32 @@ class RTC_EXPORT PacketSocketFactory { CreateClientTcpSocket(local_address, remote_address, tcp_options)); } - // TODO: bugs.webrtc.org/42223992 - deprecate all 3 CreateSomeSocket functions - // below when WebRTC and downstream users are updated to always provide - // Environment to construct a packet socket. + virtual std::unique_ptr<AsyncDnsResolverInterface> + CreateAsyncDnsResolver() = 0; + + private: virtual AsyncPacketSocket* CreateUdpSocket(const SocketAddress& address, uint16_t min_port, - uint16_t max_port) = 0; + uint16_t max_port) { + RTC_DCHECK_NOTREACHED(); + return nullptr; + } virtual AsyncListenSocket* CreateServerTcpSocket( const SocketAddress& local_address, uint16_t min_port, uint16_t max_port, - int opts) = 0; + int opts) { + RTC_DCHECK_NOTREACHED(); + return nullptr; + } virtual AsyncPacketSocket* CreateClientTcpSocket( const SocketAddress& local_address, const SocketAddress& remote_address, - const PacketSocketTcpOptions& tcp_options) = 0; - - virtual std::unique_ptr<AsyncDnsResolverInterface> - CreateAsyncDnsResolver() = 0; + const PacketSocketTcpOptions& tcp_options) { + RTC_DCHECK_NOTREACHED(); + return nullptr; + } }; } // namespace webrtc diff --git a/third_party/libwebrtc/moz-patch-stack/p0001.patch b/third_party/libwebrtc/moz-patch-stack/p0001.patch @@ -159,7 +159,7 @@ index b004b3026c..43a4935432 100644 [this](PortInterface* port) { OnSrcPortDestroyed(port); }); } diff --git a/p2p/base/turn_port_unittest.cc b/p2p/base/turn_port_unittest.cc -index d5b4c32884..7346f584de 100644 +index 6114165ec9..52aadaa05c 100644 --- a/p2p/base/turn_port_unittest.cc +++ b/p2p/base/turn_port_unittest.cc @@ -372,12 +372,9 @@ class TurnPortTest : public ::testing::Test, diff --git a/third_party/libwebrtc/moz-patch-stack/s0027.patch b/third_party/libwebrtc/moz-patch-stack/s0027.patch @@ -203,7 +203,7 @@ index 3efce2dd19..cbfc05f243 100644 } diff --git a/api/BUILD.gn b/api/BUILD.gn -index f7aa830397..609a24ab27 100644 +index 1d7d864b06..e7788090b0 100644 --- a/api/BUILD.gn +++ b/api/BUILD.gn @@ -44,6 +44,9 @@ rtc_library("enable_media") { @@ -295,7 +295,7 @@ index f7aa830397..609a24ab27 100644 rtc_library("frame_transformer_interface") { visibility = [ "*" ] -@@ -643,6 +672,7 @@ rtc_source_set("peer_network_dependencies") { +@@ -644,6 +673,7 @@ rtc_source_set("peer_network_dependencies") { } rtc_source_set("peer_connection_quality_test_fixture_api") { @@ -303,7 +303,7 @@ index f7aa830397..609a24ab27 100644 visibility = [ "*" ] testonly = true sources = [ "test/peerconnection_quality_test_fixture.h" ] -@@ -687,6 +717,7 @@ rtc_source_set("peer_connection_quality_test_fixture_api") { +@@ -688,6 +718,7 @@ rtc_source_set("peer_connection_quality_test_fixture_api") { "//third_party/abseil-cpp/absl/strings:string_view", ] } @@ -311,7 +311,7 @@ index f7aa830397..609a24ab27 100644 rtc_library("frame_generator_api") { visibility = [ "*" ] -@@ -792,6 +823,7 @@ rtc_library("create_frame_generator") { +@@ -793,6 +824,7 @@ rtc_library("create_frame_generator") { ] } @@ -319,7 +319,7 @@ index f7aa830397..609a24ab27 100644 rtc_library("create_peer_connection_quality_test_frame_generator") { visibility = [ "*" ] testonly = true -@@ -809,6 +841,7 @@ rtc_library("create_peer_connection_quality_test_frame_generator") { +@@ -810,6 +842,7 @@ rtc_library("create_peer_connection_quality_test_frame_generator") { "units:time_delta", ] } @@ -327,7 +327,7 @@ index f7aa830397..609a24ab27 100644 rtc_source_set("data_channel_event_observer_interface") { visibility = [ "*" ] -@@ -1001,6 +1034,7 @@ rtc_source_set("refcountedbase") { +@@ -1002,6 +1035,7 @@ rtc_source_set("refcountedbase") { } rtc_library("ice_transport_factory") { @@ -335,7 +335,7 @@ index f7aa830397..609a24ab27 100644 visibility = [ "*" ] sources = [ "ice_transport_factory.cc", -@@ -1024,6 +1058,7 @@ rtc_library("ice_transport_factory") { +@@ -1025,6 +1059,7 @@ rtc_library("ice_transport_factory") { "rtc_event_log", ] } diff --git a/third_party/libwebrtc/moz-patch-stack/s0102.patch b/third_party/libwebrtc/moz-patch-stack/s0102.patch @@ -126,7 +126,7 @@ index 771e0b196a..7e1e8353ab 100644 "Generated during 'gn gen' by //BUILD.gn.", "", diff --git a/api/BUILD.gn b/api/BUILD.gn -index 609a24ab27..9fec3ec05d 100644 +index e7788090b0..d85d2d38e8 100644 --- a/api/BUILD.gn +++ b/api/BUILD.gn @@ -8,8 +8,8 @@ diff --git a/third_party/libwebrtc/p2p/base/stun_port_unittest.cc b/third_party/libwebrtc/p2p/base/stun_port_unittest.cc @@ -21,6 +21,7 @@ #include "absl/functional/any_invocable.h" #include "absl/strings/string_view.h" #include "api/candidate.h" +#include "api/environment/environment.h" #include "api/environment/environment_factory.h" #include "api/field_trials.h" #include "api/field_trials_view.h" @@ -57,6 +58,7 @@ #include "rtc_base/thread.h" #include "rtc_base/virtual_socket_server.h" #include "system_wrappers/include/metrics.h" +#include "test/create_test_environment.h" #include "test/create_test_field_trials.h" #include "test/gmock.h" #include "test/gtest.h" @@ -225,11 +227,13 @@ class StunPortTestBase : public ::testing::Test, public sigslot::has_slots<> { const webrtc::SocketAddress& server_addr, webrtc::AsyncPacketSocket* socket, const webrtc::FieldTrialsView* field_trials = nullptr) { + const Environment env = + CreateTestEnvironment({.field_trials = field_trials}); if (socket) { socket_.reset(socket); } else { - socket_.reset(socket_factory()->CreateUdpSocket( - webrtc::SocketAddress(kPrivateIP.ipaddr(), 0), 0, 0)); + socket_ = socket_factory()->CreateUdpSocket( + env, webrtc::SocketAddress(kPrivateIP.ipaddr(), 0), 0, 0); } ASSERT_TRUE(socket_ != nullptr); socket_->RegisterReceivedPacketCallback( @@ -240,7 +244,7 @@ class StunPortTestBase : public ::testing::Test, public sigslot::has_slots<> { ServerAddresses stun_servers; stun_servers.insert(server_addr); stun_port_ = webrtc::UDPPort::Create( - {.env = CreateEnvironment(field_trials), + {.env = env, .network_thread = &thread_, .socket_factory = socket_factory(), .network = network_, diff --git a/third_party/libwebrtc/p2p/base/turn_port_unittest.cc b/third_party/libwebrtc/p2p/base/turn_port_unittest.cc @@ -336,8 +336,8 @@ class TurnPortTest : public ::testing::Test, RTC_CHECK(server_address.proto == PROTO_UDP); if (!socket_) { - socket_.reset(socket_factory()->CreateUdpSocket( - SocketAddress(kLocalAddr1.ipaddr(), 0), 0, 0)); + socket_ = socket_factory()->CreateUdpSocket( + env_, SocketAddress(kLocalAddr1.ipaddr(), 0), 0, 0); ASSERT_TRUE(socket_ != nullptr); socket_->RegisterReceivedPacketCallback( [&](AsyncPacketSocket* socket, const ReceivedIpPacket& packet) {