Title: [223692] trunk
Revision
223692
Author
cdu...@apple.com
Date
2017-10-19 10:58:21 -0700 (Thu, 19 Oct 2017)

Log Message

Unreviewed, revert r223650 as it caused crashes on the bots.

Source/WebCore:

* WebCore.xcodeproj/project.pbxproj:
* dom/ScriptExecutionContext.h:
* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
* loader/FetchOptions.h:
* loader/ResourceLoaderOptions.h:
* loader/WorkerThreadableLoader.cpp:
(WebCore::WorkerThreadableLoader::WorkerThreadableLoader):
(WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
* loader/WorkerThreadableLoader.h:
* platform/network/ResourceRequestBase.h:
* platform/network/ResourceResponseBase.h:
* workers/WorkerThread.h:
* workers/service/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
* workers/service/context/SWContextManager.cpp: Copied from Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.h.
(WebCore::SWContextManager::singleton):
(WebCore::SWContextManager::SWContextManager):
(WebCore::SWContextManager::startServiceWorkerContext):
* workers/service/context/SWContextManager.h: Renamed from Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.h.
* workers/service/context/ServiceWorkerThread.h:

Source/WebKit:

* CMakeLists.txt:
* DerivedSources.make:
* StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
* StorageProcess/ServiceWorker/WebSWServerConnection.h:
* StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
* StorageProcess/StorageProcess.cpp:
* StorageProcess/StorageProcess.h:
* StorageProcess/StorageProcess.messages.in:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::scheduleLoad):
(WebKit::WebLoaderStrategy::remove):
* WebProcess/Network/WebLoaderStrategy.h:
* WebProcess/Storage/ServiceWorkerClientFetch.cpp: Removed.
* WebProcess/Storage/ServiceWorkerClientFetch.h: Removed.
* WebProcess/Storage/ServiceWorkerClientFetch.messages.in: Removed.
* WebProcess/Storage/ServiceWorkerContextManager.cpp: Removed.
* WebProcess/Storage/WebSWClientConnection.cpp:
* WebProcess/Storage/WebSWClientConnection.h:
* WebProcess/Storage/WebServiceWorkerProvider.cpp:
* WebProcess/Storage/WebServiceWorkerProvider.h:
* WebProcess/Storage/WebToStorageProcessConnection.cpp:
(WebKit::WebToStorageProcessConnection::didReceiveMessage):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::getWorkerContextConnection):
(WebKit::WebProcess::startServiceWorkerContext):
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in:

LayoutTests:

* http/tests/workers/service/basic-fetch.https-expected.txt: Removed.
* http/tests/workers/service/basic-fetch.https.html: Removed.
* http/tests/workers/service/resources/basic-fetch-worker.js: Removed.
* http/tests/workers/service/resources/basic-fetch.js: Removed.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (223691 => 223692)


--- trunk/LayoutTests/ChangeLog	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/LayoutTests/ChangeLog	2017-10-19 17:58:21 UTC (rev 223692)
@@ -1,3 +1,12 @@
+2017-10-19  Chris Dumez  <cdu...@apple.com>
+
+        Unreviewed, revert r223650 as it caused crashes on the bots.
+
+        * http/tests/workers/service/basic-fetch.https-expected.txt: Removed.
+        * http/tests/workers/service/basic-fetch.https.html: Removed.
+        * http/tests/workers/service/resources/basic-fetch-worker.js: Removed.
+        * http/tests/workers/service/resources/basic-fetch.js: Removed.
+
 2017-10-19  Antti Koivisto  <an...@apple.com>
 
         Overlapping text on all CSS fonts specs

Deleted: trunk/LayoutTests/http/tests/workers/service/basic-fetch.https-expected.txt (223691 => 223692)


--- trunk/LayoutTests/http/tests/workers/service/basic-fetch.https-expected.txt	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/LayoutTests/http/tests/workers/service/basic-fetch.https-expected.txt	2017-10-19 17:58:21 UTC (rev 223692)
@@ -1,6 +0,0 @@
-CONSOLE MESSAGE: line 12: test1 status code: 200
-CONSOLE MESSAGE: line 13: test1 status text: Hello from service worker
-CONSOLE MESSAGE: line 16: test2 status code: 500
-CONSOLE MESSAGE: line 17: test2 status text: Error from service worker
-CONSOLE MESSAGE: line 26: test3 fetch failed as expected
-

Deleted: trunk/LayoutTests/http/tests/workers/service/basic-fetch.https.html (223691 => 223692)


--- trunk/LayoutTests/http/tests/workers/service/basic-fetch.https.html	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/LayoutTests/http/tests/workers/service/basic-fetch.https.html	2017-10-19 17:58:21 UTC (rev 223692)
@@ -1,9 +0,0 @@
-<html>
-<head>
-<script src=""
-</head>
-<body>
-
-<script src=""
-</body>
-</html>

Deleted: trunk/LayoutTests/http/tests/workers/service/resources/basic-fetch-worker.js (223691 => 223692)


--- trunk/LayoutTests/http/tests/workers/service/resources/basic-fetch-worker.js	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/LayoutTests/http/tests/workers/service/resources/basic-fetch-worker.js	2017-10-19 17:58:21 UTC (rev 223692)
@@ -1 +0,0 @@
-// FIXME: register an onfetch event handler and handle "test1", "test2" and "test3" URLs

Deleted: trunk/LayoutTests/http/tests/workers/service/resources/basic-fetch.js (223691 => 223692)


--- trunk/LayoutTests/http/tests/workers/service/resources/basic-fetch.js	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/LayoutTests/http/tests/workers/service/resources/basic-fetch.js	2017-10-19 17:58:21 UTC (rev 223692)
@@ -1,34 +0,0 @@
-function done()
-{
-    finishSWTest();
-}
-
-async function test()
-{
-    try {
-        await navigator.serviceWorker.register("resources/basic-fetch-worker.js", { });
-
-        var response = await fetch("test1");
-        console.log("test1 status code: " + response.status);
-        console.log("test1 status text: " + response.statusText);
-
-        var response = await fetch("test2");
-        console.log("test2 status code: " + response.status);
-        console.log("test2 status text: " + response.statusText);
-
-        try {
-            response = await fetch("test3");
-            console.log("test3 fetch succeeded unexpectedly");
-            console.log("test3 status code: " + response.status);
-            console.log("test3 status text: " + response.statusText);
-
-        } catch (e) {
-            console.log("test3 fetch failed as expected");
-        }
-    } catch(e) {
-        console.log("Got exception: " + e);
-    }
-    finishSWTest();
-}
-
-test();

Modified: trunk/Source/WebCore/ChangeLog (223691 => 223692)


--- trunk/Source/WebCore/ChangeLog	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/Source/WebCore/ChangeLog	2017-10-19 17:58:21 UTC (rev 223692)
@@ -1,3 +1,29 @@
+2017-10-19  Chris Dumez  <cdu...@apple.com>
+
+        Unreviewed, revert r223650 as it caused crashes on the bots.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * dom/ScriptExecutionContext.h:
+        * loader/DocumentThreadableLoader.cpp:
+        (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
+        * loader/FetchOptions.h:
+        * loader/ResourceLoaderOptions.h:
+        * loader/WorkerThreadableLoader.cpp:
+        (WebCore::WorkerThreadableLoader::WorkerThreadableLoader):
+        (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
+        * loader/WorkerThreadableLoader.h:
+        * platform/network/ResourceRequestBase.h:
+        * platform/network/ResourceResponseBase.h:
+        * workers/WorkerThread.h:
+        * workers/service/ServiceWorkerContainer.cpp:
+        (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
+        * workers/service/context/SWContextManager.cpp: Copied from Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.h.
+        (WebCore::SWContextManager::singleton):
+        (WebCore::SWContextManager::SWContextManager):
+        (WebCore::SWContextManager::startServiceWorkerContext):
+        * workers/service/context/SWContextManager.h: Renamed from Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.h.
+        * workers/service/context/ServiceWorkerThread.h:
+
 2017-10-19  Zalan Bujtas  <za...@apple.com>
 
         [FrameView::layout cleanup] Replace m_nestedLayoutCount with isLayoutNested()

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (223691 => 223692)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2017-10-19 17:58:21 UTC (rev 223692)
@@ -2327,6 +2327,8 @@
 		517A63C61B74319200E7DCDC /* KeyedEncoderCF.h in Headers */ = {isa = PBXBuildFile; fileRef = 517A63C21B74317E00E7DCDC /* KeyedEncoderCF.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		517B25A91CC82B2A0061C011 /* IDBConnectionProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 517B25A71CC820320061C011 /* IDBConnectionProxy.cpp */; };
 		517B25AA1CC82B2A0061C011 /* IDBConnectionProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 517B25A81CC820320061C011 /* IDBConnectionProxy.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		517C870A1F8EBB2500EB8076 /* SWContextManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 517C87081F8EB9BF00EB8076 /* SWContextManager.cpp */; };
+		517C870B1F8EBB2500EB8076 /* SWContextManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 517C87091F8EB9C000EB8076 /* SWContextManager.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		517C87181F8FD4D900EB8076 /* ServiceWorkerContextData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 517C87161F8FD4D300EB8076 /* ServiceWorkerContextData.cpp */; };
 		517DEEE51DE94ADC00B91644 /* ScrollingMomentumCalculatorMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 517DEEE31DE94ADC00B91644 /* ScrollingMomentumCalculatorMac.mm */; };
 		517DEEE81DE94B0800B91644 /* ScrollingMomentumCalculatorMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 517DEEE71DE94B0800B91644 /* ScrollingMomentumCalculatorMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -10228,6 +10230,8 @@
 		517A63C21B74317E00E7DCDC /* KeyedEncoderCF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KeyedEncoderCF.h; sourceTree = "<group>"; };
 		517B25A71CC820320061C011 /* IDBConnectionProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBConnectionProxy.cpp; sourceTree = "<group>"; };
 		517B25A81CC820320061C011 /* IDBConnectionProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBConnectionProxy.h; sourceTree = "<group>"; };
+		517C87081F8EB9BF00EB8076 /* SWContextManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SWContextManager.cpp; path = workers/service/context/SWContextManager.cpp; sourceTree = SOURCE_ROOT; };
+		517C87091F8EB9C000EB8076 /* SWContextManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SWContextManager.h; path = workers/service/context/SWContextManager.h; sourceTree = SOURCE_ROOT; };
 		517C87101F8EE72E00EB8076 /* ServiceWorkerThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ServiceWorkerThread.h; path = workers/service/context/ServiceWorkerThread.h; sourceTree = SOURCE_ROOT; };
 		517C87111F8EE72F00EB8076 /* ServiceWorkerThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ServiceWorkerThread.cpp; path = workers/service/context/ServiceWorkerThread.cpp; sourceTree = SOURCE_ROOT; };
 		517C87161F8FD4D300EB8076 /* ServiceWorkerContextData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ServiceWorkerContextData.cpp; sourceTree = "<group>"; };
@@ -19085,6 +19089,8 @@
 			children = (
 				517C87111F8EE72F00EB8076 /* ServiceWorkerThread.cpp */,
 				517C87101F8EE72E00EB8076 /* ServiceWorkerThread.h */,
