Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8eb608658b83025730ac1fccd25f19521d1bbd77
      
https://github.com/WebKit/WebKit/commit/8eb608658b83025730ac1fccd25f19521d1bbd77
  Author: Youenn Fablet <[email protected]>
  Date:   2026-09-10 (Thu, 10 Sep 2026)

  Changed paths:
    M Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
    M Source/WebKit/WebProcess/Network/webrtc/LibWebRTCDnsResolverFactory.cpp
    M Source/WebKit/WebProcess/Network/webrtc/LibWebRTCDnsResolverFactory.h
    M Source/WebKit/WebProcess/Network/webrtc/LibWebRTCNetworkManager.h
    M Source/WebKit/WebProcess/Network/webrtc/LibWebRTCProvider.cpp
    M Source/WebKit/WebProcess/Network/webrtc/LibWebRTCResolver.cpp
    M Source/WebKit/WebProcess/Network/webrtc/LibWebRTCResolver.h
    M Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp
    M Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocketFactory.h
    A Tools/TestWebKitAPI/Helpers/cocoa/MiniTURNServer.h
    A Tools/TestWebKitAPI/Helpers/cocoa/MiniTURNServer.mm
    M Tools/TestWebKitAPI/PlatformCocoa.cmake
    M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WebRTC.mm

  Log Message:
  -----------
  Add a flag to control whether allowing WebRTC to resolve DNS directly
rdar://186852502
https://bugs.webkit.org/show_bug.cgi?id=323606

Reviewed by Alex Christensen.

We add a flag to disable DNS direct resolution triggered by WebRTC.
WebRTC DNS resolution is triggered for TURN/STUN servers.

By default, the flag disables the DNS resolution except for mDNS and if private 
relay is bypassed, say if page has access to camera or microphone.
To support this we have to pass the ScriptExecutionContextIdentifier to the 
LibWebRTCResolver.
We use it to get to the resolver's document, which allows to check for flags 
and know whether private relay is bypassed.

We add a test that validates that, even if DNS resolution fails, we can still 
allocate UDP and TCP TURN candidates.
There is no support for STUN candidates yet as private relay is not supporting 
UDP bind.

* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebKit/WebProcess/Network/webrtc/LibWebRTCDnsResolverFactory.cpp:
(WebKit::LibWebRTCDnsResolverFactory::CreateAndResolve):
(WebKit::LibWebRTCDnsResolverFactory::Create):
* Source/WebKit/WebProcess/Network/webrtc/LibWebRTCDnsResolverFactory.h:
* Source/WebKit/WebProcess/Network/webrtc/LibWebRTCNetworkManager.h:
* Source/WebKit/WebProcess/Network/webrtc/LibWebRTCProvider.cpp:
(WebKit::LibWebRTCProvider::createPeerConnection):
(WebKit::RTCSocketFactory::CreateAsyncDnsResolver):
* Source/WebKit/WebProcess/Network/webrtc/LibWebRTCResolver.cpp:
(WebKit::canStart):
(WebKit::LibWebRTCResolver::start):
* Source/WebKit/WebProcess/Network/webrtc/LibWebRTCResolver.h:
* Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp:
(WebKit::LibWebRTCSocketFactory::createAsyncDnsResolver):
* Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocketFactory.h:
* Tools/TestWebKitAPI/Helpers/cocoa/MiniTURNServer.h: Copied from 
Source/WebKit/WebProcess/Network/webrtc/LibWebRTCDnsResolverFactory.h.
* Tools/TestWebKitAPI/Helpers/cocoa/MiniTURNServer.mm: Added.
(TestWebKitAPI::MiniTURNServerState::create):
(TestWebKitAPI::MiniTURNServerState::recordRequest):
(TestWebKitAPI::MiniTURNServerState::takeRequests):
(TestWebKitAPI::MiniTURNServerState::setUDPPort):
(TestWebKitAPI::MiniTURNServerState::setTCPPort):
(TestWebKitAPI::MiniTURNServerState::udpPort const):
(TestWebKitAPI::MiniTURNServerState::tcpPort const):
(TestWebKitAPI::extractStunMethod):
(TestWebKitAPI::makeStunSuccessMessageType):
(TestWebKitAPI::makeStunErrorMessageType):
(TestWebKitAPI::writeU16BE):
(TestWebKitAPI::writeU32BE):
(TestWebKitAPI::appendXorAddressAttributeV4):
(TestWebKitAPI::appendXorAddressAttributeV6):
(TestWebKitAPI::appendLifetimeAttribute):
(TestWebKitAPI::appendPadTo4):
(TestWebKitAPI::appendStringAttribute):
(TestWebKitAPI::appendErrorCodeAttribute):
(TestWebKitAPI::computeLongTermAuthKey):
(TestWebKitAPI::appendMessageIntegrityAttribute):
(TestWebKitAPI::hasMessageIntegrityAttribute):
(TestWebKitAPI::peerEndPointAddress):
(TestWebKitAPI::handleStunMessage):
(TestWebKitAPI::sendReply):
(TestWebKitAPI::receiveUDPDatagram):
(TestWebKitAPI::receiveTCPBytes):
(TestWebKitAPI::startListener):
(TestWebKitAPI::MiniTURNServer::MiniTURNServer):
(TestWebKitAPI::MiniTURNServer::~MiniTURNServer):
(TestWebKitAPI::MiniTURNServer::udpPort const):
(TestWebKitAPI::MiniTURNServer::tcpPort const):
(TestWebKitAPI::MiniTURNServer::takeRequests):
(TestWebKitAPI::MiniTURNServer::isStunMethodAllocate):
* Tools/TestWebKitAPI/PlatformCocoa.cmake:
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WebRTC.mm:
(TestWebKitAPI::TEST(WebKit2, WebRTCTurnAllocationWithDirectDNSDisabled)):

Canonical link: https://commits.webkit.org/320825@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to