Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: bb3490f57cd63e6be1c1e045a6b0d97b402d6fc7
      
https://github.com/WebKit/WebKit/commit/bb3490f57cd63e6be1c1e045a6b0d97b402d6fc7
  Author: Richard Robinson <[email protected]>
  Date:   2026-04-24 (Fri, 24 Apr 2026)

  Changed paths:
    M Tools/TestWebKitAPI/Helpers/cocoa/HTTPServer.h
    M Tools/TestWebKitAPI/Helpers/cocoa/HTTPServer.mm
    A Tools/TestWebKitAPI/Helpers/cocoa/HTTPServer.swift
    A Tools/TestWebKitAPI/Helpers/cocoa/StdLibExtras.swift
    M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/Download.mm
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/TextExtractionTests.mm
    M Tools/TestWebKitAPI/Tests/WebKit/WebPage/AppKitGesturesTests.swift
    M Tools/TestWebKitAPI/Tests/WebKit/WebPage/EditingFontSizeTests.swift
    M Tools/TestWebKitAPI/Tests/WebKit/WebPage/URLSchemeHandlerTests.swift
    M Tools/TestWebKitAPI/Tests/WebKit/WebPage/WebPageNavigationTests.swift

  Log Message:
  -----------
  [Swift Testing] Make it easy to use HTTPServer from Swift
https://bugs.webkit.org/show_bug.cgi?id=313093
rdar://175390188

Reviewed by Aditya Keerthi and Abrar Rahman Protyasha.

Design and implement a Swift overlay of HTTPServer to make it so much nicer and 
easier to use from Swift.

* Tools/TestWebKitAPI/Helpers/cocoa/HTTPServer.h:
(TestWebKitAPI::HTTPServer::HTTPServer):
* Tools/TestWebKitAPI/Helpers/cocoa/HTTPServer.mm:
(TestWebKitAPI::HTTPServer::RequestData::RequestData):
(TestWebKitAPI::HTTPServer::startListening):
(TestWebKitAPI::HTTPServer::cancel):
(TestWebKitAPI::HTTPServer::HTTPServer):
(TestWebKitAPI::m_protocol):
(hashMapSet):
(TestWebKitAPI::startListening): Deleted.

- Swift is unable to create an `std::initializer_list`, so add a `HashMap` 
overload
for the constructor.

- The `cancel` and `startListening` functions were masquarading as sync 
functions while
in actuality they are async; change them to reflect their true async nature.

- Change the Swift name of the Cxx HTTPServer so that Swift clients find the 
Swift
version instead of the Cxx version.

- Work around a limitation of Swift-Cxx interop with templated types by adding 
a helper
setter function for a hashmap.

* Tools/TestWebKitAPI/Helpers/cocoa/HTTPServer.swift: Added.
(RouteBuilder.buildBlock(_:)):
(HTTPServer.storage):

Implement the Swift HTTPServer.

* Tools/TestWebKitAPI/Helpers/cocoa/StdLibExtras.swift: Added.
(WTF.description):

Temporarily duplicate some code to make it easy to convert between WTF String 
and Swift String.

* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:

Add the new file.

* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/AppPrivacyReport.mm:
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/Download.mm:
(TestWebKitAPI::ResumeCantReconnect)):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/ServiceWorkerBasic.mm:
((ServiceWorkers, ChangeOfServerCertificate)):

Adjust some tests to accurately use the async cancel and startListening 
functions.

* Tools/TestWebKitAPI/Tests/WebKit/WebPage/AppKitGesturesTests.swift:
* Tools/TestWebKitAPI/Tests/WebKit/WebPage/URLSchemeHandlerTests.swift:
* Tools/TestWebKitAPI/Tests/WebKit/WebPage/WebPageNavigationTests.swift:

Disambiguate the `Task` type.

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



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

Reply via email to