+				517C87081F8EB9BF00EB8076 /* SWContextManager.cpp */,
+				517C87091F8EB9C000EB8076 /* SWContextManager.h */,
 			);
 			path = context;
 			sourceTree = "<group>";
@@ -30630,6 +30636,7 @@
 				B2227AF60D00BF220071B782 /* SVGZoomAndPan.h in Headers */,
 				B2E4EC980D00C22B00432643 /* SVGZoomEvent.h in Headers */,
 				517A531D1F4B53B100DCDC0A /* SWClientConnection.h in Headers */,
+				517C870B1F8EBB2500EB8076 /* SWContextManager.h in Headers */,
 				517A52F01F47535B00DCDC0A /* SWServer.h in Headers */,
 				51F645971F4A686F00B54DED /* SWServerRegistration.h in Headers */,
 				517A53461F50C17F00DCDC0A /* SWServerWorker.h in Headers */,
@@ -34360,6 +34367,7 @@
 				B2227AF50D00BF220071B782 /* SVGZoomAndPan.cpp in Sources */,
 				B2E4EC970D00C22B00432643 /* SVGZoomEvent.cpp in Sources */,
 				517A531C1F4B53B100DCDC0A /* SWClientConnection.cpp in Sources */,
+				517C870A1F8EBB2500EB8076 /* SWContextManager.cpp in Sources */,
 				517A52F11F4754E700DCDC0A /* SWServer.cpp in Sources */,
 				51F645961F4A686F00B54DED /* SWServerRegistration.cpp in Sources */,
 				517A53451F50C17F00DCDC0A /* SWServerWorker.cpp in Sources */,

Modified: trunk/Source/WebCore/dom/ScriptExecutionContext.h (223691 => 223692)


--- trunk/Source/WebCore/dom/ScriptExecutionContext.h	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/Source/WebCore/dom/ScriptExecutionContext.h	2017-10-19 17:58:21 UTC (rev 223692)
@@ -230,11 +230,6 @@
 
     JSC::ExecState* execState();
 
