Skip to content
Permalink
Browse files
Add preliminary support for ServiceWorker Handle Fetch
https://bugs.webkit.org/show_bug.cgi?id=178475

Patch by Youenn Fablet <youenn@apple.com> on 2017-10-18
Reviewed by Chris Dumez.

Source/WebCore:

Test: http/tests/workers/service/basic-fetch.https.html

Adding parameters to allow WebKit to do loading through Service Worker or through regular networking.
A script context is now storing its selected service worker identifier. This should be fully implemented later on.
This selected service worker identifier is passed to loading code as a ResourceLoaderOptions field.
Service workers mode is also added as a ResourceLoaderOptions field so that the service worker can be bypassed.

* WebCore.xcodeproj/project.pbxproj:
* dom/ScriptExecutionContext.h:
(WebCore::ScriptExecutionContext::selectedServiceWorkerIdentifier const):
(WebCore::ScriptExecutionContext::setSelectedServiceWorkerIdentifier):
* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
* loader/FetchOptions.h:
(WebCore::isPotentialNavigationOrSubresourceRequest):
(WebCore::isNonSubresourceRequest):
* 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/ServiceWorkerProvider.h:
* workers/service/context/SWContextManager.cpp: Removed.
* workers/service/context/ServiceWorkerThread.h:
* workers/service/server/SWServer.h:

Source/WebKit:

Preliminary support of Handle Fetch algorithm and integration with fetch spec.
Adding ServiceWorkerClientFetch as the class responsible to do the load through ServiceWorker.
It is similar to WebResourceLoader that do the load through NetworkProcess.
In case ServiceWorkerClientFetch is not able to load through ServiceWorker,
it will fallback to WebResourceLoader through a fallback callback.

Loading through Service Worker is done currently if:
- There is a service worker registered for that origin
- Request is a subresource
- service workers mode is all
There will be cases where the service worker will not do the loading, for instance when fetch event handler is not set.
Future work should try to reduce the cases where the IPC dance is done unnecessarily.

ServiceWorkerClientFetch is responsible to adapt the ServiceWorker response to ResourceLoader.
In particular, it is calling ResourceLoader error callback if response is of type error.
It should call ResourceLoader redirection callback if response is a redirection response.
This will be done as a follow-up.

Implementing the IPC communication dedicated to fetch between WebProcess and ServiceWorker through StorageProcess.
In the future, WebProcess should create a direct IPC communication to the ServiceWorker process.

Moved SWContextManager from WebCore to WebKit and renamed it to ServiceWorkerContextManager.
This class is moved to WebKit as it will have to handle IPC and having a separation will add some unnecessary boilerplate.

* DerivedSources.make:
* StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
(WebKit::WebSWServerConnection::startFetch):
(WebKit::WebSWServerConnection::didReceiveFetchResponse):
(WebKit::WebSWServerConnection::didReceiveFetchData):
(WebKit::WebSWServerConnection::didFinishFetch):
(WebKit::WebSWServerConnection::failedFetch):
* StorageProcess/ServiceWorker/WebSWServerConnection.h:
* StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
* StorageProcess/StorageProcess.cpp:
(WebKit::StorageProcess::failedFetch):
(WebKit::StorageProcess::didReceiveFetchResponse):
(WebKit::StorageProcess::didReceiveFetchData):
(WebKit::StorageProcess::didFinishFetch):
* StorageProcess/StorageProcess.h:
* StorageProcess/StorageProcess.messages.in:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::scheduleLoad):
(WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
* WebProcess/Network/WebLoaderStrategy.h:
* WebProcess/Storage/ServiceWorkerClientFetch.cpp: Added.
(WebKit::ServiceWorkerClientFetch::didReceiveResponse):
(WebKit::ServiceWorkerClientFetch::didReceiveData):
(WebKit::ServiceWorkerClientFetch::didFinishFetch):
(WebKit::ServiceWorkerClientFetch::didFail):
* WebProcess/Storage/ServiceWorkerClientFetch.h: Added.
* WebProcess/Storage/ServiceWorkerClientFetch.messages.in: Added.
* WebProcess/Storage/ServiceWorkerContextManager.cpp: Renamed from Source/WebCore/workers/service/context/SWContextManager.cpp.
(WebKit::ServiceWorkerContextManager::startServiceWorkerContext):
(WebKit::ServiceWorkerContextManager::startFetch):
* WebProcess/Storage/ServiceWorkerContextManager.h: Renamed from Source/WebCore/workers/service/context/SWContextManager.h.
(WebKit::ServiceWorkerContextManager::ServiceWorkerContextManager):
* WebProcess/Storage/WebSWClientConnection.cpp:
(WebKit::WebSWClientConnection::startFetch):
* WebProcess/Storage/WebSWClientConnection.h:
* WebProcess/Storage/WebServiceWorkerProvider.cpp:
(WebKit::shouldHandleFetch):
(WebKit::WebServiceWorkerProvider::handleFetch):
(WebKit::WebServiceWorkerProvider::didReceiveServiceWorkerClientFetchMessage):
* WebProcess/Storage/WebServiceWorkerProvider.h:
* WebProcess/Storage/WebToStorageProcessConnection.cpp:
(WebKit::WebToStorageProcessConnection::didReceiveMessage):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::getWorkerContextConnection):
(WebKit::WebProcess::startServiceWorkerContext):
(WebKit::WebProcess::startFetchInServiceWorker):
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in:

