WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-207669-20200212160452.patch (text/plain), 29.24 KB, created by
youenn fablet
on 2020-02-12 16:04:54 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
youenn fablet
Created:
2020-02-12 16:04:54 PST
Size:
29.24 KB
patch
obsolete
>Subversion Revision: 256454 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index fd3f346cc80b9bae5b6fecdb7e85f89f8fb3d2e2..9677fb8cbea31249daddf253b62ebeb6c692cb84 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,38 @@ >+2020-02-12 Youenn Fablet <youenn@apple.com> >+ >+ Simplify WebProcess handling of unregistering of service workers >+ https://bugs.webkit.org/show_bug.cgi?id=207669 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Instead of creating a job in WebProcess, we now create it at SWServer level. >+ This allows the ServiceWorkerContainer to only provide the service worker registration identifier >+ to start the unregistering process. >+ To simplify things, a completion handler is used to resolve the promise once the unregister job run. >+ >+ This allows to send less information from ServiceWorkerContainer to SWServer through IPC. >+ >+ No observable change of behavior. >+ >+ * workers/service/SWClientConnection.cpp: >+ (WebCore::SWClientConnection::unregistrationJobResolvedInServer): Deleted. >+ * workers/service/SWClientConnection.h: >+ * workers/service/ServiceWorkerContainer.cpp: >+ (WebCore::ServiceWorkerContainer::unregisterRegistration): >+ * workers/service/ServiceWorkerContainer.h: >+ * workers/service/ServiceWorkerJobData.cpp: >+ (WebCore::serviceWorkerOrClientIdentifier): >+ (WebCore::ServiceWorkerJobData::ServiceWorkerJobData): >+ * workers/service/ServiceWorkerJobData.h: >+ * workers/service/ServiceWorkerRegistration.cpp: >+ (WebCore::ServiceWorkerRegistration::unregister): >+ * workers/service/WorkerSWClientConnection.cpp: >+ (WebCore::WorkerSWClientConnection::scheduleUnregisterJobInServer): >+ * workers/service/WorkerSWClientConnection.h: >+ * workers/service/server/SWServer.cpp: >+ (WebCore::SWServer::scheduleUnregisterJob): >+ * workers/service/server/SWServer.h: >+ > 2020-02-12 Youenn Fablet <youenn@apple.com> > > ServiceWorkerContainer::jobResolvedWithRegistration scopeExit should capture all lambda parameters by value >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 23d858823e1ef596c3d658180c1f9411cb776452..e52297869bae7c3953f67fa67fe0ed212f96661f 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,28 @@ >+2020-02-12 Youenn Fablet <youenn@apple.com> >+ >+ Simplify WebProcess handling of unregistering of service workers >+ https://bugs.webkit.org/show_bug.cgi?id=207669 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Use Async Reply IPC for scheduling an unregister job. >+ >+ Make WebSWServerConnection own a map of CompletionHandler keyed by unregister job identifiers. >+ WebSWServerConnection then asks SWServer to schedule the unregister job. >+ When job is run, WebSWServerConnection will call the corresponding completion handler. >+ The completion handler will trigger an IPC response that will trigger the unregister promise to be resolved. >+ >+ * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp: >+ (WebKit::WebSWServerConnection::resolveUnregistrationJobInClient): >+ (WebKit::WebSWServerConnection::scheduleUnregisterJobInServer): >+ * NetworkProcess/ServiceWorker/WebSWServerConnection.h: >+ * NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in: >+ * Scripts/webkit/messages.py: >+ * WebProcess/Storage/WebSWClientConnection.cpp: >+ (WebKit::WebSWClientConnection::scheduleUnregisterJobInServer): >+ * WebProcess/Storage/WebSWClientConnection.h: >+ * WebProcess/Storage/WebSWClientConnection.messages.in: >+ > 2020-02-12 Simon Fraser <simon.fraser@apple.com> > > Pages that trigger a redirect will sometimes be left blank >diff --git a/Source/WebCore/workers/service/SWClientConnection.cpp b/Source/WebCore/workers/service/SWClientConnection.cpp >index dac90ae9dbe3b7c50c0ca610a3fa478b279d21af..119f3cfa0204c52c19268116a4a07b49e01bbefa 100644 >--- a/Source/WebCore/workers/service/SWClientConnection.cpp >+++ b/Source/WebCore/workers/service/SWClientConnection.cpp >@@ -108,13 +108,6 @@ void SWClientConnection::registrationJobResolvedInServer(ServiceWorkerJobIdentif > didResolveRegistrationPromise(registrationData.key); > } > >-void SWClientConnection::unregistrationJobResolvedInServer(ServiceWorkerJobIdentifier jobIdentifier, bool unregistrationResult) >-{ >- postTaskForJob(jobIdentifier, IsJobComplete::Yes, [unregistrationResult] (auto& job) { >- job.resolvedWithUnregistrationResult(unregistrationResult); >- }); >-} >- > void SWClientConnection::startScriptFetchForServer(ServiceWorkerJobIdentifier jobIdentifier, const ServiceWorkerRegistrationKey& registrationKey, FetchOptions::Cache cachePolicy) > { > bool isPosted = postTaskForJob(jobIdentifier, IsJobComplete::No, [cachePolicy] (auto& job) { >diff --git a/Source/WebCore/workers/service/SWClientConnection.h b/Source/WebCore/workers/service/SWClientConnection.h >index 440047df33048f9acf7f96435de09fabb3f81d79..a8b664f812af437bc2b9ca6fdec04f6ac7ff1a16 100644 >--- a/Source/WebCore/workers/service/SWClientConnection.h >+++ b/Source/WebCore/workers/service/SWClientConnection.h >@@ -63,11 +63,12 @@ public: > using GetRegistrationsCallback = CompletionHandler<void(Vector<ServiceWorkerRegistrationData>&&)>; > virtual void getRegistrations(SecurityOriginData&& topOrigin, const URL& clientURL, GetRegistrationsCallback&&) = 0; > >- using WhenRegistrationReadyCallback = Function<void(ServiceWorkerRegistrationData&&)>; >+ using WhenRegistrationReadyCallback = CompletionHandler<void(ServiceWorkerRegistrationData&&)>; > virtual void whenRegistrationReady(const SecurityOriginData& topOrigin, const URL& clientURL, WhenRegistrationReadyCallback&&) = 0; > > virtual void addServiceWorkerRegistrationInServer(ServiceWorkerRegistrationIdentifier) = 0; > virtual void removeServiceWorkerRegistrationInServer(ServiceWorkerRegistrationIdentifier) = 0; >+ virtual void scheduleUnregisterJobInServer(ServiceWorkerRegistrationIdentifier, DocumentOrWorkerIdentifier, const URL& /* clientCreationURL */, CompletionHandler<void(bool)>&&) = 0; > > WEBCORE_EXPORT virtual void scheduleJob(DocumentOrWorkerIdentifier, const ServiceWorkerJobData&); > >@@ -94,7 +95,6 @@ protected: > > WEBCORE_EXPORT void jobRejectedInServer(ServiceWorkerJobIdentifier, const ExceptionData&); > WEBCORE_EXPORT void registrationJobResolvedInServer(ServiceWorkerJobIdentifier, ServiceWorkerRegistrationData&&, ShouldNotifyWhenResolved); >- WEBCORE_EXPORT void unregistrationJobResolvedInServer(ServiceWorkerJobIdentifier, bool unregistrationResult); > WEBCORE_EXPORT void startScriptFetchForServer(ServiceWorkerJobIdentifier, const ServiceWorkerRegistrationKey&, FetchOptions::Cache); > WEBCORE_EXPORT void postMessageToServiceWorkerClient(DocumentIdentifier destinationContextIdentifier, MessageWithMessagePorts&&, ServiceWorkerData&& source, String&& sourceOrigin); > WEBCORE_EXPORT void updateRegistrationState(ServiceWorkerRegistrationIdentifier, ServiceWorkerRegistrationState, const Optional<ServiceWorkerData>&); >diff --git a/Source/WebCore/workers/service/ServiceWorkerContainer.cpp b/Source/WebCore/workers/service/ServiceWorkerContainer.cpp >index e9ec8ec37237fd078f0d6adfbe400d72db785555..12602b3c47890bacb43171bc9b972225b2ac2102 100644 >--- a/Source/WebCore/workers/service/ServiceWorkerContainer.cpp >+++ b/Source/WebCore/workers/service/ServiceWorkerContainer.cpp >@@ -187,7 +187,7 @@ void ServiceWorkerContainer::addRegistration(const String& relativeScriptURL, co > scheduleJob(makeUnique<ServiceWorkerJob>(*this, WTFMove(promise), WTFMove(jobData))); > } > >-void ServiceWorkerContainer::removeRegistration(const URL& scopeURL, Ref<DeferredPromise>&& promise) >+void ServiceWorkerContainer::unregisterRegistration(ServiceWorkerRegistrationIdentifier registrationIdentifier, Ref<DeferredPromise>&& promise) > { > auto* context = scriptExecutionContext(); > if (!context) { >@@ -202,15 +202,10 @@ void ServiceWorkerContainer::removeRegistration(const URL& scopeURL, Ref<Deferre > return; > } > >- ServiceWorkerJobData jobData(m_swConnection->serverConnectionIdentifier(), contextIdentifier()); >- jobData.clientCreationURL = context->url(); >- jobData.topOrigin = context->topOrigin().data(); >- jobData.type = ServiceWorkerJobType::Unregister; >- jobData.scopeURL = scopeURL; >- >- CONTAINER_RELEASE_LOG_IF_ALLOWED("removeRegistration: Unregistering service worker. Job ID: %" PRIu64, jobData.identifier().jobIdentifier.toUInt64()); >- >- scheduleJob(makeUnique<ServiceWorkerJob>(*this, WTFMove(promise), WTFMove(jobData))); >+ CONTAINER_RELEASE_LOG_IF_ALLOWED("unregisterRegistration: Unregistering service worker."); >+ m_swConnection->scheduleUnregisterJobInServer(registrationIdentifier, contextIdentifier(), context->url(), [promise = WTFMove(promise)](bool result) mutable { >+ promise->resolve<IDLBoolean>(result); >+ }); > } > > void ServiceWorkerContainer::updateRegistration(const URL& scopeURL, const URL& scriptURL, WorkerType, RefPtr<DeferredPromise>&& promise) >diff --git a/Source/WebCore/workers/service/ServiceWorkerContainer.h b/Source/WebCore/workers/service/ServiceWorkerContainer.h >index 418255838ddf9646ab9ad0f71fe137ff35ee537b..b8f0d3ad52f38a389fe69f862657b01a80bc328c 100644 >--- a/Source/WebCore/workers/service/ServiceWorkerContainer.h >+++ b/Source/WebCore/workers/service/ServiceWorkerContainer.h >@@ -63,7 +63,7 @@ public: > > using RegistrationOptions = ServiceWorkerRegistrationOptions; > void addRegistration(const String& scriptURL, const RegistrationOptions&, Ref<DeferredPromise>&&); >- void removeRegistration(const URL& scopeURL, Ref<DeferredPromise>&&); >+ void unregisterRegistration(ServiceWorkerRegistrationIdentifier, Ref<DeferredPromise>&&); > void updateRegistration(const URL& scopeURL, const URL& scriptURL, WorkerType, RefPtr<DeferredPromise>&&); > > void getRegistration(const String& clientURL, Ref<DeferredPromise>&&); >diff --git a/Source/WebCore/workers/service/ServiceWorkerJobData.cpp b/Source/WebCore/workers/service/ServiceWorkerJobData.cpp >index 3697e07a77cf0cf18d247a7e864811bcb1ef2a3e..b2b797845409426fd978c402f66c6d443257970d 100644 >--- a/Source/WebCore/workers/service/ServiceWorkerJobData.cpp >+++ b/Source/WebCore/workers/service/ServiceWorkerJobData.cpp >@@ -30,16 +30,27 @@ > > namespace WebCore { > >-ServiceWorkerJobData::ServiceWorkerJobData(SWServerConnectionIdentifier connectionIdentifier, const DocumentOrWorkerIdentifier& localSourceContext) >- : m_identifier { connectionIdentifier, ServiceWorkerJobIdentifier::generateThreadSafe() } >+static inline ServiceWorkerOrClientIdentifier serviceWorkerOrClientIdentifier(SWServerConnectionIdentifier connectionIdentifier, const DocumentOrWorkerIdentifier& localSourceContext) > { >- WTF::switchOn(localSourceContext, [&](DocumentIdentifier documentIdentifier) { >- sourceContext = ServiceWorkerClientIdentifier { connectionIdentifier, documentIdentifier }; >- }, [&](ServiceWorkerIdentifier serviceWorkerIdentifier) { >- sourceContext = serviceWorkerIdentifier; >+ return WTF::switchOn(localSourceContext, [&](DocumentIdentifier documentIdentifier) -> ServiceWorkerOrClientIdentifier { >+ return ServiceWorkerClientIdentifier { connectionIdentifier, documentIdentifier }; >+ }, [&](ServiceWorkerIdentifier serviceWorkerIdentifier) -> ServiceWorkerOrClientIdentifier { >+ return serviceWorkerIdentifier; > }); > } > >+ServiceWorkerJobData::ServiceWorkerJobData(SWServerConnectionIdentifier connectionIdentifier, const DocumentOrWorkerIdentifier& localSourceContext) >+ : sourceContext(serviceWorkerOrClientIdentifier(connectionIdentifier, localSourceContext)) >+ , m_identifier { connectionIdentifier, ServiceWorkerJobIdentifier::generateThreadSafe() } >+{ >+} >+ >+ServiceWorkerJobData::ServiceWorkerJobData(Identifier identifier, const DocumentOrWorkerIdentifier& localSourceContext) >+ : sourceContext(serviceWorkerOrClientIdentifier(identifier.connectionIdentifier, localSourceContext)) >+ , m_identifier { identifier } >+{ >+} >+ > ServiceWorkerRegistrationKey ServiceWorkerJobData::registrationKey() const > { > URL scope = scopeURL; >diff --git a/Source/WebCore/workers/service/ServiceWorkerJobData.h b/Source/WebCore/workers/service/ServiceWorkerJobData.h >index cc0b41da6968c5e58114f766f4f38b8701e8499c..16ec29fc82850c7073856b09a5b0a1558b473b43 100644 >--- a/Source/WebCore/workers/service/ServiceWorkerJobData.h >+++ b/Source/WebCore/workers/service/ServiceWorkerJobData.h >@@ -41,6 +41,7 @@ namespace WebCore { > struct ServiceWorkerJobData { > using Identifier = ServiceWorkerJobDataIdentifier; > ServiceWorkerJobData(SWServerConnectionIdentifier, const DocumentOrWorkerIdentifier& sourceContext); >+ ServiceWorkerJobData(Identifier, const DocumentOrWorkerIdentifier& sourceContext); > > SWServerConnectionIdentifier connectionIdentifier() const { return m_identifier.connectionIdentifier; } > >diff --git a/Source/WebCore/workers/service/ServiceWorkerRegistration.cpp b/Source/WebCore/workers/service/ServiceWorkerRegistration.cpp >index 048005c6d79595b672ae15d673f166ea334a32c0..466e9fc0f76f4a9f143d043248b13dcd4068e7c3 100644 >--- a/Source/WebCore/workers/service/ServiceWorkerRegistration.cpp >+++ b/Source/WebCore/workers/service/ServiceWorkerRegistration.cpp >@@ -159,7 +159,7 @@ void ServiceWorkerRegistration::unregister(Ref<DeferredPromise>&& promise) > return; > } > >- m_container->removeRegistration(m_registrationData.scopeURL, WTFMove(promise)); >+ m_container->unregisterRegistration(identifier(), WTFMove(promise)); > } > > void ServiceWorkerRegistration::updateStateFromServer(ServiceWorkerRegistrationState state, RefPtr<ServiceWorker>&& serviceWorker) >diff --git a/Source/WebCore/workers/service/WorkerSWClientConnection.cpp b/Source/WebCore/workers/service/WorkerSWClientConnection.cpp >index 4ae81e3e7de2cd787176fe56c3c530fa65711482..db4c78ac94f7995d5029119bc87c505e6f47c24b 100644 >--- a/Source/WebCore/workers/service/WorkerSWClientConnection.cpp >+++ b/Source/WebCore/workers/service/WorkerSWClientConnection.cpp >@@ -57,6 +57,10 @@ WorkerSWClientConnection::~WorkerSWClientConnection() > auto whenRegistrationReadyRequests = WTFMove(m_whenRegistrationReadyRequests); > for (auto& callback : whenRegistrationReadyRequests.values()) > callback({ }); >+ >+ auto unregisterRequests = WTFMove(m_unregisterRequests); >+ for (auto& callback : unregisterRequests.values()) >+ callback(false); > } > > void WorkerSWClientConnection::matchRegistration(SecurityOriginData&& topOrigin, const URL& clientURL, RegistrationCallback&& callback) >@@ -192,6 +196,22 @@ void WorkerSWClientConnection::scheduleJob(DocumentOrWorkerIdentifier identifier > }); > } > >+void WorkerSWClientConnection::scheduleUnregisterJobInServer(ServiceWorkerRegistrationIdentifier registrationIdentifier, DocumentOrWorkerIdentifier contextIdentifier, const URL& clientCreationURL, CompletionHandler<void(bool)>&& callback) >+{ >+ uint64_t requestIdentifier = ++m_lastRequestIdentifier; >+ m_unregisterRequests.add(requestIdentifier, WTFMove(callback)); >+ >+ callOnMainThread([thread = m_thread.copyRef(), requestIdentifier, registrationIdentifier, contextIdentifier, clientCreationURL = crossThreadCopy(clientCreationURL)]() mutable { >+ auto& connection = ServiceWorkerProvider::singleton().serviceWorkerConnection(); >+ connection.scheduleUnregisterJobInServer(registrationIdentifier, contextIdentifier, clientCreationURL, [thread = WTFMove(thread), requestIdentifier](auto result) mutable { >+ thread->runLoop().postTaskForMode([requestIdentifier, result] (auto& scope) mutable { >+ auto callback = downcast<WorkerGlobalScope>(scope).swClientConnection().m_unregisterRequests.take(requestIdentifier); >+ callback(result); >+ }, WorkerRunLoop::defaultMode()); >+ }); >+ }); >+} >+ > void WorkerSWClientConnection::scheduleJobInServer(const ServiceWorkerJobData&) > { > ASSERT_NOT_REACHED(); >diff --git a/Source/WebCore/workers/service/WorkerSWClientConnection.h b/Source/WebCore/workers/service/WorkerSWClientConnection.h >index d09b1602f1c493bfba4c289645ce2d5202aa45f5..e22bac846cefc55278a1029631b213fa7d410c4a 100644 >--- a/Source/WebCore/workers/service/WorkerSWClientConnection.h >+++ b/Source/WebCore/workers/service/WorkerSWClientConnection.h >@@ -57,6 +57,7 @@ private: > void finishFetchingScriptInServer(const ServiceWorkerFetchResult&) final; > void scheduleJobInServer(const ServiceWorkerJobData&) final; > void scheduleJob(DocumentOrWorkerIdentifier, const ServiceWorkerJobData&) final; >+ void scheduleUnregisterJobInServer(ServiceWorkerRegistrationIdentifier, DocumentOrWorkerIdentifier, const URL& /* clientCreationURL */, CompletionHandler<void(bool)>&&) final; > > Ref<WorkerThread> m_thread; > >@@ -64,6 +65,7 @@ private: > HashMap<uint64_t, RegistrationCallback> m_matchRegistrationRequests; > HashMap<uint64_t, GetRegistrationsCallback> m_getRegistrationsRequests; > HashMap<uint64_t, WhenRegistrationReadyCallback> m_whenRegistrationReadyRequests; >+ HashMap<uint64_t, CompletionHandler<void(bool)>> m_unregisterRequests; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/workers/service/server/SWServer.cpp b/Source/WebCore/workers/service/server/SWServer.cpp >index 4dd8f8515ced49d216bc2a095c9d08bbafc3b67b..0ca56db6ab22223fceede85e217a12f83c537b19 100644 >--- a/Source/WebCore/workers/service/server/SWServer.cpp >+++ b/Source/WebCore/workers/service/server/SWServer.cpp >@@ -357,6 +357,17 @@ void SWServer::scheduleJob(ServiceWorkerJobData&& jobData) > jobQueue.runNextJob(); > } > >+void SWServer::scheduleUnregisterJob(ServiceWorkerJobDataIdentifier jobDataIdentifier, SWServerRegistration& registration, DocumentOrWorkerIdentifier contextIdentifier, URL&& clientCreationURL) >+{ >+ ServiceWorkerJobData jobData { jobDataIdentifier, contextIdentifier }; >+ jobData.clientCreationURL = WTFMove(clientCreationURL); >+ jobData.topOrigin = registration.data().key.topOrigin(); >+ jobData.type = ServiceWorkerJobType::Unregister; >+ jobData.scopeURL = registration.data().scopeURL; >+ >+ scheduleJob(WTFMove(jobData)); >+} >+ > void SWServer::rejectJob(const ServiceWorkerJobData& jobData, const ExceptionData& exceptionData) > { > LOG(ServiceWorker, "Rejected ServiceWorker job %s in server", jobData.identifier().loggingString().utf8().data()); >diff --git a/Source/WebCore/workers/service/server/SWServer.h b/Source/WebCore/workers/service/server/SWServer.h >index cdbd1d173a8260285c9b3c3f4c1b6ca521d9bcd6..9ef3511868ffe70d654a30f55aa78477f8c07aa6 100644 >--- a/Source/WebCore/workers/service/server/SWServer.h >+++ b/Source/WebCore/workers/service/server/SWServer.h >@@ -143,6 +143,8 @@ public: > WEBCORE_EXPORT Vector<ServiceWorkerRegistrationData> getRegistrations(const SecurityOriginData& topOrigin, const URL& clientURL); > > WEBCORE_EXPORT void scheduleJob(ServiceWorkerJobData&&); >+ WEBCORE_EXPORT void scheduleUnregisterJob(ServiceWorkerJobDataIdentifier, SWServerRegistration&, DocumentOrWorkerIdentifier, URL&& /* clientCreationURL */); >+ > void rejectJob(const ServiceWorkerJobData&, const ExceptionData&); > void resolveRegistrationJob(const ServiceWorkerJobData&, const ServiceWorkerRegistrationData&, ShouldNotifyWhenResolved); > void resolveUnregistrationJob(const ServiceWorkerJobData&, const ServiceWorkerRegistrationKey&, bool unregistrationResult); >diff --git a/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp b/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp >index ab6fe29e0bd2b1c88c07aacdfc453ad159885f61..f425d892221c2535435b30fcf0a75e95eabfeb25 100644 >--- a/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp >+++ b/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp >@@ -91,7 +91,8 @@ void WebSWServerConnection::resolveRegistrationJobInClient(ServiceWorkerJobIdent > > void WebSWServerConnection::resolveUnregistrationJobInClient(ServiceWorkerJobIdentifier jobIdentifier, const ServiceWorkerRegistrationKey& registrationKey, bool unregistrationResult) > { >- send(Messages::WebSWClientConnection::UnregistrationJobResolvedInServer(jobIdentifier, unregistrationResult)); >+ if (auto completionHandler = m_unregisterJobs.take(jobIdentifier)) >+ completionHandler(unregistrationResult); > } > > void WebSWServerConnection::startScriptFetchInClient(ServiceWorkerJobIdentifier jobIdentifier, const ServiceWorkerRegistrationKey& registrationKey, FetchOptions::Cache cachePolicy) >@@ -278,6 +279,20 @@ void WebSWServerConnection::scheduleJobInServer(ServiceWorkerJobData&& jobData) > server().scheduleJob(WTFMove(jobData)); > } > >+void WebSWServerConnection::scheduleUnregisterJobInServer(WebCore::ServiceWorkerJobIdentifier jobIdentifier, WebCore::ServiceWorkerRegistrationIdentifier registrationIdentifier, WebCore::DocumentOrWorkerIdentifier contextIdentifier, URL&& clientCreationURL, CompletionHandler<void(bool)>&& completionHandler) >+{ >+ SWSERVERCONNECTION_RELEASE_LOG_IF_ALLOWED("Scheduling unregister ServiceWorker job in server"); >+ >+ auto* registration = server().getRegistration(registrationIdentifier); >+ if (!registration) >+ return completionHandler(false); >+ >+ ASSERT(!m_unregisterJobs.contains(jobIdentifier)); >+ m_unregisterJobs.add(jobIdentifier, WTFMove(completionHandler)); >+ >+ server().scheduleUnregisterJob(ServiceWorkerJobDataIdentifier { identifier(), jobIdentifier }, *registration, contextIdentifier, WTFMove(clientCreationURL)); >+} >+ > void WebSWServerConnection::postMessageToServiceWorkerClient(DocumentIdentifier destinationContextIdentifier, const MessageWithMessagePorts& message, ServiceWorkerIdentifier sourceIdentifier, const String& sourceOrigin) > { > auto* sourceServiceWorker = server().workerByID(sourceIdentifier); >diff --git a/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.h b/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.h >index 7ee3b1869b9f1ef9fd863be6985f588c0504ff27..3b2fabf0159332eeea45b30617a9d5598ecd5c6b 100644 >--- a/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.h >+++ b/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.h >@@ -86,6 +86,7 @@ private: > void registrationReady(uint64_t registrationReadyRequestIdentifier, WebCore::ServiceWorkerRegistrationData&&) final; > > void scheduleJobInServer(WebCore::ServiceWorkerJobData&&); >+ void scheduleUnregisterJobInServer(WebCore::ServiceWorkerJobIdentifier, WebCore::ServiceWorkerRegistrationIdentifier, WebCore::DocumentOrWorkerIdentifier, URL&&, CompletionHandler<void(bool)>&&); > > void startFetch(ServiceWorkerFetchTask&, WebCore::SWServerWorker&); > >@@ -118,6 +119,7 @@ private: > Ref<IPC::Connection> m_contentConnection; > Ref<NetworkProcess> m_networkProcess; > HashMap<WebCore::ServiceWorkerClientIdentifier, WebCore::ClientOrigin> m_clientOrigins; >+ HashMap<WebCore::ServiceWorkerJobIdentifier, CompletionHandler<void(bool)>> m_unregisterJobs; > bool m_isThrottleable { true }; > }; > >diff --git a/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in b/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in >index fdbceb88862b41a2c0cda4a7f35e764682cbfaf9..72c8be2e4c371014dfaa7fa3dbe69c17ef2ec633 100644 >--- a/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in >+++ b/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in >@@ -25,6 +25,8 @@ > messages -> WebSWServerConnection NotRefCounted { > # When possible, these messages can be implemented directly by WebCore::SWClientConnection > ScheduleJobInServer(struct WebCore::ServiceWorkerJobData jobData) >+ ScheduleUnregisterJobInServer(WebCore::ServiceWorkerJobIdentifier jobIdentifier, WebCore::ServiceWorkerRegistrationIdentifier identifier, WebCore::DocumentOrWorkerIdentifier documentIdentifier, URL clientCreationURL) -> (bool unregistrationResult) Async >+ > FinishFetchingScriptInServer(struct WebCore::ServiceWorkerFetchResult result) > AddServiceWorkerRegistrationInServer(WebCore::ServiceWorkerRegistrationIdentifier identifier) > RemoveServiceWorkerRegistrationInServer(WebCore::ServiceWorkerRegistrationIdentifier identifier) >diff --git a/Source/WebKit/Scripts/webkit/messages.py b/Source/WebKit/Scripts/webkit/messages.py >index 82db012de6036a6dde08d5eb4750ffe662990ae7..93952a59f415b086cbf104a6cd90481057c446ed 100644 >--- a/Source/WebKit/Scripts/webkit/messages.py >+++ b/Source/WebKit/Scripts/webkit/messages.py >@@ -205,6 +205,7 @@ def types_that_cannot_be_forward_declared(): > 'MachSendRight', > 'String', > 'WebCore::DocumentIdentifier', >+ 'WebCore::DocumentOrWorkerIdentifier', > 'WebCore::FetchIdentifier', > 'WebCore::FrameIdentifier', > 'WebCore::LibWebRTCSocketIdentifier', >@@ -552,6 +553,7 @@ def headers_for_type(type): > 'PAL::SessionID': ['<pal/SessionID.h>'], > 'WebCore::AutoplayEventFlags': ['<WebCore/AutoplayEvent.h>'], > 'WebCore::DOMPasteAccessResponse': ['<WebCore/DOMPasteAccess.h>'], >+ 'WebCore::DocumentOrWorkerIdentifier': ['<WebCore/ServiceWorkerTypes.h>'], > 'WebKit::DocumentEditingContextRequest': ['"DocumentEditingContext.h"'], > 'WebCore::DragHandlingMethod': ['<WebCore/DragActions.h>'], > 'WebCore::ExceptionDetails': ['<WebCore/JSDOMExceptionHandling.h>'], >diff --git a/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp b/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp >index 6af6ffb6875c49964d0b1df3a270a2338cabdf4c..ef8785f09373e73c569a46e7ff987b3431eee86e 100644 >--- a/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp >+++ b/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp >@@ -97,6 +97,11 @@ void WebSWClientConnection::removeServiceWorkerRegistrationInServer(ServiceWorke > send(Messages::WebSWServerConnection::RemoveServiceWorkerRegistrationInServer { identifier }); > } > >+void WebSWClientConnection::scheduleUnregisterJobInServer(ServiceWorkerRegistrationIdentifier registrationIdentifier, WebCore::DocumentOrWorkerIdentifier documentIdentifier, const URL& clientCreationURL, CompletionHandler<void(bool)>&& completionHandler) >+{ >+ sendWithAsyncReply(Messages::WebSWServerConnection::ScheduleUnregisterJobInServer { ServiceWorkerJobIdentifier::generateThreadSafe(), registrationIdentifier, documentIdentifier, clientCreationURL }, WTFMove(completionHandler)); >+} >+ > void WebSWClientConnection::postMessageToServiceWorker(ServiceWorkerIdentifier destinationIdentifier, MessageWithMessagePorts&& message, const ServiceWorkerOrClientIdentifier& sourceIdentifier) > { > send(Messages::WebSWServerConnection::PostMessageToServiceWorker { destinationIdentifier, WTFMove(message), sourceIdentifier }); >diff --git a/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h b/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h >index 9dbfbabf7683ea9afafb3323485487f1e52dc9fa..44e0e3edced5622e90e3dd2d6efdc6b885ece711 100644 >--- a/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h >+++ b/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h >@@ -75,6 +75,7 @@ private: > void postMessageToServiceWorker(WebCore::ServiceWorkerIdentifier destinationIdentifier, WebCore::MessageWithMessagePorts&&, const WebCore::ServiceWorkerOrClientIdentifier& source) final; > void registerServiceWorkerClient(const WebCore::SecurityOrigin& topOrigin, const WebCore::ServiceWorkerClientData&, const Optional<WebCore::ServiceWorkerRegistrationIdentifier>&, const String& userAgent) final; > void unregisterServiceWorkerClient(WebCore::DocumentIdentifier) final; >+ void scheduleUnregisterJobInServer(WebCore::ServiceWorkerRegistrationIdentifier, WebCore::DocumentOrWorkerIdentifier, const URL& /* clientCreationURL */, CompletionHandler<void(bool)>&&) final; > > void matchRegistration(WebCore::SecurityOriginData&& topOrigin, const URL& clientURL, RegistrationCallback&&) final; > void didMatchRegistration(uint64_t matchRequestIdentifier, Optional<WebCore::ServiceWorkerRegistrationData>&&); >diff --git a/Source/WebKit/WebProcess/Storage/WebSWClientConnection.messages.in b/Source/WebKit/WebProcess/Storage/WebSWClientConnection.messages.in >index 9406971f3b5c481ad22b8fd96b5a93f5552c2ed9..6460bccbfa65ed9419399da5bc09d41f33fbb8aa 100644 >--- a/Source/WebKit/WebProcess/Storage/WebSWClientConnection.messages.in >+++ b/Source/WebKit/WebProcess/Storage/WebSWClientConnection.messages.in >@@ -26,7 +26,6 @@ messages -> WebSWClientConnection { > # When possible, these messages can be implemented directly by WebCore::SWServer::Connection > JobRejectedInServer(WebCore::ServiceWorkerJobIdentifier jobDataIdentifier, struct WebCore::ExceptionData exception) > RegistrationJobResolvedInServer(WebCore::ServiceWorkerJobIdentifier jobDataIdentifier, struct WebCore::ServiceWorkerRegistrationData registration, enum:bool WebCore::ShouldNotifyWhenResolved shouldNotifyWhenResolved) >- UnregistrationJobResolvedInServer(WebCore::ServiceWorkerJobIdentifier jobDataIdentifier, bool unregistrationResult) > StartScriptFetchForServer(WebCore::ServiceWorkerJobIdentifier jobDataIdentifier, WebCore::ServiceWorkerRegistrationKey registrationKey, WebCore::FetchOptions::Cache cachePolicy) > UpdateRegistrationState(WebCore::ServiceWorkerRegistrationIdentifier identifier, enum:uint8_t WebCore::ServiceWorkerRegistrationState state, Optional<WebCore::ServiceWorkerData> serviceWorkerIdentifier) > UpdateWorkerState(WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier, enum:uint8_t WebCore::ServiceWorkerState state)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 207669
:
390577
|
390581
|
390595
|
390671
|
390678