-#if ENABLE(SERVICE_WORKER)
-    uint64_t selectedServiceWorkerIdentifier() const { return m_serviceWorkerIdentifier; }
-    void setSelectedServiceWorkerIdentifier(uint64_t identifier) { m_serviceWorkerIdentifier = identifier; }
-#endif
-
 protected:
     class AddConsoleMessageTask : public Task {
     public:
@@ -302,10 +297,6 @@
 #if !ASSERT_DISABLED || ENABLE(SECURITY_ASSERTIONS)
     bool m_activeDOMObjectRemovalForbidden { false };
 #endif
-
-#if ENABLE(SERVICE_WORKER)
-    uint64_t m_serviceWorkerIdentifier { 0 };
-#endif
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp (223691 => 223692)


--- trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp	2017-10-19 17:58:21 UTC (rev 223692)
@@ -103,11 +103,6 @@
 {
     relaxAdoptionRequirement();
 
-#if ENABLE(SERVICE_WORKER)
-    if (m_options.serviceWorkersMode == ServiceWorkersMode::All && !m_options.serviceWorkerIdentifier)
-        m_options.serviceWorkerIdentifier = document.selectedServiceWorkerIdentifier();
-#endif
-
     // Setting a referrer header is only supported in the async code path.
     ASSERT(m_async || m_referrer.isEmpty());
 

Modified: trunk/Source/WebCore/loader/FetchOptions.h (223691 => 223692)


--- trunk/Source/WebCore/loader/FetchOptions.h	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/Source/WebCore/loader/FetchOptions.h	2017-10-19 17:58:21 UTC (rev 223692)
@@ -69,23 +69,8 @@
 {
 }
 
-inline bool isPotentialNavigationOrSubresourceRequest(FetchOptions::Destination destination)
-{
-    return destination == FetchOptions::Destination::Object
-        || destination == FetchOptions::Destination::Embed;
 }
 
-inline bool isNonSubresourceRequest(FetchOptions::Destination destination)
-{
-    return destination == FetchOptions::Destination::Document
-        || destination == FetchOptions::Destination::Report
-        || destination == FetchOptions::Destination::Serviceworker
-        || destination == FetchOptions::Destination::Sharedworker
-        || destination == FetchOptions::Destination::Worker;
-}
-
-}
-
 namespace WTF {
 
 template<> struct EnumTraits<WebCore::FetchOptions::Destination> {

Modified: trunk/Source/WebCore/loader/ResourceLoaderOptions.h (223691 => 223692)


--- trunk/Source/WebCore/loader/ResourceLoaderOptions.h	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/Source/WebCore/loader/ResourceLoaderOptions.h	2017-10-19 17:58:21 UTC (rev 223692)
@@ -92,11 +92,6 @@
     Worker,
 };
 
-enum class ServiceWorkersMode {
-    All,
-    None,
-};
-
 struct ResourceLoaderOptions : public FetchOptions {
     ResourceLoaderOptions() { }
 
@@ -129,8 +124,6 @@
     CachingPolicy cachingPolicy { CachingPolicy::AllowCaching };
     SameOriginDataURLFlag sameOriginDataURLFlag { SameOriginDataURLFlag::Unset };
     InitiatorContext initiatorContext { InitiatorContext::Document };
-    ServiceWorkersMode serviceWorkersMode { ServiceWorkersMode::All };
-    uint64_t serviceWorkerIdentifier { 0 };
 
     ClientCredentialPolicy clientCredentialPolicy { ClientCredentialPolicy::CannotAskClientForCredentials };
     unsigned maxRedirectCount { 20 };

Modified: trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp (223691 => 223692)


--- trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp	2017-10-19 17:58:21 UTC (rev 223692)
@@ -55,7 +55,7 @@
 WorkerThreadableLoader::WorkerThreadableLoader(WorkerGlobalScope& workerGlobalScope, ThreadableLoaderClient& client, const String& taskMode, ResourceRequest&& request, const ThreadableLoaderOptions& options, const String& referrer)
     : m_workerGlobalScope(workerGlobalScope)
     , m_workerClientWrapper(ThreadableLoaderClientWrapper::create(client, options.initiator))
-    , m_bridge(*new MainThreadBridge(m_workerClientWrapper.get(), workerGlobalScope.thread().workerLoaderProxy(), taskMode, WTFMove(request), options, referrer.isEmpty() ? workerGlobalScope.url().strippedForUseAsReferrer() : referrer, workerGlobalScope))
+    , m_bridge(*new MainThreadBridge(m_workerClientWrapper.get(), workerGlobalScope.thread().workerLoaderProxy(), taskMode, WTFMove(request), options, referrer.isEmpty() ? workerGlobalScope.url().strippedForUseAsReferrer() : referrer, workerGlobalScope.securityOrigin(), workerGlobalScope.contentSecurityPolicy()))
 {
 }
 
@@ -101,15 +101,12 @@
 }
 
 WorkerThreadableLoader::MainThreadBridge::MainThreadBridge(ThreadableLoaderClientWrapper& workerClientWrapper, WorkerLoaderProxy& loaderProxy, const String& taskMode,
-    ResourceRequest&& request, const ThreadableLoaderOptions& options, const String& outgoingReferrer, WorkerGlobalScope& globalScope)
+    ResourceRequest&& request, const ThreadableLoaderOptions& options, const String& outgoingReferrer,
+    const SecurityOrigin* securityOrigin, const ContentSecurityPolicy* contentSecurityPolicy)
     : m_workerClientWrapper(&workerClientWrapper)
     , m_loaderProxy(loaderProxy)
     , m_taskMode(taskMode.isolatedCopy())
 {
-
-    auto* securityOrigin = globalScope.securityOrigin();
-    auto* contentSecurityPolicy = globalScope.contentSecurityPolicy();
-
     ASSERT(securityOrigin);
     ASSERT(contentSecurityPolicy);
 
@@ -124,11 +121,6 @@
     ASSERT(optionsCopy->options.initiatorContext == InitiatorContext::Document);
     optionsCopy->options.initiatorContext = InitiatorContext::Worker;
 
-#if ENABLE(SERVICE_WORKER)
-    optionsCopy->options.serviceWorkersMode = globalScope.isServiceWorkerGlobalScope() ? ServiceWorkersMode::None : ServiceWorkersMode::All;
-    optionsCopy->options.serviceWorkerIdentifier = globalScope.selectedServiceWorkerIdentifier();
-#endif
-
     // Can we benefit from request being an r-value to create more efficiently its isolated copy?
     m_loaderProxy.postTaskToLoader([this, request = request.isolatedCopy(), options = WTFMove(optionsCopy), contentSecurityPolicyCopy = WTFMove(contentSecurityPolicyCopy)](ScriptExecutionContext& context) mutable {
         ASSERT(isMainThread());

Modified: trunk/Source/WebCore/loader/WorkerThreadableLoader.h (223691 => 223692)


--- trunk/Source/WebCore/loader/WorkerThreadableLoader.h	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/Source/WebCore/loader/WorkerThreadableLoader.h	2017-10-19 17:58:21 UTC (rev 223692)
@@ -88,7 +88,7 @@
         class MainThreadBridge : public ThreadableLoaderClient {
         public:
             // All executed on the worker context's thread.
-            MainThreadBridge(ThreadableLoaderClientWrapper&, WorkerLoaderProxy&, const String& taskMode, ResourceRequest&&, const ThreadableLoaderOptions&, const String& outgoingReferrer, WorkerGlobalScope&);
+            MainThreadBridge(ThreadableLoaderClientWrapper&, WorkerLoaderProxy&, const String& taskMode, ResourceRequest&&, const ThreadableLoaderOptions&, const String& outgoingReferrer, const SecurityOrigin*, const ContentSecurityPolicy*);
             void cancel();
             void destroy();
 

Modified: trunk/Source/WebCore/platform/network/ResourceRequestBase.h (223691 => 223692)


--- trunk/Source/WebCore/platform/network/ResourceRequestBase.h	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/Source/WebCore/platform/network/ResourceRequestBase.h	2017-10-19 17:58:21 UTC (rev 223692)
@@ -100,7 +100,7 @@
 
     WEBCORE_EXPORT String httpContentType() const;
     WEBCORE_EXPORT void setHTTPContentType(const String&);
-    WEBCORE_EXPORT void clearHTTPContentType();
+    void clearHTTPContentType();
 
     bool hasHTTPHeader(HTTPHeaderName) const;
 

Modified: trunk/Source/WebCore/platform/network/ResourceResponseBase.h (223691 => 223692)


--- trunk/Source/WebCore/platform/network/ResourceResponseBase.h	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/Source/WebCore/platform/network/ResourceResponseBase.h	2017-10-19 17:58:21 UTC (rev 223692)
@@ -153,7 +153,7 @@
         return 1280;
     }
 
-    WEBCORE_EXPORT void setType(Type);
+    void setType(Type);
     Type type() const { return m_type; }
 
     void setRedirected(bool isRedirected) { m_isRedirected = isRedirected; }

Modified: trunk/Source/WebCore/workers/WorkerThread.h (223691 => 223692)


--- trunk/Source/WebCore/workers/WorkerThread.h	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/Source/WebCore/workers/WorkerThread.h	2017-10-19 17:58:21 UTC (rev 223692)
@@ -61,7 +61,7 @@
 public:
     virtual ~WorkerThread();
 
-    WEBCORE_EXPORT bool start();
+    bool start();
     void stop();
 
     ThreadIdentifier threadID() const { return m_thread ? m_thread->id() : 0; }

Modified: trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp (223691 => 223692)


--- trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp	2017-10-19 17:58:21 UTC (rev 223692)
@@ -179,9 +179,6 @@
         return;
     }
 
-    // FIXME: Implement proper selection of service workers.
-    context->setSelectedServiceWorkerIdentifier(data.identifier);
-
     auto registration = ServiceWorkerRegistration::create(*context, WTFMove(data));
     job.promise().resolve<IDLInterface<ServiceWorkerRegistration>>(registration.get());
 }

Copied: trunk/Source/WebCore/workers/service/context/SWContextManager.cpp (from rev 223691, trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.h) (0 => 223692)


--- trunk/Source/WebCore/workers/service/context/SWContextManager.cpp	                        (rev 0)
+++ trunk/Source/WebCore/workers/service/context/SWContextManager.cpp	2017-10-19 17:58:21 UTC (rev 223692)
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include "config.h"
+#include "SWContextManager.h"
+
+#if ENABLE(SERVICE_WORKER)
+
+#include "Logging.h"
+#include <pal/SessionID.h>
+
+using namespace PAL;
+
+namespace WebCore {
+
+SWContextManager& SWContextManager::singleton()
+{
+    static SWContextManager* sharedManager = new SWContextManager;
+    return *sharedManager;
+}
+
+SWContextManager::SWContextManager()
+{
+
+}
+
+ExceptionOr<uint64_t> SWContextManager::startServiceWorkerContext(uint64_t serverConnectionIdentifier, const ServiceWorkerContextData& data)
+{
+    // FIXME: Provide a sensical session ID
+
+    auto thread = ServiceWorkerThread::create(serverConnectionIdentifier, data, SessionID::defaultSessionID());
+    auto threadIdentifier = thread->identifier();
+    auto result = m_workerThreadMap.add(threadIdentifier, WTFMove(thread));
+    ASSERT(result.isNewEntry);
+
+    result.iterator->value->start();
+    
+    LOG(ServiceWorker, "Context process PID: %i started worker thread %s\n", getpid(), data.workerID.utf8().data());
+    
+    return threadIdentifier;
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SERVICE_WORKER)

Copied: trunk/Source/WebCore/workers/service/context/SWContextManager.h (from rev 223691, trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.h) (0 => 223692)


--- trunk/Source/WebCore/workers/service/context/SWContextManager.h	                        (rev 0)
+++ trunk/Source/WebCore/workers/service/context/SWContextManager.h	2017-10-19 17:58:21 UTC (rev 223692)
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#pragma once
+
+#if ENABLE(SERVICE_WORKER)
+
+#include "ExceptionOr.h"
+#include "ServiceWorkerThread.h"
+#include <wtf/HashMap.h>
+
+namespace WebCore {
+
+struct ServiceWorkerContextData;
+
+class SWContextManager {
+public:
+    WEBCORE_EXPORT static SWContextManager& singleton();
+
+    WEBCORE_EXPORT ExceptionOr<uint64_t> startServiceWorkerContext(uint64_t serverConnectionIdentifier, const ServiceWorkerContextData&);
+
+private:
+    SWContextManager();
+    
+    HashMap<uint64_t, RefPtr<ServiceWorkerThread>> m_workerThreadMap;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SERVICE_WORKER)

Modified: trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.h (223691 => 223692)


--- trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.h	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.h	2017-10-19 17:58:21 UTC (rev 223692)
@@ -52,7 +52,7 @@
     void runEventLoop() override;
 
 private:
-    WEBCORE_EXPORT ServiceWorkerThread(uint64_t serverConnectionIdentifier, const ServiceWorkerContextData&, PAL::SessionID);
+    ServiceWorkerThread(uint64_t serverConnectionIdentifier, const ServiceWorkerContextData&, PAL::SessionID);
 
     uint64_t m_serverConnectionIdentifier;
     ServiceWorkerContextData m_data;

Modified: trunk/Source/WebKit/CMakeLists.txt (223691 => 223692)


--- trunk/Source/WebKit/CMakeLists.txt	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/Source/WebKit/CMakeLists.txt	2017-10-19 17:58:21 UTC (rev 223692)
@@ -683,7 +683,6 @@
     WebProcess/Plugins/PluginProcessConnectionManager.messages.in
     WebProcess/Plugins/PluginProxy.messages.in
 
-    WebProcess/Storage/ServiceWorkerClientFetch.messages.in
     WebProcess/Storage/WebSWClientConnection.messages.in
 
     WebProcess/UserContent/WebUserContentController.messages.in

Modified: trunk/Source/WebKit/ChangeLog (223691 => 223692)


--- trunk/Source/WebKit/ChangeLog	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/Source/WebKit/ChangeLog	2017-10-19 17:58:21 UTC (rev 223692)
@@ -1,5 +1,38 @@
 2017-10-19  Chris Dumez  <cdu...@apple.com>
 
+        Unreviewed, revert r223650 as it caused crashes on the bots.
+
+        * CMakeLists.txt:
+        * DerivedSources.make:
+        * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
+        * StorageProcess/ServiceWorker/WebSWServerConnection.h:
+        * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
+        * StorageProcess/StorageProcess.cpp:
+        * StorageProcess/StorageProcess.h:
+        * StorageProcess/StorageProcess.messages.in:
+        * WebKit.xcodeproj/project.pbxproj:
+        * WebProcess/Network/WebLoaderStrategy.cpp:
+        (WebKit::WebLoaderStrategy::scheduleLoad):
+        (WebKit::WebLoaderStrategy::remove):
+        * WebProcess/Network/WebLoaderStrategy.h:
+        * WebProcess/Storage/ServiceWorkerClientFetch.cpp: Removed.
+        * WebProcess/Storage/ServiceWorkerClientFetch.h: Removed.
+        * WebProcess/Storage/ServiceWorkerClientFetch.messages.in: Removed.
+        * WebProcess/Storage/ServiceWorkerContextManager.cpp: Removed.
+        * WebProcess/Storage/WebSWClientConnection.cpp:
+        * WebProcess/Storage/WebSWClientConnection.h:
+        * WebProcess/Storage/WebServiceWorkerProvider.cpp:
+        * WebProcess/Storage/WebServiceWorkerProvider.h:
+        * WebProcess/Storage/WebToStorageProcessConnection.cpp:
+        (WebKit::WebToStorageProcessConnection::didReceiveMessage):
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::getWorkerContextConnection):
+        (WebKit::WebProcess::startServiceWorkerContext):
+        * WebProcess/WebProcess.h:
+        * WebProcess/WebProcess.messages.in:
+
+2017-10-19  Chris Dumez  <cdu...@apple.com>
+
         http/tests/workers/service/basic-register.html is a flaky failure.
         https://bugs.webkit.org/show_bug.cgi?id=178494
         <rdar://problem/35065315>

Modified: trunk/Source/WebKit/DerivedSources.make (223691 => 223692)


--- trunk/Source/WebKit/DerivedSources.make	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/Source/WebKit/DerivedSources.make	2017-10-19 17:58:21 UTC (rev 223692)
@@ -125,7 +125,6 @@
     RemoteWebInspectorProxy \
     RemoteWebInspectorUI \
     SecItemShimProxy \
-    ServiceWorkerClientFetch \
     SmartMagnificationController \
     StorageAreaMap \
     StorageManager \

Modified: trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.cpp (223691 => 223692)


--- trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.cpp	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.cpp	2017-10-19 17:58:21 UTC (rev 223692)
@@ -30,10 +30,8 @@
 
 #include "DataReference.h"
 #include "Logging.h"
-#include "ServiceWorkerClientFetchMessages.h"
 #include "StorageProcess.h"
 #include "StorageToWebProcessConnectionMessages.h"
-#include "WebCoreArgumentCoders.h"
 #include "WebProcess.h"
 #include "WebProcessMessages.h"
 #include "WebSWClientConnectionMessages.h"
@@ -94,31 +92,6 @@
     m_pendingContextDatas.append(data);
 }
 
-void WebSWServerConnection::startFetch(uint64_t fetchIdentifier, uint64_t serviceWorkerIdentifier, const ResourceRequest& request, const FetchOptions& options)
-{
-    sendToContextProcess(Messages::WebProcess::StartFetchInServiceWorker(identifier(), fetchIdentifier, serviceWorkerIdentifier, request, options));
-}
-
-void WebSWServerConnection::didReceiveFetchResponse(uint64_t fetchIdentifier, const ResourceResponse& response)
-{
-    m_contentConnection->send(Messages::ServiceWorkerClientFetch::DidReceiveResponse { response }, fetchIdentifier);
-}
-
-void WebSWServerConnection::didReceiveFetchData(uint64_t fetchIdentifier, const IPC::DataReference& data, int64_t encodedDataLength)
-{
-    m_contentConnection->send(Messages::ServiceWorkerClientFetch::DidReceiveData { data, encodedDataLength }, fetchIdentifier);
-}
-
-void WebSWServerConnection::didFinishFetch(uint64_t fetchIdentifier)
-{
-    m_contentConnection->send(Messages::ServiceWorkerClientFetch::DidFinish { }, fetchIdentifier);
-}
-
-void WebSWServerConnection::didFailFetch(uint64_t fetchIdentifier)
-{
-    m_contentConnection->send(Messages::ServiceWorkerClientFetch::DidFail { }, fetchIdentifier);
-}
-
 template<typename U> bool WebSWServerConnection::sendToContextProcess(U&& message)
 {
     if (!m_contextConnection)

Modified: trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.h (223691 => 223692)


--- trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.h	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.h	2017-10-19 17:58:21 UTC (rev 223692)
@@ -51,11 +51,6 @@
 
     PAL::SessionID sessionID() const { return m_sessionID; }
 
-    void didReceiveFetchResponse(uint64_t fetchIdentifier, const WebCore::ResourceResponse&);
-    void didReceiveFetchData(uint64_t fetchIdentifier, const IPC::DataReference&, int64_t encodedDataLength);
-    void didFinishFetch(uint64_t fetchIdentifier);
-    void didFailFetch(uint64_t fetchIdentifier);
-
 private:
     // Implement SWServer::Connection (Messages to the client WebProcess)
     void rejectJobInClient(uint64_t jobIdentifier, const WebCore::ExceptionData&) final;
@@ -62,11 +57,9 @@
     void resolveJobInClient(uint64_t jobIdentifier, const WebCore::ServiceWorkerRegistrationData&) final;
     void startScriptFetchInClient(uint64_t jobIdentifier) final;
 
-    void startFetch(uint64_t fetchIdentifier, uint64_t serviceWorkerIdentifier, const WebCore::ResourceRequest&, const WebCore::FetchOptions&);
-
     // Messages to the SW context WebProcess
     void startServiceWorkerContext(const WebCore::ServiceWorkerContextData&) final;
-
+    
     IPC::Connection* messageSenderConnection() final { return m_contentConnection.ptr(); }
     uint64_t messageSenderDestinationID() final { return identifier(); }
 

Modified: trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.messages.in (223691 => 223692)


--- trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.messages.in	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.messages.in	2017-10-19 17:58:21 UTC (rev 223692)
@@ -26,8 +26,6 @@
     # When possible, these messages can be implemented directly by WebCore::SWClientConnection
     ScheduleJobInServer(struct WebCore::ServiceWorkerJobData jobData)
     FinishFetchingScriptInServer(struct WebCore::ServiceWorkerFetchResult result)
-
-    StartFetch(uint64_t identifier, uint64_t serviceWorkerIdentifier, WebCore::ResourceRequest request, struct WebCore::FetchOptions options)
 }
 
 #endif // ENABLE(SERVICE_WORKER)

Modified: trunk/Source/WebKit/StorageProcess/StorageProcess.cpp (223691 => 223692)


--- trunk/Source/WebKit/StorageProcess/StorageProcess.cpp	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/Source/WebKit/StorageProcess/StorageProcess.cpp	2017-10-19 17:58:21 UTC (rev 223692)
@@ -405,30 +405,6 @@
         connection->scriptContextStarted(registrationKey, identifier, workerID);
 }
 
-void StorageProcess::didFailFetch(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier)
-{
-    if (auto* connection = m_swServerConnections.get(serverConnectionIdentifier))
-        connection->didFailFetch(fetchIdentifier);
-}
-
-void StorageProcess::didReceiveFetchResponse(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier, const WebCore::ResourceResponse& response)
-{
-    if (auto* connection = m_swServerConnections.get(serverConnectionIdentifier))
-        connection->didReceiveFetchResponse(fetchIdentifier, response);
-}
-
-void StorageProcess::didReceiveFetchData(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier, const IPC::DataReference& data, int64_t encodedDataLength)
-{
-    if (auto* connection = m_swServerConnections.get(serverConnectionIdentifier))
-        connection->didReceiveFetchData(fetchIdentifier, data, encodedDataLength);
-}
-
-void StorageProcess::didFinishFetch(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier)
-{
-    if (auto* connection = m_swServerConnections.get(serverConnectionIdentifier))
-        connection->didFinishFetch(fetchIdentifier);
-}
-
 void StorageProcess::registerSWServerConnection(WebSWServerConnection& connection)
 {
     ASSERT(!m_swServerConnections.contains(connection.identifier()));

Modified: trunk/Source/WebKit/StorageProcess/StorageProcess.h (223691 => 223692)


--- trunk/Source/WebKit/StorageProcess/StorageProcess.h	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/Source/WebKit/StorageProcess/StorageProcess.h	2017-10-19 17:58:21 UTC (rev 223692)
@@ -119,11 +119,6 @@
     void didGetWorkerContextProcessConnection(const IPC::Attachment& encodedConnectionIdentifier);
     void serviceWorkerContextFailedToStart(uint64_t serverConnectionIdentifier, const WebCore::ServiceWorkerRegistrationKey&, const String& workerID, const String& message);
     void serviceWorkerContextStarted(uint64_t serverConnectionIdentifier, const WebCore::ServiceWorkerRegistrationKey&, uint64_t identifier, const String& workerID);
-
-    void didReceiveFetchResponse(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier, const WebCore::ResourceResponse&);
-    void didReceiveFetchData(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier, const IPC::DataReference&, int64_t encodedDataLength);
-    void didFinishFetch(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier);
-    void didFailFetch(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier);
 #endif
 #if ENABLE(INDEXED_DATABASE)
     Vector<WebCore::SecurityOriginData> indexedDatabaseOrigins(const String& path);

Modified: trunk/Source/WebKit/StorageProcess/StorageProcess.messages.in (223691 => 223692)


--- trunk/Source/WebKit/StorageProcess/StorageProcess.messages.in	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/Source/WebKit/StorageProcess/StorageProcess.messages.in	2017-10-19 17:58:21 UTC (rev 223692)
@@ -37,13 +37,7 @@
 
 #if ENABLE(SERVICE_WORKER)
     DidGetWorkerContextProcessConnection(IPC::Attachment connectionHandle)
-
     ServiceWorkerContextFailedToStart(uint64_t serverConnectionIdentifier, struct WebCore::ServiceWorkerRegistrationKey registrationKey, String workerID, String message)
     ServiceWorkerContextStarted(uint64_t serverConnectionIdentifier, struct WebCore::ServiceWorkerRegistrationKey registrationKey, uint64_t identifier, String workerID)
-
-    DidFailFetch(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier)
-    DidReceiveFetchResponse(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier, WebCore::ResourceResponse response)
-    DidReceiveFetchData(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier, IPC::DataReference data, int64_t encodedDataLength)
-    DidFinishFetch(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier)
 #endif
 }

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (223691 => 223692)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2017-10-19 17:58:21 UTC (rev 223692)
@@ -890,9 +890,6 @@
 		413075B21DE85F580039EC69 /* LibWebRTCSocketFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 413075A61DE85EE70039EC69 /* LibWebRTCSocketFactory.h */; };
 		413075B31DE85F580039EC69 /* LibWebRTCProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 413075A71DE85EE70039EC69 /* LibWebRTCProvider.cpp */; };
 		413075B41DE85F580039EC69 /* LibWebRTCProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 413075A81DE85EE70039EC69 /* LibWebRTCProvider.h */; };