LayoutTests:

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

Canonical link: https://commits.webkit.org/194695@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223650 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
youennf authored and webkit-commit-queue committed Oct 19, 2017
1 parent fd68364 commit 48e8de042c721f40d5370a560ab8f23d283967a0
Showing 44 changed files with 796 additions and 109 deletions.
@@ -1,3 +1,15 @@
2017-10-18 Youenn Fablet <youenn@apple.com>

Add preliminary support for ServiceWorker Handle Fetch
https://bugs.webkit.org/show_bug.cgi?id=178475

Reviewed by Chris Dumez.

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

2017-10-18 Youenn Fablet <youenn@apple.com>

TestController should clear all fetch caches when resetting its state
@@ -0,0 +1,6 @@
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

@@ -0,0 +1,9 @@
<html>
<head>
<script src="resources/sw-test-pre.js"></script>
</head>
<body>

<script src="resources/basic-fetch.js"></script>
</body>
</html>
@@ -0,0 +1 @@
// FIXME: register an onfetch event handler and handle "test1", "test2" and "test3" URLs
@@ -0,0 +1,34 @@
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();
@@ -1,3 +1,41 @@
2017-10-18 Youenn Fablet <youenn@apple.com>

Add preliminary support for ServiceWorker Handle Fetch
https://bugs.webkit.org/show_bug.cgi?id=178475

Reviewed by Chris Dumez.

Test: http/tests/workers/service/basic-fetch.https.html

Adding parameters to allow WebKit to do loading through Service Worker or through regular networking.
A script context is now storing its selected service worker identifier. This should be fully implemented later on.
This selected service worker identifier is passed to loading code as a ResourceLoaderOptions field.
Service workers mode is also added as a ResourceLoaderOptions field so that the service worker can be bypassed.

* WebCore.xcodeproj/project.pbxproj:
* dom/ScriptExecutionContext.h:
(WebCore::ScriptExecutionContext::selectedServiceWorkerIdentifier const):
(WebCore::ScriptExecutionContext::setSelectedServiceWorkerIdentifier):
* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
* loader/FetchOptions.h:
(WebCore::isPotentialNavigationOrSubresourceRequest):
(WebCore::isNonSubresourceRequest):
* 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/ServiceWorkerProvider.h:
* workers/service/context/SWContextManager.cpp: Removed.
* workers/service/context/ServiceWorkerThread.h:
* workers/service/server/SWServer.h:

2017-10-18 Zalan Bujtas <zalan@apple.com>

