Diff
Modified: trunk/Source/WebCore/ChangeLog (288937 => 288938)
--- trunk/Source/WebCore/ChangeLog 2022-02-02 02:47:36 UTC (rev 288937)
+++ trunk/Source/WebCore/ChangeLog 2022-02-02 02:49:48 UTC (rev 288938)
@@ -1,3 +1,39 @@
+2022-02-01 Chris Dumez <[email protected]>
+
+ Rename ServiceWorkerFetchResult to WorkerFetchResult and make it more generic
+ https://bugs.webkit.org/show_bug.cgi?id=235983
+
+ Reviewed by Geoffrey Garen.
+
+ Rename ServiceWorkerFetchResult to WorkerFetchResult and make it more generic so that it can be reused by Shared Workers.
+
+ * Headers.cmake:
+ * WebCore.xcodeproj/project.pbxproj:
+ * workers/service/SWClientConnection.cpp:
+ (WebCore::SWClientConnection::startScriptFetchForServer):
+ * workers/service/SWClientConnection.h:
+ * workers/service/ServiceWorkerContainer.cpp:
+ (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
+ (WebCore::ServiceWorkerContainer::notifyFailedFetchingScript):
+ * workers/service/ServiceWorkerFetchResult.h: Removed.
+ (WebCore::ServiceWorkerFetchResult::isolatedCopy const): Deleted.
+ (WebCore::serviceWorkerFetchError): Deleted.
+ (WebCore::ServiceWorkerFetchResult::encode const): Deleted.
+ (WebCore::ServiceWorkerFetchResult::decode): Deleted.
+ * workers/service/WorkerSWClientConnection.cpp:
+ (WebCore::WorkerSWClientConnection::finishFetchingScriptInServer):
+ * workers/service/WorkerSWClientConnection.h:
+ * workers/service/server/SWServer.cpp:
+ (WebCore::SWServer::Connection::finishFetchingScriptInServer):
+ (WebCore::SWServer::startScriptFetch):
+ (WebCore::SWServer::scriptFetchFinished):
+ * workers/service/server/SWServer.h:
+ * workers/service/server/SWServerJobQueue.cpp:
+ (WebCore::SWServerJobQueue::scriptFetchFinished):
+ * workers/service/server/SWServerJobQueue.h:
+ * workers/service/server/SWServerRegistration.h:
+ * workers/WorkerFetchResult.h: Added.
+
2022-02-01 Andres Gonzalez <[email protected]>
Check AccessibilityRenderObject::m_renderer for null before using it.
Modified: trunk/Source/WebCore/Headers.cmake (288937 => 288938)
--- trunk/Source/WebCore/Headers.cmake 2022-02-02 02:47:36 UTC (rev 288937)
+++ trunk/Source/WebCore/Headers.cmake 2022-02-02 02:49:48 UTC (rev 288938)
@@ -1951,6 +1951,7 @@
workers/ScriptBuffer.h
workers/WorkerAnimationController.h
workers/WorkerDebuggerProxy.h
+ workers/WorkerFetchResult.h
workers/WorkerFontLoadRequest.h
workers/WorkerGlobalScope.h
workers/WorkerLoaderProxy.h
@@ -1972,7 +1973,6 @@
workers/service/ServiceWorkerClientType.h
workers/service/ServiceWorkerContextData.h
workers/service/ServiceWorkerData.h
- workers/service/ServiceWorkerFetchResult.h
workers/service/ServiceWorkerIdentifier.h
workers/service/ServiceWorkerJob.h
workers/service/ServiceWorkerJobClient.h
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (288937 => 288938)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2022-02-02 02:47:36 UTC (rev 288937)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2022-02-02 02:49:48 UTC (rev 288938)
@@ -1314,6 +1314,7 @@
45830D4E1679B4F800ACF8C3 /* AutoscrollController.h in Headers */ = {isa = PBXBuildFile; fileRef = 45830D4C1679B4F800ACF8C3 /* AutoscrollController.h */; settings = {ATTRIBUTES = (Private, ); }; };
458FE40A1589DF0B005609E6 /* RenderSearchField.h in Headers */ = {isa = PBXBuildFile; fileRef = 458FE4081589DF0B005609E6 /* RenderSearchField.h */; };
45FEA5D0156DDE8C00654101 /* Decimal.h in Headers */ = {isa = PBXBuildFile; fileRef = 45FEA5CE156DDE8C00654101 /* Decimal.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 460BB52227A9FC3700CB782F /* WorkerFetchResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 460BB52127A9FC2E00CB782F /* WorkerFetchResult.h */; settings = {ATTRIBUTES = (Private, ); }; };
460BB6161D0A1BF000221812 /* Base64Utilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 460BB6141D0A1BEC00221812 /* Base64Utilities.h */; settings = {ATTRIBUTES = (Private, ); }; };
460C745926DD69BB00427D3E /* WindowOrWorkerGlobalScope.h in Headers */ = {isa = PBXBuildFile; fileRef = 460C745826DD699D00427D3E /* WindowOrWorkerGlobalScope.h */; settings = {ATTRIBUTES = (Private, ); }; };
460CBF361D4BCD0E0092E88E /* JSDOMWindowProperties.h in Headers */ = {isa = PBXBuildFile; fileRef = 460CBF341D4BCCFE0092E88E /* JSDOMWindowProperties.h */; };
@@ -1601,7 +1602,6 @@
517A534F1F54A8BA00DCDC0A /* ServiceWorkerRegistrationData.h in Headers */ = {isa = PBXBuildFile; fileRef = 517A534C1F549D4A00DCDC0A /* ServiceWorkerRegistrationData.h */; settings = {ATTRIBUTES = (Private, ); }; };
517A53581F5889E800DCDC0A /* FetchLoaderClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4147E2B61C89912600A7E715 /* FetchLoaderClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
517A535B1F588A4C00DCDC0A /* FetchBodyConsumer.h in Headers */ = {isa = PBXBuildFile; fileRef = 41CF8BE51D46222000707DC9 /* FetchBodyConsumer.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 517A535D1F5899FE00DCDC0A /* ServiceWorkerFetchResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 517A535C1F5899F200DCDC0A /* ServiceWorkerFetchResult.h */; settings = {ATTRIBUTES = (Private, ); }; };
517A63C51B74318F00E7DCDC /* KeyedDecoderCF.h in Headers */ = {isa = PBXBuildFile; fileRef = 517A63C01B74317E00E7DCDC /* KeyedDecoderCF.h */; settings = {ATTRIBUTES = (Private, ); }; };
517A63C61B74319200E7DCDC /* KeyedEncoderCF.h in Headers */ = {isa = PBXBuildFile; fileRef = 517A63C21B74317E00E7DCDC /* KeyedEncoderCF.h */; settings = {ATTRIBUTES = (Private, ); }; };
517B25AA1CC82B2A0061C011 /* IDBConnectionProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 517B25A81CC820320061C011 /* IDBConnectionProxy.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -9173,6 +9173,7 @@
458FE4081589DF0B005609E6 /* RenderSearchField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSearchField.h; sourceTree = "<group>"; };
45FEA5CD156DDE8C00654101 /* Decimal.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Decimal.cpp; sourceTree = "<group>"; };
45FEA5CE156DDE8C00654101 /* Decimal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Decimal.h; sourceTree = "<group>"; };
+ 460BB52127A9FC2E00CB782F /* WorkerFetchResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkerFetchResult.h; sourceTree = "<group>"; };
460BB6131D0A1BEC00221812 /* Base64Utilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Base64Utilities.cpp; sourceTree = "<group>"; };
460BB6141D0A1BEC00221812 /* Base64Utilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Base64Utilities.h; sourceTree = "<group>"; };
460C745626DD699D00427D3E /* WindowOrWorkerGlobalScope.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WindowOrWorkerGlobalScope.cpp; sourceTree = "<group>"; };
@@ -9801,7 +9802,6 @@
517A53431F50C16100DCDC0A /* SWServerWorker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SWServerWorker.cpp; sourceTree = "<group>"; };
517A534B1F549D4A00DCDC0A /* ServiceWorkerRegistrationData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ServiceWorkerRegistrationData.cpp; sourceTree = "<group>"; };
517A534C1F549D4A00DCDC0A /* ServiceWorkerRegistrationData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ServiceWorkerRegistrationData.h; sourceTree = "<group>"; };
- 517A535C1F5899F200DCDC0A /* ServiceWorkerFetchResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ServiceWorkerFetchResult.h; sourceTree = "<group>"; };
517A63BF1B74317E00E7DCDC /* KeyedDecoderCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KeyedDecoderCF.cpp; sourceTree = "<group>"; };
517A63C01B74317E00E7DCDC /* KeyedDecoderCF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KeyedDecoderCF.h; sourceTree = "<group>"; };
517A63C11B74317E00E7DCDC /* KeyedEncoderCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KeyedEncoderCF.cpp; sourceTree = "<group>"; };
@@ -20794,6 +20794,7 @@
A52B349C1FA416F8008B6246 /* WorkerDebuggerProxy.h */,
9B0ABCA323679ACF00B45085 /* WorkerEventLoop.cpp */,
9B0ABCA423679ACF00B45085 /* WorkerEventLoop.h */,
+ 460BB52127A9FC2E00CB782F /* WorkerFetchResult.h */,
A7D6B3480F61104500FF9FD1 /* WorkerFontLoadRequest.cpp */,
A7D6B3470F61104500FF9FD1 /* WorkerFontLoadRequest.h */,
2E4346360F546A8200B0F1BA /* WorkerGlobalScope.cpp */,
@@ -22407,7 +22408,6 @@
51CA7EE71F8832E0003D3131 /* ServiceWorkerContextData.h */,
83E8667F1FBA5640008855C5 /* ServiceWorkerData.cpp */,
83E8667D1FBA563F008855C5 /* ServiceWorkerData.h */,
- 517A535C1F5899F200DCDC0A /* ServiceWorkerFetchResult.h */,
51F175551F3EBC0C00C74950 /* ServiceWorkerGlobalScope.cpp */,
51F175541F3EBC0C00C74950 /* ServiceWorkerGlobalScope.h */,
51F175531F3EBC0C00C74950 /* ServiceWorkerGlobalScope.idl */,
@@ -37129,7 +37129,6 @@
83E866801FBA565B008855C5 /* ServiceWorkerData.h in Headers */,
A52B348F1FA3BDA6008B6246 /* ServiceWorkerDebuggable.h in Headers */,
419ACF921F97E7DA009F1A83 /* ServiceWorkerFetch.h in Headers */,
- 517A535D1F5899FE00DCDC0A /* ServiceWorkerFetchResult.h in Headers */,
51F175611F3EBC8300C74950 /* ServiceWorkerGlobalScope.h in Headers */,
83A8AC401FABBFE5002064AC /* ServiceWorkerIdentifier.h in Headers */,
A52B34961FA3E290008B6246 /* ServiceWorkerInspectorProxy.h in Headers */,
@@ -38016,6 +38015,7 @@
A5B81CCE1FAA44DE0037D1E6 /* WorkerDebuggerAgent.h in Headers */,
A52B349E1FA41703008B6246 /* WorkerDebuggerProxy.h in Headers */,
91E0DDC4230B41F10019E1E3 /* WorkerDOMDebuggerAgent.h in Headers */,
+ 460BB52227A9FC3700CB782F /* WorkerFetchResult.h in Headers */,
93233C8627054C7900BBF41E /* WorkerFileSystemStorageConnection.h in Headers */,
93217ABC270632D2002E60F0 /* WorkerFileSystemStorageConnectionCallbackIdentifier.h in Headers */,
A7D6B3490F61104500FF9FD1 /* WorkerFontLoadRequest.h in Headers */,
Copied: trunk/Source/WebCore/workers/WorkerFetchResult.h (from rev 288937, trunk/Source/WebCore/workers/service/ServiceWorkerFetchResult.h) (0 => 288938)
--- trunk/Source/WebCore/workers/WorkerFetchResult.h (rev 0)
+++ trunk/Source/WebCore/workers/WorkerFetchResult.h 2022-02-02 02:49:48 UTC (rev 288938)
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2017-2022 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
+
+#include "CertificateInfo.h"
+#include "ContentSecurityPolicyResponseHeaders.h"
+#include "CrossOriginEmbedderPolicy.h"
+#include "ResourceError.h"
+#include "ScriptBuffer.h"
+
+namespace WebCore {
+
+struct WorkerFetchResult {
+ ScriptBuffer script;
+ CertificateInfo certificateInfo;
+ ContentSecurityPolicyResponseHeaders contentSecurityPolicy;
+ CrossOriginEmbedderPolicy crossOriginEmbedderPolicy;
+ String referrerPolicy;
+ ResourceError error;
+
+ WorkerFetchResult isolatedCopy() const { return { script.isolatedCopy(), certificateInfo.isolatedCopy(), contentSecurityPolicy.isolatedCopy(), crossOriginEmbedderPolicy.isolatedCopy(), referrerPolicy.isolatedCopy(), error.isolatedCopy() }; }
+
+ template<class Encoder> void encode(Encoder&) const;
+ template<class Decoder> static WARN_UNUSED_RETURN bool decode(Decoder&, WorkerFetchResult&);
+};
+
+inline WorkerFetchResult workerFetchError(const ResourceError& error)
+{
+ return { { }, { }, { }, { }, { }, error };
+}
+
+template<class Encoder>
+void WorkerFetchResult::encode(Encoder& encoder) const
+{
+ encoder << script << contentSecurityPolicy << crossOriginEmbedderPolicy << referrerPolicy << error << certificateInfo;
+}
+
+template<class Decoder>
+bool WorkerFetchResult::decode(Decoder& decoder, WorkerFetchResult& result)
+{
+ if (!decoder.decode(result.script))
+ return false;
+ if (!decoder.decode(result.contentSecurityPolicy))
+ return false;
+ if (!decoder.decode(result.crossOriginEmbedderPolicy))
+ return false;
+ if (!decoder.decode(result.referrerPolicy))
+ return false;
+ if (!decoder.decode(result.error))
+ return false;
+
+ std::optional<CertificateInfo> certificateInfo;
+ decoder >> certificateInfo;
+ if (!certificateInfo)
+ return false;
+ result.certificateInfo = WTFMove(*certificateInfo);
+
+ return true;
+}
+
+} // namespace WebCore
Modified: trunk/Source/WebCore/workers/service/SWClientConnection.cpp (288937 => 288938)
--- trunk/Source/WebCore/workers/service/SWClientConnection.cpp 2022-02-02 02:47:36 UTC (rev 288937)
+++ trunk/Source/WebCore/workers/service/SWClientConnection.cpp 2022-02-02 02:49:48 UTC (rev 288938)
@@ -33,10 +33,10 @@
#include "MessageEvent.h"
#include "SWContextManager.h"
#include "ServiceWorkerContainer.h"
-#include "ServiceWorkerFetchResult.h"
#include "ServiceWorkerGlobalScope.h"
#include "ServiceWorkerJobData.h"
#include "ServiceWorkerRegistration.h"
+#include "WorkerFetchResult.h"
#include <wtf/CrossThreadCopier.h>
namespace WebCore {
@@ -115,7 +115,7 @@
job.startScriptFetch(cachePolicy);
});
if (!isPosted)
- finishFetchingScriptInServer(serviceWorkerFetchError({ serverConnectionIdentifier(), jobIdentifier }, ServiceWorkerRegistrationKey { registrationKey}, ResourceError { errorDomainWebKitInternal, 0, { }, makeString("Failed to fetch script for service worker with scope ", registrationKey.scope().string()) }));
+ finishFetchingScriptInServer({ serverConnectionIdentifier(), jobIdentifier }, registrationKey, workerFetchError(ResourceError { errorDomainWebKitInternal, 0, { }, makeString("Failed to fetch script for service worker with scope ", registrationKey.scope().string()) }));
}
Modified: trunk/Source/WebCore/workers/service/SWClientConnection.h (288937 => 288938)
--- trunk/Source/WebCore/workers/service/SWClientConnection.h 2022-02-02 02:47:36 UTC (rev 288937)
+++ trunk/Source/WebCore/workers/service/SWClientConnection.h 2022-02-02 02:49:48 UTC (rev 288938)
@@ -52,8 +52,8 @@
struct MessageWithMessagePorts;
struct ServiceWorkerClientData;
struct ServiceWorkerData;
-struct ServiceWorkerFetchResult;
struct ServiceWorkerRegistrationData;
+struct WorkerFetchResult;
class SWClientConnection : public RefCounted<SWClientConnection> {
public:
@@ -84,7 +84,7 @@
virtual void registerServiceWorkerClient(const SecurityOrigin& topOrigin, const ServiceWorkerClientData&, const std::optional<ServiceWorkerRegistrationIdentifier>&, const String& userAgent) = 0;
virtual void unregisterServiceWorkerClient(ScriptExecutionContextIdentifier) = 0;
- virtual void finishFetchingScriptInServer(const ServiceWorkerFetchResult&) = 0;
+ virtual void finishFetchingScriptInServer(const ServiceWorkerJobDataIdentifier&, const ServiceWorkerRegistrationKey&, const WorkerFetchResult&) = 0;
virtual void storeRegistrationsOnDiskForTesting(CompletionHandler<void()>&& callback) { callback(); }
virtual void whenServiceWorkerIsTerminatedForTesting(ServiceWorkerIdentifier, CompletionHandler<void()>&& callback) { callback(); }
Modified: trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp (288937 => 288938)
--- trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp 2022-02-02 02:47:36 UTC (rev 288937)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp 2022-02-02 02:49:48 UTC (rev 288938)
@@ -52,12 +52,12 @@
#include "ScriptExecutionContext.h"
#include "SecurityOrigin.h"
#include "ServiceWorker.h"
-#include "ServiceWorkerFetchResult.h"
#include "ServiceWorkerGlobalScope.h"
#include "ServiceWorkerJob.h"
#include "ServiceWorkerJobData.h"
#include "ServiceWorkerProvider.h"
#include "ServiceWorkerThread.h"
+#include "WorkerFetchResult.h"
#include "WorkerSWClientConnection.h"
#include <wtf/IsoMallocInlines.h>
#include <wtf/RunLoop.h>
@@ -497,7 +497,7 @@
CONTAINER_RELEASE_LOG("jobFinishedLoadingScript: Successfuly finished fetching script for job %" PRIu64, job.identifier().toUInt64());
- ensureSWClientConnection().finishFetchingScriptInServer(ServiceWorkerFetchResult { job.data().identifier(), job.data().registrationKey(), script, certificateInfo, contentSecurityPolicy, coep, referrerPolicy, { } });
+ ensureSWClientConnection().finishFetchingScriptInServer(job.data().identifier(), job.data().registrationKey(), WorkerFetchResult { script, certificateInfo, contentSecurityPolicy, coep, referrerPolicy, { } });
}
void ServiceWorkerContainer::jobFailedLoadingScript(ServiceWorkerJob& job, const ResourceError& error, Exception&& exception)
@@ -522,7 +522,7 @@
void ServiceWorkerContainer::notifyFailedFetchingScript(ServiceWorkerJob& job, const ResourceError& error)
{
- ensureSWClientConnection().finishFetchingScriptInServer(serviceWorkerFetchError(job.data().identifier(), ServiceWorkerRegistrationKey { job.data().registrationKey() }, ResourceError { error }));
+ ensureSWClientConnection().finishFetchingScriptInServer(job.data().identifier(), job.data().registrationKey(), workerFetchError(ResourceError { error }));
}
void ServiceWorkerContainer::destroyJob(ServiceWorkerJob& job)
Deleted: trunk/Source/WebCore/workers/service/ServiceWorkerFetchResult.h (288937 => 288938)
--- trunk/Source/WebCore/workers/service/ServiceWorkerFetchResult.h 2022-02-02 02:47:36 UTC (rev 288937)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerFetchResult.h 2022-02-02 02:49:48 UTC (rev 288938)
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#if ENABLE(SERVICE_WORKER)
-
-#include "ContentSecurityPolicyResponseHeaders.h"
-#include "CrossOriginEmbedderPolicy.h"
-#include "ResourceError.h"
-#include "ScriptBuffer.h"
-#include "ServiceWorkerJobDataIdentifier.h"
-#include "ServiceWorkerRegistrationKey.h"
-#include "ServiceWorkerTypes.h"
-
-namespace WebCore {
-
-struct ServiceWorkerFetchResult {
- ServiceWorkerJobDataIdentifier jobDataIdentifier;
- ServiceWorkerRegistrationKey registrationKey;
- ScriptBuffer script;
- CertificateInfo certificateInfo;
- ContentSecurityPolicyResponseHeaders contentSecurityPolicy;
- CrossOriginEmbedderPolicy crossOriginEmbedderPolicy;
- String referrerPolicy;
- ResourceError scriptError;
-
- ServiceWorkerFetchResult isolatedCopy() const { return { jobDataIdentifier, registrationKey.isolatedCopy(), script.isolatedCopy(), certificateInfo.isolatedCopy(), contentSecurityPolicy.isolatedCopy(), crossOriginEmbedderPolicy.isolatedCopy(), referrerPolicy.isolatedCopy(), scriptError.isolatedCopy() }; }
-
- template<class Encoder> void encode(Encoder&) const;
- template<class Decoder> static WARN_UNUSED_RETURN bool decode(Decoder&, ServiceWorkerFetchResult&);
-};
-
-inline ServiceWorkerFetchResult serviceWorkerFetchError(ServiceWorkerJobDataIdentifier jobDataIdentifier, ServiceWorkerRegistrationKey&& registrationKey, ResourceError&& error)
-{
- return { jobDataIdentifier, WTFMove(registrationKey), { }, { }, { }, { }, { }, WTFMove(error) };
-}
-
-template<class Encoder>
-void ServiceWorkerFetchResult::encode(Encoder& encoder) const
-{
- encoder << jobDataIdentifier << registrationKey << script << contentSecurityPolicy << crossOriginEmbedderPolicy << referrerPolicy << scriptError;
- encoder << certificateInfo;
-}
-
-template<class Decoder>
-bool ServiceWorkerFetchResult::decode(Decoder& decoder, ServiceWorkerFetchResult& result)
-{
- std::optional<ServiceWorkerJobDataIdentifier> jobDataIdentifier;
- decoder >> jobDataIdentifier;
- if (!jobDataIdentifier)
- return false;
- result.jobDataIdentifier = WTFMove(*jobDataIdentifier);
-
- auto registrationKey = ServiceWorkerRegistrationKey::decode(decoder);
- if (!registrationKey)
- return false;
- std::swap(*registrationKey, result.registrationKey);
-
- if (!decoder.decode(result.script))
- return false;
- if (!decoder.decode(result.contentSecurityPolicy))
- return false;
- if (!decoder.decode(result.crossOriginEmbedderPolicy))
- return false;
- if (!decoder.decode(result.referrerPolicy))
- return false;
- if (!decoder.decode(result.scriptError))
- return false;
-
- std::optional<CertificateInfo> certificateInfo;
- decoder >> certificateInfo;
- if (!certificateInfo)
- return false;
- result.certificateInfo = WTFMove(*certificateInfo);
-
- return true;
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(SERVICE_WORKER)
Modified: trunk/Source/WebCore/workers/service/WorkerSWClientConnection.cpp (288937 => 288938)
--- trunk/Source/WebCore/workers/service/WorkerSWClientConnection.cpp 2022-02-02 02:47:36 UTC (rev 288937)
+++ trunk/Source/WebCore/workers/service/WorkerSWClientConnection.cpp 2022-02-02 02:49:48 UTC (rev 288938)
@@ -30,10 +30,10 @@
#include "SecurityOrigin.h"
#include "ServiceWorkerClientData.h"
-#include "ServiceWorkerFetchResult.h"
#include "ServiceWorkerJobData.h"
#include "ServiceWorkerProvider.h"
#include "ServiceWorkerRegistration.h"
+#include "WorkerFetchResult.h"
#include "WorkerGlobalScope.h"
#include "WorkerThread.h"
@@ -192,11 +192,11 @@
ASSERT_NOT_REACHED();
}
-void WorkerSWClientConnection::finishFetchingScriptInServer(const ServiceWorkerFetchResult& result)
+void WorkerSWClientConnection::finishFetchingScriptInServer(const ServiceWorkerJobDataIdentifier& jobDataIdentifier, const ServiceWorkerRegistrationKey& registrationKey, const WorkerFetchResult& result)
{
- callOnMainThread([result = crossThreadCopy(result)]() mutable {
+ callOnMainThread([jobDataIdentifier, registrationKey = crossThreadCopy(registrationKey), result = crossThreadCopy(result)]() mutable {
auto& connection = ServiceWorkerProvider::singleton().serviceWorkerConnection();
- connection.finishFetchingScriptInServer(result);
+ connection.finishFetchingScriptInServer(jobDataIdentifier, registrationKey, result);
});
}
Modified: trunk/Source/WebCore/workers/service/WorkerSWClientConnection.h (288937 => 288938)
--- trunk/Source/WebCore/workers/service/WorkerSWClientConnection.h 2022-02-02 02:47:36 UTC (rev 288937)
+++ trunk/Source/WebCore/workers/service/WorkerSWClientConnection.h 2022-02-02 02:49:48 UTC (rev 288938)
@@ -53,7 +53,7 @@
bool mayHaveServiceWorkerRegisteredForOrigin(const SecurityOriginData&) const final;
void registerServiceWorkerClient(const SecurityOrigin& topOrigin, const ServiceWorkerClientData&, const std::optional<ServiceWorkerRegistrationIdentifier>&, const String& userAgent) final;
void unregisterServiceWorkerClient(ScriptExecutionContextIdentifier) final;
- void finishFetchingScriptInServer(const ServiceWorkerFetchResult&) final;
+ void finishFetchingScriptInServer(const ServiceWorkerJobDataIdentifier&, const ServiceWorkerRegistrationKey&, const WorkerFetchResult&) final;
void scheduleJobInServer(const ServiceWorkerJobData&) final;
void scheduleJob(ServiceWorkerOrClientIdentifier, const ServiceWorkerJobData&) final;
void scheduleUnregisterJobInServer(ServiceWorkerRegistrationIdentifier, ServiceWorkerOrClientIdentifier, CompletionHandler<void(ExceptionOr<bool>&&)>&&) final;
Modified: trunk/Source/WebCore/workers/service/server/SWServer.cpp (288937 => 288938)
--- trunk/Source/WebCore/workers/service/server/SWServer.cpp 2022-02-02 02:47:36 UTC (rev 288937)
+++ trunk/Source/WebCore/workers/service/server/SWServer.cpp 2022-02-02 02:49:48 UTC (rev 288938)
@@ -40,8 +40,8 @@
#include "SecurityOrigin.h"
#include "ServiceWorkerClientType.h"
#include "ServiceWorkerContextData.h"
-#include "ServiceWorkerFetchResult.h"
#include "ServiceWorkerJobData.h"
+#include "WorkerFetchResult.h"
#include <wtf/CompletionHandler.h>
#include <wtf/MemoryPressureHandler.h>
#include <wtf/NeverDestroyed.h>
@@ -327,9 +327,9 @@
m_registrationStore->flushChanges(WTFMove(completionHandler));
}
-void SWServer::Connection::finishFetchingScriptInServer(const ServiceWorkerFetchResult& result)
+void SWServer::Connection::finishFetchingScriptInServer(const ServiceWorkerJobDataIdentifier& jobDataIdentifier, const ServiceWorkerRegistrationKey& registrationKey, const WorkerFetchResult& result)
{
- m_server.scriptFetchFinished(result);
+ m_server.scriptFetchFinished(jobDataIdentifier, registrationKey, result);
}
void SWServer::Connection::didResolveRegistrationPromise(const ServiceWorkerRegistrationKey& key)
@@ -503,10 +503,9 @@
request.setPriority(ResourceLoadPriority::Low);
request.setIsAppInitiated(registration.isAppInitiated());
- m_softUpdateCallback(ServiceWorkerJobData { jobData }, shouldRefreshCache, WTFMove(request), [this, weakThis = WeakPtr { *this }](auto& result) {
- if (!weakThis)
- return;
- scriptFetchFinished(result);
+ m_softUpdateCallback(ServiceWorkerJobData { jobData }, shouldRefreshCache, WTFMove(request), [weakThis = WeakPtr { *this }, jobDataIdentifier = jobData.identifier(), registrationKey = jobData.registrationKey()](auto& result) {
+ if (weakThis)
+ weakThis->scriptFetchFinished(jobDataIdentifier, registrationKey, result);
});
return;
}
@@ -513,17 +512,17 @@
ASSERT_WITH_MESSAGE(connection, "If the connection was lost, this job should have been cancelled");
}
-void SWServer::scriptFetchFinished(const ServiceWorkerFetchResult& result)
+void SWServer::scriptFetchFinished(const ServiceWorkerJobDataIdentifier& jobDataIdentifier, const ServiceWorkerRegistrationKey& registrationKey, const WorkerFetchResult& result)
{
- LOG(ServiceWorker, "Server handling scriptFetchFinished for current job %s in client", result.jobDataIdentifier.loggingString().utf8().data());
+ LOG(ServiceWorker, "Server handling scriptFetchFinished for current job %s in client", jobDataIdentifier.loggingString().utf8().data());
- ASSERT(m_connections.contains(result.jobDataIdentifier.connectionIdentifier) || result.jobDataIdentifier.connectionIdentifier == Process::identifier());
+ ASSERT(m_connections.contains(jobDataIdentifier.connectionIdentifier) || jobDataIdentifier.connectionIdentifier == Process::identifier());
- auto jobQueue = m_jobQueues.get(result.registrationKey);
+ auto jobQueue = m_jobQueues.get(registrationKey);
if (!jobQueue)
return;
- jobQueue->scriptFetchFinished(result);
+ jobQueue->scriptFetchFinished(jobDataIdentifier, result);
}
void SWServer::scriptContextFailedToStart(const std::optional<ServiceWorkerJobDataIdentifier>& jobDataIdentifier, SWServerWorker& worker, const String& message)
Modified: trunk/Source/WebCore/workers/service/server/SWServer.h (288937 => 288938)
--- trunk/Source/WebCore/workers/service/server/SWServer.h 2022-02-02 02:47:36 UTC (rev 288937)
+++ trunk/Source/WebCore/workers/service/server/SWServer.h 2022-02-02 02:49:48 UTC (rev 288938)
@@ -57,6 +57,7 @@
class SWServerJobQueue;
class SWServerRegistration;
class SWServerToContextConnection;
+class Timer;
enum class ServiceWorkerRegistrationState : uint8_t;
enum class ServiceWorkerState : uint8_t;
struct ExceptionData;
@@ -63,9 +64,8 @@
struct MessageWithMessagePorts;
struct ServiceWorkerClientQueryOptions;
struct ServiceWorkerContextData;
-struct ServiceWorkerFetchResult;
struct ServiceWorkerRegistrationData;
-class Timer;
+struct WorkerFetchResult;
class SWServer : public CanMakeWeakPtr<SWServer> {
WTF_MAKE_FAST_ALLOCATED;
@@ -100,7 +100,7 @@
protected:
WEBCORE_EXPORT Connection(SWServer&, Identifier);
- WEBCORE_EXPORT void finishFetchingScriptInServer(const ServiceWorkerFetchResult&);
+ WEBCORE_EXPORT void finishFetchingScriptInServer(const ServiceWorkerJobDataIdentifier&, const ServiceWorkerRegistrationKey&, const WorkerFetchResult&);
WEBCORE_EXPORT void addServiceWorkerRegistrationInServer(ServiceWorkerRegistrationIdentifier);
WEBCORE_EXPORT void removeServiceWorkerRegistrationInServer(ServiceWorkerRegistrationIdentifier);
WEBCORE_EXPORT void whenRegistrationReady(const SecurityOriginData& topOrigin, const URL& clientURL, CompletionHandler<void(std::optional<ServiceWorkerRegistrationData>&&)>&&);
@@ -125,7 +125,7 @@
Vector<RegistrationReadyRequest> m_registrationReadyRequests;
};
- using SoftUpdateCallback = Function<void(ServiceWorkerJobData&& jobData, bool shouldRefreshCache, ResourceRequest&&, CompletionHandler<void(const ServiceWorkerFetchResult&)>&&)>;
+ using SoftUpdateCallback = Function<void(ServiceWorkerJobData&& jobData, bool shouldRefreshCache, ResourceRequest&&, CompletionHandler<void(const WorkerFetchResult&)>&&)>;
using CreateContextConnectionCallback = Function<void(const WebCore::RegistrableDomain&, 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, SoftUpdateCallback&&, CreateContextConnectionCallback&&, AppBoundDomainsCallback&&);
@@ -231,7 +231,7 @@
private:
void validateRegistrationDomain(WebCore::RegistrableDomain, ServiceWorkerJobType, CompletionHandler<void(bool)>&&);
- void scriptFetchFinished(const ServiceWorkerFetchResult&);
+ void scriptFetchFinished(const ServiceWorkerJobDataIdentifier&, const ServiceWorkerRegistrationKey&, const WorkerFetchResult&);
void didResolveRegistrationPromise(Connection*, const ServiceWorkerRegistrationKey&);
Modified: trunk/Source/WebCore/workers/service/server/SWServerJobQueue.cpp (288937 => 288938)
--- trunk/Source/WebCore/workers/service/server/SWServerJobQueue.cpp 2022-02-02 02:47:36 UTC (rev 288937)
+++ trunk/Source/WebCore/workers/service/server/SWServerJobQueue.cpp 2022-02-02 02:49:48 UTC (rev 288938)
@@ -34,9 +34,9 @@
#include "SWServerRegistration.h"
#include "SWServerWorker.h"
#include "SecurityOrigin.h"
-#include "ServiceWorkerFetchResult.h"
#include "ServiceWorkerRegistrationData.h"
#include "ServiceWorkerUpdateViaCache.h"
+#include "WorkerFetchResult.h"
#include "WorkerType.h"
namespace WebCore {
@@ -69,9 +69,9 @@
#endif
}
-void SWServerJobQueue::scriptFetchFinished(const ServiceWorkerFetchResult& result)
+void SWServerJobQueue::scriptFetchFinished(const ServiceWorkerJobDataIdentifier& jobDataIdentifier, const WorkerFetchResult& result)
{
- if (!isCurrentlyProcessingJob(result.jobDataIdentifier))
+ if (!isCurrentlyProcessingJob(jobDataIdentifier))
return;
auto& job = firstJob();
@@ -82,9 +82,9 @@
auto* newestWorker = registration->getNewestWorker();
- if (!result.scriptError.isNull()) {
+ if (!result.error.isNull()) {
// Invoke Reject Job Promise with job and TypeError.
- m_server.rejectJob(job, ExceptionData { TypeError, makeString("Script URL ", job.scriptURL.string(), " fetch resulted in error: ", result.scriptError.localizedDescription()) });
+ m_server.rejectJob(job, ExceptionData { TypeError, makeString("Script URL ", job.scriptURL.string(), " fetch resulted in error: ", result.error.localizedDescription()) });
// If newestWorker is null, invoke Clear Registration algorithm passing registration as its argument.
if (!newestWorker)
Modified: trunk/Source/WebCore/workers/service/server/SWServerJobQueue.h (288937 => 288938)
--- trunk/Source/WebCore/workers/service/server/SWServerJobQueue.h 2022-02-02 02:47:36 UTC (rev 288937)
+++ trunk/Source/WebCore/workers/service/server/SWServerJobQueue.h 2022-02-02 02:49:48 UTC (rev 288938)
@@ -35,6 +35,7 @@
namespace WebCore {
class SWServerWorker;
+struct WorkerFetchResult;
class SWServerJobQueue {
WTF_MAKE_FAST_ALLOCATED;
@@ -50,7 +51,7 @@
void runNextJob();
- void scriptFetchFinished(const ServiceWorkerFetchResult&);
+ void scriptFetchFinished(const ServiceWorkerJobDataIdentifier&, const WorkerFetchResult&);
void scriptContextFailedToStart(const ServiceWorkerJobDataIdentifier&, ServiceWorkerIdentifier, const String& message);
void scriptContextStarted(const ServiceWorkerJobDataIdentifier&, ServiceWorkerIdentifier);
void didFinishInstall(const ServiceWorkerJobDataIdentifier&, SWServerWorker&, bool wasSuccessful);
Modified: trunk/Source/WebCore/workers/service/server/SWServerRegistration.h (288937 => 288938)
--- trunk/Source/WebCore/workers/service/server/SWServerRegistration.h 2022-02-02 02:47:36 UTC (rev 288937)
+++ trunk/Source/WebCore/workers/service/server/SWServerRegistration.h 2022-02-02 02:49:48 UTC (rev 288938)
@@ -46,7 +46,6 @@
enum class ServiceWorkerState : uint8_t;
struct ExceptionData;
struct ServiceWorkerContextData;
-struct ServiceWorkerFetchResult;
enum class IsAppInitiated : bool { No, Yes };
Modified: trunk/Source/WebKit/ChangeLog (288937 => 288938)
--- trunk/Source/WebKit/ChangeLog 2022-02-02 02:47:36 UTC (rev 288937)
+++ trunk/Source/WebKit/ChangeLog 2022-02-02 02:49:48 UTC (rev 288938)
@@ -1,5 +1,24 @@
2022-02-01 Chris Dumez <[email protected]>
+ Rename ServiceWorkerFetchResult to WorkerFetchResult and make it more generic
+ https://bugs.webkit.org/show_bug.cgi?id=235983
+
+ Reviewed by Geoffrey Garen.
+
+ Rename ServiceWorkerFetchResult to WorkerFetchResult and make it more generic so that it can be reused by Shared Workers.
+
+ * NetworkProcess/ServiceWorker/ServiceWorkerSoftUpdateLoader.cpp:
+ (WebKit::ServiceWorkerSoftUpdateLoader::~ServiceWorkerSoftUpdateLoader):
+ (WebKit::ServiceWorkerSoftUpdateLoader::fail):
+ (WebKit::ServiceWorkerSoftUpdateLoader::didFinishLoading):
+ * NetworkProcess/ServiceWorker/ServiceWorkerSoftUpdateLoader.h:
+ * NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in:
+ * WebProcess/Storage/WebSWClientConnection.cpp:
+ (WebKit::WebSWClientConnection::finishFetchingScriptInServer):
+ * WebProcess/Storage/WebSWClientConnection.h:
+
+2022-02-01 Chris Dumez <[email protected]>
+
Rename some service worker functions that have names that are too generic
https://bugs.webkit.org/show_bug.cgi?id=235988
Modified: trunk/Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerSoftUpdateLoader.cpp (288937 => 288938)
--- trunk/Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerSoftUpdateLoader.cpp 2022-02-02 02:47:36 UTC (rev 288937)
+++ trunk/Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerSoftUpdateLoader.cpp 2022-02-02 02:49:48 UTC (rev 288938)
@@ -32,9 +32,9 @@
#include "NetworkCache.h"
#include "NetworkLoad.h"
#include "NetworkSession.h"
-#include <WebCore/ServiceWorkerFetchResult.h>
#include <WebCore/ServiceWorkerJob.h>
#include <WebCore/TextResourceDecoder.h>
+#include <WebCore/WorkerFetchResult.h>
#include <WebCore/WorkerScriptLoader.h>
namespace WebKit {
@@ -44,7 +44,7 @@
void ServiceWorkerSoftUpdateLoader::start(NetworkSession* session, ServiceWorkerJobData&& jobData, bool shouldRefreshCache, ResourceRequest&& request, Handler&& completionHandler)
{
if (!session)
- return completionHandler(serviceWorkerFetchError(jobData.identifier(), ServiceWorkerRegistrationKey { jobData.registrationKey() }, ResourceError { ResourceError::Type::Cancellation }));
+ return completionHandler(workerFetchError(ResourceError { ResourceError::Type::Cancellation }));
auto loader = std::unique_ptr<ServiceWorkerSoftUpdateLoader>(new ServiceWorkerSoftUpdateLoader(*session, WTFMove(jobData), shouldRefreshCache, WTFMove(request), WTFMove(completionHandler)));
session->addSoftUpdateLoader(WTFMove(loader));
}
@@ -94,7 +94,7 @@
ServiceWorkerSoftUpdateLoader::~ServiceWorkerSoftUpdateLoader()
{
if (m_completionHandler)
- m_completionHandler(serviceWorkerFetchError(m_jobData.identifier(), ServiceWorkerRegistrationKey { m_jobData.registrationKey() }, ResourceError { ResourceError::Type::Cancellation }));
+ m_completionHandler(workerFetchError(ResourceError { ResourceError::Type::Cancellation }));
}
void ServiceWorkerSoftUpdateLoader::fail(ResourceError&& error)
@@ -102,7 +102,7 @@
if (!m_completionHandler)
return;
- m_completionHandler(serviceWorkerFetchError(m_jobData.identifier(), ServiceWorkerRegistrationKey { m_jobData.registrationKey() }, WTFMove(error)));
+ m_completionHandler(workerFetchError(WTFMove(error)));
didComplete();
}
@@ -196,7 +196,7 @@
{
if (m_decoder)
m_script.append(m_decoder->flush());
- m_completionHandler({ m_jobData.identifier(), m_jobData.registrationKey(), ScriptBuffer { m_script.toString() }, m_certificateInfo, m_contentSecurityPolicy, m_crossOriginEmbedderPolicy, m_referrerPolicy, { } });
+ m_completionHandler({ ScriptBuffer { m_script.toString() }, m_certificateInfo, m_contentSecurityPolicy, m_crossOriginEmbedderPolicy, m_referrerPolicy, { } });
didComplete();
}
Modified: trunk/Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerSoftUpdateLoader.h (288937 => 288938)
--- trunk/Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerSoftUpdateLoader.h 2022-02-02 02:47:36 UTC (rev 288937)
+++ trunk/Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerSoftUpdateLoader.h 2022-02-02 02:49:48 UTC (rev 288938)
@@ -37,8 +37,8 @@
#include <wtf/WeakPtr.h>
namespace WebCore {
-struct ServiceWorkerFetchResult;
struct ServiceWorkerJobData;
+struct WorkerFetchResult;
class TextResourceDecoder;
}
@@ -50,7 +50,7 @@
class ServiceWorkerSoftUpdateLoader final : public NetworkLoadClient, public CanMakeWeakPtr<ServiceWorkerSoftUpdateLoader> {
WTF_MAKE_FAST_ALLOCATED;
public:
- using Handler = CompletionHandler<void(const WebCore::ServiceWorkerFetchResult&)>;
+ using Handler = CompletionHandler<void(const WebCore::WorkerFetchResult&)>;
static void start(NetworkSession*, WebCore::ServiceWorkerJobData&&, bool shouldRefreshCache, WebCore::ResourceRequest&&, Handler&&);
~ServiceWorkerSoftUpdateLoader();
Modified: trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in (288937 => 288938)
--- trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in 2022-02-02 02:47:36 UTC (rev 288937)
+++ trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in 2022-02-02 02:49:48 UTC (rev 288938)
@@ -27,7 +27,7 @@
ScheduleJobInServer(struct WebCore::ServiceWorkerJobData jobData)
ScheduleUnregisterJobInServer(WebCore::ServiceWorkerJobIdentifier jobIdentifier, WebCore::ServiceWorkerRegistrationIdentifier identifier, WebCore::ServiceWorkerOrClientIdentifier documentIdentifier) -> (Expected<bool, WebCore::ExceptionData> result) Async
- FinishFetchingScriptInServer(struct WebCore::ServiceWorkerFetchResult result)
+ FinishFetchingScriptInServer(struct WebCore::ServiceWorkerJobDataIdentifier jobDataIdentifier, WebCore::ServiceWorkerRegistrationKey registrationKey, struct WebCore::WorkerFetchResult result)
AddServiceWorkerRegistrationInServer(WebCore::ServiceWorkerRegistrationIdentifier identifier)
RemoveServiceWorkerRegistrationInServer(WebCore::ServiceWorkerRegistrationIdentifier identifier)
Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp (288937 => 288938)
--- trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp 2022-02-02 02:47:36 UTC (rev 288937)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp 2022-02-02 02:49:48 UTC (rev 288938)
@@ -45,10 +45,10 @@
#include <WebCore/SecurityOrigin.h>
#include <WebCore/SerializedScriptValue.h>
#include <WebCore/ServiceWorkerClientData.h>
-#include <WebCore/ServiceWorkerFetchResult.h>
#include <WebCore/ServiceWorkerJobData.h>
#include <WebCore/ServiceWorkerRegistrationData.h>
#include <WebCore/ServiceWorkerRegistrationKey.h>
+#include <WebCore/WorkerFetchResult.h>
namespace WebKit {
using namespace PAL;
@@ -78,9 +78,9 @@
});
}
-void WebSWClientConnection::finishFetchingScriptInServer(const ServiceWorkerFetchResult& result)
+void WebSWClientConnection::finishFetchingScriptInServer(const ServiceWorkerJobDataIdentifier& jobDataIdentifier, const ServiceWorkerRegistrationKey& registrationKey, const WorkerFetchResult& result)
{
- send(Messages::WebSWServerConnection::FinishFetchingScriptInServer { result });
+ send(Messages::WebSWServerConnection::FinishFetchingScriptInServer { jobDataIdentifier, registrationKey, result });
}
void WebSWClientConnection::addServiceWorkerRegistrationInServer(ServiceWorkerRegistrationIdentifier identifier)
Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h (288937 => 288938)
--- trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h 2022-02-02 02:47:36 UTC (rev 288937)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h 2022-02-02 02:49:48 UTC (rev 288938)
@@ -71,7 +71,7 @@
WebSWClientConnection();
void scheduleJobInServer(const WebCore::ServiceWorkerJobData&) final;
- void finishFetchingScriptInServer(const WebCore::ServiceWorkerFetchResult&) final;
+ void finishFetchingScriptInServer(const WebCore::ServiceWorkerJobDataIdentifier&, const WebCore::ServiceWorkerRegistrationKey&, const WebCore::WorkerFetchResult&) final;
void postMessageToServiceWorker(WebCore::ServiceWorkerIdentifier destinationIdentifier, WebCore::MessageWithMessagePorts&&, const WebCore::ServiceWorkerOrClientIdentifier& source) final;
void registerServiceWorkerClient(const WebCore::SecurityOrigin& topOrigin, const WebCore::ServiceWorkerClientData&, const std::optional<WebCore::ServiceWorkerRegistrationIdentifier>&, const String& userAgent) final;
void unregisterServiceWorkerClient(WebCore::ScriptExecutionContextIdentifier) final;