-		4131F3D11F96BCCC0059995A /* ServiceWorkerClientFetch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4131F3D01F96BCC80059995A /* ServiceWorkerClientFetch.cpp */; };
-		4131F3D41F96E9350059995A /* ServiceWorkerContextManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4131F3D31F96E9310059995A /* ServiceWorkerContextManager.cpp */; };
-		4131F3D51F96E9350059995A /* ServiceWorkerContextManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 4131F3D21F96E9300059995A /* ServiceWorkerContextManager.h */; };
 		4135FBD11F4FB8090074C47B /* CacheStorageEngineCaches.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4135FBCF1F4FB7F20074C47B /* CacheStorageEngineCaches.cpp */; };
 		41897ECF1F415D620016FA42 /* WebCacheStorageConnection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41897ECE1F415D5C0016FA42 /* WebCacheStorageConnection.cpp */; };
 		41897ED01F415D650016FA42 /* WebCacheStorageProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41897ECC1F415D5C0016FA42 /* WebCacheStorageProvider.cpp */; };
@@ -1032,9 +1029,7 @@
 		5179556A162876F300FA43B6 /* NetworkProcess.h in Headers */ = {isa = PBXBuildFile; fileRef = 510CC7E016138E2900D03ED3 /* NetworkProcess.h */; };
 		5179556D162877B100FA43B6 /* NetworkProcessProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510CC7EA16138E7200D03ED3 /* NetworkProcessProxy.cpp */; };
 		5179556E162877B300FA43B6 /* NetworkProcessProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 510CC7EB16138E7200D03ED3 /* NetworkProcessProxy.h */; };
