Diff
Modified: trunk/Source/WebCore/ChangeLog (293823 => 293824)
--- trunk/Source/WebCore/ChangeLog 2022-05-05 06:38:33 UTC (rev 293823)
+++ trunk/Source/WebCore/ChangeLog 2022-05-05 07:38:15 UTC (rev 293824)
@@ -1,3 +1,24 @@
+2022-05-05 Youenn Fablet <you...@apple.com>
+
+ SWOriginStore is no longer needed
+ https://bugs.webkit.org/show_bug.cgi?id=240003
+
+ Reviewed by Chris Dumez.
+
+ Covered by existing tests.
+
+ * Headers.cmake:
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * loader/DocumentLoader.cpp:
+ * workers/service/SWClientConnection.h:
+ * workers/service/WorkerSWClientConnection.cpp:
+ * workers/service/WorkerSWClientConnection.h:
+ * workers/service/server/SWOriginStore.cpp: Removed.
+ * workers/service/server/SWOriginStore.h: Removed.
+ * workers/service/server/SWServer.cpp:
+ * workers/service/server/SWServer.h:
+
2022-05-04 Devin Rousso <drou...@apple.com>
[Apple Pay] REGRESSION(r291588): `appearance: -apple-pay-button` doesn't work with `border-width: 0`
Modified: trunk/Source/WebCore/Headers.cmake (293823 => 293824)
--- trunk/Source/WebCore/Headers.cmake 2022-05-05 06:38:33 UTC (rev 293823)
+++ trunk/Source/WebCore/Headers.cmake 2022-05-05 07:38:15 UTC (rev 293824)
@@ -2043,7 +2043,6 @@
workers/service/context/ServiceWorkerThreadProxy.h
workers/service/server/RegistrationDatabase.h
- workers/service/server/SWOriginStore.h
workers/service/server/SWServer.h
workers/service/server/SWServerRegistration.h
workers/service/server/SWServerToContextConnection.h
Modified: trunk/Source/WebCore/Sources.txt (293823 => 293824)
--- trunk/Source/WebCore/Sources.txt 2022-05-05 06:38:33 UTC (rev 293823)
+++ trunk/Source/WebCore/Sources.txt 2022-05-05 07:38:15 UTC (rev 293824)
@@ -2801,7 +2801,6 @@
workers/service/context/ServiceWorkerThreadProxy.cpp
workers/service/server/RegistrationDatabase.cpp
workers/service/server/RegistrationStore.cpp
-workers/service/server/SWOriginStore.cpp
workers/service/server/SWScriptStorage.cpp
workers/service/server/SWServer.cpp
workers/service/server/SWServerJobQueue.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (293823 => 293824)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2022-05-05 06:38:33 UTC (rev 293823)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2022-05-05 07:38:15 UTC (rev 293824)
@@ -1115,7 +1115,6 @@
415080371E3F00B00051D75D /* LibWebRTCAudioModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 415080351E3F00AA0051D75D /* LibWebRTCAudioModule.h */; };
4150F9F112B6E0E70008C860 /* SliderThumbElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 4150F9EF12B6E0E70008C860 /* SliderThumbElement.h */; };
41519CB81FD1F02E007F623C /* ServiceWorkerClientQueryOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 413FC4CD1FD1DD8C00541C4B /* ServiceWorkerClientQueryOptions.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 4151E5BB1FBA4C7A00E47E2D /* SWOriginStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 4151E5B71FBA4C7500E47E2D /* SWOriginStore.h */; settings = {ATTRIBUTES = (Private, ); }; };
415747471E3869A400E914D8 /* LibWebRTCMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 415747431E38699E00E914D8 /* LibWebRTCMacros.h */; settings = {ATTRIBUTES = (Private, ); }; };
415747481E3869A700E914D8 /* LibWebRTCProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 415747441E38699E00E914D8 /* LibWebRTCProvider.h */; settings = {ATTRIBUTES = (Private, ); }; };
4157EBFA1E3AB67900AC9FE9 /* MockLibWebRTCPeerConnection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4157EBF91E3AB06800AC9FE9 /* MockLibWebRTCPeerConnection.cpp */; };
@@ -8708,8 +8707,6 @@
415080351E3F00AA0051D75D /* LibWebRTCAudioModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LibWebRTCAudioModule.h; path = libwebrtc/LibWebRTCAudioModule.h; sourceTree = "<group>"; };
4150F9EF12B6E0E70008C860 /* SliderThumbElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SliderThumbElement.h; sourceTree = "<group>"; };
4150F9F012B6E0E70008C860 /* SliderThumbElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SliderThumbElement.cpp; sourceTree = "<group>"; };
- 4151E5B71FBA4C7500E47E2D /* SWOriginStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWOriginStore.h; sourceTree = "<group>"; };
- 4151E5B91FBA4C7600E47E2D /* SWOriginStore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SWOriginStore.cpp; sourceTree = "<group>"; };
415747431E38699E00E914D8 /* LibWebRTCMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LibWebRTCMacros.h; path = libwebrtc/LibWebRTCMacros.h; sourceTree = "<group>"; };
415747441E38699E00E914D8 /* LibWebRTCProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LibWebRTCProvider.h; path = libwebrtc/LibWebRTCProvider.h; sourceTree = "<group>"; };
4157EBF81E3AB06800AC9FE9 /* MockLibWebRTCPeerConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MockLibWebRTCPeerConnection.h; sourceTree = "<group>"; };
@@ -22426,8 +22423,6 @@
51B9140C1FD2782500EE2859 /* RegistrationDatabase.h */,
51B9140E1FD2782500EE2859 /* RegistrationStore.cpp */,
51B9140B1FD2782500EE2859 /* RegistrationStore.h */,
- 4151E5B91FBA4C7600E47E2D /* SWOriginStore.cpp */,
- 4151E5B71FBA4C7500E47E2D /* SWOriginStore.h */,
46273CAE260E59DF006FAA91 /* SWScriptStorage.cpp */,
46273CAC260E59DF006FAA91 /* SWScriptStorage.h */,
517A52EF1F47535900DCDC0A /* SWServer.cpp */,
@@ -37917,7 +37912,6 @@
46ECB6381FD0A3C80088E5AD /* SWClientConnection.h in Headers */,
46658DC91FA24B8700F7DD54 /* SWContextManager.h in Headers */,
C11A9ECE21403A5C00CFB20A /* SwitchingGPUClient.h in Headers */,
- 4151E5BB1FBA4C7A00E47E2D /* SWOriginStore.h in Headers */,
46273CAF260E59EF006FAA91 /* SWScriptStorage.h in Headers */,
517A52F01F47535B00DCDC0A /* SWServer.h in Headers */,
8311C0031FAA2E9500E3C8E5 /* SWServerJobQueue.h in Headers */,
Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (293823 => 293824)
--- trunk/Source/WebCore/loader/DocumentLoader.cpp 2022-05-05 06:38:33 UTC (rev 293823)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp 2022-05-05 07:38:15 UTC (rev 293824)
@@ -578,10 +578,6 @@
}
auto origin = (!m_frame->isMainFrame() && m_frame->document()) ? m_frame->document()->topOrigin().data() : SecurityOriginData::fromURL(url);
- if (!ServiceWorkerProvider::singleton().serviceWorkerConnection().mayHaveServiceWorkerRegisteredForOrigin(origin)) {
- callback(std::nullopt);
- return;
- }
auto& connection = ServiceWorkerProvider::singleton().serviceWorkerConnection();
connection.matchRegistration(WTFMove(origin), url, WTFMove(callback));
Modified: trunk/Source/WebCore/workers/service/SWClientConnection.h (293823 => 293824)
--- trunk/Source/WebCore/workers/service/SWClientConnection.h 2022-05-05 06:38:33 UTC (rev 293823)
+++ trunk/Source/WebCore/workers/service/SWClientConnection.h 2022-05-05 07:38:15 UTC (rev 293824)
@@ -83,7 +83,6 @@
virtual void postMessageToServiceWorker(ServiceWorkerIdentifier destination, MessageWithMessagePorts&&, const ServiceWorkerOrClientIdentifier& source) = 0;
virtual SWServerConnectionIdentifier serverConnectionIdentifier() const = 0;
- virtual bool mayHaveServiceWorkerRegisteredForOrigin(const SecurityOriginData&) const = 0;
virtual void registerServiceWorkerClient(const ClientOrigin&, ServiceWorkerClientData&&, const std::optional<ServiceWorkerRegistrationIdentifier>&, String&& userAgent) = 0;
virtual void unregisterServiceWorkerClient(ScriptExecutionContextIdentifier) = 0;
Modified: trunk/Source/WebCore/workers/service/WorkerSWClientConnection.cpp (293823 => 293824)
--- trunk/Source/WebCore/workers/service/WorkerSWClientConnection.cpp 2022-05-05 06:38:33 UTC (rev 293823)
+++ trunk/Source/WebCore/workers/service/WorkerSWClientConnection.cpp 2022-05-05 07:38:15 UTC (rev 293824)
@@ -178,12 +178,6 @@
return identifier;
}
-bool WorkerSWClientConnection::mayHaveServiceWorkerRegisteredForOrigin(const SecurityOriginData&) const
-{
- ASSERT_NOT_REACHED();
- return true;
-}
-
void WorkerSWClientConnection::registerServiceWorkerClient(const ClientOrigin& clientOrigin, ServiceWorkerClientData&& data, const std::optional<ServiceWorkerRegistrationIdentifier>& identifier, String&& userAgent)
{
callOnMainThread([clientOrigin = clientOrigin.isolatedCopy(), data = "" identifier, userAgent = crossThreadCopy(WTFMove(userAgent))]() mutable {
Modified: trunk/Source/WebCore/workers/service/WorkerSWClientConnection.h (293823 => 293824)
--- trunk/Source/WebCore/workers/service/WorkerSWClientConnection.h 2022-05-05 06:38:33 UTC (rev 293823)
+++ trunk/Source/WebCore/workers/service/WorkerSWClientConnection.h 2022-05-05 07:38:15 UTC (rev 293824)
@@ -53,7 +53,6 @@
void didResolveRegistrationPromise(const ServiceWorkerRegistrationKey&) final;
void postMessageToServiceWorker(ServiceWorkerIdentifier destination, MessageWithMessagePorts&&, const ServiceWorkerOrClientIdentifier& source) final;
SWServerConnectionIdentifier serverConnectionIdentifier() const final;
- bool mayHaveServiceWorkerRegisteredForOrigin(const SecurityOriginData&) const final;
void finishFetchingScriptInServer(const ServiceWorkerJobDataIdentifier&, ServiceWorkerRegistrationKey&&, WorkerFetchResult&&) final;
void scheduleJobInServer(const ServiceWorkerJobData&) final;
void scheduleJob(ServiceWorkerOrClientIdentifier, const ServiceWorkerJobData&) final;
Deleted: trunk/Source/WebCore/workers/service/server/SWOriginStore.cpp (293823 => 293824)
--- trunk/Source/WebCore/workers/service/server/SWOriginStore.cpp 2022-05-05 06:38:33 UTC (rev 293823)
+++ trunk/Source/WebCore/workers/service/server/SWOriginStore.cpp 2022-05-05 07:38:15 UTC (rev 293824)
@@ -1,71 +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 "SWOriginStore.h"
-
-#if ENABLE(SERVICE_WORKER)
-
-#include "SecurityOrigin.h"
-
-namespace WebCore {
-
-void SWOriginStore::add(const SecurityOriginData& origin)
-{
- ++m_originCounts.ensure(origin, [&] {
- addToStore(origin);
- return 0;
- }).iterator->value;
-}
-
-void SWOriginStore::remove(const SecurityOriginData& origin)
-{
- auto iterator = m_originCounts.find(origin);
- ASSERT(iterator != m_originCounts.end());
- if (iterator == m_originCounts.end())
- return;
-
- if (--iterator->value)
- return;
-
- m_originCounts.remove(iterator);
- removeFromStore(origin);
-}
-
-void SWOriginStore::clear(const SecurityOriginData& origin)
-{
- m_originCounts.remove(origin);
- removeFromStore(origin);
-}
-
-void SWOriginStore::clearAll()
-{
- m_originCounts.clear();
- clearStore();
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(SERVICE_WORKER)
Deleted: trunk/Source/WebCore/workers/service/server/SWOriginStore.h (293823 => 293824)
--- trunk/Source/WebCore/workers/service/server/SWOriginStore.h 2022-05-05 06:38:33 UTC (rev 293823)
+++ trunk/Source/WebCore/workers/service/server/SWOriginStore.h 2022-05-05 07:38:15 UTC (rev 293824)
@@ -1,57 +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 "SecurityOriginData.h"
-#include <wtf/HashMap.h>
-
-namespace WebCore {
-
-class SWOriginStore {
- WTF_MAKE_FAST_ALLOCATED;
-public:
- virtual ~SWOriginStore() = default;
-
- void add(const SecurityOriginData&);
- void remove(const SecurityOriginData&);
- void clear(const SecurityOriginData&);
- void clearAll();
-
- virtual void importComplete() = 0;
-
-private:
- virtual void addToStore(const SecurityOriginData&) = 0;
- virtual void removeFromStore(const SecurityOriginData&) = 0;
- virtual void clearStore() = 0;
-
- HashMap<SecurityOriginData, uint64_t> m_originCounts;
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(SERVICE_WORKER)
Modified: trunk/Source/WebCore/workers/service/server/SWServer.cpp (293823 => 293824)
--- trunk/Source/WebCore/workers/service/server/SWServer.cpp 2022-05-05 06:38:33 UTC (rev 293823)
+++ trunk/Source/WebCore/workers/service/server/SWServer.cpp 2022-05-05 07:38:15 UTC (rev 293824)
@@ -33,7 +33,6 @@
#include "Logging.h"
#include "NotificationData.h"
#include "RegistrationStore.h"
-#include "SWOriginStore.h"
#include "SWServerJobQueue.h"
#include "SWServerRegistration.h"
#include "SWServerToContextConnection.h"
@@ -149,7 +148,6 @@
{
ASSERT(!m_importCompleted);
m_importCompleted = true;
- m_originStore->importComplete();
auto clearCallbacks = WTFMove(m_clearCompletionCallbacks);
for (auto& callback : clearCallbacks)
@@ -224,7 +222,6 @@
if (registration->serviceWorkerPageIdentifier())
m_serviceWorkerPageIdentifierToRegistrationMap.add(*registration->serviceWorkerPageIdentifier(), *registration);
- m_originStore->add(registration->key().topOrigin());
auto registrationID = registration->identifier();
ASSERT(!m_scopeToRegistrationMap.contains(registration->key()));
m_scopeToRegistrationMap.set(registration->key(), *registration);
@@ -247,7 +244,6 @@
m_uniqueRegistrationCount--;
}
- m_originStore->remove(registration->key().topOrigin());
if (m_registrationStore)
m_registrationStore->removeRegistration(registration->key());
}
@@ -286,7 +282,6 @@
while (!m_registrations.isEmpty())
m_registrations.begin()->value->clear();
m_pendingContextDatas.clear();
- m_originStore->clearAll();
if (!m_registrationStore)
return completionHandler();
@@ -339,7 +334,7 @@
return;
}
- // Calling SWServerRegistration::clear() takes care of updating m_registrations, m_originStore and m_registrationStore.
+ // Calling SWServerRegistration::clear() takes care of updating m_registrations and m_registrationStore.
for (auto* registration : registrationsToRemove)
registration->clear();
@@ -369,9 +364,8 @@
m_server.removeClientServiceWorkerRegistration(*this, identifier);
}
-SWServer::SWServer(UniqueRef<SWOriginStore>&& originStore, bool processTerminationDelayEnabled, String&& registrationDatabaseDirectory, PAL::SessionID sessionID, bool shouldRunServiceWorkersOnMainThreadForTesting, bool hasServiceWorkerEntitlement, std::optional<unsigned> overrideServiceWorkerRegistrationCountTestingValue, SoftUpdateCallback&& softUpdateCallback, CreateContextConnectionCallback&& callback, AppBoundDomainsCallback&& appBoundDomainsCallback)
- : m_originStore(WTFMove(originStore))
- , m_sessionID(sessionID)
+SWServer::SWServer(bool processTerminationDelayEnabled, String&& registrationDatabaseDirectory, PAL::SessionID sessionID, bool shouldRunServiceWorkersOnMainThreadForTesting, bool hasServiceWorkerEntitlement, std::optional<unsigned> overrideServiceWorkerRegistrationCountTestingValue, SoftUpdateCallback&& softUpdateCallback, CreateContextConnectionCallback&& callback, AppBoundDomainsCallback&& appBoundDomainsCallback)
+ : m_sessionID(sessionID)
, m_isProcessTerminationDelayEnabled(processTerminationDelayEnabled)
, m_createContextConnectionCallback(WTFMove(callback))
, m_softUpdateCallback(WTFMove(softUpdateCallback))
Modified: trunk/Source/WebCore/workers/service/server/SWServer.h (293823 => 293824)
--- trunk/Source/WebCore/workers/service/server/SWServer.h 2022-05-05 06:38:33 UTC (rev 293823)
+++ trunk/Source/WebCore/workers/service/server/SWServer.h 2022-05-05 07:38:15 UTC (rev 293824)
@@ -55,7 +55,6 @@
namespace WebCore {
class RegistrationStore;
-class SWOriginStore;
class SWServerJobQueue;
class SWServerRegistration;
class SWServerToContextConnection;
@@ -134,7 +133,7 @@
using SoftUpdateCallback = Function<void(ServiceWorkerJobData&& jobData, bool shouldRefreshCache, ResourceRequest&&, CompletionHandler<void(WorkerFetchResult&&)>&&)>;
using CreateContextConnectionCallback = Function<void(const WebCore::RegistrableDomain&, std::optional<ProcessIdentifier> requestingProcessIdentifier, std::optional<ScriptExecutionContextIdentifier>, CompletionHandler<void()>&&)>;
using AppBoundDomainsCallback = Function<void(CompletionHandler<void(HashSet<WebCore::RegistrableDomain>&&)>&&)>;
- WEBCORE_EXPORT SWServer(UniqueRef<SWOriginStore>&&, bool processTerminationDelayEnabled, String&& registrationDatabaseDirectory, PAL::SessionID, bool shouldRunServiceWorkersOnMainThreadForTesting, bool hasServiceWorkerEntitlement, std::optional<unsigned> overrideServiceWorkerRegistrationCountTestingValue, SoftUpdateCallback&&, CreateContextConnectionCallback&&, AppBoundDomainsCallback&&);
+ WEBCORE_EXPORT SWServer(bool processTerminationDelayEnabled, String&& registrationDatabaseDirectory, PAL::SessionID, bool shouldRunServiceWorkersOnMainThreadForTesting, bool hasServiceWorkerEntitlement, std::optional<unsigned> overrideServiceWorkerRegistrationCountTestingValue, SoftUpdateCallback&&, CreateContextConnectionCallback&&, AppBoundDomainsCallback&&);
WEBCORE_EXPORT ~SWServer();
@@ -178,8 +177,6 @@
const HashMap<SWServerConnectionIdentifier, std::unique_ptr<Connection>>& connections() const { return m_connections; }
WEBCORE_EXPORT bool canHandleScheme(StringView) const;
- SWOriginStore& originStore() { return m_originStore; }
-
void refreshImportedScriptsFinished(const ServiceWorkerJobDataIdentifier&, const ServiceWorkerRegistrationKey&, const Vector<std::pair<URL, ScriptBuffer>>&);
void scriptContextFailedToStart(const std::optional<ServiceWorkerJobDataIdentifier>&, SWServerWorker&, const String& message);
void scriptContextStarted(const std::optional<ServiceWorkerJobDataIdentifier>&, SWServerWorker&);
@@ -221,6 +218,7 @@
bool isImportCompleted() const { return m_importCompleted; }
WEBCORE_EXPORT void whenImportIsCompleted(CompletionHandler<void()>&&);
+ WEBCORE_EXPORT void whenImportIsCompletedIfNeeded(CompletionHandler<void()>&&);
void softUpdate(SWServerRegistration&);
@@ -284,7 +282,6 @@
void contextConnectionCreated(SWServerToContextConnection&);
void updateAppInitiatedValueForWorkers(const ClientOrigin&, LastNavigationWasAppInitiated);
- void whenImportIsCompletedIfNeeded(CompletionHandler<void()>&&);
ResourceRequest createScriptRequest(const URL&, const ServiceWorkerJobData&, SWServerRegistration&);
@@ -307,7 +304,6 @@
HashMap<ScriptExecutionContextIdentifier, ServiceWorkerRegistrationIdentifier> m_clientToControllingRegistration;
MemoryCompactRobinHoodHashMap<String, ScriptExecutionContextIdentifier> m_visibleClientIdToInternalClientIdMap;
- UniqueRef<SWOriginStore> m_originStore;
std::unique_ptr<RegistrationStore> m_registrationStore;
HashMap<RegistrableDomain, Vector<ServiceWorkerContextData>> m_pendingContextDatas;
HashMap<RegistrableDomain, HashMap<ServiceWorkerIdentifier, Vector<RunServiceWorkerCallback>>> m_serviceWorkerRunRequests;
Modified: trunk/Source/WebKit/ChangeLog (293823 => 293824)
--- trunk/Source/WebKit/ChangeLog 2022-05-05 06:38:33 UTC (rev 293823)
+++ trunk/Source/WebKit/ChangeLog 2022-05-05 07:38:15 UTC (rev 293824)
@@ -1,3 +1,26 @@
+2022-05-05 Youenn Fablet <you...@apple.com>
+
+ SWOriginStore is no longer needed
+ https://bugs.webkit.org/show_bug.cgi?id=240003
+
+ Reviewed by Chris Dumez.
+
+ No observable change, we remove the SWOrigin optimization as its main remaining use
+ is to optimize the case of a page being loaded by service worker instead of app cache which is a tiny edge case.
+
+ * NetworkProcess/NetworkSession.cpp:
+ * NetworkProcess/NetworkSession.h:
+ * NetworkProcess/ServiceWorker/WebSWOriginStore.cpp: Removed.
+ * NetworkProcess/ServiceWorker/WebSWOriginStore.h: Removed.
+ * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
+ * NetworkProcess/ServiceWorker/WebSWServerConnection.h:
+ * WebKit.xcodeproj/project.pbxproj:
+ * WebProcess/Storage/WebSWClientConnection.cpp:
+ * WebProcess/Storage/WebSWClientConnection.h:
+ * WebProcess/Storage/WebSWClientConnection.messages.in:
+ * WebProcess/Storage/WebSWOriginTable.cpp: Removed.
+ * WebProcess/Storage/WebSWOriginTable.h: Removed.
+
2022-05-04 Kimmo Kinnunen <kkinnu...@apple.com>
SharedMemory::systemPageSize is redundant function
Modified: trunk/Source/WebKit/NetworkProcess/NetworkSession.cpp (293823 => 293824)
--- trunk/Source/WebKit/NetworkProcess/NetworkSession.cpp 2022-05-05 06:38:33 UTC (rev 293823)
+++ trunk/Source/WebKit/NetworkProcess/NetworkSession.cpp 2022-05-05 07:38:15 UTC (rev 293824)
@@ -46,7 +46,6 @@
#include "WebPageProxy.h"
#include "WebPageProxyMessages.h"
#include "WebProcessProxy.h"
-#include "WebSWOriginStore.h"
#include "WebSharedWorkerServer.h"
#include "WebSocketTask.h"
#include <WebCore/CookieJar.h>
@@ -611,25 +610,6 @@
return m_navigationPreloaders.get(identifier).get();
}
-WebSWOriginStore* NetworkSession::swOriginStore() const
-{
- return m_swServer ? &static_cast<WebSWOriginStore&>(m_swServer->originStore()) : nullptr;
-}
-
-void NetworkSession::registerSWServerConnection(WebSWServerConnection& connection)
-{
- auto* store = swOriginStore();
- ASSERT(store);
- if (store)
- store->registerSWServerConnection(connection);
-}
-
-void NetworkSession::unregisterSWServerConnection(WebSWServerConnection& connection)
-{
- if (auto* store = swOriginStore())
- store->unregisterSWServerConnection(connection);
-}
-
SWServer& NetworkSession::ensureSWServer()
{
if (!m_swServer) {
@@ -648,7 +628,7 @@
completionHandler({ });
};
#endif
- m_swServer = makeUnique<SWServer>(makeUniqueRef<WebSWOriginStore>(), info.processTerminationDelayEnabled, WTFMove(path), m_sessionID, shouldRunServiceWorkersOnMainThreadForTesting(), m_networkProcess->parentProcessHasServiceWorkerEntitlement(), overrideServiceWorkerRegistrationCountTestingValue(), [this](auto&& jobData, bool shouldRefreshCache, auto&& request, auto&& completionHandler) mutable {
+ m_swServer = makeUnique<SWServer>(info.processTerminationDelayEnabled, WTFMove(path), m_sessionID, shouldRunServiceWorkersOnMainThreadForTesting(), m_networkProcess->parentProcessHasServiceWorkerEntitlement(), overrideServiceWorkerRegistrationCountTestingValue(), [this](auto&& jobData, bool shouldRefreshCache, auto&& request, auto&& completionHandler) mutable {
ServiceWorkerSoftUpdateLoader::start(this, WTFMove(jobData), shouldRefreshCache, WTFMove(request), WTFMove(completionHandler));
}, [this](auto& registrableDomain, std::optional<ProcessIdentifier> requestingProcessIdentifier, std::optional<ScriptExecutionContextIdentifier> serviceWorkerPageIdentifier, auto&& completionHandler) {
ASSERT(!registrableDomain.isEmpty());
Modified: trunk/Source/WebKit/NetworkProcess/NetworkSession.h (293823 => 293824)
--- trunk/Source/WebKit/NetworkProcess/NetworkSession.h 2022-05-05 06:38:33 UTC (rev 293823)
+++ trunk/Source/WebKit/NetworkProcess/NetworkSession.h 2022-05-05 07:38:15 UTC (rev 293824)
@@ -81,7 +81,6 @@
class WebResourceLoadStatisticsStore;
class WebSharedWorkerServer;
class WebSocketTask;
-class WebSWOriginStore;
class WebSWServerConnection;
struct NetworkSessionCreationParameters;
struct SessionSet;
@@ -203,9 +202,6 @@
WebCore::SWServer* swServer() { return m_swServer.get(); }
WebCore::SWServer& ensureSWServer();
- WebSWOriginStore* swOriginStore() const; // FIXME: Can be private?
- void registerSWServerConnection(WebSWServerConnection&);
- void unregisterSWServerConnection(WebSWServerConnection&);
bool hasServiceWorkerDatabasePath() const;
#endif
Deleted: trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWOriginStore.cpp (293823 => 293824)
--- trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWOriginStore.cpp 2022-05-05 06:38:33 UTC (rev 293823)
+++ trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWOriginStore.cpp 2022-05-05 07:38:15 UTC (rev 293824)
@@ -1,106 +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"
-
-#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::addToStore(const SecurityOriginData& origin)
-{
- m_store.scheduleAddition(computeSharedStringHash(origin.toString()));
- m_store.flushPendingChanges();
-}
-
-void WebSWOriginStore::removeFromStore(const SecurityOriginData& origin)
-{
- m_store.scheduleRemoval(computeSharedStringHash(origin.toString()));
- m_store.flushPendingChanges();
-}
-
-void WebSWOriginStore::clearStore()
-{
- m_store.clear();
-}
-
-void WebSWOriginStore::importComplete()
-{
- m_isImported = true;
- for (auto& connection : m_webSWServerConnections)
- connection.send(Messages::WebSWClientConnection::SetSWOriginTableIsImported());
-}
-
-void WebSWOriginStore::registerSWServerConnection(WebSWServerConnection& connection)
-{
- m_webSWServerConnections.add(connection);
-
- if (!m_store.isEmpty())
- sendStoreHandle(connection);
-
- if (m_isImported)
- connection.send(Messages::WebSWClientConnection::SetSWOriginTableIsImported());
-}
-
-void WebSWOriginStore::unregisterSWServerConnection(WebSWServerConnection& connection)
-{
- m_webSWServerConnections.remove(connection);
-}
-
-void WebSWOriginStore::sendStoreHandle(WebSWServerConnection& connection)
-{
- SharedMemory::Handle handle;
- if (!m_store.createSharedMemoryHandle(handle))
- return;
-
-#if (OS(DARWIN) || OS(WINDOWS)) && !USE(UNIX_DOMAIN_SOCKETS)
- uint64_t dataSize = handle.size();
-#else
- uint64_t dataSize = 0;
-#endif
- connection.send(Messages::WebSWClientConnection::SetSWOriginTableSharedMemory(SharedMemory::IPCHandle { WTFMove(handle), dataSize }));
-}
-
-void WebSWOriginStore::didInvalidateSharedMemory()
-{
- for (auto& connection : m_webSWServerConnections)
- sendStoreHandle(connection);
-}
-
-} // namespace WebKit
-
-#endif // ENABLE(SERVICE_WORKER)
Deleted: trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWOriginStore.h (293823 => 293824)
--- trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWOriginStore.h 2022-05-05 06:38:33 UTC (rev 293823)
+++ trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWOriginStore.h 2022-05-05 07:38:15 UTC (rev 293824)
@@ -1,63 +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 "SharedStringHashStore.h"
-#include <WebCore/SWOriginStore.h>
-#include <wtf/WeakHashSet.h>
-
-namespace WebKit {
-
-class WebSWServerConnection;
-
-class WebSWOriginStore final : public WebCore::SWOriginStore, private SharedStringHashStore::Client {
-public:
- WebSWOriginStore();
-
- void registerSWServerConnection(WebSWServerConnection&);
- void unregisterSWServerConnection(WebSWServerConnection&);
- void importComplete() final;
-
-private:
- void sendStoreHandle(WebSWServerConnection&);
-
- void addToStore(const WebCore::SecurityOriginData&) final;
- void removeFromStore(const WebCore::SecurityOriginData&) final;
- void clearStore() final;
-
- // SharedStringHashStore::Client.
- void didInvalidateSharedMemory() final;
-
- SharedStringHashStore m_store;
- bool m_isImported { false };
- WeakHashSet<WebSWServerConnection> m_webSWServerConnections;
-};
-
-} // namespace WebKit
-
-#endif // ENABLE(SERVICE_WORKER)
Modified: trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp (293823 => 293824)
--- trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp 2022-05-05 06:38:33 UTC (rev 293823)
+++ trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp 2022-05-05 07:38:15 UTC (rev 293824)
@@ -82,14 +82,10 @@
, m_contentConnection(connection)
, m_networkProcess(networkProcess)
{
- if (auto* session = this->session())
- session->registerSWServerConnection(*this);
}
WebSWServerConnection::~WebSWServerConnection()
{
- if (auto* session = this->session())
- session->unregisterSWServerConnection(*this);
for (const auto& keyValue : m_clientOrigins)
server().unregisterServiceWorkerClient(keyValue.value, keyValue.key);
for (auto& completionHandler : m_unregisterJobs.values())
@@ -388,18 +384,30 @@
send(Messages::WebSWClientConnection::PostMessageToServiceWorkerClient { destinationContextIdentifier, message, sourceServiceWorker->data(), sourceOrigin });
}
-void WebSWServerConnection::matchRegistration(const SecurityOriginData& topOrigin, const URL& clientURL, CompletionHandler<void(std::optional<ServiceWorkerRegistrationData>&&)>&& callback)
+void WebSWServerConnection::matchRegistration(SecurityOriginData&& topOrigin, URL&& clientURL, CompletionHandler<void(std::optional<ServiceWorkerRegistrationData>&&)>&& callback)
{
- if (auto* registration = doRegistrationMatching(topOrigin, clientURL)) {
- callback(registration->data());
- return;
- }
- callback({ });
+ server().whenImportIsCompletedIfNeeded([weakThis = WeakPtr { *this }, topOrigin = WTFMove(topOrigin), clientURL = WTFMove(clientURL), callback = WTFMove(callback)]() mutable {
+ if (!weakThis) {
+ callback({ });
+ return;
+ }
+ if (auto* registration = weakThis->doRegistrationMatching(topOrigin, clientURL)) {
+ callback(registration->data());
+ return;
+ }
+ callback({ });
+ });
}
-void WebSWServerConnection::getRegistrations(const SecurityOriginData& topOrigin, const URL& clientURL, CompletionHandler<void(const Vector<ServiceWorkerRegistrationData>&)>&& callback)
+void WebSWServerConnection::getRegistrations(SecurityOriginData&& topOrigin, URL&& clientURL, CompletionHandler<void(const Vector<ServiceWorkerRegistrationData>&)>&& callback)
{
- callback(server().getRegistrations(topOrigin, clientURL));
+ server().whenImportIsCompletedIfNeeded([weakThis = WeakPtr { *this }, topOrigin = WTFMove(topOrigin), clientURL = WTFMove(clientURL), callback = WTFMove(callback)]() mutable {
+ if (!weakThis) {
+ callback({ });
+ return;
+ }
+ callback(weakThis->server().getRegistrations(topOrigin, clientURL));
+ });
}
void WebSWServerConnection::registerServiceWorkerClient(WebCore::ClientOrigin&& clientOrigin, ServiceWorkerClientData&& data, const std::optional<ServiceWorkerRegistrationIdentifier>& controllingServiceWorkerRegistrationIdentifier, String&& userAgent)
Modified: trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.h (293823 => 293824)
--- trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.h 2022-05-05 06:38:33 UTC (rev 293823)
+++ trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.h 2022-05-05 07:38:15 UTC (rev 293824)
@@ -112,8 +112,8 @@
void startFetch(ServiceWorkerFetchTask&, WebCore::SWServerWorker&);
- void matchRegistration(const WebCore::SecurityOriginData& topOrigin, const URL& clientURL, CompletionHandler<void(std::optional<WebCore::ServiceWorkerRegistrationData>&&)>&&);
- void getRegistrations(const WebCore::SecurityOriginData& topOrigin, const URL& clientURL, CompletionHandler<void(const Vector<WebCore::ServiceWorkerRegistrationData>&)>&&);
+ void matchRegistration(WebCore::SecurityOriginData&&, URL&&, CompletionHandler<void(std::optional<WebCore::ServiceWorkerRegistrationData>&&)>&&);
+ void getRegistrations(WebCore::SecurityOriginData&&, URL&&, CompletionHandler<void(const Vector<WebCore::ServiceWorkerRegistrationData>&)>&&);
void terminateWorkerFromClient(WebCore::ServiceWorkerIdentifier, CompletionHandler<void()>&&);
void whenServiceWorkerIsTerminatedForTesting(WebCore::ServiceWorkerIdentifier, CompletionHandler<void()>&&);
Modified: trunk/Source/WebKit/Sources.txt (293823 => 293824)
--- trunk/Source/WebKit/Sources.txt 2022-05-05 06:38:33 UTC (rev 293823)
+++ trunk/Source/WebKit/Sources.txt 2022-05-05 07:38:15 UTC (rev 293824)
@@ -135,7 +135,6 @@
NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp
NetworkProcess/ServiceWorker/ServiceWorkerNavigationPreloader.cpp
NetworkProcess/ServiceWorker/ServiceWorkerSoftUpdateLoader.cpp
-NetworkProcess/ServiceWorker/WebSWOriginStore.cpp @no-unify
NetworkProcess/ServiceWorker/WebSWServerConnection.cpp @no-unify
NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp @no-unify
@@ -796,7 +795,6 @@
WebProcess/Storage/RemoteWorkerFrameLoaderClient.cpp
WebProcess/Storage/WebSWClientConnection.cpp
WebProcess/Storage/WebSWContextManagerConnection.cpp
-WebProcess/Storage/WebSWOriginTable.cpp
WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp
WebProcess/Storage/WebServiceWorkerProvider.cpp
WebProcess/Storage/WebSharedWorkerContextManagerConnection.cpp
Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (293823 => 293824)
--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2022-05-05 06:38:33 UTC (rev 293823)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2022-05-05 07:38:15 UTC (rev 293824)
@@ -1435,7 +1435,6 @@
83A0ED351F747CCF003299EB /* PreconnectTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 83A0ED321F747CC6003299EB /* PreconnectTask.h */; };
83D454D71BE9D3C4006C93BD /* NetworkLoadClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D454D61BE9D3C4006C93BD /* NetworkLoadClient.h */; };
83EE575C1DB7D61100C74C50 /* WebValidationMessageClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 83EE575A1DB7D60600C74C50 /* WebValidationMessageClient.h */; };
- 83F1A07A1F96E7790045B94E /* WebSWOriginTable.h in Headers */ = {isa = PBXBuildFile; fileRef = 83F1A0781F96E7710045B94E /* WebSWOriginTable.h */; };
83F9644E1FA0F76E00C47750 /* SharedStringHashTableReadOnly.h in Headers */ = {isa = PBXBuildFile; fileRef = 83F9644C1FA0F76300C47750 /* SharedStringHashTableReadOnly.h */; };
84477853176FCC0800CDC7BB /* InjectedBundleHitTestResultMediaType.h in Headers */ = {isa = PBXBuildFile; fileRef = 84477851176FCAC100CDC7BB /* InjectedBundleHitTestResultMediaType.h */; };
8644890B27B47020007A1C66 /* _WKSystemPreferences.h in Headers */ = {isa = PBXBuildFile; fileRef = 8644890A27B47020007A1C66 /* _WKSystemPreferences.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -1470,8 +1469,6 @@
9354242C2703BDCB005CA72C /* WebFileSystemStorageConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 9354242A2703BDCB005CA72C /* WebFileSystemStorageConnection.h */; };
9356F2DC2152B6B500E6D5DF /* WebSWClientConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 517A53021F4793B200DCDC0A /* WebSWClientConnection.h */; };
9356F2DD2152B6F600E6D5DF /* WebSWServerConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 93BA04E02151ADF4007F455F /* WebSWServerConnection.h */; };
- 9356F2DE2152B71000E6D5DF /* WebSWOriginStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 93BA04DE2151ADF4007F455F /* WebSWOriginStore.h */; };
- 9356F2DF2152B72300E6D5DF /* WebSWOriginStore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93BA04DF2151ADF4007F455F /* WebSWOriginStore.cpp */; };
9356F2E02152B75200E6D5DF /* WebSWServerToContextConnection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93BA04DD2151ADF3007F455F /* WebSWServerToContextConnection.cpp */; };
9356F2E12152B76600E6D5DF /* WebSWServerConnection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93BA04E12151ADF4007F455F /* WebSWServerConnection.cpp */; };
935B579A26F51933008B48AC /* FileSystemStorageHandleRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 935B579826F51270008B48AC /* FileSystemStorageHandleRegistry.h */; };
@@ -5690,8 +5687,6 @@
83D454D61BE9D3C4006C93BD /* NetworkLoadClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 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>"; };
83F9644B1FA0F76200C47750 /* SharedStringHashTableReadOnly.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SharedStringHashTableReadOnly.cpp; sourceTree = "<group>"; };
83F9644C1FA0F76300C47750 /* SharedStringHashTableReadOnly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SharedStringHashTableReadOnly.h; sourceTree = "<group>"; };
84477851176FCAC100CDC7BB /* InjectedBundleHitTestResultMediaType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundleHitTestResultMediaType.h; sourceTree = "<group>"; };
@@ -5807,8 +5802,6 @@
93BA04DB2151ADF3007F455F /* WebSWServerToContextConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSWServerToContextConnection.h; sourceTree = "<group>"; };
93BA04DC2151ADF3007F455F /* WebSWServerToContextConnection.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebSWServerToContextConnection.messages.in; sourceTree = "<group>"; };
93BA04DD2151ADF3007F455F /* WebSWServerToContextConnection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebSWServerToContextConnection.cpp; sourceTree = "<group>"; };
- 93BA04DE2151ADF4007F455F /* WebSWOriginStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSWOriginStore.h; sourceTree = "<group>"; };
- 93BA04DF2151ADF4007F455F /* WebSWOriginStore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebSWOriginStore.cpp; sourceTree = "<group>"; };
93BA04E02151ADF4007F455F /* WebSWServerConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSWServerConnection.h; sourceTree = "<group>"; };
93BA04E12151ADF4007F455F /* WebSWServerConnection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebSWServerConnection.cpp; sourceTree = "<group>"; };
93BDEB00171DD7AF00BFEE1B /* WKPageLoadTypesPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPageLoadTypesPrivate.h; sourceTree = "<group>"; };
@@ -10280,8 +10273,6 @@
466BC0381FA266C9002FA9C1 /* WebSWContextManagerConnection.cpp */,
466BC0391FA266C9002FA9C1 /* WebSWContextManagerConnection.h */,
466BC03A1FA266C9002FA9C1 /* WebSWContextManagerConnection.messages.in */,
- 83F1A0771F96E7700045B94E /* WebSWOriginTable.cpp */,
- 83F1A0781F96E7710045B94E /* WebSWOriginTable.h */,
);
path = Storage;
sourceTree = "<group>";
@@ -11340,8 +11331,6 @@
41EB4D3A274CE04500A9272B /* ServiceWorkerNavigationPreloader.h */,
41D5C6D9238EB20E00B9B3CB /* ServiceWorkerSoftUpdateLoader.cpp */,
41D5C6D8238EB20D00B9B3CB /* ServiceWorkerSoftUpdateLoader.h */,
- 93BA04DF2151ADF4007F455F /* WebSWOriginStore.cpp */,
- 93BA04DE2151ADF4007F455F /* WebSWOriginStore.h */,
93BA04E12151ADF4007F455F /* WebSWServerConnection.cpp */,
93BA04E02151ADF4007F455F /* WebSWServerConnection.h */,
93BA04DA2151ADF3007F455F /* WebSWServerConnection.messages.in */,
@@ -15114,8 +15103,6 @@
466BC03C1FA266DA002FA9C1 /* WebSWContextManagerConnection.h in Headers */,
460F48901F996F7100CF4B87 /* WebSWContextManagerConnectionMessages.h in Headers */,
C11A9ECC214035F800CFB20A /* WebSwitchingGPUClient.h in Headers */,
- 9356F2DE2152B71000E6D5DF /* WebSWOriginStore.h in Headers */,
- 83F1A07A1F96E7790045B94E /* WebSWOriginTable.h in Headers */,
9356F2DD2152B6F600E6D5DF /* WebSWServerConnection.h in Headers */,
517A52D91F43A9DA00DCDC0A /* WebSWServerConnectionMessages.h in Headers */,
515262BC1FB9515D0070E579 /* WebSWServerToContextConnectionMessages.h in Headers */,
@@ -17380,7 +17367,6 @@
93D6B78A254CD43E0058DD3A /* WebSpeechRecognitionConnectionMessageReceiver.cpp in Sources */,
517A530F1F47A86200DCDC0A /* WebSWClientConnectionMessageReceiver.cpp in Sources */,
460F488F1F996F7100CF4B87 /* WebSWContextManagerConnectionMessageReceiver.cpp in Sources */,
- 9356F2DF2152B72300E6D5DF /* WebSWOriginStore.cpp in Sources */,
9356F2E12152B76600E6D5DF /* WebSWServerConnection.cpp in Sources */,
517A52D81F43A9DA00DCDC0A /* WebSWServerConnectionMessageReceiver.cpp in Sources */,
9356F2E02152B75200E6D5DF /* WebSWServerToContextConnection.cpp in Sources */,
Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp (293823 => 293824)
--- trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp 2022-05-05 06:38:33 UTC (rev 293823)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp 2022-05-05 07:38:15 UTC (rev 293824)
@@ -39,7 +39,6 @@
#include "WebPageProxyMessages.h"
#include "WebProcess.h"
#include "WebProcessProxyMessages.h"
-#include "WebSWOriginTable.h"
#include "WebSWServerConnectionMessages.h"
#include <WebCore/Document.h>
#include <WebCore/DocumentLoader.h>
@@ -62,7 +61,6 @@
WebSWClientConnection::WebSWClientConnection()
: m_identifier(Process::identifier())
- , m_swOriginTable(makeUniqueRef<WebSWOriginTable>())
{
}
@@ -78,9 +76,7 @@
void WebSWClientConnection::scheduleJobInServer(const ServiceWorkerJobData& jobData)
{
- runOrDelayTaskForImport([this, jobData] {
- send(Messages::WebSWServerConnection::ScheduleJobInServer { jobData });
- });
+ send(Messages::WebSWServerConnection::ScheduleJobInServer { jobData });
}
void WebSWClientConnection::finishFetchingScriptInServer(const ServiceWorkerJobDataIdentifier& jobDataIdentifier, ServiceWorkerRegistrationKey&& registrationKey, WorkerFetchResult&& result)
@@ -130,49 +126,12 @@
send(Messages::WebSWServerConnection::DidResolveRegistrationPromise { key });
}
-bool WebSWClientConnection::mayHaveServiceWorkerRegisteredForOrigin(const SecurityOriginData& origin) const
-{
- if (!m_swOriginTable->isImported())
- return true;
-
- return m_swOriginTable->contains(origin);
-}
-
-void WebSWClientConnection::setSWOriginTableSharedMemory(const SharedMemory::IPCHandle& ipcHandle)
-{
- m_swOriginTable->setSharedMemory(ipcHandle.handle);
-}
-
-void WebSWClientConnection::setSWOriginTableIsImported()
-{
- m_swOriginTable->setIsImported();
- while (!m_tasksPendingOriginImport.isEmpty())
- m_tasksPendingOriginImport.takeFirst()();
-}
-
void WebSWClientConnection::matchRegistration(SecurityOriginData&& topOrigin, const URL& clientURL, RegistrationCallback&& callback)
{
ASSERT(isMainRunLoop());
-
- if (!mayHaveServiceWorkerRegisteredForOrigin(topOrigin)) {
- callback(std::nullopt);
- return;
- }
-
- runOrDelayTaskForImport([this, callback = WTFMove(callback), topOrigin = WTFMove(topOrigin), clientURL]() mutable {
- sendWithAsyncReply(Messages::WebSWServerConnection::MatchRegistration { topOrigin, clientURL }, WTFMove(callback));
- });
+ sendWithAsyncReply(Messages::WebSWServerConnection::MatchRegistration { topOrigin, clientURL }, WTFMove(callback));
}
-void WebSWClientConnection::runOrDelayTaskForImport(Function<void()>&& task)
-{
- if (m_swOriginTable->isImported()) {
- task();
- return;
- }
- m_tasksPendingOriginImport.append(WTFMove(task));
-}
-
void WebSWClientConnection::whenRegistrationReady(const SecurityOriginData& topOrigin, const URL& clientURL, WhenRegistrationReadyCallback&& callback)
{
sendWithAsyncReply(Messages::WebSWServerConnection::WhenRegistrationReady { topOrigin, clientURL }, [callback = WTFMove(callback)](auto result) mutable {
@@ -199,15 +158,7 @@
void WebSWClientConnection::getRegistrations(SecurityOriginData&& topOrigin, const URL& clientURL, GetRegistrationsCallback&& callback)
{
ASSERT(isMainRunLoop());
-
- if (!mayHaveServiceWorkerRegisteredForOrigin(topOrigin)) {
- callback({ });
- return;
- }
-
- runOrDelayTaskForImport([this, callback = WTFMove(callback), topOrigin = WTFMove(topOrigin), clientURL]() mutable {
- sendWithAsyncReply(Messages::WebSWServerConnection::GetRegistrations { topOrigin, clientURL }, WTFMove(callback));
- });
+ sendWithAsyncReply(Messages::WebSWServerConnection::GetRegistrations { topOrigin, clientURL }, WTFMove(callback));
}
void WebSWClientConnection::connectionToServerLost()
Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h (293823 => 293824)
--- trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h 2022-05-05 06:38:33 UTC (rev 293823)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h 2022-05-05 07:38:15 UTC (rev 293824)
@@ -42,7 +42,6 @@
namespace WebKit {
-class WebSWOriginTable;
class WebServiceWorkerProvider;
class WebSWClientConnection final : public WebCore::SWClientConnection, private IPC::MessageSender, public IPC::MessageReceiver {
@@ -58,8 +57,6 @@
void disconnectedFromWebProcess();
void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final;
- bool mayHaveServiceWorkerRegisteredForOrigin(const WebCore::SecurityOriginData&) const final;
-
void connectionToServerLost();
bool isThrottleable() const { return m_isThrottleable; }
@@ -110,16 +107,10 @@
IPC::Connection* messageSenderConnection() const final;
uint64_t messageSenderDestinationID() const final { return 0; }
- void setSWOriginTableSharedMemory(const SharedMemory::IPCHandle&);
- void setSWOriginTableIsImported();
-
void clear();
WebCore::SWServerConnectionIdentifier m_identifier;
- UniqueRef<WebSWOriginTable> m_swOriginTable;
-
- Deque<Function<void()>> m_tasksPendingOriginImport;
bool m_isThrottleable { true };
}; // class WebSWServerConnection
Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.messages.in (293823 => 293824)
--- trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.messages.in 2022-05-05 06:38:33 UTC (rev 293823)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.messages.in 2022-05-05 07:38:15 UTC (rev 293824)
@@ -35,8 +35,6 @@
SetRegistrationUpdateViaCache(WebCore::ServiceWorkerRegistrationIdentifier identifier, enum:uint8_t WebCore::ServiceWorkerUpdateViaCache updateViaCache);
NotifyClientsOfControllerChange(HashSet<WebCore::ScriptExecutionContextIdentifier> contextIdentifiers, struct WebCore::ServiceWorkerData newController)
- SetSWOriginTableIsImported()
- SetSWOriginTableSharedMemory(WebKit::SharedMemory::IPCHandle handle)
PostMessageToServiceWorkerClient(WebCore::ScriptExecutionContextIdentifier destinationContextIdentifier, struct WebCore::MessageWithMessagePorts message, struct WebCore::ServiceWorkerData source, String sourceOrigin)
SetServiceWorkerClientIsControlled(WebCore::ScriptExecutionContextIdentifier workerIdentifier, struct WebCore::ServiceWorkerRegistrationData data) -> (bool isSuccess)
Deleted: trunk/Source/WebKit/WebProcess/Storage/WebSWOriginTable.cpp (293823 => 293824)
--- trunk/Source/WebKit/WebProcess/Storage/WebSWOriginTable.cpp 2022-05-05 06:38:33 UTC (rev 293823)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWOriginTable.cpp 2022-05-05 07:38:15 UTC (rev 293824)
@@ -1,52 +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"
-
-#if ENABLE(SERVICE_WORKER)
-#include "WebSWOriginTable.h"
-
-#include <WebCore/SecurityOrigin.h>
-
-namespace WebKit {
-using namespace WebCore;
-
-bool WebSWOriginTable::contains(const SecurityOriginData& origin) const
-{
- 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)
Deleted: trunk/Source/WebKit/WebProcess/Storage/WebSWOriginTable.h (293823 => 293824)
--- trunk/Source/WebKit/WebProcess/Storage/WebSWOriginTable.h 2022-05-05 06:38:33 UTC (rev 293823)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWOriginTable.h 2022-05-05 07:38:15 UTC (rev 293824)
@@ -1,56 +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 "SharedMemory.h"
-#include "SharedStringHashTableReadOnly.h"
-
-namespace WebCore {
-struct SecurityOriginData;
-}
-
-namespace WebKit {
-
-class WebSWOriginTable {
- WTF_MAKE_FAST_ALLOCATED;
-public:
- WebSWOriginTable() = default;
-
- bool isImported() const { return m_isImported; }
- void setIsImported() { m_isImported = true; }
- bool contains(const WebCore::SecurityOriginData&) const;
- void setSharedMemory(const SharedMemory::Handle&);
-
-private:
- SharedStringHashTableReadOnly m_serviceWorkerOriginTable;
- bool m_isImported { false };
-};
-
-} // namespace WebKit
-
-#endif // ENABLE(SERVICE_WORKER)
Modified: trunk/Source/WebKit/WebProcess/Storage/WebSharedWorkerContextManagerConnection.cpp (293823 => 293824)
--- trunk/Source/WebKit/WebProcess/Storage/WebSharedWorkerContextManagerConnection.cpp 2022-05-05 06:38:33 UTC (rev 293823)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSharedWorkerContextManagerConnection.cpp 2022-05-05 07:38:15 UTC (rev 293824)
@@ -43,6 +43,7 @@
#include <WebCore/EmptyClients.h>
#include <WebCore/Page.h>
#include <WebCore/PageConfiguration.h>
+#include <WebCore/ScriptExecutionContextIdentifier.h>
#include <WebCore/SharedWorkerContextManager.h>
#include <WebCore/SharedWorkerThreadProxy.h>
#include <WebCore/UserAgent.h>
@@ -115,7 +116,7 @@
initializationData.userAgent = m_userAgent;
if (!initializationData.clientIdentifier)
- initializationData.clientIdentifier = ScriptExecutionContextIdentifier::generate();
+ initializationData.clientIdentifier = WebCore::ScriptExecutionContextIdentifier::generate();
page->setupForRemoteWorker(workerFetchResult.lastRequestURL, origin.topOrigin, workerFetchResult.referrerPolicy);
auto sharedWorkerThreadProxy = WebCore::SharedWorkerThreadProxy::create(WTFMove(page), sharedWorkerIdentifier, origin, WTFMove(workerFetchResult), WTFMove(workerOptions), WTFMove(initializationData), WebProcess::singleton().cacheStorageProvider());