Diff
Modified: trunk/LayoutTests/ChangeLog (223607 => 223608)
--- trunk/LayoutTests/ChangeLog 2017-10-18 15:16:35 UTC (rev 223607)
+++ trunk/LayoutTests/ChangeLog 2017-10-18 16:12:11 UTC (rev 223608)
@@ -1,3 +1,19 @@
+2017-10-18 Chris Dumez <[email protected]>
+
+ Add an efficient data structure for WebCore to query if there is a Service Worker registered for a given origin
+ https://bugs.webkit.org/show_bug.cgi?id=177876
+ <rdar://problem/34813129>
+
+ Reviewed by Ryosuke Niwa.
+
+ Add layout test coverage. Also rebaseline a few tests now that registration succeeds.
+
+ * http/tests/workers/service/basic-register-exceptions-expected.txt:
+ * http/tests/workers/service/basic-register-expected.txt:
+ * http/tests/workers/service/registration-task-queue-scheduling-1-expected.txt:
+ * http/tests/workers/service/resources/basic-register.js:
+ * http/tests/workers/service/resources/registration-task-queue-scheduling-1.js:
+
2017-10-18 Antti Koivisto <[email protected]>
Resolve ::before and ::after pseudo elements during style resolution
Modified: trunk/LayoutTests/http/tests/workers/service/basic-register-exceptions-expected.txt (223607 => 223608)
--- trunk/LayoutTests/http/tests/workers/service/basic-register-exceptions-expected.txt 2017-10-18 15:16:35 UTC (rev 223607)
+++ trunk/LayoutTests/http/tests/workers/service/basic-register-exceptions-expected.txt 2017-10-18 16:12:11 UTC (rev 223608)
@@ -4,7 +4,7 @@
CONSOLE MESSAGE: line 50: Registration failed with error: TypeError: serviceWorker.register() must be called with a script URL whose path does not contain '%2f' or '%5c'
CONSOLE MESSAGE: line 60: Registration failed with error: TypeError: Scope URL provided to serviceWorker.register() must be either HTTP or HTTPS
CONSOLE MESSAGE: line 70: Registration failed with error: TypeError: Scope URL provided to serviceWorker.register() cannot have a path that contains '%2f' or '%5c'
-CONSOLE MESSAGE: line 10: Registration failed with error: UnknownError: Worker script successfully started, but it has no way to communicate yet
+CONSOLE MESSAGE: line 8: Registered! (unexpectedly)
CONSOLE MESSAGE: line 80: Registration failed with error: SecurityError: Script origin does not match the registering client's origin
CONSOLE MESSAGE: line 91: Registration failed with error: SecurityError: Scope origin does not match the registering client's origin
Modified: trunk/LayoutTests/http/tests/workers/service/basic-register-expected.txt (223607 => 223608)
--- trunk/LayoutTests/http/tests/workers/service/basic-register-expected.txt 2017-10-18 15:16:35 UTC (rev 223607)
+++ trunk/LayoutTests/http/tests/workers/service/basic-register-expected.txt 2017-10-18 16:12:11 UTC (rev 223608)
@@ -1,3 +1,7 @@
-CONSOLE MESSAGE: line 10: Registration failed with error: UnknownError: Worker script successfully started, but it has no way to communicate yet
-CONSOLE MESSAGE: line 21: Registration failed with error: UnknownError: Worker script successfully started, but it has no way to communicate yet
+PASS: No service worker is initially registered for this origin
+PASS: No service worker is initially registered for this origin in private session
+Registered!
+PASS: A service worker is now registered for this origin
+PASS: No service worker is registered for this origin in private session
+Registered!
Modified: trunk/LayoutTests/http/tests/workers/service/registration-task-queue-scheduling-1-expected.txt (223607 => 223608)
--- trunk/LayoutTests/http/tests/workers/service/registration-task-queue-scheduling-1-expected.txt 2017-10-18 15:16:35 UTC (rev 223607)
+++ trunk/LayoutTests/http/tests/workers/service/registration-task-queue-scheduling-1-expected.txt 2017-10-18 16:12:11 UTC (rev 223608)
@@ -1,2 +1,2 @@
-ALERT: Unexpected error received from server: UnknownError: Worker script successfully started, but it has no way to communicate yet
+CONSOLE MESSAGE: line 48: Original window resolved successfully (unexpected)
Modified: trunk/LayoutTests/http/tests/workers/service/resources/basic-register.js (223607 => 223608)
--- trunk/LayoutTests/http/tests/workers/service/resources/basic-register.js 2017-10-18 15:16:35 UTC (rev 223607)
+++ trunk/LayoutTests/http/tests/workers/service/resources/basic-register.js 2017-10-18 16:12:11 UTC (rev 223608)
@@ -3,25 +3,66 @@
finishSWTest();
}
+function log(msg)
+{
+ let console = document.getElementById("console");
+ if (!console) {
+ console = document.createElement("div");
+ console.id = "console";
+ document.body.appendChild(console);
+ }
+ let span = document.createElement("span");
+ span.innerHTML = msg + "<br>";
+ console.appendChild(span);
+}
+
+if (!internals.hasServiceWorkerRegisteredForOrigin(self.origin))
+ log("PASS: No service worker is initially registered for this origin");
+else
+ log("FAIL: A service worker is initially registered for this origin");
+
+testRunner.setPrivateBrowsingEnabled(true);
+
+if (!internals.hasServiceWorkerRegisteredForOrigin(self.origin))
+ log("PASS: No service worker is initially registered for this origin in private session");
+else
+ log("FAIL: A service worker is initially registered for this origin in private session");
+
+testRunner.setPrivateBrowsingEnabled(false);
+
navigator.serviceWorker.register("resources/empty-worker.js", { })
.then(function(r) {
- console.log("Registered!");
+ log("Registered!");
+
+ if (internals.hasServiceWorkerRegisteredForOrigin(self.origin))
+ log("PASS: A service worker is now registered for this origin");
+ else
+ log("FAIL: No service worker is registered for this origin");
+
+ testRunner.setPrivateBrowsingEnabled(true);
+
+ if (!internals.hasServiceWorkerRegisteredForOrigin(self.origin))
+ log("PASS: No service worker is registered for this origin in private session");
+ else
+ log("FAIL: A service worker is registered for this origin in private session");
+
+ testRunner.setPrivateBrowsingEnabled(false);
}, function(e) {
- console.log("Registration failed with error: " + e);
+ log("Registration failed with error: " + e);
})
.catch(function(e) {
- console.log("Exception registering: " + e);
+ log("Exception registering: " + e);
});
navigator.serviceWorker.register("resources/empty-worker-doesnt-exist.js", { })
.then(function(r) {
- console.log("Registered!");
+ log("Registered!");
done();
}, function(e) {
- console.log("Registration failed with error: " + e);
+ log("Registration failed with error: " + e);
done();
})
.catch(function(e) {
- console.log("Exception registering: " + e);
+ log("Exception registering: " + e);
done();
});
Modified: trunk/LayoutTests/http/tests/workers/service/resources/registration-task-queue-scheduling-1.js (223607 => 223608)
--- trunk/LayoutTests/http/tests/workers/service/resources/registration-task-queue-scheduling-1.js 2017-10-18 15:16:35 UTC (rev 223607)
+++ trunk/LayoutTests/http/tests/workers/service/resources/registration-task-queue-scheduling-1.js 2017-10-18 16:12:11 UTC (rev 223608)
@@ -46,7 +46,7 @@
navigator.serviceWorker.register("resources/empty-worker.js", { })
.then(function(r) {
console.log("Original window resolved successfully (unexpected)")
- done();
+ finishSWTest();
}, function(e) {
if (e+"" != "UnknownError: Script URL http://127.0.0.1:8000/workers/service/resources/empty-worker.js fetched with 41 characters, but we're not using the result yet") {
alert("Unexpected error received from server: " + e);
Modified: trunk/Source/WebCore/ChangeLog (223607 => 223608)
--- trunk/Source/WebCore/ChangeLog 2017-10-18 15:16:35 UTC (rev 223607)
+++ trunk/Source/WebCore/ChangeLog 2017-10-18 16:12:11 UTC (rev 223608)
@@ -1,3 +1,31 @@
+2017-10-18 Chris Dumez <[email protected]>
+
+ Add an efficient data structure for WebCore to query if there is a Service Worker registered for a given origin
+ https://bugs.webkit.org/show_bug.cgi?id=177876
+ <rdar://problem/34813129>
+
+ Reviewed by Ryosuke Niwa.
+
+ No new tests, updatdd existing test.
+
+ * dom/Document.h:
+ * testing/Internals.cpp:
+ (WebCore::Internals::hasServiceWorkerRegisteredForOrigin):
+ * testing/Internals.h:
+ * testing/Internals.idl:
+ * workers/service/ServiceWorkerProvider.h:
+ * workers/service/context/SWContextManager.cpp:
+ (WebCore::SWContextManager::startServiceWorkerContext):
+ * workers/service/server/SWClientConnection.h:
+ * workers/service/server/SWServer.cpp:
+ (WebCore::SWServer::Connection::scriptContextStarted):
+ (WebCore::SWServer::scriptContextStarted):
+ * workers/service/server/SWServer.h:
+ * workers/service/server/SWServerRegistration.cpp:
+ (WebCore::SWServerRegistration::scriptContextFailedToStart):
+ (WebCore::SWServerRegistration::scriptContextStarted):
+ * workers/service/server/SWServerRegistration.h:
+
2017-10-18 Sam Weinig <[email protected]>
[Settings] Replace macros in Settings.h/cpp with generated code
Modified: trunk/Source/WebCore/dom/Document.h (223607 => 223608)
--- trunk/Source/WebCore/dom/Document.h 2017-10-18 15:16:35 UTC (rev 223607)
+++ trunk/Source/WebCore/dom/Document.h 2017-10-18 16:12:11 UTC (rev 223608)
@@ -643,7 +643,7 @@
WEBCORE_EXPORT URL completeURL(const String&) const final;
URL completeURL(const String&, const URL& baseURLOverride) const;
- PAL::SessionID sessionID() const final;
+ WEBCORE_EXPORT PAL::SessionID sessionID() const final;
String userAgent(const URL&) const final;
Modified: trunk/Source/WebCore/testing/Internals.cpp (223607 => 223608)
--- trunk/Source/WebCore/testing/Internals.cpp 2017-10-18 15:16:35 UTC (rev 223607)
+++ trunk/Source/WebCore/testing/Internals.cpp 2017-10-18 16:12:11 UTC (rev 223608)
@@ -123,11 +123,14 @@
#include "SVGDocumentExtensions.h"
#include "SVGPathStringBuilder.h"
#include "SVGSVGElement.h"
+#include "SWClientConnection.h"
#include "SchemeRegistry.h"
#include "ScriptedAnimationController.h"
#include "ScrollingCoordinator.h"
#include "ScrollingMomentumCalculator.h"
+#include "SecurityOrigin.h"
#include "SerializedScriptValue.h"
+#include "ServiceWorkerProvider.h"
#include "Settings.h"
#include "ShadowRoot.h"
#include "SourceBuffer.h"
@@ -4187,6 +4190,19 @@
contextDocument()->setConsoleMessageListener(WTFMove(listener));
}
+bool Internals::hasServiceWorkerRegisteredForOrigin(const String& origin)
+{
+#if ENABLE(SERVICE_WORKER)
+ if (!contextDocument())
+ return false;
+
+ return ServiceWorkerProvider::singleton().serviceWorkerConnectionForSession(contextDocument()->sessionID()).hasServiceWorkerRegisteredForOrigin(SecurityOrigin::createFromString(origin));
+#else
+ UNUSED_PARAM(origin);
+ return false;
+#endif
+}
+
void Internals::setResponseSizeWithPadding(FetchResponse& response, uint64_t size)
{
response.setBodySizeWithPadding(size);
Modified: trunk/Source/WebCore/testing/Internals.h (223607 => 223608)
--- trunk/Source/WebCore/testing/Internals.h 2017-10-18 15:16:35 UTC (rev 223607)
+++ trunk/Source/WebCore/testing/Internals.h 2017-10-18 16:12:11 UTC (rev 223608)
@@ -614,6 +614,8 @@
Ref<ExtendableEvent> createTrustedExtendableEvent();
#endif
+ bool hasServiceWorkerRegisteredForOrigin(const String&);
+
private:
explicit Internals(Document&);
Document* contextDocument() const;
Modified: trunk/Source/WebCore/testing/Internals.idl (223607 => 223608)
--- trunk/Source/WebCore/testing/Internals.idl 2017-10-18 15:16:35 UTC (rev 223607)
+++ trunk/Source/WebCore/testing/Internals.idl 2017-10-18 16:12:11 UTC (rev 223608)
@@ -557,4 +557,6 @@
[Conditional=SERVICE_WORKER] Promise<Response> waitForFetchEventToFinish(FetchEvent event);
[Conditional=SERVICE_WORKER] Promise<void> waitForExtendableEventToFinish(ExtendableEvent event);
[Conditional=SERVICE_WORKER] ExtendableEvent createTrustedExtendableEvent();
+
+ boolean hasServiceWorkerRegisteredForOrigin(DOMString origin);
};
Modified: trunk/Source/WebCore/workers/service/ServiceWorkerProvider.h (223607 => 223608)
--- trunk/Source/WebCore/workers/service/ServiceWorkerProvider.h 2017-10-18 15:16:35 UTC (rev 223607)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerProvider.h 2017-10-18 16:12:11 UTC (rev 223608)
@@ -43,7 +43,7 @@
WEBCORE_EXPORT static ServiceWorkerProvider& singleton();
WEBCORE_EXPORT static void setSharedProvider(ServiceWorkerProvider&);
- virtual SWClientConnection& serviceWorkerConnectionForSession(const PAL::SessionID&) = 0;
+ virtual SWClientConnection& serviceWorkerConnectionForSession(PAL::SessionID) = 0;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/workers/service/context/SWContextManager.cpp (223607 => 223608)
--- trunk/Source/WebCore/workers/service/context/SWContextManager.cpp 2017-10-18 15:16:35 UTC (rev 223607)
+++ trunk/Source/WebCore/workers/service/context/SWContextManager.cpp 2017-10-18 16:12:11 UTC (rev 223608)
@@ -51,7 +51,8 @@
// FIXME: Provide a sensical session ID
auto thread = ServiceWorkerThread::create(serverConnectionIdentifier, data, SessionID::defaultSessionID());
- auto result = m_workerThreadMap.add(thread->identifier(), WTFMove(thread));
+ auto threadIdentifier = thread->identifier();
+ auto result = m_workerThreadMap.add(threadIdentifier, WTFMove(thread));
ASSERT(result.isNewEntry);
result.iterator->value->start();
@@ -58,10 +59,7 @@
LOG(ServiceWorker, "Context process PID: %i started worker thread %s\n", getpid(), data.workerID.utf8().data());
- // FIXME: For testing purposes we need to signal a failure with an exception payload.
- // Later with more APIs and infrastructure filled in, testing will be much easier.
-
- return Exception { UnknownError, "Worker script successfully started, but it has no way to communicate yet" };
+ return threadIdentifier;
}
} // namespace WebCore
Modified: trunk/Source/WebCore/workers/service/server/SWClientConnection.h (223607 => 223608)
--- trunk/Source/WebCore/workers/service/server/SWClientConnection.h 2017-10-18 15:16:35 UTC (rev 223607)
+++ trunk/Source/WebCore/workers/service/server/SWClientConnection.h 2017-10-18 16:12:11 UTC (rev 223608)
@@ -34,6 +34,7 @@
namespace WebCore {
class ResourceError;
+class SecurityOrigin;
class SharedBuffer;
struct ExceptionData;
struct ServiceWorkerFetchResult;
@@ -49,6 +50,7 @@
void failedFetchingScript(ServiceWorkerJob&, const ResourceError&);
virtual uint64_t identifier() const = 0;
+ virtual bool hasServiceWorkerRegisteredForOrigin(const SecurityOrigin&) const = 0;
protected:
WEBCORE_EXPORT void jobRejectedInServer(uint64_t jobIdentifier, const ExceptionData&);
Modified: trunk/Source/WebCore/workers/service/server/SWServer.cpp (223607 => 223608)
--- trunk/Source/WebCore/workers/service/server/SWServer.cpp 2017-10-18 15:16:35 UTC (rev 223607)
+++ trunk/Source/WebCore/workers/service/server/SWServer.cpp 2017-10-18 16:12:11 UTC (rev 223608)
@@ -86,6 +86,11 @@
m_server.scriptContextFailedToStart(*this, registrationKey, workerID, message);
}
+void SWServer::Connection::scriptContextStarted(const ServiceWorkerRegistrationKey& registrationKey, uint64_t identifier, const String& workerID)
+{
+ m_server.scriptContextStarted(*this, registrationKey, identifier, workerID);
+}
+
SWServer::SWServer()
{
m_taskThread = Thread::create(ASCIILiteral("ServiceWorker Task Thread"), [this] {
@@ -157,6 +162,14 @@
registration->scriptContextFailedToStart(connection, workerID, message);
}
+void SWServer::scriptContextStarted(Connection& connection, const ServiceWorkerRegistrationKey& registrationKey, uint64_t identifier, const String& workerID)
+{
+ ASSERT(m_connections.contains(connection.identifier()));
+
+ if (auto* registration = m_registrations.get(registrationKey))
+ registration->scriptContextStarted(connection, identifier, workerID);
+}
+
Ref<SWServerWorker> SWServer::createWorker(Connection& connection, const ServiceWorkerRegistrationKey& registrationKey, const URL& url, const String& script, WorkerType type)
{
String workerID = createCanonicalUUIDString();
Modified: trunk/Source/WebCore/workers/service/server/SWServer.h (223607 => 223608)
--- trunk/Source/WebCore/workers/service/server/SWServer.h 2017-10-18 15:16:35 UTC (rev 223607)
+++ trunk/Source/WebCore/workers/service/server/SWServer.h 2017-10-18 16:12:11 UTC (rev 223608)
@@ -55,6 +55,7 @@
WEBCORE_EXPORT virtual ~Connection();
WEBCORE_EXPORT void scriptContextFailedToStart(const ServiceWorkerRegistrationKey&, const String& workerID, const String& message);
+ WEBCORE_EXPORT void scriptContextStarted(const ServiceWorkerRegistrationKey&, uint64_t identifier, const String& workerID);
protected:
WEBCORE_EXPORT Connection(SWServer&, uint64_t identifier);
@@ -97,6 +98,7 @@
void scriptFetchFinished(Connection&, const ServiceWorkerFetchResult&);
void scriptContextFailedToStart(Connection&, const ServiceWorkerRegistrationKey&, const String& workerID, const String& message);
+ void scriptContextStarted(Connection&, const ServiceWorkerRegistrationKey&, uint64_t identifier, const String& workerID);
HashMap<uint64_t, Connection*> m_connections;
HashMap<ServiceWorkerRegistrationKey, std::unique_ptr<SWServerRegistration>> m_registrations;
Modified: trunk/Source/WebCore/workers/service/server/SWServerRegistration.cpp (223607 => 223608)
--- trunk/Source/WebCore/workers/service/server/SWServerRegistration.cpp 2017-10-18 15:16:35 UTC (rev 223607)
+++ trunk/Source/WebCore/workers/service/server/SWServerRegistration.cpp 2017-10-18 16:12:11 UTC (rev 223608)
@@ -88,12 +88,18 @@
void SWServerRegistration::scriptContextFailedToStart(SWServer::Connection&, const String& workerID, const String& message)
{
- ASSERT(m_currentJob);
UNUSED_PARAM(workerID);
rejectCurrentJob(ExceptionData { UnknownError, message });
}
+void SWServerRegistration::scriptContextStarted(SWServer::Connection&, uint64_t identifier, const String& workerID)
+{
+ UNUSED_PARAM(workerID);
+
+ resolveCurrentJob(ServiceWorkerRegistrationData { m_registrationKey, identifier });
+}
+
void SWServerRegistration::startNextJob()
{
ASSERT(isMainThread());
Modified: trunk/Source/WebCore/workers/service/server/SWServerRegistration.h (223607 => 223608)
--- trunk/Source/WebCore/workers/service/server/SWServerRegistration.h 2017-10-18 15:16:35 UTC (rev 223607)
+++ trunk/Source/WebCore/workers/service/server/SWServerRegistration.h 2017-10-18 16:12:11 UTC (rev 223608)
@@ -50,6 +50,7 @@
void enqueueJob(const ServiceWorkerJobData&);
void scriptFetchFinished(SWServer::Connection&, const ServiceWorkerFetchResult&);
void scriptContextFailedToStart(SWServer::Connection&, const String& workerID, const String& message);
+ void scriptContextStarted(SWServer::Connection&, uint64_t identifier, const String& workerID);
ServiceWorkerRegistrationData data() const;
Modified: trunk/Source/WebKit/CMakeLists.txt (223607 => 223608)
--- trunk/Source/WebKit/CMakeLists.txt 2017-10-18 15:16:35 UTC (rev 223607)
+++ trunk/Source/WebKit/CMakeLists.txt 2017-10-18 16:12:11 UTC (rev 223608)
@@ -282,6 +282,7 @@
StorageProcess/IndexedDB/WebIDBConnectionToClient.cpp
+ StorageProcess/ServiceWorker/WebSWOriginStore.cpp
StorageProcess/ServiceWorker/WebSWServerConnection.cpp
UIProcess/BackgroundProcessResponsivenessTimer.cpp
@@ -539,6 +540,7 @@
WebProcess/Plugins/Netscape/NetscapePluginStream.cpp
WebProcess/Storage/WebSWClientConnection.cpp
+ WebProcess/Storage/WebSWOriginTable.cpp
WebProcess/Storage/WebServiceWorkerProvider.cpp
WebProcess/Storage/WebToStorageProcessConnection.cpp
Modified: trunk/Source/WebKit/ChangeLog (223607 => 223608)
--- trunk/Source/WebKit/ChangeLog 2017-10-18 15:16:35 UTC (rev 223607)
+++ trunk/Source/WebKit/ChangeLog 2017-10-18 16:12:11 UTC (rev 223608)
@@ -1,3 +1,75 @@
+2017-10-18 Chris Dumez <[email protected]>
+
+ Add an efficient data structure for WebCore to query if there is a Service Worker registered for a given origin
+ https://bugs.webkit.org/show_bug.cgi?id=177876
+ <rdar://problem/34813129>
+
+ Reviewed by Ryosuke Niwa.
+
+ Introduce a Service Worker origin store which gets populated / updated on the StorageProcess side
+ and queried on the WebContent process side via the WebSWOriginTable so that the WebProcess can
+ efficiently check if there is a ServiceWorker registered for a given origin without actually doing
+ an IPC to the StorageProcess.
+
+ For efficiency, the hash table is backed by SharedMemory so we only pass shared memory handles
+ between the StorageProcess and the WebProcesses.
+
+ We currently add entries to the WebSWOriginStore whenever a service worker registration succeeds
+ on the StorageProcess side. We also clear this store whenever the API to clear service worker
+ registrations is called. Code to query the WebSWOriginTable from the WebContent process side is
+ there but currently only used by Internals for testing. We will later leverage this code when
+ integrating with Fetch API.
+
+ * CMakeLists.txt:
+ * Shared/SharedStringHashStore.h:
+ (WebKit::SharedStringHashStore::Client::didUpdateSharedStringHashes):
+ * Shared/SharedStringHashTable.cpp:
+ (WebKit::SharedStringHashTable::clear):
+ * StorageProcess/ServiceWorker/WebSWOriginStore.cpp: Copied from Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.cpp.
+ (WebKit::WebSWOriginStore::WebSWOriginStore):
+ (WebKit::WebSWOriginStore::add):
+ (WebKit::WebSWOriginStore::remove):
+ (WebKit::WebSWOriginStore::clear):
+ (WebKit::WebSWOriginStore::registerSWServerConnection):
+ (WebKit::WebSWOriginStore::unregisterSWServerConnection):
+ (WebKit::WebSWOriginStore::sendStoreHandle):
+ (WebKit::WebSWOriginStore::didInvalidateSharedMemory):
+ * StorageProcess/ServiceWorker/WebSWOriginStore.h: Copied from Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.h.
+ * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
+ (WebKit::WebSWServerConnection::WebSWServerConnection):
+ (WebKit::WebSWServerConnection::resolveJobInClient):
+ * StorageProcess/ServiceWorker/WebSWServerConnection.h:
+ (WebKit::WebSWServerConnection::sessionID const):
+ * StorageProcess/StorageProcess.cpp:
+ (WebKit::StorageProcess::deleteWebsiteData):
+ (WebKit::StorageProcess::deleteWebsiteDataForOrigins):
+ (WebKit::StorageProcess::ensureSWOriginStoreForSession):
+ (WebKit::StorageProcess::swOriginStoreForSession const):
+ (WebKit::StorageProcess::serviceWorkerContextStarted):
+ (WebKit::StorageProcess::registerSWServerConnection):
+ (WebKit::StorageProcess::unregisterSWServerConnection):
+ * StorageProcess/StorageProcess.h:
+ * StorageProcess/StorageProcess.messages.in:
+ * WebKit.xcodeproj/project.pbxproj:
+ * WebProcess/Storage/WebSWClientConnection.cpp:
+ (WebKit::WebSWClientConnection::WebSWClientConnection):
+ (WebKit::WebSWClientConnection::hasServiceWorkerRegisteredForOrigin const):
+ (WebKit::WebSWClientConnection::setSWOriginTableSharedMemory):
+ * WebProcess/Storage/WebSWClientConnection.h:
+ * WebProcess/Storage/WebSWClientConnection.messages.in:
+ * WebProcess/Storage/WebSWOriginTable.cpp: Copied from Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.h.
+ (WebKit::WebSWOriginTable::contains const):
+ (WebKit::WebSWOriginTable::setSharedMemory):
+ * WebProcess/Storage/WebSWOriginTable.h: Copied from Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.h.
+ * WebProcess/Storage/WebServiceWorkerProvider.cpp:
+ (WebKit::WebServiceWorkerProvider::serviceWorkerConnectionForSession):
+ * WebProcess/Storage/WebServiceWorkerProvider.h:
+ * WebProcess/Storage/WebToStorageProcessConnection.cpp:
+ (WebKit::WebToStorageProcessConnection::serviceWorkerConnectionForSession):
+ * WebProcess/Storage/WebToStorageProcessConnection.h:
+ * WebProcess/WebProcess.cpp:
+ (WebKit::WebProcess::startServiceWorkerContext):
+
2017-10-16 Andy Estes <[email protected]>
[Apple Pay] Add subLocality and subAdministrativeArea to ApplePayPaymentContact and ApplePayError
Modified: trunk/Source/WebKit/Shared/SharedStringHashStore.h (223607 => 223608)
--- trunk/Source/WebKit/Shared/SharedStringHashStore.h 2017-10-18 15:16:35 UTC (rev 223607)
+++ trunk/Source/WebKit/Shared/SharedStringHashStore.h 2017-10-18 16:12:11 UTC (rev 223608)
@@ -40,7 +40,7 @@
virtual ~Client() { }
virtual void didInvalidateSharedMemory() = 0;
- virtual void didUpdateSharedStringHashes(const Vector<WebCore::SharedStringHash>& addedHashes, const Vector<WebCore::SharedStringHash>& removedHashes) = 0;
+ virtual void didUpdateSharedStringHashes(const Vector<WebCore::SharedStringHash>& addedHashes, const Vector<WebCore::SharedStringHash>& removedHashes) { };
};
SharedStringHashStore(Client&);
Modified: trunk/Source/WebKit/Shared/SharedStringHashTable.cpp (223607 => 223608)
--- trunk/Source/WebKit/Shared/SharedStringHashTable.cpp 2017-10-18 15:16:35 UTC (rev 223607)
+++ trunk/Source/WebKit/Shared/SharedStringHashTable.cpp 2017-10-18 16:12:11 UTC (rev 223608)
@@ -132,6 +132,11 @@
void SharedStringHashTable::clear()
{
+ if (!m_sharedMemory)
+ return;
+
+ memset(m_sharedMemory->data(), 0, m_sharedMemory->size());
+ m_table = nullptr;
m_tableSize = 0;
m_tableSizeMask = 0;
m_sharedMemory = nullptr;
Copied: trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWOriginStore.cpp (from rev 223607, trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.cpp) (0 => 223608)
--- trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWOriginStore.cpp (rev 0)
+++ trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWOriginStore.cpp 2017-10-18 16:12:11 UTC (rev 223608)
@@ -0,0 +1,91 @@
+/*
+ * 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"
+
+#if ENABLE(SERVICE_WORKER)
+#include "WebSWOriginStore.h"
+
+#include "WebSWClientConnectionMessages.h"
+#include "WebSWServerConnection.h"
+#include <WebCore/SecurityOrigin.h>
+
+namespace WebKit {
+
+using namespace WebCore;
+
+WebSWOriginStore::WebSWOriginStore()
+ : m_store(*this)
+{
+}
+
+void WebSWOriginStore::add(const SecurityOrigin& origin)
+{
+ m_store.add(computeSharedStringHash(origin.toString()));
+}
+
+void WebSWOriginStore::remove(const SecurityOrigin& origin)
+{
+ m_store.remove(computeSharedStringHash(origin.toString()));
+}
+
+void WebSWOriginStore::clear()
+{
+ m_store.clear();
+}
+
+void WebSWOriginStore::registerSWServerConnection(WebSWServerConnection& connection)
+{
+ m_webSWServerConnections.add(&connection);
+
+ if (m_store.isEmpty())
+ return;
+
+ sendStoreHandle(connection);
+}
+
+void WebSWOriginStore::unregisterSWServerConnection(WebSWServerConnection& connection)
+{
+ m_webSWServerConnections.remove(&connection);
+}
+
+void WebSWOriginStore::sendStoreHandle(WebSWServerConnection& connection)
+{
+ SharedMemory::Handle handle;
+ if (!m_store.createSharedMemoryHandle(handle))
+ return;
+
+ connection.send(Messages::WebSWClientConnection::SetSWOriginTableSharedMemory(handle));
+}
+
+void WebSWOriginStore::didInvalidateSharedMemory()
+{
+ for (auto* connection : m_webSWServerConnections)
+ sendStoreHandle(*connection);
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(SERVICE_WORKER)
Copied: trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWOriginStore.h (from rev 223607, trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.h) (0 => 223608)
--- trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWOriginStore.h (rev 0)
+++ trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWOriginStore.h 2017-10-18 16:12:11 UTC (rev 223608)
@@ -0,0 +1,64 @@
+/*
+ * 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 "SharedStringHashStore.h"
+#include <wtf/HashSet.h>
+
+namespace WebCore {
+class SecurityOrigin;
+}
+
+namespace WebKit {
+
+class WebSWServerConnection;
+
+class WebSWOriginStore final : private SharedStringHashStore::Client {
+public:
+ WebSWOriginStore();
+
+ void add(const WebCore::SecurityOrigin&);
+ void remove(const WebCore::SecurityOrigin&);
+ void clear();
+
+ void registerSWServerConnection(WebSWServerConnection&);
+ void unregisterSWServerConnection(WebSWServerConnection&);
+
+private:
+ void sendStoreHandle(WebSWServerConnection&);
+
+ // SharedStringHashStore::Client.
+ void didInvalidateSharedMemory() final;
+
+ SharedStringHashStore m_store;
+ HashSet<WebSWServerConnection*> m_webSWServerConnections;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(SERVICE_WORKER)
Modified: trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.cpp (223607 => 223608)
--- trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.cpp 2017-10-18 15:16:35 UTC (rev 223607)
+++ trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.cpp 2017-10-18 16:12:11 UTC (rev 223608)
@@ -30,14 +30,17 @@
#include "DataReference.h"
#include "Logging.h"
+#include "StorageProcess.h"
#include "StorageToWebProcessConnectionMessages.h"
#include "WebProcess.h"
#include "WebProcessMessages.h"
#include "WebSWClientConnectionMessages.h"
+#include "WebSWOriginStore.h"
#include "WebSWServerConnectionMessages.h"
#include "WebToStorageProcessConnection.h"
#include <WebCore/ExceptionData.h>
#include <WebCore/NotImplemented.h>
+#include <WebCore/SecurityOrigin.h>
#include <WebCore/ServiceWorkerContextData.h>
#include <WebCore/ServiceWorkerJobData.h>
#include <WebCore/ServiceWorkerRegistrationData.h>
@@ -48,7 +51,7 @@
namespace WebKit {
-WebSWServerConnection::WebSWServerConnection(SWServer& server, IPC::Connection& connection, uint64_t connectionIdentifier, const SessionID& sessionID)
+WebSWServerConnection::WebSWServerConnection(SWServer& server, IPC::Connection& connection, uint64_t connectionIdentifier, SessionID sessionID)
: SWServer::Connection(server, connectionIdentifier)
, m_sessionID(sessionID)
, m_contentConnection(connection)
@@ -71,6 +74,8 @@
void WebSWServerConnection::resolveJobInClient(uint64_t jobIdentifier, const ServiceWorkerRegistrationData& registrationData)
{
+ auto origin = registrationData.key.topOrigin.securityOrigin();
+ StorageProcess::singleton().ensureSWOriginStoreForSession(m_sessionID).add(origin);
send(Messages::WebSWClientConnection::JobResolvedInServer(jobIdentifier, registrationData));
}
Modified: trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.h (223607 => 223608)
--- trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.h 2017-10-18 15:16:35 UTC (rev 223607)
+++ trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.h 2017-10-18 16:12:11 UTC (rev 223608)
@@ -41,7 +41,7 @@
class WebSWServerConnection : public WebCore::SWServer::Connection, public IPC::MessageSender, public IPC::MessageReceiver {
public:
- WebSWServerConnection(WebCore::SWServer&, IPC::Connection&, uint64_t connectionIdentifier, const PAL::SessionID&);
+ WebSWServerConnection(WebCore::SWServer&, IPC::Connection&, uint64_t connectionIdentifier, PAL::SessionID);
WebSWServerConnection(const WebSWServerConnection&) = delete;
~WebSWServerConnection() final;
@@ -49,6 +49,8 @@
void setContextConnection(IPC::Connection*);
void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final;
+ PAL::SessionID sessionID() const { return m_sessionID; }
+
private:
// Implement SWServer::Connection (Messages to the client WebProcess)
void rejectJobInClient(uint64_t jobIdentifier, const WebCore::ExceptionData&) final;
Modified: trunk/Source/WebKit/StorageProcess/StorageProcess.cpp (223607 => 223608)
--- trunk/Source/WebKit/StorageProcess/StorageProcess.cpp 2017-10-18 15:16:35 UTC (rev 223607)
+++ trunk/Source/WebKit/StorageProcess/StorageProcess.cpp 2017-10-18 16:12:11 UTC (rev 223608)
@@ -31,11 +31,13 @@
#include "StorageProcessProxyMessages.h"
#include "StorageToWebProcessConnection.h"
#include "WebCoreArgumentCoders.h"
+#include "WebSWOriginStore.h"
#include "WebSWServerConnection.h"
#include "WebsiteData.h"
#include <WebCore/FileSystem.h>
#include <WebCore/IDBKeyData.h>
#include <WebCore/NotImplemented.h>
+#include <WebCore/SecurityOrigin.h>
#include <WebCore/TextEncoding.h>
#include <pal/SessionID.h>
#include <wtf/CrossThreadTask.h>
@@ -220,8 +222,10 @@
};
#if ENABLE(SERVICE_WORKER)
- if (websiteDataTypes.contains(WebsiteDataType::ServiceWorkerRegistrations))
- notImplemented();
+ if (websiteDataTypes.contains(WebsiteDataType::ServiceWorkerRegistrations)) {
+ if (auto* store = swOriginStoreForSession(sessionID))
+ store->clear();
+ }
#endif
#if ENABLE(INDEXED_DATABASE)
@@ -241,8 +245,12 @@
};
#if ENABLE(SERVICE_WORKER)
- if (websiteDataTypes.contains(WebsiteDataType::ServiceWorkerRegistrations))
- notImplemented();
+ if (websiteDataTypes.contains(WebsiteDataType::ServiceWorkerRegistrations)) {
+ if (auto* store = swOriginStoreForSession(sessionID)) {
+ for (auto& originData : securityOriginDatas)
+ store->remove(originData.securityOrigin());
+ }
+ }
#endif
#if ENABLE(INDEXED_DATABASE)
@@ -345,6 +353,21 @@
parentProcessConnection()->send(Messages::StorageProcessProxy::GetWorkerContextProcessConnection(), 0);
}
+WebSWOriginStore& StorageProcess::ensureSWOriginStoreForSession(PAL::SessionID sessionID)
+{
+ return *m_swOriginStores.ensure(sessionID, [this, sessionID] {
+ return std::make_unique<WebSWOriginStore>();
+ }).iterator->value;
+}
+
+WebSWOriginStore* StorageProcess::swOriginStoreForSession(PAL::SessionID sessionID) const
+{
+ auto it = m_swOriginStores.find(sessionID);
+ if (it == m_swOriginStores.end())
+ return nullptr;
+ return it->value.get();
+}
+
void StorageProcess::didGetWorkerContextProcessConnection(const IPC::Attachment& encodedConnectionIdentifier)
{
ASSERT(m_waitingForWorkerContextProcessConnection);
@@ -376,10 +399,17 @@
connection->scriptContextFailedToStart(registrationKey, workerID, message);
}
+void StorageProcess::serviceWorkerContextStarted(uint64_t serverConnectionIdentifier, const ServiceWorkerRegistrationKey& registrationKey, uint64_t identifier, const String& workerID)
+{
+ if (auto* connection = m_swServerConnections.get(serverConnectionIdentifier))
+ connection->scriptContextStarted(registrationKey, identifier, workerID);
+}
+
void StorageProcess::registerSWServerConnection(WebSWServerConnection& connection)
{
ASSERT(!m_swServerConnections.contains(connection.identifier()));
m_swServerConnections.add(connection.identifier(), &connection);
+ ensureSWOriginStoreForSession(connection.sessionID()).registerSWServerConnection(connection);
}
void StorageProcess::unregisterSWServerConnection(WebSWServerConnection& connection)
@@ -386,6 +416,8 @@
{
ASSERT(m_swServerConnections.get(connection.identifier()) == &connection);
m_swServerConnections.remove(connection.identifier());
+ if (auto* originStore = swOriginStoreForSession(connection.sessionID()))
+ originStore->unregisterSWServerConnection(connection);
}
#endif
Modified: trunk/Source/WebKit/StorageProcess/StorageProcess.h (223607 => 223608)
--- trunk/Source/WebKit/StorageProcess/StorageProcess.h 2017-10-18 15:16:35 UTC (rev 223607)
+++ trunk/Source/WebKit/StorageProcess/StorageProcess.h 2017-10-18 16:12:11 UTC (rev 223608)
@@ -47,6 +47,10 @@
enum class WebsiteDataType;
struct StorageProcessCreationParameters;
+#if ENABLE(SERVICE_WORKER)
+class WebSWOriginStore;
+#endif
+
class StorageProcess : public ChildProcess
#if ENABLE(INDEXED_DATABASE)
, public WebCore::IDBServer::IDBBackingStoreTemporaryFileHandler
@@ -69,16 +73,17 @@
void accessToTemporaryFileComplete(const String& path) final;
#endif
+#if ENABLE(SANDBOX_EXTENSIONS)
+ void getSandboxExtensionsForBlobFiles(const Vector<String>& filenames, WTF::Function<void (SandboxExtension::HandleArray&&)>&& completionHandler);
+#endif
+
#if ENABLE(SERVICE_WORKER)
IPC::Connection* workerContextProcessConnection();
void createWorkerContextProcessConnection();
-#endif
-#if ENABLE(SANDBOX_EXTENSIONS)
- void getSandboxExtensionsForBlobFiles(const Vector<String>& filenames, WTF::Function<void (SandboxExtension::HandleArray&&)>&& completionHandler);
-#endif
+ WebSWOriginStore& ensureSWOriginStoreForSession(PAL::SessionID);
+ WebSWOriginStore* swOriginStoreForSession(PAL::SessionID) const;
-#if ENABLE(SERVICE_WORKER)
WebCore::SWServer& swServerForSession(PAL::SessionID);
void registerSWServerConnection(WebSWServerConnection&);
void unregisterSWServerConnection(WebSWServerConnection&);
@@ -113,6 +118,7 @@
#if ENABLE(SERVICE_WORKER)
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);
#endif
#if ENABLE(INDEXED_DATABASE)
Vector<WebCore::SecurityOriginData> indexedDatabaseOrigins(const String& path);
@@ -122,7 +128,7 @@
void performNextStorageTask();
void ensurePathExists(const String&);
- Vector<RefPtr<StorageToWebProcessConnection>> m_storageToWebProcessConnections;
+ Vector<Ref<StorageToWebProcessConnection>> m_storageToWebProcessConnections;
Ref<WorkQueue> m_queue;
@@ -143,6 +149,7 @@
bool m_waitingForWorkerContextProcessConnection { false };
HashMap<PAL::SessionID, std::unique_ptr<WebCore::SWServer>> m_swServers;
HashMap<uint64_t, WebSWServerConnection*> m_swServerConnections;
+ HashMap<PAL::SessionID, std::unique_ptr<WebSWOriginStore>> m_swOriginStores;
#endif
};
Modified: trunk/Source/WebKit/StorageProcess/StorageProcess.messages.in (223607 => 223608)
--- trunk/Source/WebKit/StorageProcess/StorageProcess.messages.in 2017-10-18 15:16:35 UTC (rev 223607)
+++ trunk/Source/WebKit/StorageProcess/StorageProcess.messages.in 2017-10-18 16:12:11 UTC (rev 223608)
@@ -38,5 +38,6 @@
#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)
#endif
}
Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (223607 => 223608)
--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2017-10-18 15:16:35 UTC (rev 223607)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2017-10-18 16:12:11 UTC (rev 223608)
@@ -1361,6 +1361,8 @@
8313F7EE1F7DAE0800B944EB /* SharedStringHashTable.h in Headers */ = {isa = PBXBuildFile; fileRef = 8313F7E71F7DAE0300B944EB /* SharedStringHashTable.h */; };
831EEBBD1BD85C4300BB64C3 /* NetworkCacheSpeculativeLoad.h in Headers */ = {isa = PBXBuildFile; fileRef = 831EEBBB1BD85C4300BB64C3 /* NetworkCacheSpeculativeLoad.h */; };
831EEBBE1BD85C4300BB64C3 /* NetworkCacheSpeculativeLoad.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 831EEBBC1BD85C4300BB64C3 /* NetworkCacheSpeculativeLoad.cpp */; };
+ 832994A71F96F50200AC57B1 /* WebSWOriginStore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 832994A51F96F4FD00AC57B1 /* WebSWOriginStore.cpp */; };
+ 832994A81F96F50200AC57B1 /* WebSWOriginStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 832994A61F96F4FE00AC57B1 /* WebSWOriginStore.h */; };
832AE2521BE2E8CD00FAAE10 /* NetworkCacheSpeculativeLoadManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 832AE2501BE2E8CD00FAAE10 /* NetworkCacheSpeculativeLoadManager.h */; };
832AE2531BE2E8CD00FAAE10 /* NetworkCacheSpeculativeLoadManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 832AE2511BE2E8CD00FAAE10 /* NetworkCacheSpeculativeLoadManager.cpp */; };
832ED18B1E2FE157006BA64A /* PerActivityStateCPUUsageSampler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 832ED1891E2FE13B006BA64A /* PerActivityStateCPUUsageSampler.cpp */; };
@@ -1391,6 +1393,8 @@
83D454D71BE9D3C4006C93BD /* NetworkLoadClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D454D61BE9D3C4006C93BD /* NetworkLoadClient.h */; };
83EE575B1DB7D61100C74C50 /* WebValidationMessageClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83EE57591DB7D60600C74C50 /* WebValidationMessageClient.cpp */; };
83EE575C1DB7D61100C74C50 /* WebValidationMessageClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 83EE575A1DB7D60600C74C50 /* WebValidationMessageClient.h */; };
+ 83F1A0791F96E7790045B94E /* WebSWOriginTable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83F1A0771F96E7700045B94E /* WebSWOriginTable.cpp */; };
+ 83F1A07A1F96E7790045B94E /* WebSWOriginTable.h in Headers */ = {isa = PBXBuildFile; fileRef = 83F1A0781F96E7710045B94E /* WebSWOriginTable.h */; };
84477853176FCC0800CDC7BB /* InjectedBundleHitTestResultMediaType.h in Headers */ = {isa = PBXBuildFile; fileRef = 84477851176FCAC100CDC7BB /* InjectedBundleHitTestResultMediaType.h */; };
868160D0187645570021E79D /* WindowServerConnection.mm in Sources */ = {isa = PBXBuildFile; fileRef = 868160CF187645370021E79D /* WindowServerConnection.mm */; };
86E67A251910B9D100004AB7 /* ProcessThrottler.h in Headers */ = {isa = PBXBuildFile; fileRef = 86E67A21190F411800004AB7 /* ProcessThrottler.h */; };
@@ -3718,6 +3722,8 @@
8313F7EA1F7DAE0400B944EB /* SharedStringHashStore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SharedStringHashStore.cpp; sourceTree = "<group>"; };
831EEBBB1BD85C4300BB64C3 /* NetworkCacheSpeculativeLoad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkCacheSpeculativeLoad.h; sourceTree = "<group>"; };
831EEBBC1BD85C4300BB64C3 /* NetworkCacheSpeculativeLoad.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkCacheSpeculativeLoad.cpp; sourceTree = "<group>"; };
+ 832994A51F96F4FD00AC57B1 /* WebSWOriginStore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebSWOriginStore.cpp; sourceTree = "<group>"; };
+ 832994A61F96F4FE00AC57B1 /* WebSWOriginStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSWOriginStore.h; sourceTree = "<group>"; };
832AE2501BE2E8CD00FAAE10 /* NetworkCacheSpeculativeLoadManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkCacheSpeculativeLoadManager.h; sourceTree = "<group>"; };
832AE2511BE2E8CD00FAAE10 /* NetworkCacheSpeculativeLoadManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkCacheSpeculativeLoadManager.cpp; sourceTree = "<group>"; };
832ED1891E2FE13B006BA64A /* PerActivityStateCPUUsageSampler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PerActivityStateCPUUsageSampler.cpp; sourceTree = "<group>"; };
@@ -3748,6 +3754,8 @@
83D454D61BE9D3C4006C93BD /* NetworkLoadClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkLoadClient.h; path = NetworkProcess/NetworkLoadClient.h; sourceTree = "<group>"; };
83EE57591DB7D60600C74C50 /* WebValidationMessageClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebValidationMessageClient.cpp; sourceTree = "<group>"; };
83EE575A1DB7D60600C74C50 /* WebValidationMessageClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebValidationMessageClient.h; sourceTree = "<group>"; };
+ 83F1A0771F96E7700045B94E /* WebSWOriginTable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebSWOriginTable.cpp; sourceTree = "<group>"; };
+ 83F1A0781F96E7710045B94E /* WebSWOriginTable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSWOriginTable.h; sourceTree = "<group>"; };
84477851176FCAC100CDC7BB /* InjectedBundleHitTestResultMediaType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundleHitTestResultMediaType.h; sourceTree = "<group>"; };
868160CD18763D4B0021E79D /* WindowServerConnection.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WindowServerConnection.h; sourceTree = "<group>"; };
868160CF187645370021E79D /* WindowServerConnection.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WindowServerConnection.mm; sourceTree = "<group>"; };
@@ -6165,6 +6173,8 @@
517A53031F4793B200DCDC0A /* WebSWClientConnection.cpp */,
517A53021F4793B200DCDC0A /* WebSWClientConnection.h */,
517A530C1F479E9700DCDC0A /* WebSWClientConnection.messages.in */,
+ 83F1A0771F96E7700045B94E /* WebSWOriginTable.cpp */,
+ 83F1A0781F96E7710045B94E /* WebSWOriginTable.h */,
5118E9991F295259003EF9F5 /* WebToStorageProcessConnection.cpp */,
5118E99A1F295259003EF9F5 /* WebToStorageProcessConnection.h */,
);
@@ -6286,6 +6296,8 @@
517A53061F479E0F00DCDC0A /* ServiceWorker */ = {
isa = PBXGroup;
children = (
+ 832994A51F96F4FD00AC57B1 /* WebSWOriginStore.cpp */,
+ 832994A61F96F4FE00AC57B1 /* WebSWOriginStore.h */,
517A53091F479E3100DCDC0A /* WebSWServerConnection.cpp */,
517A53071F479E3100DCDC0A /* WebSWServerConnection.h */,
517A53081F479E3100DCDC0A /* WebSWServerConnection.messages.in */,
@@ -9003,6 +9015,8 @@
1A52C0F81A38CDC70016160A /* WebStorageNamespaceProvider.h in Headers */,
517A53051F4793C600DCDC0A /* WebSWClientConnection.h in Headers */,
517A53101F47A86200DCDC0A /* WebSWClientConnectionMessages.h in Headers */,
+ 832994A81F96F50200AC57B1 /* WebSWOriginStore.h in Headers */,
+ 83F1A07A1F96E7790045B94E /* WebSWOriginTable.h in Headers */,
517A530B1F479E3600DCDC0A /* WebSWServerConnection.h in Headers */,
517A52D91F43A9DA00DCDC0A /* WebSWServerConnectionMessages.h in Headers */,
5118E99C1F295266003EF9F5 /* WebToStorageProcessConnection.h in Headers */,
@@ -10651,6 +10665,8 @@
1A52C0F71A38CDC70016160A /* WebStorageNamespaceProvider.cpp in Sources */,
517A53041F4793C600DCDC0A /* WebSWClientConnection.cpp in Sources */,
517A530F1F47A86200DCDC0A /* WebSWClientConnectionMessageReceiver.cpp in Sources */,
+ 832994A71F96F50200AC57B1 /* WebSWOriginStore.cpp in Sources */,
+ 83F1A0791F96E7790045B94E /* WebSWOriginTable.cpp in Sources */,
517A530A1F479E3600DCDC0A /* WebSWServerConnection.cpp in Sources */,
517A52D81F43A9DA00DCDC0A /* WebSWServerConnectionMessageReceiver.cpp in Sources */,
5118E99B1F295266003EF9F5 /* WebToStorageProcessConnection.cpp in Sources */,
@@ -11032,9 +11048,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = A1EDD2DB1884B96400BBFE98 /* PluginProcessShim.xcconfig */;
buildSettings = {
- OTHER_LDFLAGS = (
- "$(OTHER_LDFLAGS)",
- );
+ OTHER_LDFLAGS = "$(OTHER_LDFLAGS)";
PRODUCT_NAME = PluginProcessShim;
};
name = Debug;
@@ -11043,9 +11057,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = A1EDD2DB1884B96400BBFE98 /* PluginProcessShim.xcconfig */;
buildSettings = {
- OTHER_LDFLAGS = (
- "$(OTHER_LDFLAGS)",
- );
+ OTHER_LDFLAGS = "$(OTHER_LDFLAGS)";
PRODUCT_NAME = PluginProcessShim;
};
name = Release;
@@ -11054,9 +11066,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = A1EDD2DB1884B96400BBFE98 /* PluginProcessShim.xcconfig */;
buildSettings = {
- OTHER_LDFLAGS = (
- "$(OTHER_LDFLAGS)",
- );
+ OTHER_LDFLAGS = "$(OTHER_LDFLAGS)";
PRODUCT_NAME = PluginProcessShim;
};
name = Production;
@@ -11065,9 +11075,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = BCB86F4B116AAACD00CE20B7 /* WebKit.xcconfig */;
buildSettings = {
- OTHER_LDFLAGS = (
- "$(OTHER_LDFLAGS)",
- );
+ OTHER_LDFLAGS = "$(OTHER_LDFLAGS)";
};
name = Debug;
};
@@ -11075,9 +11083,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = BCB86F4B116AAACD00CE20B7 /* WebKit.xcconfig */;
buildSettings = {
- OTHER_LDFLAGS = (
- "$(OTHER_LDFLAGS)",
- );
+ OTHER_LDFLAGS = "$(OTHER_LDFLAGS)";
};
name = Release;
};
@@ -11161,9 +11167,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = BCB86F4B116AAACD00CE20B7 /* WebKit.xcconfig */;
buildSettings = {
- OTHER_LDFLAGS = (
- "$(OTHER_LDFLAGS)",
- );
+ OTHER_LDFLAGS = "$(OTHER_LDFLAGS)";
};
name = Production;
};
Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp (223607 => 223608)
--- trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp 2017-10-18 15:16:35 UTC (rev 223607)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp 2017-10-18 16:12:11 UTC (rev 223608)
@@ -31,6 +31,7 @@
#include "Logging.h"
#include "StorageToWebProcessConnectionMessages.h"
#include "WebCoreArgumentCoders.h"
+#include "WebSWOriginTable.h"
#include "WebSWServerConnectionMessages.h"
#include <WebCore/ServiceWorkerFetchResult.h>
#include <WebCore/ServiceWorkerJobData.h>
@@ -40,9 +41,10 @@
namespace WebKit {
-WebSWClientConnection::WebSWClientConnection(IPC::Connection& connection, const SessionID& sessionID)
+WebSWClientConnection::WebSWClientConnection(IPC::Connection& connection, SessionID sessionID)
: m_sessionID(sessionID)
, m_connection(connection)
+ , m_swOriginTable(makeUniqueRef<WebSWOriginTable>())
{
bool result = sendSync(Messages::StorageToWebProcessConnection::EstablishSWServerConnection(sessionID), Messages::StorageToWebProcessConnection::EstablishSWServerConnection::Reply(m_identifier));
@@ -63,6 +65,16 @@
send(Messages::WebSWServerConnection::FinishFetchingScriptInServer(result));
}
+bool WebSWClientConnection::hasServiceWorkerRegisteredForOrigin(const SecurityOrigin& origin) const
+{
+ return m_swOriginTable->contains(origin);
+}
+
+void WebSWClientConnection::setSWOriginTableSharedMemory(const SharedMemory::Handle& handle)
+{
+ m_swOriginTable->setSharedMemory(handle);
+}
+
} // namespace WebKit
#endif // ENABLE(SERVICE_WORKER)
Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h (223607 => 223608)
--- trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h 2017-10-18 15:16:35 UTC (rev 223607)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h 2017-10-18 16:12:11 UTC (rev 223608)
@@ -30,8 +30,10 @@
#include "Connection.h"
#include "MessageReceiver.h"
#include "MessageSender.h"
+#include "SharedMemory.h"
#include <WebCore/SWClientConnection.h>
#include <pal/SessionID.h>
+#include <wtf/UniqueRef.h>
namespace WebCore {
struct ExceptionData;
@@ -39,9 +41,11 @@
namespace WebKit {
+class WebSWOriginTable;
+
class WebSWClientConnection : public WebCore::SWClientConnection, public IPC::MessageSender, public IPC::MessageReceiver {
public:
- WebSWClientConnection(IPC::Connection&, const PAL::SessionID&);
+ WebSWClientConnection(IPC::Connection&, PAL::SessionID);
WebSWClientConnection(const WebSWClientConnection&) = delete;
~WebSWClientConnection() final;
@@ -53,6 +57,8 @@
void disconnectedFromWebProcess();
void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final;
+ bool hasServiceWorkerRegisteredForOrigin(const WebCore::SecurityOrigin&) const final;
+
private:
void scheduleStorageJob(const WebCore::ServiceWorkerJobData&);
@@ -59,10 +65,13 @@
IPC::Connection* messageSenderConnection() final { return m_connection.ptr(); }
uint64_t messageSenderDestinationID() final { return m_identifier; }
+ void setSWOriginTableSharedMemory(const SharedMemory::Handle&);
+
PAL::SessionID m_sessionID;
uint64_t m_identifier;
Ref<IPC::Connection> m_connection;
+ UniqueRef<WebSWOriginTable> m_swOriginTable;
}; // class WebSWServerConnection
} // namespace WebKit
Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.messages.in (223607 => 223608)
--- trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.messages.in 2017-10-18 15:16:35 UTC (rev 223607)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.messages.in 2017-10-18 16:12:11 UTC (rev 223608)
@@ -27,6 +27,8 @@
JobRejectedInServer(uint64_t identifier, struct WebCore::ExceptionData exception)
JobResolvedInServer(uint64_t identifier, struct WebCore::ServiceWorkerRegistrationData registration)
StartScriptFetchForServer(uint64_t jobIdentifier)
+
+ SetSWOriginTableSharedMemory(WebKit::SharedMemory::Handle handle)
}
#endif // ENABLE(SERVICE_WORKER)
Copied: trunk/Source/WebKit/WebProcess/Storage/WebSWOriginTable.cpp (from rev 223607, trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.h) (0 => 223608)
--- trunk/Source/WebKit/WebProcess/Storage/WebSWOriginTable.cpp (rev 0)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWOriginTable.cpp 2017-10-18 16:12:11 UTC (rev 223608)
@@ -0,0 +1,56 @@
+/*
+ * 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"
+
+#if ENABLE(SERVICE_WORKER)
+#include "WebSWOriginTable.h"
+
+#include <WebCore/SecurityOrigin.h>
+
+namespace WebKit {
+
+using namespace WebCore;
+
+bool WebSWOriginTable::contains(const SecurityOrigin& origin) const
+{
+ if (origin.isUnique())
+ return false;
+
+ return m_serviceWorkerOriginTable.contains(computeSharedStringHash(origin.toString()));
+}
+
+void WebSWOriginTable::setSharedMemory(const SharedMemory::Handle& handle)
+{
+ auto sharedMemory = SharedMemory::map(handle, SharedMemory::Protection::ReadOnly);
+ if (!sharedMemory)
+ return;
+
+ m_serviceWorkerOriginTable.setSharedMemory(sharedMemory.releaseNonNull());
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(SERVICE_WORKER)
Copied: trunk/Source/WebKit/WebProcess/Storage/WebSWOriginTable.h (from rev 223607, trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.h) (0 => 223608)
--- trunk/Source/WebKit/WebProcess/Storage/WebSWOriginTable.h (rev 0)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWOriginTable.h 2017-10-18 16:12:11 UTC (rev 223608)
@@ -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 "SharedMemory.h"
+#include "SharedStringHashTable.h"
+
+namespace WebCore {
+class SecurityOrigin;
+}
+
+namespace WebKit {
+
+class WebSWOriginTable {
+public:
+ WebSWOriginTable() = default;
+
+ bool contains(const WebCore::SecurityOrigin&) const;
+ void setSharedMemory(const SharedMemory::Handle&);
+
+private:
+ SharedStringHashTable m_serviceWorkerOriginTable;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(SERVICE_WORKER)
Modified: trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.cpp (223607 => 223608)
--- trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.cpp 2017-10-18 15:16:35 UTC (rev 223607)
+++ trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.cpp 2017-10-18 16:12:11 UTC (rev 223608)
@@ -52,7 +52,7 @@
{
}
-WebCore::SWClientConnection& WebServiceWorkerProvider::serviceWorkerConnectionForSession(const SessionID& sessionID)
+WebCore::SWClientConnection& WebServiceWorkerProvider::serviceWorkerConnectionForSession(SessionID sessionID)
{
ASSERT(WebProcess::singleton().webToStorageProcessConnection());
return WebProcess::singleton().webToStorageProcessConnection()->serviceWorkerConnectionForSession(sessionID);
Modified: trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.h (223607 => 223608)
--- trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.h 2017-10-18 15:16:35 UTC (rev 223607)
+++ trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.h 2017-10-18 16:12:11 UTC (rev 223608)
@@ -32,7 +32,7 @@
namespace WebKit {
-class WebServiceWorkerProvider : public WebCore::ServiceWorkerProvider {
+class WebServiceWorkerProvider final : public WebCore::ServiceWorkerProvider {
public:
static WebServiceWorkerProvider& singleton();
@@ -40,7 +40,7 @@
friend NeverDestroyed<WebServiceWorkerProvider>;
WebServiceWorkerProvider();
- WebCore::SWClientConnection& serviceWorkerConnectionForSession(const PAL::SessionID&) final;
+ WebCore::SWClientConnection& serviceWorkerConnectionForSession(PAL::SessionID) final;
}; // class WebServiceWorkerProvider
Modified: trunk/Source/WebKit/WebProcess/Storage/WebToStorageProcessConnection.cpp (223607 => 223608)
--- trunk/Source/WebKit/WebProcess/Storage/WebToStorageProcessConnection.cpp 2017-10-18 15:16:35 UTC (rev 223607)
+++ trunk/Source/WebKit/WebProcess/Storage/WebToStorageProcessConnection.cpp 2017-10-18 16:12:11 UTC (rev 223608)
@@ -103,7 +103,7 @@
#endif
#if ENABLE(SERVICE_WORKER)
-WebSWClientConnection& WebToStorageProcessConnection::serviceWorkerConnectionForSession(const SessionID& sessionID)
+WebSWClientConnection& WebToStorageProcessConnection::serviceWorkerConnectionForSession(SessionID sessionID)
{
auto result = m_swConnectionsBySession.add(sessionID, nullptr);
if (result.isNewEntry) {
Modified: trunk/Source/WebKit/WebProcess/Storage/WebToStorageProcessConnection.h (223607 => 223608)
--- trunk/Source/WebKit/WebProcess/Storage/WebToStorageProcessConnection.h 2017-10-18 15:16:35 UTC (rev 223607)
+++ trunk/Source/WebKit/WebProcess/Storage/WebToStorageProcessConnection.h 2017-10-18 16:12:11 UTC (rev 223608)
@@ -54,7 +54,7 @@
WebIDBConnectionToServer& idbConnectionToServerForSession(const PAL::SessionID&);
#endif
#if ENABLE(SERVICE_WORKER)
- WebSWClientConnection& serviceWorkerConnectionForSession(const PAL::SessionID&);
+ WebSWClientConnection& serviceWorkerConnectionForSession(PAL::SessionID);
#endif
private:
Modified: trunk/Source/WebKit/WebProcess/WebProcess.cpp (223607 => 223608)
--- trunk/Source/WebKit/WebProcess/WebProcess.cpp 2017-10-18 15:16:35 UTC (rev 223607)
+++ trunk/Source/WebKit/WebProcess/WebProcess.cpp 2017-10-18 16:12:11 UTC (rev 223608)
@@ -1654,6 +1654,8 @@
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);
}
#endif
Modified: trunk/Tools/ChangeLog (223607 => 223608)
--- trunk/Tools/ChangeLog 2017-10-18 15:16:35 UTC (rev 223607)
+++ trunk/Tools/ChangeLog 2017-10-18 16:12:11 UTC (rev 223608)
@@ -1,3 +1,16 @@
+2017-10-18 Chris Dumez <[email protected]>
+
+ Add an efficient data structure for WebCore to query if there is a Service Worker registered for a given origin
+ https://bugs.webkit.org/show_bug.cgi?id=177876
+ <rdar://problem/34813129>
+
+ Reviewed by Ryosuke Niwa.
+
+ Clear service worker registrations between test runs to avoid flakiness.
+
+ * WebKitTestRunner/TestController.cpp:
+ (WTR::TestController::resetStateToConsistentValues):
+
2017-10-18 Zan Dobersek <[email protected]>
Remove remnants of OpenWebRTC
Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (223607 => 223608)
--- trunk/Tools/WebKitTestRunner/TestController.cpp 2017-10-18 15:16:35 UTC (rev 223607)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp 2017-10-18 16:12:11 UTC (rev 223608)
@@ -781,6 +781,8 @@
WKContextClearCachedCredentials(TestController::singleton().context());
+ WKWebsiteDataStoreRemoveAllServiceWorkerRegistrations(WKContextGetWebsiteDataStore(platformContext()));
+
// FIXME: This function should also ensure that there is only one page open.
// Reset the EventSender for each test.