-		617A52D81F43A9DA00DCDC0A /* ServiceWorkerClientFetchMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 617A52D71F43A9B600DCDC0A /* ServiceWorkerClientFetchConnectionMessageReceiver.cpp */; };
 		517A52D81F43A9DA00DCDC0A /* WebSWServerConnectionMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 517A52D71F43A9B600DCDC0A /* WebSWServerConnectionMessageReceiver.cpp */; };
-		617A52D91F43A9DA00DCDC0A /* ServiceWorkerClientFetchMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 617A52D61F43A9B600DCDC0A /* ServiceWorkerClientFetchMessages.h */; };
 		517A52D91F43A9DA00DCDC0A /* WebSWServerConnectionMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 517A52D61F43A9B600DCDC0A /* WebSWServerConnectionMessages.h */; };
 		517A53041F4793C600DCDC0A /* WebSWClientConnection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 517A53031F4793B200DCDC0A /* WebSWClientConnection.cpp */; };
 		517A53051F4793C600DCDC0A /* WebSWClientConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 517A53021F4793B200DCDC0A /* WebSWClientConnection.h */; };
@@ -3183,11 +3178,6 @@
 		413075A61DE85EE70039EC69 /* LibWebRTCSocketFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LibWebRTCSocketFactory.h; path = Network/webrtc/LibWebRTCSocketFactory.h; sourceTree = "<group>"; };
 		413075A71DE85EE70039EC69 /* LibWebRTCProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; name = LibWebRTCProvider.cpp; path = Network/webrtc/LibWebRTCProvider.cpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
 		413075A81DE85EE70039EC69 /* LibWebRTCProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = LibWebRTCProvider.h; path = Network/webrtc/LibWebRTCProvider.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
-		4131F3CE1F96A4950059995A /* ServiceWorkerClientFetch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ServiceWorkerClientFetch.h; sourceTree = "<group>"; };
-		4131F3CF1F96A9360059995A /* ServiceWorkerClientFetch.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ServiceWorkerClientFetch.messages.in; sourceTree = "<group>"; };
-		4131F3D01F96BCC80059995A /* ServiceWorkerClientFetch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ServiceWorkerClientFetch.cpp; sourceTree = "<group>"; };
-		4131F3D21F96E9300059995A /* ServiceWorkerContextManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ServiceWorkerContextManager.h; sourceTree = "<group>"; };
-		4131F3D31F96E9310059995A /* ServiceWorkerContextManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ServiceWorkerContextManager.cpp; sourceTree = "<group>"; };
 		4135FBCF1F4FB7F20074C47B /* CacheStorageEngineCaches.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CacheStorageEngineCaches.cpp; sourceTree = "<group>"; };
 		4135FBD01F4FB7F20074C47B /* CacheStorageEngineCaches.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CacheStorageEngineCaches.h; sourceTree = "<group>"; };
 		41897ECB1F415D5C0016FA42 /* WebCacheStorageConnection.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebCacheStorageConnection.messages.in; sourceTree = "<group>"; };
@@ -3344,9 +3334,7 @@
 		516A4A5B120A2CCD00C05B7F /* APIError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIError.h; sourceTree = "<group>"; };
 		517A33B3130B308C00F80CB5 /* WKApplicationCacheManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKApplicationCacheManager.cpp; sourceTree = "<group>"; };
 		517A33B4130B308C00F80CB5 /* WKApplicationCacheManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKApplicationCacheManager.h; sourceTree = "<group>"; };
-		617A52D61F43A9B600DCDC0A /* ServiceWorkerFetchClientMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSWServerConnectionMessages.h; sourceTree = "<group>"; };
 		517A52D61F43A9B600DCDC0A /* WebSWServerConnectionMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSWServerConnectionMessages.h; sourceTree = "<group>"; };
-		617A52D71F43A9B600DCDC0A /* ServiceWorkerClientFetchMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ServiceWorkerClientFetchMessageReceiver.cpp; sourceTree = "<group>"; };
 		517A52D71F43A9B600DCDC0A /* WebSWServerConnectionMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebSWServerConnectionMessageReceiver.cpp; sourceTree = "<group>"; };
 		517A53021F4793B200DCDC0A /* WebSWClientConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSWClientConnection.h; sourceTree = "<group>"; };
 		517A53031F4793B200DCDC0A /* WebSWClientConnection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebSWClientConnection.cpp; sourceTree = "<group>"; };
@@ -6180,11 +6168,6 @@
 		5118E9981F295259003EF9F5 /* Storage */ = {
 			isa = PBXGroup;
 			children = (
-				4131F3D01F96BCC80059995A /* ServiceWorkerClientFetch.cpp */,
-				4131F3CE1F96A4950059995A /* ServiceWorkerClientFetch.h */,
-				4131F3CF1F96A9360059995A /* ServiceWorkerClientFetch.messages.in */,
-				4131F3D31F96E9310059995A /* ServiceWorkerContextManager.cpp */,
-				4131F3D21F96E9300059995A /* ServiceWorkerContextManager.h */,
 				51BEB6291F3A5ACD005029B9 /* WebServiceWorkerProvider.cpp */,
 				51BEB62A1F3A5ACD005029B9 /* WebServiceWorkerProvider.h */,
 				517A53031F4793B200DCDC0A /* WebSWClientConnection.cpp */,
@@ -8027,7 +8010,6 @@
 				1BBBE49E19B66C53006B7D81 /* RemoteWebInspectorUIMessageReceiver.cpp */,
 				E18E6913169B667B009B6670 /* SecItemShimProxyMessageReceiver.cpp */,
 				E18E6914169B667B009B6670 /* SecItemShimProxyMessages.h */,
-				617A52D71F43A9B600DCDC0A /* ServiceWorkerClientFetchConnectionMessageReceiver.cpp */,
 				2DE6943B18BD2A68005C15E5 /* SmartMagnificationControllerMessageReceiver.cpp */,
 				2DE6943C18BD2A68005C15E5 /* SmartMagnificationControllerMessages.h */,
 				1A334DEB16DE8F88006A8E38 /* StorageAreaMapMessageReceiver.cpp */,
@@ -8799,7 +8781,6 @@
 				E18E690C169B563F009B6670 /* SecItemShimProxy.h in Headers */,
 				E18E6918169B667B009B6670 /* SecItemShimProxyMessages.h in Headers */,
 				514D9F5719119D35000063A7 /* ServicesController.h in Headers */,
-				4131F3D51F96E9350059995A /* ServiceWorkerContextManager.h in Headers */,
 				1AFDE65A1954A42B00C48FFA /* SessionState.h in Headers */,
 				1A002D49196B345D00B9AD44 /* SessionStateCoding.h in Headers */,
 				753E3E0E1887398900188496 /* SessionTracker.h in Headers */,
@@ -10389,9 +10370,6 @@
 				E18E690B169B563F009B6670 /* SecItemShimProxy.cpp in Sources */,
 				E18E6917169B667B009B6670 /* SecItemShimProxyMessageReceiver.cpp in Sources */,
 				514D9F5819119D35000063A7 /* ServicesController.mm in Sources */,
-				4131F3D11F96BCCC0059995A /* ServiceWorkerClientFetch.cpp in Sources */,
-				617A52D81F43A9DA00DCDC0A /* ServiceWorkerClientFetchConnectionMessageReceiver.cpp in Sources */,
-				4131F3D41F96E9350059995A /* ServiceWorkerContextManager.cpp in Sources */,
 				1AFDE6591954A42B00C48FFA /* SessionState.cpp in Sources */,
 				1A002D48196B345D00B9AD44 /* SessionStateCoding.mm in Sources */,
 				1A7284481959F8040007BCE5 /* SessionStateConversion.cpp in Sources */,

Modified: trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp (223691 => 223692)


--- trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp	2017-10-19 17:58:21 UTC (rev 223692)
@@ -43,7 +43,6 @@
 #include "WebPageProxyMessages.h"
 #include "WebProcess.h"
 #include "WebResourceLoader.h"
-#include "WebServiceWorkerProvider.h"
 #include "WebURLSchemeHandlerProxy.h"
 #include "WebURLSchemeTaskProxy.h"
 #include <WebCore/ApplicationCacheHost.h>
@@ -216,29 +215,6 @@
         }
     }
 
