<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[287223] trunk/Tools</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/287223">287223</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2021-12-18 09:18:25 -0800 (Sat, 18 Dec 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>Drop ServiceWorkerTCPServer and use HTTPServer instead
https://bugs.webkit.org/show_bug.cgi?id=234443
<rdar://86646140>

Reviewed by Alex Christensen.

Drop ServiceWorkerTCPServer and use HTTPServer instead. ServiceWorkerTCPServer relies on TCPServer which is
known to cause flakiness and sometimes hang in its destruction.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/AppPrivacyReport.mm:
* TestWebKitAPI/Tests/WebKitCocoa/InAppBrowserPrivacy.mm:
* TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm:
* TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerTCPServer.h: Removed.
(): Deleted.
(ServiceWorkerTCPServer::ServiceWorkerTCPServer): Deleted.
(ServiceWorkerTCPServer::request): Deleted.
(ServiceWorkerTCPServer::requestWithLocalhost): Deleted.
(ServiceWorkerTCPServer::requestWithFragment): Deleted.
(ServiceWorkerTCPServer::userAgentsChecked const): Deleted.
(ServiceWorkerTCPServer::respondToRequests): Deleted.
(ServiceWorkerTCPServer::requestWithURLString): Deleted.
* TestWebKitAPI/Tests/WebKitCocoa/StorageQuota.mm:
* TestWebKitAPI/cocoa/HTTPServer.h:
* TestWebKitAPI/cocoa/HTTPServer.mm:
(TestWebKitAPI::HTTPServer::scheme const):
(TestWebKitAPI::HTTPServer::request const):
(TestWebKitAPI::HTTPServer::requestWithLocalhost const):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj">trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKitCocoaAppPrivacyReportmm">trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/AppPrivacyReport.mm</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKitCocoaInAppBrowserPrivacymm">trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/InAppBrowserPrivacy.mm</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKitCocoaServiceWorkerBasicmm">trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKitCocoaStorageQuotamm">trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/StorageQuota.mm</a></li>
<li><a href="#trunkToolsTestWebKitAPIcocoaHTTPServerh">trunk/Tools/TestWebKitAPI/cocoa/HTTPServer.h</a></li>
<li><a href="#trunkToolsTestWebKitAPIcocoaHTTPServermm">trunk/Tools/TestWebKitAPI/cocoa/HTTPServer.mm</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkToolsTestWebKitAPITestsWebKitCocoaServiceWorkerTCPServerh">trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerTCPServer.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (287222 => 287223)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog    2021-12-18 15:11:29 UTC (rev 287222)
+++ trunk/Tools/ChangeLog       2021-12-18 17:18:25 UTC (rev 287223)
</span><span class="lines">@@ -1,3 +1,34 @@
</span><ins>+2021-12-18  Chris Dumez  <cdumez@apple.com>
+
+        Drop ServiceWorkerTCPServer and use HTTPServer instead
+        https://bugs.webkit.org/show_bug.cgi?id=234443
+        <rdar://86646140>
+
+        Reviewed by Alex Christensen.
+
+        Drop ServiceWorkerTCPServer and use HTTPServer instead. ServiceWorkerTCPServer relies on TCPServer which is
+        known to cause flakiness and sometimes hang in its destruction.
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WebKitCocoa/AppPrivacyReport.mm:
+        * TestWebKitAPI/Tests/WebKitCocoa/InAppBrowserPrivacy.mm:
+        * TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm:
+        * TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerTCPServer.h: Removed.
+        (): Deleted.
+        (ServiceWorkerTCPServer::ServiceWorkerTCPServer): Deleted.
+        (ServiceWorkerTCPServer::request): Deleted.
+        (ServiceWorkerTCPServer::requestWithLocalhost): Deleted.
+        (ServiceWorkerTCPServer::requestWithFragment): Deleted.
+        (ServiceWorkerTCPServer::userAgentsChecked const): Deleted.
+        (ServiceWorkerTCPServer::respondToRequests): Deleted.
+        (ServiceWorkerTCPServer::requestWithURLString): Deleted.
+        * TestWebKitAPI/Tests/WebKitCocoa/StorageQuota.mm:
+        * TestWebKitAPI/cocoa/HTTPServer.h:
+        * TestWebKitAPI/cocoa/HTTPServer.mm:
+        (TestWebKitAPI::HTTPServer::scheme const):
+        (TestWebKitAPI::HTTPServer::request const):
+        (TestWebKitAPI::HTTPServer::requestWithLocalhost const):
+
</ins><span class="cx"> 2021-12-17  Yusuke Suzuki  <ysuzuki@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [WTF] Introduce TrailingArray
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (287222 => 287223)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2021-12-18 15:11:29 UTC (rev 287222)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj   2021-12-18 17:18:25 UTC (rev 287223)
</span><span class="lines">@@ -2204,7 +2204,6 @@
</span><span class="cx">          5C42594422669E9B0039AA7A /* BasicProposedCredentialPlugIn.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = BasicProposedCredentialPlugIn.mm; sourceTree = "<group>"; };
</span><span class="cx">          5C4A84941F7EEFD400ACFC54 /* Configuration.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = Configuration.mm; sourceTree = "<group>"; };
</span><span class="cx">          5C5E633D1D0B67940085A025 /* UniqueRef.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UniqueRef.cpp; sourceTree = "<group>"; };
</span><del>-               5C683471235ACC7C0041E6B1 /* ServiceWorkerTCPServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ServiceWorkerTCPServer.h; sourceTree = "<group>"; };
</del><span class="cx">           5C69BDD41F82A7EB000F4F4B /* JavaScriptDuringNavigation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = JavaScriptDuringNavigation.mm; sourceTree = "<group>"; };
</span><span class="cx">          5C6E27A6224EEBEA00128736 /* URLCanonicalization.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = URLCanonicalization.mm; sourceTree = "<group>"; };
</span><span class="cx">          5C7101C625DD988700686200 /* test_print.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = test_print.pdf; sourceTree = "<group>"; };
</span><span class="lines">@@ -3549,7 +3548,6 @@
</span><span class="cx">                          51EB12931FDF050500A5A1BD /* ServiceWorkerBasic.mm */,
</span><span class="cx">                          466AF38826FE393200CE2EB8 /* ServiceWorkerPagePlugIn.mm */,
</span><span class="cx">                          460C2FC827039D7D0047EF11 /* ServiceWorkerPageProtocol.h */,
</span><del>-                               5C683471235ACC7C0041E6B1 /* ServiceWorkerTCPServer.h */,
</del><span class="cx">                           46A46A192575645600A1B118 /* SessionStorage.mm */,
</span><span class="cx">                          5CCB10DF2134579D00AC5AF0 /* ShouldGoToBackForwardListItem.mm */,
</span><span class="cx">                          37BCA61B1B596BA9002012CA /* ShouldOpenExternalURLsInNewWindowActions.mm */,
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKitCocoaAppPrivacyReportmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/AppPrivacyReport.mm (287222 => 287223)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/AppPrivacyReport.mm  2021-12-18 15:11:29 UTC (rev 287222)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/AppPrivacyReport.mm     2021-12-18 17:18:25 UTC (rev 287223)
</span><span class="lines">@@ -27,7 +27,6 @@
</span><span class="cx"> 
</span><span class="cx"> #import "HTTPServer.h"
</span><span class="cx"> #import "PlatformUtilities.h"
</span><del>-#import "ServiceWorkerTCPServer.h"
</del><span class="cx"> #import "TestNavigationDelegate.h"
</span><span class="cx"> #import "TestUIDelegate.h"
</span><span class="cx"> #import "TestWKWebView.h"
</span><span class="lines">@@ -665,17 +664,14 @@
</span><span class="cx">     webView1.get().navigationDelegate = delegate.get();
</span><span class="cx">     webView2.get().navigationDelegate = delegate.get();
</span><span class="cx"> 
</span><del>-    ServiceWorkerTCPServer server({
-        { "text/html", mainSWBytesDefaultValue },
-        { "application/javascript", scriptBytesDefaultValue },
-    }, {
-        { "text/html", mainSWBytesDefaultValue },
-        { "application/javascript", scriptBytesDefaultValue },
</del><ins>+    TestWebKitAPI::HTTPServer server({
+        { "/main.html", { mainSWBytesDefaultValue } },
+        { "/sw.js", { { { "Content-Type", "application/javascript" } }, scriptBytesDefaultValue } },
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     // Load WebView with an app initiated request. We expect the ServiceWorkerThreadProxy to be app initiated.
</span><span class="cx">     expectedMessage = "app initiated";
</span><del>-    [webView1 loadRequest:server.request()];
</del><ins>+    [webView1 loadRequest:server.request("/main.html")];
</ins><span class="cx">     TestWebKitAPI::Util::run(&receivedMessage);
</span><span class="cx"> 
</span><span class="cx">     // Load WebView with a non app initiated request. We expect the ServiceWorkerThreadProxy to be app initiated
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKitCocoaInAppBrowserPrivacymm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/InAppBrowserPrivacy.mm (287222 => 287223)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/InAppBrowserPrivacy.mm       2021-12-18 15:11:29 UTC (rev 287222)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/InAppBrowserPrivacy.mm  2021-12-18 17:18:25 UTC (rev 287223)
</span><span class="lines">@@ -26,8 +26,8 @@
</span><span class="cx"> #import "config.h"
</span><span class="cx"> 
</span><span class="cx"> #import "DeprecatedGlobalValues.h"
</span><ins>+#import "HTTPServer.h"
</ins><span class="cx"> #import "PlatformUtilities.h"
</span><del>-#import "ServiceWorkerTCPServer.h"
</del><span class="cx"> #import "TestNavigationDelegate.h"
</span><span class="cx"> #import "TestURLSchemeHandler.h"
</span><span class="cx"> #import "TestWKWebView.h"
</span><span class="lines">@@ -898,9 +898,9 @@
</span><span class="cx"> 
</span><span class="cx">     auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
</span><span class="cx"> 
</span><del>-    ServiceWorkerTCPServer server1({
-        { "text/html", mainBytes },
-        { "application/javascript", scriptBytes},
</del><ins>+    TestWebKitAPI::HTTPServer server({
+        { "/main.html", { mainBytes } },
+        { "/sw.js", { { { "Content-Type", "application/javascript" } }, scriptBytes } },
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     [WKWebsiteDataStore _allowWebsiteDataRecordsForAllOrigins];
</span><span class="lines">@@ -914,7 +914,7 @@
</span><span class="cx">     
</span><span class="cx">     // Expect the service worker load to complete successfully.
</span><span class="cx">     expectedMessage = "Message from worker: ServiceWorker received: Hello from an app-bound domain";
</span><del>-    [webView loadRequest:server1.requestWithLocalhost()];
</del><ins>+    [webView loadRequest:server.requestWithLocalhost("/main.html")];
</ins><span class="cx">     TestWebKitAPI::Util::run(&isDone);
</span><span class="cx">     isDone = false;
</span><span class="cx"> 
</span><span class="lines">@@ -955,9 +955,9 @@
</span><span class="cx"> 
</span><span class="cx">     auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
</span><span class="cx"> 
</span><del>-    ServiceWorkerTCPServer server({
-        { "text/html", mainUnregisterBytes },
-        { "application/javascript", scriptBytes},
</del><ins>+    TestWebKitAPI::HTTPServer server({
+        { "/main.html", { mainUnregisterBytes } },
+        { "/sw.js", { { { "Content-Type", "application/javascript" } }, scriptBytes } },
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     [WKWebsiteDataStore _allowWebsiteDataRecordsForAllOrigins];
</span><span class="lines">@@ -968,7 +968,7 @@
</span><span class="cx">     isDone = false;
</span><span class="cx"> 
</span><span class="cx">     expectedMessage = "Unregistration success";
</span><del>-    [webView loadRequest:server.requestWithLocalhost()];
</del><ins>+    [webView loadRequest:server.requestWithLocalhost("/main.html")];
</ins><span class="cx">     TestWebKitAPI::Util::run(&isDone);
</span><span class="cx"> 
</span><span class="cx">     isDone = false;
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKitCocoaServiceWorkerBasicmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm (287222 => 287223)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm        2021-12-18 15:11:29 UTC (rev 287222)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm   2021-12-18 17:18:25 UTC (rev 287223)
</span><span class="lines">@@ -29,7 +29,6 @@
</span><span class="cx"> #import "HTTPServer.h"
</span><span class="cx"> #import "PlatformUtilities.h"
</span><span class="cx"> #import "ServiceWorkerPageProtocol.h"
</span><del>-#import "ServiceWorkerTCPServer.h"
</del><span class="cx"> #import "Test.h"
</span><span class="cx"> #import "TestNavigationDelegate.h"
</span><span class="cx"> #import "TestUIDelegate.h"
</span><span class="lines">@@ -438,9 +437,9 @@
</span><span class="cx"> 
</span><span class="cx"> static void runBasicSWTest(ShouldRunServiceWorkersOnMainThread shouldRunServiceWorkersOnMainThread)
</span><span class="cx"> {
</span><del>-    ServiceWorkerTCPServer server({
-        { "text/html", mainBytes },
-        { "application/javascript", scriptBytes},
</del><ins>+    TestWebKitAPI::HTTPServer server({
+        { "/", { mainBytes } },
+        { "/sw.js", { { { "Content-Type", "application/javascript" } }, scriptBytes } },
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     [WKWebsiteDataStore _allowWebsiteDataRecordsForAllOrigins];
</span><span class="lines">@@ -561,13 +560,10 @@
</span><span class="cx">     auto messageHandler = adoptNS([[SWUserAgentMessageHandler alloc] initWithExpectedMessage:@"Message from worker: Foo Custom UserAgent"]);
</span><span class="cx">     [[configuration userContentController] addScriptMessageHandler:messageHandler.get() name:@"sw"];
</span><span class="cx"> 
</span><del>-    ServiceWorkerTCPServer server({
-        { "text/html", mainBytes },
-        { "application/javascript", userAgentSWBytes },
-    }, {
-        { "text/html", mainBytes },
-        { "application/javascript", userAgentSWBytes },
-    }, 2, { "Foo Custom UserAgent"_s, "Bar Custom UserAgent"_s });
</del><ins>+    TestWebKitAPI::HTTPServer server({
+        { "/", { mainBytes } },
+        { "/sw.js", { { { "Content-Type", "application/javascript" } }, userAgentSWBytes } },
+    });
</ins><span class="cx"> 
</span><span class="cx">     auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
</span><span class="cx"> 
</span><span class="lines">@@ -599,7 +595,6 @@
</span><span class="cx"> 
</span><span class="cx">     TestWebKitAPI::Util::run(&done);
</span><span class="cx">     done = false;
</span><del>-    EXPECT_EQ(server.userAgentsChecked(), 3ull);
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> TEST(ServiceWorkers, RestoreFromDisk)
</span><span class="lines">@@ -618,17 +613,15 @@
</span><span class="cx">     RetainPtr<SWMessageHandlerForRestoreFromDiskTest> messageHandler = adoptNS([[SWMessageHandlerForRestoreFromDiskTest alloc] initWithExpectedMessage:@"PASS: Registration was successful and service worker was activated"]);
</span><span class="cx">     [[configuration userContentController] addScriptMessageHandler:messageHandler.get() name:@"sw"];
</span><span class="cx"> 
</span><del>-    ServiceWorkerTCPServer server({
-        { "text/html", mainRegisteringWorkerBytes },
-        { "application/javascript", scriptBytes },
-    }, {
-        { "text/html", mainRegisteringAlreadyExistingWorkerBytes },
-        { "application/javascript", scriptBytes },
</del><ins>+    TestWebKitAPI::HTTPServer server({
+        { "/first.html", { mainRegisteringWorkerBytes } },
+        { "/second.html", { mainRegisteringAlreadyExistingWorkerBytes } },
+        { "/sw.js", { { { "Content-Type", "application/javascript" } }, scriptBytes } },
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
</span><span class="cx"> 
</span><del>-    [webView loadRequest:server.request()];
</del><ins>+    [webView loadRequest:server.request("/first.html")];
</ins><span class="cx"> 
</span><span class="cx">     TestWebKitAPI::Util::run(&done);
</span><span class="cx"> 
</span><span class="lines">@@ -644,7 +637,7 @@
</span><span class="cx"> 
</span><span class="cx">     webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
</span><span class="cx"> 
</span><del>-    [webView loadRequest:server.request()];
</del><ins>+    [webView loadRequest:server.request("/second.html")];
</ins><span class="cx"> 
</span><span class="cx">     TestWebKitAPI::Util::run(&done);
</span><span class="cx">     done = false;
</span><span class="lines">@@ -756,17 +749,15 @@
</span><span class="cx">     RetainPtr<SWMessageHandlerWithExpectedMessage> messageHandler = adoptNS([[SWMessageHandlerWithExpectedMessage alloc] init]);
</span><span class="cx">     [[configuration userContentController] addScriptMessageHandler:messageHandler.get() name:@"sw"];
</span><span class="cx"> 
</span><del>-    ServiceWorkerTCPServer server({
-        { "text/html", mainForFirstLoadInterceptTestBytes },
-        { "application/javascript", scriptInterceptingFirstLoadBytes },
-    }, {
-        { "application/javascript", scriptInterceptingFirstLoadBytes },
</del><ins>+    TestWebKitAPI::HTTPServer server({
+        { "/main.html", { mainForFirstLoadInterceptTestBytes } },
+        { "/sw.js", { { { "Content-Type", "application/javascript" } }, scriptInterceptingFirstLoadBytes } },
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
</span><span class="cx"> 
</span><span class="cx">     expectedMessage = "Service Worker activated";
</span><del>-    [webView loadRequest:server.request()];
</del><ins>+    [webView loadRequest:server.request("/main.html")];
</ins><span class="cx"> 
</span><span class="cx">     TestWebKitAPI::Util::run(&done);
</span><span class="cx"> 
</span><span class="lines">@@ -783,7 +774,7 @@
</span><span class="cx">     webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
</span><span class="cx"> 
</span><span class="cx">     expectedMessage = "Intercepted by worker";
</span><del>-    [webView loadRequest:server.request()];
</del><ins>+    [webView loadRequest:server.request("/main.html")];
</ins><span class="cx"> 
</span><span class="cx">     TestWebKitAPI::Util::run(&done);
</span><span class="cx">     done = false;
</span><span class="lines">@@ -807,17 +798,15 @@
</span><span class="cx">     auto messageHandler = adoptNS([[SWMessageHandlerWithExpectedMessage alloc] init]);
</span><span class="cx">     [[configuration userContentController] addScriptMessageHandler:messageHandler.get() name:@"sw"];
</span><span class="cx"> 
</span><del>-    ServiceWorkerTCPServer server({
-        { "text/html", mainForFirstLoadInterceptTestBytes },
-        { "application/javascript", scriptInterceptingFirstLoadBytes },
-    }, {
-        { "application/javascript", scriptInterceptingFirstLoadBytes },
</del><ins>+    TestWebKitAPI::HTTPServer server({
+        { "/main.html", { mainForFirstLoadInterceptTestBytes } },
+        { "/sw.js", { { { "Content-Type", "application/javascript" } }, scriptInterceptingFirstLoadBytes } },
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
</span><span class="cx"> 
</span><span class="cx">     expectedMessage = "Service Worker activated";
</span><del>-    [webView loadRequest:server.request()];
</del><ins>+    [webView loadRequest:server.request("/main.html")];
</ins><span class="cx"> 
</span><span class="cx">     TestWebKitAPI::Util::run(&done);
</span><span class="cx"> 
</span><span class="lines">@@ -835,7 +824,7 @@
</span><span class="cx">     webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
</span><span class="cx"> 
</span><span class="cx">     expectedMessage = "Intercepted by worker";
</span><del>-    [webView loadRequest:server.request()];
</del><ins>+    [webView loadRequest:server.request("/main.html")];
</ins><span class="cx"> 
</span><span class="cx">     TestWebKitAPI::Util::run(&done);
</span><span class="cx">     done = false;
</span><span class="lines">@@ -857,11 +846,9 @@
</span><span class="cx">     RetainPtr<SWMessageHandlerWithExpectedMessage> messageHandler = adoptNS([[SWMessageHandlerWithExpectedMessage alloc] init]);
</span><span class="cx">     [[configuration userContentController] addScriptMessageHandler:messageHandler.get() name:@"sw"];
</span><span class="cx"> 
</span><del>-    ServiceWorkerTCPServer server({
-        { "text/html", mainForFirstLoadInterceptTestBytes },
-        { "application/javascript", scriptInterceptingFirstLoadBytes },
-    }, {
-        { "application/javascript", scriptInterceptingFirstLoadBytes },
</del><ins>+    TestWebKitAPI::HTTPServer server({
+        { "/main.html", { mainForFirstLoadInterceptTestBytes } },
+        { "/sw.js", { { { "Content-Type", "application/javascript" } }, scriptInterceptingFirstLoadBytes } },
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
</span><span class="lines">@@ -868,7 +855,7 @@
</span><span class="cx"> 
</span><span class="cx">     // Register a service worker and activate it.
</span><span class="cx">     expectedMessage = "Service Worker activated";
</span><del>-    [webView loadRequest:server.request()];
</del><ins>+    [webView loadRequest:server.request("/main.html")];
</ins><span class="cx"> 
</span><span class="cx">     TestWebKitAPI::Util::run(&done);
</span><span class="cx"> 
</span><span class="lines">@@ -886,7 +873,7 @@
</span><span class="cx"> 
</span><span class="cx">     // Verify service worker is intercepting load.
</span><span class="cx">     expectedMessage = "Intercepted by worker";
</span><del>-    [webView loadRequest:server.request()];
</del><ins>+    [webView loadRequest:server.request("/main.html")];
</ins><span class="cx"> 
</span><span class="cx">     TestWebKitAPI::Util::run(&done);
</span><span class="cx">     done = false;
</span><span class="lines">@@ -901,7 +888,7 @@
</span><span class="cx">     navigationComplete = false;
</span><span class="cx"> 
</span><span class="cx">     // Verify service worker load goes well when policy delegate is ok.
</span><del>-    [webView loadRequest:server.request()];
</del><ins>+    [webView loadRequest:server.request("/main.html")];
</ins><span class="cx">     TestWebKitAPI::Util::run(&navigationComplete);
</span><span class="cx"> 
</span><span class="cx">     EXPECT_FALSE(navigationFailed);
</span><span class="lines">@@ -915,7 +902,7 @@
</span><span class="cx">     navigationComplete = false;
</span><span class="cx"> 
</span><span class="cx">     // Verify service worker load fails well when policy delegate is not ok.
</span><del>-    [webView loadRequest:server.request()];
</del><ins>+    [webView loadRequest:server.request("/main.html")];
</ins><span class="cx">     TestWebKitAPI::Util::run(&navigationComplete);
</span><span class="cx"> 
</span><span class="cx">     EXPECT_TRUE(navigationFailed);
</span><span class="lines">@@ -974,12 +961,12 @@
</span><span class="cx">     RetainPtr<RegularPageMessageHandler> regularPageMessageHandler = adoptNS([[RegularPageMessageHandler alloc] init]);
</span><span class="cx">     [[configuration userContentController] addScriptMessageHandler:regularPageMessageHandler.get() name:@"regularPage"];
</span><span class="cx"> 
</span><del>-    ServiceWorkerTCPServer server({
-        { "text/html", regularPageWithConnectionBytes },
-        { "text/html", mainBytes },
-        { "application/javascript", scriptBytes },
-        { "text/html", regularPageWithConnectionBytes },
-        { "text/html", regularPageWithConnectionBytes },
</del><ins>+    TestWebKitAPI::HTTPServer server({
+        { "/first.html", { regularPageWithConnectionBytes } },
+        { "/second.html", { mainBytes } },
+        { "/sw.js", { { { "Content-Type", "application/javascript" } }, scriptBytes } },
+        { "/third.html", { regularPageWithConnectionBytes } },
+        { "/fourth.html", { regularPageWithConnectionBytes } },
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     RetainPtr<WKWebView> regularPageWebView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
</span><span class="lines">@@ -987,23 +974,23 @@
</span><span class="cx">     RetainPtr<WKWebView> newRegularPageWebView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
</span><span class="cx"> 
</span><span class="cx">     // Test that a regular page does not trigger a service worker connection to network process if there is no registered service worker.
</span><del>-    [regularPageWebView loadRequest:server.request()];
</del><ins>+    [regularPageWebView loadRequest:server.request("/first.html")];
</ins><span class="cx">     TestWebKitAPI::Util::run(&done);
</span><span class="cx">     done = false;
</span><span class="cx"> 
</span><span class="cx">     // Test that a sw scheme page can register a service worker.
</span><del>-    [webView loadRequest:server.request()];
</del><ins>+    [webView loadRequest:server.request("/second.html")];
</ins><span class="cx">     TestWebKitAPI::Util::run(&done);
</span><span class="cx">     done = false;
</span><span class="cx">     webView = nullptr;
</span><span class="cx"> 
</span><span class="cx">     // Now that a service worker is registered, the regular page should have a service worker connection.
</span><del>-    [regularPageWebView loadRequest:server.request()];
</del><ins>+    [regularPageWebView loadRequest:server.request("/third.html")];
</ins><span class="cx">     TestWebKitAPI::Util::run(&done);
</span><span class="cx">     done = false;
</span><span class="cx">     regularPageWebView = nullptr;
</span><span class="cx"> 
</span><del>-    [newRegularPageWebView loadRequest:server.request()];
</del><ins>+    [newRegularPageWebView loadRequest:server.request("/fourth.html")];
</ins><span class="cx">     TestWebKitAPI::Util::run(&done);
</span><span class="cx">     done = false;
</span><span class="cx">     newRegularPageWebView = nullptr;
</span><span class="lines">@@ -1078,19 +1065,17 @@
</span><span class="cx">     RetainPtr<RegularPageMessageHandler> regularPageMessageHandler = adoptNS([[RegularPageMessageHandler alloc] init]);
</span><span class="cx">     [[configuration userContentController] addScriptMessageHandler:regularPageMessageHandler.get() name:@"regularPage"];
</span><span class="cx"> 
</span><del>-    ServiceWorkerTCPServer server({
-        { "text/html", mainBytesWithScope },
-        { "application/javascript", scriptBytes },
-    }, {
-        { "text/html", regularPageWithConnectionBytes },
-        { "text/html", mainBytes },
-        { "application/javascript", scriptBytes },
</del><ins>+    TestWebKitAPI::HTTPServer server({
+        { "/first.html", { mainBytesWithScope } },
+        { "/second.html", { regularPageWithConnectionBytes } },
+        { "/third.html", { mainBytes } },
+        { "/sw.js", { { { "Content-Type", "application/javascript" } }, scriptBytes } },
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
</span><span class="cx"> 
</span><span class="cx">     // Load a page that registers a service worker.
</span><del>-    [webView loadRequest:server.request()];
</del><ins>+    [webView loadRequest:server.request("/first.html")];
</ins><span class="cx">     TestWebKitAPI::Util::run(&done);
</span><span class="cx">     done = false;
</span><span class="cx">     webView = nullptr;
</span><span class="lines">@@ -1105,7 +1090,7 @@
</span><span class="cx"> 
</span><span class="cx">     webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:newConfiguration.get()]);
</span><span class="cx">     EXPECT_EQ(1u, webView.get().configuration.processPool._webProcessCountIgnoringPrewarmed);
</span><del>-    [webView loadRequest:server.request()];
</del><ins>+    [webView loadRequest:server.request("/second.html")];
</ins><span class="cx">     TestWebKitAPI::Util::run(&done);
</span><span class="cx">     done = false;
</span><span class="cx"> 
</span><span class="lines">@@ -1114,7 +1099,7 @@
</span><span class="cx"> 
</span><span class="cx">     webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:newConfiguration.get()]);
</span><span class="cx">     EXPECT_EQ(2u, webView.get().configuration.processPool._webProcessCountIgnoringPrewarmed);
</span><del>-    [webView loadRequest:server.request()];
</del><ins>+    [webView loadRequest:server.request("/third.html")];
</ins><span class="cx">     TestWebKitAPI::Util::run(&done);
</span><span class="cx">     done = false;
</span><span class="cx"> 
</span><span class="lines">@@ -1181,20 +1166,20 @@
</span><span class="cx">     auto messageHandler = adoptNS([[SWMessageHandlerForCacheStorage alloc] init]);
</span><span class="cx">     [[configuration userContentController] addScriptMessageHandler:messageHandler.get() name:@"sw"];
</span><span class="cx"> 
</span><del>-    ServiceWorkerTCPServer server({
-        { "text/html", writeCacheBytes },
-        { "text/html", readCacheBytes },
</del><ins>+    TestWebKitAPI::HTTPServer server({
+        { "/first.html", { writeCacheBytes } },
+        { "/second.html", { readCacheBytes } },
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     configuration.get().websiteDataStore = [WKWebsiteDataStore nonPersistentDataStore];
</span><span class="cx"> 
</span><span class="cx">     auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
</span><del>-    [webView loadRequest:server.request()];
</del><ins>+    [webView loadRequest:server.request("/first.html")];
</ins><span class="cx">     TestWebKitAPI::Util::run(&done);
</span><span class="cx">     done = false;
</span><span class="cx"> 
</span><span class="cx">     webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
</span><del>-    [webView loadRequest:server.request()];
</del><ins>+    [webView loadRequest:server.request("/second.html")];
</ins><span class="cx">     TestWebKitAPI::Util::run(&done);
</span><span class="cx">     done = false;
</span><span class="cx"> }
</span><span class="lines">@@ -1253,9 +1238,9 @@
</span><span class="cx">     auto defaultPreferences = [configuration preferences];
</span><span class="cx">     [defaultPreferences _setSecureContextChecksEnabled:NO];
</span><span class="cx">     
</span><del>-    ServiceWorkerTCPServer server({
-        { "text/html", serviceWorkerCacheAccessEphemeralSessionMainBytes },
-        { "application/javascript", serviceWorkerCacheAccessEphemeralSessionSWBytes },
</del><ins>+    TestWebKitAPI::HTTPServer server({
+        { "/", { serviceWorkerCacheAccessEphemeralSessionMainBytes } },
+        { "/serviceworker-private-browsing-worker.js", { { { "Content-Type", "application/javascript" } }, serviceWorkerCacheAccessEphemeralSessionSWBytes } },
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     auto defaultWebView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
</span><span class="lines">@@ -1334,21 +1319,20 @@
</span><span class="cx">     auto messageHandler = adoptNS([[SWMessageHandlerForCacheStorage alloc] init]);
</span><span class="cx">     [[configuration userContentController] addScriptMessageHandler:messageHandler.get() name:@"sw"];
</span><span class="cx">     
</span><del>-    ServiceWorkerTCPServer server({
-        { "text/html", differentSessionsUseDifferentRegistrationsMainBytes },
-        { "application/javascript", "" },
-        { "text/html", defaultPageMainBytes }
-    }, {
-        { "text/html", privatePageMainBytes }
</del><ins>+    TestWebKitAPI::HTTPServer server({
+        { "/first.html", { differentSessionsUseDifferentRegistrationsMainBytes } },
+        { "/empty-worker.js", { { { "Content-Type", "application/javascript" } }, "" } },
+        { "/second.html", { defaultPageMainBytes } },
+        { "/third.html", { privatePageMainBytes } },
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     auto defaultWebView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
</span><del>-    [defaultWebView synchronouslyLoadRequest:server.request()];
</del><ins>+    [defaultWebView synchronouslyLoadRequest:server.request("/first.html")];
</ins><span class="cx"> 
</span><span class="cx">     TestWebKitAPI::Util::run(&done);
</span><span class="cx">     done = false;
</span><span class="cx"> 
</span><del>-    [defaultWebView synchronouslyLoadRequest:server.request()];
</del><ins>+    [defaultWebView synchronouslyLoadRequest:server.request("/second.html")];
</ins><span class="cx"> 
</span><span class="cx">     TestWebKitAPI::Util::run(&done);
</span><span class="cx">     done = false;
</span><span class="lines">@@ -1355,7 +1339,7 @@
</span><span class="cx"> 
</span><span class="cx">     configuration.get().websiteDataStore = [WKWebsiteDataStore nonPersistentDataStore];
</span><span class="cx">     auto ephemeralWebView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
</span><del>-    [ephemeralWebView synchronouslyLoadRequest:server.request()];
</del><ins>+    [ephemeralWebView synchronouslyLoadRequest:server.request("/third.html")];
</ins><span class="cx"> 
</span><span class="cx">     TestWebKitAPI::Util::run(&done);
</span><span class="cx">     done = false;
</span><span class="lines">@@ -1393,15 +1377,15 @@
</span><span class="cx">     RetainPtr<DirectoryPageMessageHandler> directoryPageMessageHandler = adoptNS([[DirectoryPageMessageHandler alloc] init]);
</span><span class="cx">     [[configuration userContentController] addScriptMessageHandler:directoryPageMessageHandler.get() name:@"sw"];
</span><span class="cx"> 
</span><del>-    ServiceWorkerTCPServer server({
-        { "text/html", mainBytes },
-        { "application/javascript", scriptBytes },
-        { "text/html", regularPageGrabbingCacheStorageDirectory },
</del><ins>+    TestWebKitAPI::HTTPServer server({
+        { "/first.html", { mainBytes } },
+        { "/sw.js", { { { "Content-Type", "application/javascript" } }, scriptBytes } },
+        { "/second.html", { regularPageGrabbingCacheStorageDirectory } },
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
</span><span class="cx"> 
</span><del>-    [webView loadRequest:server.request()];
</del><ins>+    [webView loadRequest:server.request("/first.html")];
</ins><span class="cx">     TestWebKitAPI::Util::run(&done);
</span><span class="cx">     done = false;
</span><span class="cx">     while (![[configuration websiteDataStore] _hasRegisteredServiceWorker])
</span><span class="lines">@@ -1409,7 +1393,7 @@
</span><span class="cx"> 
</span><span class="cx">     webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
</span><span class="cx"> 
</span><del>-    [webView loadRequest:server.request()];
</del><ins>+    [webView loadRequest:server.request("/second.html")];
</ins><span class="cx">     TestWebKitAPI::Util::run(&done);
</span><span class="cx">     done = false;
</span><span class="cx">     EXPECT_TRUE(retrievedString.contains("/Caches/com.apple.WebKit.TestWebKitAPI/WebKit/CacheStorage"));
</span><span class="lines">@@ -1436,15 +1420,15 @@
</span><span class="cx">     RetainPtr<DirectoryPageMessageHandler> directoryPageMessageHandler = adoptNS([[DirectoryPageMessageHandler alloc] init]);
</span><span class="cx">     [[configuration userContentController] addScriptMessageHandler:directoryPageMessageHandler.get() name:@"sw"];
</span><span class="cx"> 
</span><del>-    ServiceWorkerTCPServer server({
-        { "text/html", mainBytes },
-        { "application/javascript", scriptBytes },
-        { "text/html", regularPageGrabbingCacheStorageDirectory },
</del><ins>+    TestWebKitAPI::HTTPServer server({
+        { "/first.html", { mainBytes } },
+        { "/sw.js", { { { "Content-Type", "application/javascript" } }, scriptBytes } },
+        { "/second.html", { regularPageGrabbingCacheStorageDirectory } },
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
</span><span class="cx"> 
</span><del>-    [webView loadRequest:server.request()];
</del><ins>+    [webView loadRequest:server.request("/first.html")];
</ins><span class="cx">     TestWebKitAPI::Util::run(&done);
</span><span class="cx">     done = false;
</span><span class="cx">     while (![websiteDataStore _hasRegisteredServiceWorker])
</span><span class="lines">@@ -1452,7 +1436,7 @@
</span><span class="cx"> 
</span><span class="cx">     webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
</span><span class="cx"> 
</span><del>-    [webView loadRequest:server.request()];
</del><ins>+    [webView loadRequest:server.request("/second.html")];
</ins><span class="cx">     TestWebKitAPI::Util::run(&done);
</span><span class="cx">     done = false;
</span><span class="cx">     EXPECT_TRUE(retrievedString.contains("\"path\": \"/var/tmp\""));
</span><span class="lines">@@ -1487,9 +1471,9 @@
</span><span class="cx">     RetainPtr<SWMessageHandlerWithExpectedMessage> messageHandler = adoptNS([[SWMessageHandlerWithExpectedMessage alloc] init]);
</span><span class="cx">     [[configuration userContentController] addScriptMessageHandler:messageHandler.get() name:@"sw"];
</span><span class="cx"> 
</span><del>-    ServiceWorkerTCPServer server({
-        { "text/html", mainBytesForSessionIDTest },
-        { "application/javascript", scriptBytesForSessionIDTest },
</del><ins>+    TestWebKitAPI::HTTPServer server({
+        { "/", { mainBytesForSessionIDTest } },
+        { "/sw.js", { { { "Content-Type", "application/javascript" } }, scriptBytesForSessionIDTest } },
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     expectedMessage = "PASS: activation successful";
</span><span class="lines">@@ -1551,15 +1535,13 @@
</span><span class="cx">     RetainPtr<SWMessageHandler> messageHandler = adoptNS([[SWMessageHandler alloc] init]);
</span><span class="cx">     [[configuration userContentController] addScriptMessageHandler:messageHandler.get() name:@"sw"];
</span><span class="cx"> 
</span><del>-    ServiceWorkerTCPServer server1({
-        { "text/html", mainBytes },
-        { "application/javascript", scriptBytes },
-        { "text/html", mainBytes },
-        { "text/html", mainBytes },
</del><ins>+    TestWebKitAPI::HTTPServer server1({
+        { "/", { mainBytes } },
+        { "/sw.js", { { { "Content-Type", "application/javascript" } }, scriptBytes } },
</ins><span class="cx">     });
</span><del>-    ServiceWorkerTCPServer server2({
-        { "text/html", mainBytes },
-        { "application/javascript", scriptBytes },
</del><ins>+    TestWebKitAPI::HTTPServer server2({
+        { "/", { mainBytes } },
+        { "/sw.js", { { { "Content-Type", "application/javascript" } }, scriptBytes } },
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     WKProcessPool *processPool = configuration.get().processPool;
</span><span class="lines">@@ -1629,13 +1611,13 @@
</span><span class="cx">     auto messageHandler = adoptNS([[SWMessageHandler alloc] init]);
</span><span class="cx">     [[configuration userContentController] addScriptMessageHandler:messageHandler.get() name:@"sw"];
</span><span class="cx"> 
</span><del>-    ServiceWorkerTCPServer server1({
-        { "text/html", mainBytes },
-        { "application/javascript", scriptBytes },
</del><ins>+    TestWebKitAPI::HTTPServer server1({
+        { "/", { mainBytes } },
+        { "/sw.js", { { { "Content-Type", "application/javascript" } }, scriptBytes } },
</ins><span class="cx">     });
</span><del>-    ServiceWorkerTCPServer server2({
-        { "text/html", mainBytes },
-        { "application/javascript", scriptBytes },
</del><ins>+    TestWebKitAPI::HTTPServer server2({
+        { "/", { mainBytes } },
+        { "/sw.js", { { { "Content-Type", "application/javascript" } }, scriptBytes } },
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     auto *processPool = configuration.get().processPool;
</span><span class="lines">@@ -1743,9 +1725,9 @@
</span><span class="cx">     auto messageHandler = adoptNS([[SWMessageHandler alloc] init]);
</span><span class="cx">     [[configuration userContentController] addScriptMessageHandler:messageHandler.get() name:@"sw"];
</span><span class="cx"> 
</span><del>-    ServiceWorkerTCPServer server({
-        { "text/html", mainBytes },
-        { "application/javascript", scriptBytes },
</del><ins>+    TestWebKitAPI::HTTPServer server({
+        { "/", { mainBytes } },
+        { "/sw.js", { { { "Content-Type", "application/javascript" } }, scriptBytes } },
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     auto *processPool = configuration.get().processPool;
</span><span class="lines">@@ -1884,9 +1866,9 @@
</span><span class="cx">     RetainPtr<SWMessageHandler> messageHandler = adoptNS([[SWMessageHandler alloc] init]);
</span><span class="cx">     [[configuration userContentController] addScriptMessageHandler:messageHandler.get() name:@"sw"];
</span><span class="cx"> 
</span><del>-    ServiceWorkerTCPServer server({
-        { "text/html", mainBytes },
-        { "application/javascript", scriptBytes },
</del><ins>+    TestWebKitAPI::HTTPServer server({
+        { "/", { mainBytes } },
+        { "/sw.js", { { { "Content-Type", "application/javascript" } }, scriptBytes } },
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
</span><span class="lines">@@ -1924,12 +1906,10 @@
</span><span class="cx">     RetainPtr<WKProcessPool> protectedProcessPool;
</span><span class="cx">     RetainPtr<WKWebsiteDataStore> protectedWebsiteDataStore;
</span><span class="cx"> 
</span><del>-    ServiceWorkerTCPServer server({
-        { "text/html", mainRegisteringWorkerBytes },
-        { "application/javascript", scriptBytes },
-    }, {
-        { "text/html", mainRegisteringAlreadyExistingWorkerBytes },
-        { "application/javascript", scriptBytes },
</del><ins>+    TestWebKitAPI::HTTPServer server({
+        { "/first.html", { mainRegisteringWorkerBytes } },
+        { "/sw.js", { { { "Content-Type", "application/javascript" } }, scriptBytes } },
+        { "/second.html", { mainRegisteringAlreadyExistingWorkerBytes } },
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     @autoreleasepool {
</span><span class="lines">@@ -1947,7 +1927,7 @@
</span><span class="cx">         protectedProcessPool = webView.get().configuration.processPool;
</span><span class="cx">         protectedWebsiteDataStore = webView.get().configuration.websiteDataStore;
</span><span class="cx"> 
</span><del>-        [webView loadRequest:server.request()];
</del><ins>+        [webView loadRequest:server.request("/first.html")];
</ins><span class="cx"> 
</span><span class="cx">         TestWebKitAPI::Util::run(&done);
</span><span class="cx">         done = false;
</span><span class="lines">@@ -1970,7 +1950,7 @@
</span><span class="cx"> 
</span><span class="cx">         auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
</span><span class="cx"> 
</span><del>-        [webView loadRequest:server.request()];
</del><ins>+        [webView loadRequest:server.request("/second.html")];
</ins><span class="cx"> 
</span><span class="cx">         TestWebKitAPI::Util::run(&done);
</span><span class="cx">         done = false;
</span><span class="lines">@@ -1993,10 +1973,10 @@
</span><span class="cx">     RetainPtr<SWMessageHandler> messageHandler = adoptNS([[SWMessageHandler alloc] init]);
</span><span class="cx">     [[configuration userContentController] addScriptMessageHandler:messageHandler.get() name:@"sw"];
</span><span class="cx"> 
</span><del>-    ServiceWorkerTCPServer server({
-        { "text/html", mainBytes },
-        { "application/javascript", scriptBytes },
-        { "text/html", mainBytes },
</del><ins>+    TestWebKitAPI::HTTPServer server({
+        { "/first.html", { mainBytes } },
+        { "/sw.js", { { { "Content-Type", "application/javascript" } }, scriptBytes } },
+        { "/second.html", { mainBytes } },
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
</span><span class="lines">@@ -2008,7 +1988,7 @@
</span><span class="cx">     done = false;
</span><span class="cx"> 
</span><span class="cx">     // Normal load to get SW registered.
</span><del>-    [webView loadRequest:server.request()];
</del><ins>+    [webView loadRequest:server.request("/first.html")];
</ins><span class="cx"> 
</span><span class="cx">     TestWebKitAPI::Util::run(&done);
</span><span class="cx">     done = false;
</span><span class="lines">@@ -2031,7 +2011,7 @@
</span><span class="cx"> 
</span><span class="cx">     [webView.get().configuration.websiteDataStore _sendNetworkProcessDidResume];
</span><span class="cx"> 
</span><del>-    [webView loadRequest:server.request()];
</del><ins>+    [webView loadRequest:server.request("/second.html")];
</ins><span class="cx">     TestWebKitAPI::Util::run(&done);
</span><span class="cx">     done = false;
</span><span class="cx"> 
</span><span class="lines">@@ -2081,9 +2061,9 @@
</span><span class="cx">     auto messageHandler = adoptNS([[SWMessageHandler alloc] init]);
</span><span class="cx">     [[configuration userContentController] addScriptMessageHandler:messageHandler.get() name:@"sw"];
</span><span class="cx"> 
</span><del>-    ServiceWorkerTCPServer server1({
-        { "text/html", mainBytes },
-        { "application/javascript", scriptBytes },
</del><ins>+    TestWebKitAPI::HTTPServer server1({
+        { "/", { mainBytes } },
+        { "/sw.js", { { { "Content-Type", "application/javascript" } }, scriptBytes } },
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     WKProcessPool *processPool = configuration.get().processPool;
</span><span class="lines">@@ -2097,9 +2077,9 @@
</span><span class="cx"> 
</span><span class="cx">     configuration.get().websiteDataStore = [WKWebsiteDataStore nonPersistentDataStore];
</span><span class="cx"> 
</span><del>-    ServiceWorkerTCPServer server2({
-        { "text/html", mainBytes },
-        { "application/javascript", scriptBytes },
</del><ins>+    TestWebKitAPI::HTTPServer server2({
+        { "/", { mainBytes } },
+        { "/sw.js", { { { "Content-Type", "application/javascript" } }, scriptBytes } },
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     auto webView2 = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
</span><span class="lines">@@ -2384,9 +2364,9 @@
</span><span class="cx">     auto messageHandler = adoptNS([[SWMessageHandler alloc] init]);
</span><span class="cx">     [[configuration userContentController] addScriptMessageHandler:messageHandler.get() name:@"sw"];
</span><span class="cx"> 
</span><del>-    ServiceWorkerTCPServer server({
-        { "text/html", mainBytes },
-        { "application/javascript", scriptBytes },
</del><ins>+    TestWebKitAPI::HTTPServer server({
+        { "/", { mainBytes } },
+        { "/sw.js", { { { "Content-Type", "application/javascript" } }, scriptBytes } },
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
</span><span class="lines">@@ -2439,9 +2419,9 @@
</span><span class="cx">     auto messageHandler = adoptNS([[SWMessageHandler alloc] init]);
</span><span class="cx">     [[configuration userContentController] addScriptMessageHandler:messageHandler.get() name:@"sw"];
</span><span class="cx"> 
</span><del>-    ServiceWorkerTCPServer server({
-        { "text/html", mainBytes },
-        { "application/javascript", scriptBytes },
</del><ins>+    TestWebKitAPI::HTTPServer server({
+        { "/", { mainBytes } },
+        { "/sw.js", { { { "Content-Type", "application/javascript" } }, scriptBytes } },
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKitCocoaServiceWorkerTCPServerh"></a>
<div class="delfile"><h4>Deleted: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerTCPServer.h (287222 => 287223)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerTCPServer.h     2021-12-18 15:11:29 UTC (rev 287222)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerTCPServer.h        2021-12-18 17:18:25 UTC (rev 287223)
</span><span class="lines">@@ -1,97 +0,0 @@
</span><del>-/*
- * Copyright (C) 2019 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "HTTPServer.h"
-#import <wtf/text/WTFString.h>
-
-class ServiceWorkerTCPServer : public TestWebKitAPI::HTTPServer {
-public:
-    struct ResourceInfo {
-        const char* mimeType { nullptr };
-        const char* response { nullptr };
-    };
-
-    explicit ServiceWorkerTCPServer(Vector<ResourceInfo>&& vector)
-        : ServiceWorkerTCPServer(WTFMove(vector), { }, 1) { }
-    
-    ServiceWorkerTCPServer(Vector<ResourceInfo>&& firstConnection, Vector<ResourceInfo>&& secondConnection, size_t connections = 2, Vector<String>&& expectedUserAgents = { })
-        : ServiceWorkerTCPServer(WTFMove(firstConnection), WTFMove(secondConnection), { }, connections, WTFMove(expectedUserAgents)) { }
-
-    ServiceWorkerTCPServer(Vector<ResourceInfo>&& firstConnection, Vector<ResourceInfo>&& secondConnection, Vector<ResourceInfo>&& thirdConnection, size_t connections = 3, Vector<String>&& expectedUserAgents = { })
-        : TestWebKitAPI::HTTPServer([this, firstConnection = WTFMove(firstConnection), secondConnection = WTFMove(secondConnection), thirdConnection = WTFMove(thirdConnection), expectedUserAgents = WTFMove(expectedUserAgents)] (TestWebKitAPI::Connection connection) mutable {
-            if (!firstConnection.isEmpty())
-                return respondToRequests(connection, std::exchange(firstConnection, { }), !expectedUserAgents.isEmpty() ? expectedUserAgents[0] : String());
-            if (!secondConnection.isEmpty())
-                return respondToRequests(connection, std::exchange(secondConnection, { }), expectedUserAgents.size() > 1 ? expectedUserAgents[1] : String());
-            respondToRequests(connection, std::exchange(thirdConnection, { }), { });
-        }) { }
-
-    NSURLRequest *request()
-    {
-        auto url = adoptNS([[NSString alloc] initWithFormat:@"http://127.0.0.1:%d/main.html", port()]);
-        return requestWithURLString(url.get());
-    }
-
-    NSURLRequest *requestWithLocalhost()
-    {
-        auto url = adoptNS([[NSString alloc] initWithFormat:@"http://localhost:%d/main.html", port()]);
-        return requestWithURLString(url.get());
-    }
-
-    NSURLRequest *requestWithFragment()
-    {
-        auto url = adoptNS([[NSString alloc] initWithFormat:@"http://127.0.0.1:%d/main.html#fragment", port()]);
-        return requestWithURLString(url.get());
-    }
-
-    size_t userAgentsChecked() const { return m_userAgentsChecked; }
-
-private:
-    void respondToRequests(TestWebKitAPI::Connection& connection, Vector<ResourceInfo>&& vector, const String& expectedUserAgent, size_t vectorIndex = 0)
-    {
-        if (vectorIndex >= vector.size()) {
-            connection.terminate();
-            return;
-        }
-        connection.receiveHTTPRequest([=, vector = WTFMove(vector)] (Vector<char>&& request) mutable {
-            if (!expectedUserAgent.isNull()) {
-                EXPECT_TRUE(strnstr((const char*)request.data(), makeString("User-Agent: ", expectedUserAgent).utf8().data(), request.size()));
-                m_userAgentsChecked++;
-            }
-            constexpr NSString *format = @"HTTP/1.1 200 OK\r\n"
-            "Content-Type: %s\r\n"
-            "Content-Length: %zu\r\n\r\n"
-            "%s";
-            auto& info = vector[vectorIndex];
-            NSString *response = [NSString stringWithFormat:format, info.mimeType, strlen(info.response), info.response];
-            connection.send(response, [=, vector = WTFMove(vector)] () mutable {
-                respondToRequests(connection, WTFMove(vector), expectedUserAgent, vectorIndex + 1);
-            });
-        });
-    }
-
-    NSURLRequest *requestWithURLString(NSString *urlString) { return [NSURLRequest requestWithURL:[NSURL URLWithString:urlString]]; }
-    size_t m_userAgentsChecked { 0 };
-};
</del></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKitCocoaStorageQuotamm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/StorageQuota.mm (287222 => 287223)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/StorageQuota.mm      2021-12-18 15:11:29 UTC (rev 287222)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/StorageQuota.mm 2021-12-18 17:18:25 UTC (rev 287223)
</span><span class="lines">@@ -27,8 +27,8 @@
</span><span class="cx"> #import <WebKit/WebKit.h>
</span><span class="cx"> 
</span><span class="cx"> #import "DeprecatedGlobalValues.h"
</span><ins>+#import "HTTPServer.h"
</ins><span class="cx"> #import "PlatformUtilities.h"
</span><del>-#import "ServiceWorkerTCPServer.h"
</del><span class="cx"> #import "Test.h"
</span><span class="cx"> #import "TestNavigationDelegate.h"
</span><span class="cx"> #import "TestWKWebView.h"
</span><span class="lines">@@ -261,10 +261,8 @@
</span><span class="cx">     auto messageHandler = adoptNS([[QuotaMessageHandler alloc] init]);
</span><span class="cx">     [[configuration userContentController] addScriptMessageHandler:messageHandler.get() name:@"qt"];
</span><span class="cx"> 
</span><del>-    ServiceWorkerTCPServer server({
-        { "text/html", TestHiddenBytes }
-    }, {
-        { "text/html", TestHiddenBytes }
</del><ins>+    TestWebKitAPI::HTTPServer server({
+        { "/", { TestHiddenBytes } },
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get() addToWindow:YES]);
</span><span class="lines">@@ -321,10 +319,8 @@
</span><span class="cx">     auto messageHandler = adoptNS([[QuotaMessageHandler alloc] init]);
</span><span class="cx">     [[configuration userContentController] addScriptMessageHandler:messageHandler.get() name:@"qt"];
</span><span class="cx"> 
</span><del>-    ServiceWorkerTCPServer server({
-        { "text/html", TestBytes }
-    }, {
-        { "text/html", TestBytes }
</del><ins>+    TestWebKitAPI::HTTPServer server({
+        { "/", { TestBytes } },
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     auto webView1 = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get() addToWindow:YES]);
</span><span class="lines">@@ -382,9 +378,8 @@
</span><span class="cx">     auto messageHandler = adoptNS([[QuotaMessageHandler alloc] init]);
</span><span class="cx">     [[configuration userContentController] addScriptMessageHandler:messageHandler.get() name:@"qt"];
</span><span class="cx">     
</span><del>-    ServiceWorkerTCPServer server({
-        { "text/html", TestBytes },
-        { "text/html", TestBytes }
</del><ins>+    TestWebKitAPI::HTTPServer server({
+        { "/", { TestBytes } },
</ins><span class="cx">     });
</span><span class="cx">     
</span><span class="cx">     auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get() addToWindow:YES]);
</span><span class="lines">@@ -430,8 +425,8 @@
</span><span class="cx">     auto messageHandler = adoptNS([[QuotaMessageHandler alloc] init]);
</span><span class="cx">     [[configuration userContentController] addScriptMessageHandler:messageHandler.get() name:@"qt"];
</span><span class="cx"> 
</span><del>-    ServiceWorkerTCPServer server({
-        { "text/html", TestBytes }
</del><ins>+    TestWebKitAPI::HTTPServer server({
+        { "/main.html", { TestBytes } },
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get() addToWindow:YES]);
</span><span class="lines">@@ -440,7 +435,7 @@
</span><span class="cx">     setVisible(webView.get());
</span><span class="cx"> 
</span><span class="cx">     receivedQuotaDelegateCalled = false;
</span><del>-    [webView loadRequest:server.request()];
</del><ins>+    [webView loadRequest:server.request("/main.html")];
</ins><span class="cx">     Util::run(&receivedQuotaDelegateCalled);
</span><span class="cx"> 
</span><span class="cx">     [delegate denyQuota];
</span><span class="lines">@@ -450,7 +445,7 @@
</span><span class="cx">     Util::run(&receivedMessage);
</span><span class="cx"> 
</span><span class="cx">     receivedQuotaDelegateCalled = false;
</span><del>-    [webView loadRequest:server.requestWithFragment()];
</del><ins>+    [webView loadRequest:server.request("/main.html#fragment")];
</ins><span class="cx">     [webView stringByEvaluatingJavaScript:@"doTestAgain()"];
</span><span class="cx"> 
</span><span class="cx">     [messageHandler setExpectedMessage: @"start"];
</span><span class="lines">@@ -481,8 +476,8 @@
</span><span class="cx">     auto messageHandler = adoptNS([[QuotaMessageHandler alloc] init]);
</span><span class="cx">     [[configuration userContentController] addScriptMessageHandler:messageHandler.get() name:@"qt"];
</span><span class="cx"> 
</span><del>-    ServiceWorkerTCPServer server({
-        { "text/html", TestUrlBytes }
</del><ins>+    TestWebKitAPI::HTTPServer server({
+        { "/", { TestUrlBytes } },
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get() addToWindow:YES]);
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPIcocoaHTTPServerh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/cocoa/HTTPServer.h (287222 => 287223)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/cocoa/HTTPServer.h     2021-12-18 15:11:29 UTC (rev 287222)
+++ trunk/Tools/TestWebKitAPI/cocoa/HTTPServer.h        2021-12-18 17:18:25 UTC (rev 287223)
</span><span class="lines">@@ -51,6 +51,7 @@
</span><span class="cx">     ~HTTPServer();
</span><span class="cx">     uint16_t port() const;
</span><span class="cx">     NSURLRequest *request(const String& path = "/"_str) const;
</span><ins>+    NSURLRequest *requestWithLocalhost(const String& path = "/"_str) const;
</ins><span class="cx">     size_t totalRequests() const;
</span><span class="cx">     void cancel();
</span><span class="cx"> 
</span><span class="lines">@@ -66,6 +67,7 @@
</span><span class="cx"> private:
</span><span class="cx">     static RetainPtr<nw_parameters_t> listenerParameters(Protocol, CertificateVerifier&&, RetainPtr<SecIdentityRef>&&, std::optional<uint16_t> port);
</span><span class="cx">     static void respondToRequests(Connection, Ref<RequestData>);
</span><ins>+    const char* scheme() const;
</ins><span class="cx"> 
</span><span class="cx">     Ref<RequestData> m_requestData;
</span><span class="cx">     RetainPtr<nw_listener_t> m_listener;
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPIcocoaHTTPServermm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/cocoa/HTTPServer.mm (287222 => 287223)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/cocoa/HTTPServer.mm    2021-12-18 15:11:29 UTC (rev 287222)
+++ trunk/Tools/TestWebKitAPI/cocoa/HTTPServer.mm       2021-12-18 17:18:25 UTC (rev 287223)
</span><span class="lines">@@ -357,7 +357,7 @@
</span><span class="cx">     return nw_listener_get_port(m_listener.get());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-NSURLRequest *HTTPServer::request(const String& path) const
</del><ins>+const char* HTTPServer::scheme() const
</ins><span class="cx"> {
</span><span class="cx">     const char* scheme = nullptr;
</span><span class="cx">     switch (m_protocol) {
</span><span class="lines">@@ -373,9 +373,19 @@
</span><span class="cx">     case Protocol::HttpsProxyWithAuthentication:
</span><span class="cx">         RELEASE_ASSERT_NOT_REACHED();
</span><span class="cx">     }
</span><del>-    return [NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%s://127.0.0.1:%d%@", scheme, port(), path.createCFString().get()]]];
</del><ins>+    return scheme;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+NSURLRequest *HTTPServer::request(const String& path) const
+{
+    return [NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%s://127.0.0.1:%d%@", scheme(), port(), path.createCFString().get()]]];
+}
+
+NSURLRequest *HTTPServer::requestWithLocalhost(const String& path) const
+{
+    return [NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%s://localhost:%d%@", scheme(), port(), path.createCFString().get()]]];
+}
+
</ins><span class="cx"> void Connection::receiveBytes(CompletionHandler<void(Vector<uint8_t>&&)>&& completionHandler, size_t minimumSize) const
</span><span class="cx"> {
</span><span class="cx">     nw_connection_receive(m_connection.get(), minimumSize, std::numeric_limits<uint32_t>::max(), makeBlockPtr([connection = *this, completionHandler = WTFMove(completionHandler)](dispatch_data_t content, nw_content_context_t, bool, nw_error_t error) mutable {
</span></span></pre>
</div>
</div>

</body>
</html>