Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ae5d4ebf2175309275a974221a1b85ddf55facac
      
https://github.com/WebKit/WebKit/commit/ae5d4ebf2175309275a974221a1b85ddf55facac
  Author: Per Arne Vollan <pvol...@apple.com>
  Date:   2025-09-16 (Tue, 16 Sep 2025)

  Changed paths:
    M Source/WebCore/PAL/pal/spi/cocoa/NetworkSPI.h
    M Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm
    M Tools/Scripts/webkitpy/__init__.py
    M Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py
    A Tools/Scripts/webkitpy/layout_tests/servers/basic_dns_server.py
    M Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py
    M Tools/Scripts/webkitpy/port/apple.py
    M Tools/Scripts/webkitpy/port/driver.py
    M Tools/Scripts/webkitpy/port/test.py
    M 
Tools/WebKitTestRunner/Configurations/WebKitTestRunner-internal.entitlements
    M Tools/WebKitTestRunner/Options.cpp
    M Tools/WebKitTestRunner/Options.h
    M Tools/WebKitTestRunner/TestController.h
    M Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj
    M Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm

  Log Message:
  -----------
  [Cocoa] Add support for overriding DNS resolution for WPT
https://bugs.webkit.org/show_bug.cgi?id=261038
rdar://82927182

Reviewed by Alex Christensen.

Patch by Matthew Finkel and Anne van Kesteren with minor modifications by Per 
Arne.

Some ports don't have support for resolving arbitrary domains, but
web-platform-tests rely on this capability. Currently, the Apple ports only
use localhost, and 127.0.0.1 as a workaround where it's necessary, but this
affects our test coverage. This patch adds a very basic DNS resolver and
introduces a new command-line argument for run-webkit-tests; this is disabled
by default.

In 254273@main, glib ports gained support for resolving arbitrary domains,
and this moves Apple ports closer to supporting that. We expect to enable
this by default, along with rebaselining, in a later commit.

Previous attempts were made in https://bugs.webkit.org/show_bug.cgi?id=245294,
and 264076@main introduced part of that behavior for a different reason. In
some situations, name resolutions falls back on that SPI, as well.

The basic DNS resolver only resolves A records for names ending with
"localhost" and for the host names defines by the port's localhost_aliases.
The server always returns 127.0.0.1 as the answer for those hosts. All other
queries return NXDomain. This resolver depends on the dnslib Python library.

On Apple ports, the iOS Simulator and Mac use different implementations. The
iOS simulator part is in the Network process because we need to define the
resolver in-process otherwise it won't be used. The way the resolver is
configured on Mac isn't supported on the simulator. On Mac, we use SPI and a
Network Extensions policy so this works when a VPN is enabled. We do this in
WebKitTestRunner so we don't need to add additional entitlements and weaken
the sandbox for the network process.

* Source/WebCore/PAL/pal/spi/cocoa/NetworkSPI.h:
* Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm:
(WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
* Tools/Scripts/webkitpy/__init__.py:
* Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py:
(parse_args):
* Tools/Scripts/webkitpy/layout_tests/servers/basic_dns_server.py: Added.
(Resolver):
(Resolver.__init__):
(Resolver.resolve):
* Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py:
(WebPlatformTestServer.__init__):
(WebPlatformTestServer._spawn_process):
(WebPlatformTestServer._stop_running_server):
* Tools/Scripts/webkitpy/port/apple.py:
(ApplePort.__init__):
* Tools/Scripts/webkitpy/port/driver.py:
(Driver.cmd_line):
* Tools/Scripts/webkitpy/port/test.py:
* Tools/WebKitTestRunner/Configurations/WebKitTestRunner-internal.entitlements:
* Tools/WebKitTestRunner/Options.cpp:
(WTR::handleOptionLocalDNSResolver):
(WTR::OptionsHandler::OptionsHandler):
* Tools/WebKitTestRunner/Options.h:
* Tools/WebKitTestRunner/TestController.h:
* Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:
* Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::cocoaPlatformInitialize):
(WTR::TestController::cocoaDNSInitialize):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to