-#if ENABLE(SERVICE_WORKER)
-    WebServiceWorkerProvider::singleton().handleFetch(resourceLoader, resource, webPage ? webPage->sessionID() : PAL::SessionID::defaultSessionID(), [trackingParameters, shouldClearReferrerOnHTTPSToHTTPRedirect, maximumBufferingTime = maximumBufferingTime(resource), resourceLoader = makeRef(resourceLoader)] (ServiceWorkerClientFetch::Result result) mutable {
-        if (result != ServiceWorkerClientFetch::Result::Unhandled)
-            return;
-
-        LOG(NetworkScheduling, "(WebProcess) WebLoaderStrategy::scheduleLoad, url '%s' will be scheduled through ServiceWorker handle fetch algorithm", resourceLoader->url().string().latin1().data());
-        WebProcess::singleton().webLoaderStrategy().scheduleLoadFromNetworkProcess(resourceLoader.get(), resourceLoader->originalRequest(), WTFMove(trackingParameters), shouldClearReferrerOnHTTPSToHTTPRedirect, maximumBufferingTime);
-    });
-#else
-    LOG(NetworkScheduling, "(WebProcess) WebLoaderStrategy::scheduleLoad, url '%s' will be scheduled through ServiceWorker handle fetch algorithm", resourceLoader.url().string().latin1().data());
-    scheduleLoadFromNetworkProcess(resourceLoader, resourceLoader.request(), trackingParameters, shouldClearReferrerOnHTTPSToHTTPRedirect, maximumBufferingTime(resource));
-#endif
-}
-
-void WebLoaderStrategy::scheduleLoadFromNetworkProcess(ResourceLoader& resourceLoader, const ResourceRequest& request, const WebResourceLoader::TrackingParameters& trackingParameters, bool shouldClearReferrerOnHTTPSToHTTPRedirect, Seconds maximumBufferingTime)
-{
-    ResourceLoadIdentifier identifier = resourceLoader.identifier();
-    ASSERT(identifier);
-
-    WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(resourceLoader.frameLoader()->client());
-    WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : nullptr;
-    WebPage* webPage = webFrame ? webFrame->page() : nullptr;
-
     LOG(NetworkScheduling, "(WebProcess) WebLoaderStrategy::scheduleLoad, url '%s' will be scheduled with the NetworkProcess with priority %d", resourceLoader.url().string().latin1().data(), static_cast<int>(resourceLoader.request().priority()));
 
     ContentSniffingPolicy contentSniffingPolicy = resourceLoader.shouldSniffContent() ? SniffContent : DoNotSniffContent;
@@ -249,7 +225,7 @@
     loadParameters.webPageID = webPage ? webPage->pageID() : 0;
     loadParameters.webFrameID = webFrame ? webFrame->frameID() : 0;
     loadParameters.sessionID = webPage ? webPage->sessionID() : PAL::SessionID::defaultSessionID();
-    loadParameters.request = request;
+    loadParameters.request = resourceLoader.request();
     loadParameters.contentSniffingPolicy = contentSniffingPolicy;
     loadParameters.storedCredentialsPolicy = storedCredentialsPolicy;
     // If there is no WebFrame then this resource cannot be authenticated with the client.
@@ -257,7 +233,7 @@
     loadParameters.shouldClearReferrerOnHTTPSToHTTPRedirect = shouldClearReferrerOnHTTPSToHTTPRedirect;
     loadParameters.defersLoading = resourceLoader.defersLoading();
     loadParameters.needsCertificateInfo = resourceLoader.shouldIncludeCertificateInfo();
-    loadParameters.maximumBufferingTime = maximumBufferingTime;
+    loadParameters.maximumBufferingTime = maximumBufferingTime(resource);
     loadParameters.derivedCachedDataTypesToRetrieve = resourceLoader.options().derivedCachedDataTypesToRetrieve;
 
     ASSERT((loadParameters.webPageID && loadParameters.webFrameID) || loadParameters.clientCredentialPolicy == ClientCredentialPolicy::CannotAskClientForCredentials);
@@ -324,12 +300,7 @@
         LOG_ERROR("WebLoaderStrategy removing a ResourceLoader that has no identifier.");
         return;
     }
-
-#if ENABLE(SERVICE_WORKER)
-    if (WebServiceWorkerProvider::singleton().cancelFetch(identifier))
-        return;
-#endif
-
+    
     RefPtr<WebResourceLoader> loader = m_webResourceLoaders.take(identifier);
     // Loader may not be registered if we created it, but haven't scheduled yet (a bundle client can decide to cancel such request via willSendRequest).
     if (!loader)

Modified: trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.h (223691 => 223692)


--- trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.h	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.h	2017-10-19 17:58:21 UTC (rev 223692)
@@ -77,8 +77,6 @@
     void addURLSchemeTaskProxy(WebURLSchemeTaskProxy&);
     void removeURLSchemeTaskProxy(WebURLSchemeTaskProxy&);
 
-    void scheduleLoadFromNetworkProcess(WebCore::ResourceLoader&, const WebCore::ResourceRequest&, const WebResourceLoader::TrackingParameters&, bool shouldClearReferrerOnHTTPSToHTTPRedirect, Seconds maximumBufferingTime);
-
 private:
     void scheduleLoad(WebCore::ResourceLoader&, WebCore::CachedResource*, bool shouldClearReferrerOnHTTPSToHTTPRedirect);
     void scheduleInternallyFailedLoad(WebCore::ResourceLoader&);

Deleted: trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerClientFetch.cpp (223691 => 223692)


--- trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerClientFetch.cpp	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerClientFetch.cpp	2017-10-19 17:58:21 UTC (rev 223692)
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include "config.h"
-#include "ServiceWorkerClientFetch.h"
-
-#if ENABLE(SERVICE_WORKER)
-
-#include "DataReference.h"
-#include "WebServiceWorkerProvider.h"
-#include <WebCore/NotImplemented.h>
-
-using namespace WebCore;
-
-namespace WebKit {
-
-ServiceWorkerClientFetch::ServiceWorkerClientFetch(WebServiceWorkerProvider& serviceWorkerProvider, Ref<WebCore::ResourceLoader>&& loader, uint64_t identifier, Ref<IPC::Connection>&& connection, Callback&& callback)
-    : m_serviceWorkerProvider(serviceWorkerProvider)
-    , m_loader(WTFMove(loader))
-    , m_identifier(identifier)
-    , m_connection(WTFMove(connection))
-    , m_callback(WTFMove(callback))
-{
-}
-
-void ServiceWorkerClientFetch::didReceiveResponse(const WebCore::ResourceResponse& response)
-{
-    auto protectedThis = makeRef(*this);
-
-    if (!(response.httpStatusCode() <= 300 || response.httpStatusCode() >= 400 || response.httpStatusCode() == 304 || response.httpStatusCode() == 305 || response.httpStatusCode() == 306)) {
-        // FIXME: Support redirections.
-        notImplemented();
-        m_loader->didFail({ });
-        if (auto callback = WTFMove(m_callback))
-            callback(Result::Succeeded);
-        return;
-    }
-
-    if (response.type() == ResourceResponse::Type::Error) {
-        // Add support for a better error.
-        m_loader->didFail({ });
-        if (auto callback = WTFMove(m_callback))
-            callback(Result::Succeeded);
-        return;
-    }
-
-    m_loader->didReceiveResponse(response);
-    if (auto callback = WTFMove(m_callback))
-        callback(Result::Succeeded);
-}
-
-void ServiceWorkerClientFetch::didReceiveData(const IPC::DataReference& data, int64_t encodedDataLength)
-{
-    m_loader->didReceiveData(reinterpret_cast<const char*>(data.data()), data.size(), encodedDataLength, DataPayloadBytes);
-}
-
-void ServiceWorkerClientFetch::didFinish()
-{
-    ASSERT(!m_callback);
-
-    auto protectedThis = makeRef(*this);
-    m_loader->didFinishLoading(NetworkLoadMetrics { });
-    m_serviceWorkerProvider.fetchFinished(m_identifier);
-}
-
-void ServiceWorkerClientFetch::didFail()
-{
-    if (auto callback = WTFMove(m_callback))
-        callback(Result::Unhandled);
-
-    m_serviceWorkerProvider.fetchFinished(m_identifier);
-}
-
-void ServiceWorkerClientFetch::cancel()
-{
-    if (auto callback = WTFMove(m_callback))
-        callback(Result::Cancelled);
-}
-
-} // namespace WebKit
-
-#endif // ENABLE(SERVICE_WORKER)

Deleted: trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerClientFetch.h (223691 => 223692)


--- trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerClientFetch.h	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerClientFetch.h	2017-10-19 17:58:21 UTC (rev 223692)
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#pragma once
-
-#if ENABLE(SERVICE_WORKER)
-
-#include "MessageReceiver.h"
-#include "MessageSender.h"
-#include <WebCore/ResourceLoader.h>
-#include <wtf/CompletionHandler.h>
-
-namespace WebKit {
-
-class WebServiceWorkerProvider;
-
-class ServiceWorkerClientFetch final : public RefCounted<ServiceWorkerClientFetch>, public IPC::MessageSender, public IPC::MessageReceiver {
-public:
-    enum class Result { Succeeded, Cancelled, Unhandled };
-    using Callback = WTF::CompletionHandler<void(Result)>;
-
-    static Ref<ServiceWorkerClientFetch> create(WebServiceWorkerProvider& serviceWorkerProvider, Ref<WebCore::ResourceLoader>&& loader, uint64_t identifier, Ref<IPC::Connection>&& connection, Callback&& callback)
-    {
-        return adoptRef(*new ServiceWorkerClientFetch { serviceWorkerProvider, WTFMove(loader), identifier, WTFMove(connection), WTFMove(callback) });
-    }
-
-    void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final;
-    void cancel();
-
-    bool isOngoing() const { return !!m_callback; }
-
-private:
-    ServiceWorkerClientFetch(WebServiceWorkerProvider&, Ref<WebCore::ResourceLoader>&&, uint64_t identifier, Ref<IPC::Connection>&&, Callback&&);
-
-    void didReceiveResponse(const WebCore::ResourceResponse&);
-    void didReceiveData(const IPC::DataReference&, int64_t encodedDataLength);
-    void didFinish();
-    void didFail();
-
-    IPC::Connection* messageSenderConnection() final { return m_connection.ptr(); }
-    uint64_t messageSenderDestinationID() final { return m_identifier; }
-
-    WebServiceWorkerProvider& m_serviceWorkerProvider;
-    Ref<WebCore::ResourceLoader> m_loader;
-    uint64_t m_identifier { 0 };
-    Ref<IPC::Connection> m_connection;
-    Callback m_callback;
-};
-
-} // namespace WebKit
-
-#endif // ENABLE(SERVICE_WORKER)