[FrameView::layout cleanup] Group related pre-layout code to improve readability
@@ -2327,8 +2327,6 @@
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, ); }; };
@@ -10230,8 +10228,6 @@
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>"; };
@@ -19089,8 +19085,6 @@
children = (
517C87111F8EE72F00EB8076 /* ServiceWorkerThread.cpp */,
517C87101F8EE72E00EB8076 /* ServiceWorkerThread.h */,
517C87081F8EB9BF00EB8076 /* SWContextManager.cpp */,
517C87091F8EB9C000EB8076 /* SWContextManager.h */,
);
path = context;
sourceTree = "<group>";
@@ -30636,7 +30630,6 @@
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 */,
@@ -34368,7 +34361,6 @@
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 */,
@@ -230,6 +230,11 @@ class ScriptExecutionContext : public SecurityContext {

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:
@@ -297,6 +302,10 @@ class ScriptExecutionContext : public SecurityContext {
#if !ASSERT_DISABLED || ENABLE(SECURITY_ASSERTIONS)
bool m_activeDOMObjectRemovalForbidden { false };
#endif

#if ENABLE(SERVICE_WORKER)
uint64_t m_serviceWorkerIdentifier { 0 };
#endif
};

} // namespace WebCore
@@ -103,6 +103,11 @@ DocumentThreadableLoader::DocumentThreadableLoader(Document& document, Threadabl
{
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());

@@ -69,6 +69,21 @@ inline FetchOptions::FetchOptions(Destination destination, Mode mode, Credential
{
}

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 {
@@ -92,6 +92,11 @@ enum class InitiatorContext {
Worker,
};

enum class ServiceWorkersMode {
All,
None,
};

struct ResourceLoaderOptions : public FetchOptions {
ResourceLoaderOptions() { }

@@ -124,6 +129,8 @@ struct ResourceLoaderOptions : public FetchOptions {
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 };
@@ -55,7 +55,7 @@ static const char loadResourceSynchronouslyMode[] = "loadResourceSynchronouslyMo
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.securityOrigin(), workerGlobalScope.contentSecurityPolicy()))
, m_bridge(*new MainThreadBridge(m_workerClientWrapper.get(), workerGlobalScope.thread().workerLoaderProxy(), taskMode, WTFMove(request), options, referrer.isEmpty() ? workerGlobalScope.url().strippedForUseAsReferrer() : referrer, workerGlobalScope))
{
}

@@ -101,12 +101,15 @@ LoaderTaskOptions::LoaderTaskOptions(const ThreadableLoaderOptions& options, con
}

WorkerThreadableLoader::MainThreadBridge::MainThreadBridge(ThreadableLoaderClientWrapper& workerClientWrapper, WorkerLoaderProxy& loaderProxy, const String& taskMode,
ResourceRequest&& request, const ThreadableLoaderOptions& options, const String& outgoingReferrer,
const SecurityOrigin* securityOrigin, const ContentSecurityPolicy* contentSecurityPolicy)
ResourceRequest&& request, const ThreadableLoaderOptions& options, const String& outgoingReferrer, WorkerGlobalScope& globalScope)
: m_workerClientWrapper(&workerClientWrapper)
, m_loaderProxy(loaderProxy)
, m_taskMode(taskMode.isolatedCopy())
{

auto* securityOrigin = globalScope.securityOrigin();
auto* contentSecurityPolicy = globalScope.contentSecurityPolicy();

ASSERT(securityOrigin);
ASSERT(contentSecurityPolicy);

@@ -121,6 +124,11 @@ WorkerThreadableLoader::MainThreadBridge::MainThreadBridge(ThreadableLoaderClien
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());
@@ -88,7 +88,7 @@ namespace WebCore {
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, const SecurityOrigin*, const ContentSecurityPolicy*);
MainThreadBridge(ThreadableLoaderClientWrapper&, WorkerLoaderProxy&, const String& taskMode, ResourceRequest&&, const ThreadableLoaderOptions&, const String& outgoingReferrer, WorkerGlobalScope&);
void cancel();
void destroy();

@@ -100,7 +100,7 @@ class ResourceRequestBase {

WEBCORE_EXPORT String httpContentType() const;
WEBCORE_EXPORT void setHTTPContentType(const String&);
void clearHTTPContentType();
WEBCORE_EXPORT void clearHTTPContentType();

bool hasHTTPHeader(HTTPHeaderName) const;

@@ -153,7 +153,7 @@ class ResourceResponseBase {
return 1280;
}

void setType(Type);
WEBCORE_EXPORT void setType(Type);
Type type() const { return m_type; }

void setRedirected(bool isRedirected) { m_isRedirected = isRedirected; }
@@ -61,7 +61,7 @@ class WorkerThread : public RefCounted<WorkerThread> {
public:
virtual ~WorkerThread();

bool start();
WEBCORE_EXPORT bool start();
void stop();

ThreadIdentifier threadID() const { return m_thread ? m_thread->id() : 0; }
@@ -179,6 +179,9 @@ void ServiceWorkerContainer::jobResolvedWithRegistration(ServiceWorkerJob& job,
return;
}

// FIXME: Implement proper selection of service workers.
context->setSelectedServiceWorkerIdentifier(data.identifier);

auto registration = ServiceWorkerRegistration::create(*context, data);
job.promise().resolve<IDLInterface<ServiceWorkerRegistration>>(registration.get());
}

This file was deleted.

@@ -52,7 +52,7 @@ class ServiceWorkerThread : public WorkerThread, public ThreadSafeIdentified<Ser
void runEventLoop() override;

private:
ServiceWorkerThread(uint64_t serverConnectionIdentifier, const ServiceWorkerContextData&, PAL::SessionID);
WEBCORE_EXPORT ServiceWorkerThread(uint64_t serverConnectionIdentifier, const ServiceWorkerContextData&, PAL::SessionID);

uint64_t m_serverConnectionIdentifier;
ServiceWorkerContextData m_data;

0 comments on commit 48e8de0

Please sign in to comment.