Deleted: trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerClientFetch.messages.in (223691 => 223692)


--- trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerClientFetch.messages.in	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerClientFetch.messages.in	2017-10-19 17:58:21 UTC (rev 223692)
@@ -1,32 +0,0 @@
-# Copyright (C) 2017 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.
-
-#if ENABLE(SERVICE_WORKER)
-
-messages -> ServiceWorkerClientFetch {
-    DidReceiveResponse(WebCore::ResourceResponse response)
-    DidReceiveData(IPC::DataReference data, int64_t encodedDataLength)
-    DidFinish()
-    DidFail()
-}
-
-#endif // ENABLE(SERVICE_WORKER)

Deleted: trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.cpp (223691 => 223692)


--- trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.cpp	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.cpp	2017-10-19 17:58:21 UTC (rev 223692)
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include "config.h"
-#include "ServiceWorkerContextManager.h"
-
-#if ENABLE(SERVICE_WORKER)
-
-#include "Logging.h"
-#include "StorageProcessMessages.h"
-#include "WebCoreArgumentCoders.h"
-#include <WebCore/ResourceRequest.h>
-#include <WebCore/ResourceResponse.h>
-#include <pal/SessionID.h>
-
-using namespace PAL;
-using namespace WebCore;
-
-namespace WebKit {
-
-void ServiceWorkerContextManager::startServiceWorkerContext(uint64_t serverConnectionIdentifier, const ServiceWorkerContextData& data)
-{
-    // FIXME: Provide a sensical session ID.
-    auto thread = ServiceWorkerThread::create(serverConnectionIdentifier, data, SessionID::defaultSessionID());
-    auto threadIdentifier = thread->identifier();
-    auto result = m_workerThreadMap.add(threadIdentifier, WTFMove(thread));
-    ASSERT(result.isNewEntry);
-
-    result.iterator->value->start();
-
-    LOG(ServiceWorker, "Context process PID: %i started worker thread %s\n", getpid(), data.workerID.utf8().data());
-
-    m_connectionToStorageProcess->send(Messages::StorageProcess::ServiceWorkerContextStarted(serverConnectionIdentifier, data.registrationKey, threadIdentifier, data.workerID), 0);
-}
-
-void ServiceWorkerContextManager::startFetch(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier, uint64_t serviceWorkerIdentifier, const ResourceRequest& request, const FetchOptions& options)
-{
-    UNUSED_PARAM(serviceWorkerIdentifier);
-
-    // FIXME: Hard coding some fetches for testing purpose until we implement the creation of fetch event.
-    if (request.url().string().contains("test1")) {
-        ResourceResponse response;
-        response.setURL(request.url());
-        response.setHTTPStatusCode(200);
-        response.setHTTPStatusText(ASCIILiteral("Hello from service worker"));
-        m_connectionToStorageProcess->send(Messages::StorageProcess::DidReceiveFetchResponse(serverConnectionIdentifier, fetchIdentifier, response), 0);
-        m_connectionToStorageProcess->send(Messages::StorageProcess::DidFinishFetch(serverConnectionIdentifier, fetchIdentifier), 0);
-        return;
-    }
-    if (request.url().string().contains("test2")) {
-        ResourceResponse response;
-        response.setURL(request.url());
-        response.setHTTPStatusCode(500);
-        response.setHTTPStatusText(ASCIILiteral("Error from service worker"));
-        m_connectionToStorageProcess->send(Messages::StorageProcess::DidReceiveFetchResponse(serverConnectionIdentifier, fetchIdentifier, response), 0);
-        m_connectionToStorageProcess->send(Messages::StorageProcess::DidFinishFetch(serverConnectionIdentifier, fetchIdentifier), 0);
-        return;
-    }
-    if (request.url().string().contains("test3")) {
-        ResourceResponse response;
-        response.setURL(request.url());
-        response.setHTTPStatusCode(500);
-        response.setHTTPStatusText(ASCIILiteral("Error from service worker"));
-        response.setType(ResourceResponse::Type::Error);
-        m_connectionToStorageProcess->send(Messages::StorageProcess::DidReceiveFetchResponse(serverConnectionIdentifier, fetchIdentifier, response), 0);
-        m_connectionToStorageProcess->send(Messages::StorageProcess::DidFinishFetch(serverConnectionIdentifier, fetchIdentifier), 0);
-        return;
-    }
-
-    m_connectionToStorageProcess->send(Messages::StorageProcess::DidFailFetch(serverConnectionIdentifier, fetchIdentifier), 0);
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(SERVICE_WORKER)

Deleted: trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.h (223691 => 223692)


--- trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.h	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.h	2017-10-19 17:58:21 UTC (rev 223692)
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#pragma once
-
-#if ENABLE(SERVICE_WORKER)
-
-#include "Connection.h"
-#include <WebCore/ServiceWorkerThread.h>
-#include <wtf/HashMap.h>
-
-namespace WebCore {
-struct FetchOptions;
-class ResourceRequest;
-struct ServiceWorkerContextData;
-}
-
-namespace WebKit {
-
-class ServiceWorkerContextManager {
-public:
-    explicit ServiceWorkerContextManager(Ref<IPC::Connection>&& connection)
-        : m_connectionToStorageProcess(WTFMove(connection))
-    {
-    }
-
-    void startServiceWorkerContext(uint64_t serverConnectionIdentifier, const WebCore::ServiceWorkerContextData&);
-    void startFetch(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier, uint64_t serviceWorkerIdentifier, const WebCore::ResourceRequest&, const WebCore::FetchOptions&);
-
-private:
-    Ref<IPC::Connection> m_connectionToStorageProcess;
-    HashMap<uint64_t, RefPtr<WebCore::ServiceWorkerThread>> m_workerThreadMap;
-};
-
-} // namespace WebKit
-
-#endif // ENABLE(SERVICE_WORKER)

Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp (223691 => 223692)


--- trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp	2017-10-19 17:58:21 UTC (rev 223692)
@@ -29,7 +29,6 @@
 #if ENABLE(SERVICE_WORKER)
 
 #include "Logging.h"
-#include "ServiceWorkerClientFetch.h"
 #include "StorageToWebProcessConnectionMessages.h"
 #include "WebCoreArgumentCoders.h"
 #include "WebSWOriginTable.h"
@@ -76,15 +75,6 @@
     m_swOriginTable->setSharedMemory(handle);
 }
 
-Ref<ServiceWorkerClientFetch> WebSWClientConnection::startFetch(WebServiceWorkerProvider& provider, Ref<WebCore::ResourceLoader>&& loader, uint64_t identifier, ServiceWorkerClientFetch::Callback&& callback)
-{
-    ASSERT(loader->options().serviceWorkersMode == ServiceWorkersMode::All);
-    // FIXME: Decide whether to assert for loader->options().serviceWorkerIdentifier once we have a story for navigation loads.
-
-    send(Messages::WebSWServerConnection::StartFetch(identifier, loader->options().serviceWorkerIdentifier, loader->originalRequest(), loader->options()));
-    return ServiceWorkerClientFetch::create(provider, WTFMove(loader), identifier, m_connection.get(), WTFMove(callback));
-}
-
 } // namespace WebKit
 
 #endif // ENABLE(SERVICE_WORKER)

Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h (223691 => 223692)


--- trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h	2017-10-19 17:58:21 UTC (rev 223692)
@@ -30,7 +30,6 @@
 #include "Connection.h"
 #include "MessageReceiver.h"
 #include "MessageSender.h"
-#include "ServiceWorkerClientFetch.h"
 #include "SharedMemory.h"
 #include <WebCore/SWClientConnection.h>
 #include <pal/SessionID.h>
@@ -38,13 +37,11 @@
 
 namespace WebCore {
 struct ExceptionData;
-class ResourceLoader;
 }
 
 namespace WebKit {
 
 class WebSWOriginTable;
-class WebServiceWorkerProvider;
 
 class WebSWClientConnection : public WebCore::SWClientConnection, public IPC::MessageSender, public IPC::MessageReceiver {
 public:
@@ -61,7 +58,6 @@
     void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final;
 
     bool hasServiceWorkerRegisteredForOrigin(const WebCore::SecurityOrigin&) const final;
-    Ref<ServiceWorkerClientFetch> startFetch(WebServiceWorkerProvider&, Ref<WebCore::ResourceLoader>&&, uint64_t identifier, ServiceWorkerClientFetch::Callback&&);
 
 private:
     void scheduleStorageJob(const WebCore::ServiceWorkerJobData&);

Modified: trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.cpp (223691 => 223692)


--- trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.cpp	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.cpp	2017-10-19 17:58:21 UTC (rev 223692)
@@ -58,60 +58,6 @@
     return WebProcess::singleton().webToStorageProcessConnection()->serviceWorkerConnectionForSession(sessionID);
 }
 
-static inline bool shouldHandleFetch(const WebSWClientConnection& connection, CachedResource* resource, const ResourceLoaderOptions& options)
-{
-    if (options.serviceWorkersMode != ServiceWorkersMode::All)
-        return false;
-
-    // FIXME: We should probably assert that options.serviceWorkersIdentifier is not null.
-    if (isPotentialNavigationOrSubresourceRequest(options.destination))
-        return false;
-
-    // FIXME: Implement non-subresource request loads.
-    if (isNonSubresourceRequest(options.destination))
-        return false;
-
-    if (!resource)
-        return false;
-
-    return connection.hasServiceWorkerRegisteredForOrigin(*resource->origin());
-}
-
-void WebServiceWorkerProvider::handleFetch(ResourceLoader& loader, CachedResource* resource, PAL::SessionID sessionID, ServiceWorkerClientFetch::Callback&& callback)
-{
-    auto& connection = WebProcess::singleton().webToStorageProcessConnection()->serviceWorkerConnectionForSession(sessionID);
-
-    if (!shouldHandleFetch(connection, resource, loader.options())) {
-        // FIXME: Add an option to error resource load for DTL to actually go through preflight.
-        callback(ServiceWorkerClientFetch::Result::Unhandled);
-        return;
-    }
-
-    auto fetch = connection.startFetch(*this, loader, loader.identifier(), WTFMove(callback));
-    ASSERT(fetch->isOngoing());
-
-    m_ongoingFetchTasks.add(loader.identifier(), WTFMove(fetch));
-}
-
-bool WebServiceWorkerProvider::cancelFetch(uint64_t fetchIdentifier)
-{
-    auto fetch = m_ongoingFetchTasks.take(fetchIdentifier);
-    if (fetch)
-        (*fetch)->cancel();
-    return !!fetch;
-}
-
-void WebServiceWorkerProvider::fetchFinished(uint64_t fetchIdentifier)
-{
-    m_ongoingFetchTasks.take(fetchIdentifier);
-}
-
-void WebServiceWorkerProvider::didReceiveServiceWorkerClientFetchMessage(IPC::Connection& connection, IPC::Decoder& decoder)
-{
-    if (auto fetch = m_ongoingFetchTasks.get(decoder.destinationID()))
-        fetch->didReceiveMessage(connection, decoder);
-}
-
 } // namespace WebKit
 
 #endif // ENABLE(SERVICE_WORKER)

Modified: trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.h (223691 => 223692)


--- trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.h	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.h	2017-10-19 17:58:21 UTC (rev 223692)
@@ -27,7 +27,6 @@
 
 #if ENABLE(SERVICE_WORKER)
 
-#include "ServiceWorkerClientFetch.h"
 #include <WebCore/ServiceWorkerProvider.h>
 #include <wtf/NeverDestroyed.h>
 
@@ -37,12 +36,6 @@
 public:
     static WebServiceWorkerProvider& singleton();
 
-    void handleFetch(WebCore::ResourceLoader&, WebCore::CachedResource*, PAL::SessionID, ServiceWorkerClientFetch::Callback&&);
-    bool cancelFetch(uint64_t fetchIdentifier);
-    void fetchFinished(uint64_t fetchIdentifier);
-
-    void didReceiveServiceWorkerClientFetchMessage(IPC::Connection&, IPC::Decoder&);
-
 private:
     friend NeverDestroyed<WebServiceWorkerProvider>;
     WebServiceWorkerProvider();
@@ -49,7 +42,6 @@
 
     WebCore::SWClientConnection& serviceWorkerConnectionForSession(PAL::SessionID) final;
 
-    HashMap<uint64_t, Ref<ServiceWorkerClientFetch>> m_ongoingFetchTasks;
 }; // class WebServiceWorkerProvider
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/WebProcess/Storage/WebToStorageProcessConnection.cpp (223691 => 223692)


--- trunk/Source/WebKit/WebProcess/Storage/WebToStorageProcessConnection.cpp	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/Source/WebKit/WebProcess/Storage/WebToStorageProcessConnection.cpp	2017-10-19 17:58:21 UTC (rev 223692)
@@ -27,13 +27,11 @@
 #include "config.h"
 #include "WebToStorageProcessConnection.h"
 
-#include "ServiceWorkerClientFetchMessages.h"
 #include "StorageToWebProcessConnectionMessages.h"
 #include "WebIDBConnectionToServerMessages.h"
 #include "WebProcess.h"
 #include "WebSWClientConnection.h"
 #include "WebSWClientConnectionMessages.h"
-#include "WebServiceWorkerProvider.h"
 
 using namespace PAL;
 using namespace WebCore;
@@ -69,10 +67,6 @@
             serviceWorkerConnection->didReceiveMessage(connection, decoder);
         return;
     }
-    if (decoder.messageReceiverName() == Messages::ServiceWorkerClientFetch::messageReceiverName()) {
-        WebServiceWorkerProvider::singleton().didReceiveServiceWorkerClientFetchMessage(connection, decoder);
-        return;
-    }
 #endif
     ASSERT_NOT_REACHED();
 }

Modified: trunk/Source/WebKit/WebProcess/WebProcess.cpp (223691 => 223692)


--- trunk/Source/WebKit/WebProcess/WebProcess.cpp	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/Source/WebKit/WebProcess/WebProcess.cpp	2017-10-19 17:58:21 UTC (rev 223692)
@@ -40,7 +40,6 @@
 #include "NetworkProcessConnection.h"
 #include "NetworkSession.h"
 #include "PluginProcessConnectionManager.h"
-#include "ServiceWorkerContextManager.h"
 #include "SessionTracker.h"
 #include "StatisticsData.h"
 #include "StorageProcessMessages.h"
@@ -106,6 +105,7 @@
 #include <WebCore/ResourceLoadObserver.h>
 #include <WebCore/ResourceLoadStatistics.h>
 #include <WebCore/RuntimeApplicationChecks.h>
+#include <WebCore/SWContextManager.h>
 #include <WebCore/SchemeRegistry.h>
 #include <WebCore/SecurityOrigin.h>
 #include <WebCore/ServiceWorkerContextData.h>
@@ -1622,7 +1622,7 @@
 #if ENABLE(SERVICE_WORKER)
 void WebProcess::getWorkerContextConnection()
 {
-    ASSERT(!m_serviceWorkerManager);
+    ASSERT(!m_workerContextConnection);
 
 #if USE(UNIX_DOMAIN_SOCKETS)
     IPC::Connection::SocketPair socketPair = IPC::Connection::createPlatformConnection();
@@ -1642,29 +1642,22 @@
     RELEASE_ASSERT_NOT_REACHED();
 #endif
 
-    auto workerContextConnection = IPC::Connection::createServerConnection(connectionIdentifier, *this);
-    workerContextConnection->open();
-    m_serviceWorkerManager =  ServiceWorkerContextManager(WTFMove(workerContextConnection));
+    m_workerContextConnection = IPC::Connection::createServerConnection(connectionIdentifier, *this);
+    m_workerContextConnection->open();
+
     WebProcess::singleton().parentProcessConnection()->send(Messages::WebProcessProxy::DidGetWorkerContextConnection(connectionClientPort), 0);
 }
 
 void WebProcess::startServiceWorkerContext(uint64_t serverConnectionIdentifier, const ServiceWorkerContextData& data)
 {
-    ASSERT(m_serviceWorkerManager);
-    if (!m_serviceWorkerManager)
-        return;
-
-    m_serviceWorkerManager->startServiceWorkerContext(serverConnectionIdentifier, data);
+    auto contextResult = SWContextManager::singleton().startServiceWorkerContext(serverConnectionIdentifier, data);
+    
+    if (contextResult.hasException())
+        m_workerContextConnection->send(Messages::StorageProcess::ServiceWorkerContextFailedToStart(serverConnectionIdentifier, data.registrationKey, data.workerID, contextResult.exception().message()), 0);
+    else
+        m_workerContextConnection->send(Messages::StorageProcess::ServiceWorkerContextStarted(serverConnectionIdentifier, data.registrationKey, contextResult.returnValue(), data.workerID), 0);
 }
 
-void WebProcess::startFetchInServiceWorker(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier, uint64_t serviceWorkerIdentifier, const ResourceRequest& request, const FetchOptions& options)
-{
-    if (!m_serviceWorkerManager)
-        return;
-
-    m_serviceWorkerManager->startFetch(serverConnectionIdentifier, fetchIdentifier, serviceWorkerIdentifier, request, options);
-}
-
 #endif
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/WebProcess/WebProcess.h (223691 => 223692)


--- trunk/Source/WebKit/WebProcess/WebProcess.h	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/Source/WebKit/WebProcess/WebProcess.h	2017-10-19 17:58:21 UTC (rev 223692)
@@ -30,7 +30,6 @@
 #include "PluginProcessConnectionManager.h"
 #include "ResourceCachesToClear.h"
 #include "SandboxExtension.h"
-#include "ServiceWorkerContextManager.h"
 #include "TextCheckerState.h"
 #include "ViewUpdateDispatcher.h"
 #include "WebInspectorInterruptDispatcher.h"
@@ -301,7 +300,7 @@
 #if ENABLE(SERVICE_WORKER)
     void getWorkerContextConnection();
     void startServiceWorkerContext(uint64_t serverConnectionIdentifier, const WebCore::ServiceWorkerContextData&);
-    void startFetchInServiceWorker(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier, uint64_t serviceWorkerIdentifier, const WebCore::ResourceRequest&, const WebCore::FetchOptions&);
+    RefPtr<IPC::Connection> m_workerContextConnection;
 #endif
 
     void releasePageCache();
@@ -439,9 +438,6 @@
 #if PLATFORM(WAYLAND)
     std::unique_ptr<WaylandCompositorDisplay> m_waylandCompositorDisplay;
 #endif
-#if ENABLE(SERVICE_WORKER)
-    std::optional<ServiceWorkerContextManager> m_serviceWorkerManager;
-#endif
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/WebProcess/WebProcess.messages.in (223691 => 223692)


--- trunk/Source/WebKit/WebProcess/WebProcess.messages.in	2017-10-19 16:27:44 UTC (rev 223691)
+++ trunk/Source/WebKit/WebProcess/WebProcess.messages.in	2017-10-19 17:58:21 UTC (rev 223692)
@@ -117,6 +117,5 @@
 #if ENABLE(SERVICE_WORKER)
     GetWorkerContextConnection()
     StartServiceWorkerContext(uint64_t serverConnectionIdentifier, struct WebCore::ServiceWorkerContextData contextData)
-    StartFetchInServiceWorker(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier, uint64_t serviceWorkerIdentifier, WebCore::ResourceRequest request, struct WebCore::FetchOptions options)
 #endif
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to