Skip to content

Commit 6b4ebcd

Browse files
committed
http/tests/workers/service/self_registration.html is a flaky text failure.
https://bugs.webkit.org/show_bug.cgi?id=260823 rdar://114590106 Reviewed by Chris Dumez. Worker state updates (and events) and Message events are queued on the same DOM manipulation task source. We moved message events handling to: IPC thread -> context manager work queue -> service worker thread. But some events are using the past code path: IPC thread -> main thread -> service worker thread. This is triggering message events to fire faster than the other events/state updaters. We are now moving all DOM manipulation task source events fired on the service worker to the same code path (IPC thread -> context manager work queue -> service worker thread). This includes install, activate, updatefound, statechange, message events. I was not able to reproduce the http/tests/workers/service/self_registration.html flakiness locally but this patch should fix this race and should be covered by this test. * LayoutTests/TestExpectations: * Source/WebCore/workers/service/SWClientConnection.cpp: (WebCore::forDedicatedAndSharedWorkers): (WebCore::forAllWorkers): (WebCore::SWClientConnection::updateRegistrationState): (WebCore::SWClientConnection::updateWorkerState): (WebCore::SWClientConnection::fireUpdateFoundEvent): * Source/WebCore/workers/service/context/SWContextManager.cpp: (WebCore::SWContextManager::updateRegistrationState): (WebCore::SWContextManager::updateWorkerState): (WebCore::SWContextManager::fireUpdateFoundEvent): * Source/WebCore/workers/service/context/SWContextManager.h: * Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp: (WebCore::ServiceWorkerThreadProxy::fireActivateEvent): * Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.h: * Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::establishSWServerConnection): * Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h: (WebKit::NetworkConnectionToWebProcess::swContextConnection): * Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp: (WebKit::WebSWServerConnection::WebSWServerConnection): (WebKit::WebSWServerConnection::networkProcess): (WebKit::WebSWServerConnection::updateRegistrationStateInClient): (WebKit::WebSWServerConnection::fireUpdateFoundEvent): (WebKit::WebSWServerConnection::updateWorkerStateInClient): (WebKit::WebSWServerConnection::scheduleJobInServer): (WebKit::WebSWServerConnection::registerServiceWorkerClientInternal): (WebKit::WebSWServerConnection::unregisterServiceWorkerClient): (WebKit::WebSWServerConnection::contextConnectionCreated): (WebKit::WebSWServerConnection::session): * Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.h: * Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp: (WebKit::WebSWServerToContextConnection::networkProcess): * Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h: * Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp: (WebKit::WebSWContextManagerConnection::fireActivateEvent): (WebKit::WebSWContextManagerConnection::updateRegistrationState): (WebKit::WebSWContextManagerConnection::updateWorkerState): (WebKit::WebSWContextManagerConnection::fireUpdateFoundEvent): * Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h: * Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.messages.in: Canonical link: https://commits.webkit.org/269460@main
1 parent 210b1dc commit 6b4ebcd

17 files changed

+185
-35
lines changed

LayoutTests/TestExpectations

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6668,8 +6668,6 @@ imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/im
66686668
# webkit.org/b/260546
66696669
[ Debug ] imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-details-element/toggleEvent.html [ Pass Failure ]
66706670

6671-
webkit.org/b/260823 http/tests/workers/service/self_registration.html [ Pass Failure ]
6672-
66736671
# Initial css/compositing test import
66746672
imported/w3c/web-platform-tests/css/compositing/background-blending/background-blend-mode-plus-lighter.html [ ImageOnlyFailure ]
66756673
imported/w3c/web-platform-tests/css/compositing/mix-blend-mode/mix-blend-mode-blended-element-overflow-hidden-and-border-radius.html [ ImageOnlyFailure ]

Source/WebCore/workers/WorkerRunLoop.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class WorkerDedicatedRunLoop final : public WorkerRunLoop {
117117
int m_debugCount { 0 };
118118
};
119119

120-
class WorkerMainRunLoop final : public WorkerRunLoop, public CanMakeWeakPtr<WorkerMainRunLoop> {
120+
class WorkerMainRunLoop final : public WorkerRunLoop, public CanMakeWeakPtr<WorkerMainRunLoop, WeakPtrFactoryInitialization::Eager> {
121121
public:
122122
WorkerMainRunLoop();
123123

Source/WebCore/workers/service/SWClientConnection.cpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,8 @@ void SWClientConnection::postMessageToServiceWorkerClient(ScriptExecutionContext
148148
});
149149
}
150150

151-
static void forAllWorkers(const Function<Function<void(ScriptExecutionContext&)>()>& callback)
151+
static void forDedicatedAndSharedWorkers(const Function<Function<void(ScriptExecutionContext&)>()>& callback)
152152
{
153-
SWContextManager::singleton().forEachServiceWorker(callback);
154153
Worker::forEachWorker(callback);
155154
SharedWorkerContextManager::singleton().forEachSharedWorker(callback);
156155
}
@@ -164,7 +163,7 @@ void SWClientConnection::updateRegistrationState(ServiceWorkerRegistrationIdenti
164163
container->updateRegistrationState(identifier, state, serviceWorkerData);
165164
}
166165

167-
forAllWorkers([identifier, state, &serviceWorkerData] {
166+
forDedicatedAndSharedWorkers([identifier, state, &serviceWorkerData] {
168167
return [identifier, state, serviceWorkerData = crossThreadCopy(serviceWorkerData)] (auto& context) mutable {
169168
if (auto* container = context.serviceWorkerContainer())
170169
container->updateRegistrationState(identifier, state, WTFMove(serviceWorkerData));
@@ -181,7 +180,7 @@ void SWClientConnection::updateWorkerState(ServiceWorkerIdentifier identifier, S
181180
container->updateWorkerState(identifier, state);
182181
}
183182

184-
forAllWorkers([identifier, state] {
183+
forDedicatedAndSharedWorkers([identifier, state] {
185184
return [identifier, state] (auto& context) {
186185
if (auto* container = context.serviceWorkerContainer())
187186
container->updateWorkerState(identifier, state);
@@ -198,7 +197,7 @@ void SWClientConnection::fireUpdateFoundEvent(ServiceWorkerRegistrationIdentifie
198197
container->queueTaskToFireUpdateFoundEvent(identifier);
199198
}
200199

201-
forAllWorkers([identifier] {
200+
forDedicatedAndSharedWorkers([identifier] {
202201
return [identifier] (auto& context) {
203202
if (auto* container = context.serviceWorkerContainer())
204203
container->queueTaskToFireUpdateFoundEvent(identifier);
@@ -217,7 +216,7 @@ void SWClientConnection::setRegistrationLastUpdateTime(ServiceWorkerRegistration
217216
}
218217
}
219218

220-
forAllWorkers([identifier, lastUpdateTime] {
219+
forDedicatedAndSharedWorkers([identifier, lastUpdateTime] {
221220
return [identifier, lastUpdateTime] (auto& context) {
222221
if (auto* container = context.serviceWorkerContainer()) {
223222
if (auto* registration = container->registration(identifier))
@@ -238,7 +237,7 @@ void SWClientConnection::setRegistrationUpdateViaCache(ServiceWorkerRegistration
238237
}
239238
}
240239

241-
forAllWorkers([identifier, updateViaCache] {
240+
forDedicatedAndSharedWorkers([identifier, updateViaCache] {
242241
return [identifier, updateViaCache] (auto& context) {
243242
if (auto* container = context.serviceWorkerContainer()) {
244243
if (auto* registration = container->registration(identifier))
@@ -248,11 +247,18 @@ void SWClientConnection::setRegistrationUpdateViaCache(ServiceWorkerRegistration
248247
});
249248
}
250249

250+
static void forAllWorkers(const Function<Function<void(ScriptExecutionContext&)>()>& callback)
251+
{
252+
SWContextManager::singleton().forEachServiceWorker(callback);
253+
forDedicatedAndSharedWorkers(callback);
254+
}
255+
251256
void SWClientConnection::updateBackgroundFetchRegistration(const BackgroundFetchInformation& information)
252257
{
253258
for (auto* document : Document::allDocuments())
254259
BackgroundFetchRegistration::updateIfExisting(*document, information);
255260

261+
// FIXME: this code path for service worker should follow background fetch event code path.
256262
forAllWorkers([&information] {
257263
return [information = crossThreadCopy(information)] (auto& context) {
258264
BackgroundFetchRegistration::updateIfExisting(context, information);

Source/WebCore/workers/service/context/SWContextManager.cpp

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "Logging.h"
3232
#include "MessageWithMessagePorts.h"
3333
#include "NotificationPayload.h"
34+
#include "ServiceWorkerContainer.h"
3435
#include "ServiceWorkerGlobalScope.h"
3536
#include <wtf/WTFProcess.h>
3637

@@ -282,6 +283,61 @@ void SWContextManager::setInspectable(bool inspectable)
282283
serviceWorker->setInspectable(inspectable);
283284
}
284285

286+
287+
void SWContextManager::updateRegistrationState(ServiceWorkerRegistrationIdentifier identifier, ServiceWorkerRegistrationState state, const std::optional<ServiceWorkerData>& serviceWorkerData)
288+
{
289+
forEachServiceWorker([identifier, state, &serviceWorkerData] {
290+
return [identifier, state, serviceWorkerData = crossThreadCopy(serviceWorkerData)] (auto& context) mutable {
291+
if (auto* container = context.serviceWorkerContainer())
292+
container->updateRegistrationState(identifier, state, WTFMove(serviceWorkerData));
293+
};
294+
});
295+
}
296+
297+
void SWContextManager::updateWorkerState(ServiceWorkerIdentifier identifier, ServiceWorkerState state)
298+
{
299+
forEachServiceWorker([identifier, state] {
300+
return [identifier, state] (auto& context) {
301+
if (auto* container = context.serviceWorkerContainer())
302+
container->updateWorkerState(identifier, state);
303+
};
304+
});
305+
}
306+
307+
void SWContextManager::fireUpdateFoundEvent(ServiceWorkerRegistrationIdentifier identifier)
308+
{
309+
forEachServiceWorker([identifier] {
310+
return [identifier] (auto& context) {
311+
if (auto* container = context.serviceWorkerContainer())
312+
container->queueTaskToFireUpdateFoundEvent(identifier);
313+
};
314+
});
315+
}
316+
317+
void SWContextManager::setRegistrationLastUpdateTime(ServiceWorkerRegistrationIdentifier identifier, WallTime lastUpdateTime)
318+
{
319+
forEachServiceWorker([identifier, lastUpdateTime] {
320+
return [identifier, lastUpdateTime] (auto& context) {
321+
if (auto* container = context.serviceWorkerContainer()) {
322+
if (auto* registration = container->registration(identifier))
323+
registration->setLastUpdateTime(lastUpdateTime);
324+
}
325+
};
326+
});
327+
}
328+
329+
void SWContextManager::setRegistrationUpdateViaCache(ServiceWorkerRegistrationIdentifier identifier, ServiceWorkerUpdateViaCache updateViaCache)
330+
{
331+
forEachServiceWorker([identifier, updateViaCache] {
332+
return [identifier, updateViaCache] (auto& context) {
333+
if (auto* container = context.serviceWorkerContainer()) {
334+
if (auto* registration = container->registration(identifier))
335+
registration->setUpdateViaCache(updateViaCache);
336+
}
337+
};
338+
});
339+
}
340+
285341
} // namespace WebCore
286342

287343
#endif

Source/WebCore/workers/service/context/SWContextManager.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,12 @@ class SWContextManager {
130130
WEBCORE_EXPORT void setAsInspected(ServiceWorkerIdentifier, bool);
131131
WEBCORE_EXPORT void setInspectable(bool);
132132

133+
WEBCORE_EXPORT void updateRegistrationState(ServiceWorkerRegistrationIdentifier, ServiceWorkerRegistrationState, const std::optional<ServiceWorkerData>&);
134+
WEBCORE_EXPORT void updateWorkerState(ServiceWorkerIdentifier, ServiceWorkerState);
135+
WEBCORE_EXPORT void fireUpdateFoundEvent(ServiceWorkerRegistrationIdentifier);
136+
WEBCORE_EXPORT void setRegistrationLastUpdateTime(ServiceWorkerRegistrationIdentifier, WallTime);
137+
WEBCORE_EXPORT void setRegistrationUpdateViaCache(ServiceWorkerRegistrationIdentifier, ServiceWorkerUpdateViaCache);
138+
133139
private:
134140
SWContextManager() = default;
135141

Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -336,18 +336,26 @@ void ServiceWorkerThreadProxy::fireMessageEvent(MessageWithMessagePorts&& messag
336336

337337
void ServiceWorkerThreadProxy::fireInstallEvent()
338338
{
339-
ASSERT(isMainThread());
340-
thread().willPostTaskToFireInstallEvent();
339+
ASSERT(!isMainThread());
340+
341+
callOnMainRunLoop([protectedThis = Ref { *this }] {
342+
protectedThis->thread().willPostTaskToFireInstallEvent();
343+
});
344+
341345
thread().runLoop().postTask([this, protectedThis = Ref { *this }](auto&) mutable {
342346
thread().queueTaskToFireInstallEvent();
343347
});
344348
}
345349

346350
void ServiceWorkerThreadProxy::fireActivateEvent()
347351
{
348-
ASSERT(isMainThread());
349-
thread().willPostTaskToFireActivateEvent();
350-
thread().runLoop().postTask([this, protectedThis = Ref { *this }](auto&) mutable {
352+
ASSERT(!isMainThread());
353+
354+
callOnMainRunLoop([protectedThis = Ref { *this }] {
355+
protectedThis->thread().willPostTaskToFireActivateEvent();
356+
});
357+
358+
thread().runLoop().postTask([this, protectedThis = Ref { *this }](auto&) {
351359
thread().queueTaskToFireActivateEvent();
352360
});
353361
}

Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ class ServiceWorkerThreadProxy final : public ThreadSafeRefCountedAndCanMakeThre
8686

8787
WEBCORE_EXPORT void fireMessageEvent(MessageWithMessagePorts&&, ServiceWorkerOrClientData&&);
8888

89-
void fireInstallEvent();
90-
void fireActivateEvent();
89+
WEBCORE_EXPORT void fireInstallEvent();
90+
WEBCORE_EXPORT void fireActivateEvent();
9191
void firePushEvent(std::optional<Vector<uint8_t>>&&, std::optional<NotificationPayload>&&, CompletionHandler<void(bool, std::optional<NotificationPayload>&&)>&&);
9292
void firePushSubscriptionChangeEvent(std::optional<PushSubscriptionData>&& newSubscriptionData, std::optional<PushSubscriptionData>&& oldSubscriptionData);
9393
void fireNotificationEvent(NotificationData&&, NotificationEventType, CompletionHandler<void(bool)>&&);

Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1313,7 +1313,7 @@ void NetworkConnectionToWebProcess::establishSWServerConnection()
13131313
return;
13141314

13151315
auto& server = session->ensureSWServer();
1316-
auto connection = makeUnique<WebSWServerConnection>(m_networkProcess, server, m_connection.get(), m_webProcessIdentifier);
1316+
auto connection = makeUnique<WebSWServerConnection>(*this, server, m_connection.get(), m_webProcessIdentifier);
13171317

13181318
m_swConnection = *connection;
13191319
server.addConnection(WTFMove(connection));

Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include "WebPageProxyIdentifier.h"
3838
#include "WebPaymentCoordinatorProxy.h"
3939
#include "WebResourceLoadObserver.h"
40+
#include "WebSWServerToContextConnection.h"
4041
#include <JavaScriptCore/ConsoleTypes.h>
4142
#include <WebCore/ExceptionData.h>
4243
#include <WebCore/FrameIdentifier.h>
@@ -229,6 +230,10 @@ class NetworkConnectionToWebProcess
229230
NetworkMDNSRegister& mdnsRegister() { return m_mdnsRegister; }
230231
#endif
231232

233+
#if ENABLE(SERVICE_WORKER)
234+
WeakPtr<WebSWServerToContextConnection> swContextConnection() { return m_swContextConnection.get(); }
235+
#endif
236+
232237
private:
233238
NetworkConnectionToWebProcess(NetworkProcess&, WebCore::ProcessIdentifier, PAL::SessionID, NetworkProcessConnectionParameters&&, IPC::Connection::Identifier);
234239

Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,16 @@ using namespace WebCore;
7474
ASSERT(assertion); \
7575
if (UNLIKELY(!(assertion))) { \
7676
RELEASE_LOG_FAULT(IPC, __FILE__ " " CONNECTION_STRINGIFY_MACRO(__LINE__) ": Invalid message dispatched %" PUBLIC_LOG_STRING, WTF_PRETTY_FUNCTION); \
77-
m_networkProcess->parentProcessConnection()->send(Messages::NetworkProcessProxy::TerminateWebProcess(identifier()), 0); \
77+
networkProcess().parentProcessConnection()->send(Messages::NetworkProcessProxy::TerminateWebProcess(identifier()), 0); \
7878
{ completion; } \
7979
return; \
8080
} \
8181
} while (0)
8282

83-
WebSWServerConnection::WebSWServerConnection(NetworkProcess& networkProcess, SWServer& server, IPC::Connection& connection, ProcessIdentifier processIdentifier)
83+
WebSWServerConnection::WebSWServerConnection(NetworkConnectionToWebProcess& networkConnectionToWebProcess, SWServer& server, IPC::Connection& connection, ProcessIdentifier processIdentifier)
8484
: SWServer::Connection(server, processIdentifier)
85+
, m_networkConnectionToWebProcess(networkConnectionToWebProcess)
8586
, m_contentConnection(connection)
86-
, m_networkProcess(networkProcess)
8787
{
8888
if (auto* session = this->session())
8989
session->registerSWServerConnection(*this);
@@ -99,6 +99,11 @@ WebSWServerConnection::~WebSWServerConnection()
9999
completionHandler(false);
100100
}
101101

102+
NetworkProcess& WebSWServerConnection::networkProcess()
103+
{
104+
return m_networkConnectionToWebProcess->networkProcess();
105+
}
106+
102107
void WebSWServerConnection::rejectJobInClient(ServiceWorkerJobIdentifier jobIdentifier, const ExceptionData& exceptionData)
103108
{
104109
if (auto completionHandler = m_unregisterJobs.take(jobIdentifier))
@@ -140,21 +145,29 @@ void WebSWServerConnection::startScriptFetchInClient(ServiceWorkerJobIdentifier
140145
void WebSWServerConnection::updateRegistrationStateInClient(ServiceWorkerRegistrationIdentifier identifier, ServiceWorkerRegistrationState state, const std::optional<ServiceWorkerData>& serviceWorkerData)
141146
{
142147
send(Messages::WebSWClientConnection::UpdateRegistrationState(identifier, state, serviceWorkerData));
148+
if (auto contextConnection = m_networkConnectionToWebProcess->swContextConnection())
149+
sendToContextProcess(*contextConnection, Messages::WebSWContextManagerConnection::UpdateRegistrationState(identifier, state, serviceWorkerData));
143150
}
144151

145152
void WebSWServerConnection::fireUpdateFoundEvent(ServiceWorkerRegistrationIdentifier identifier)
146153
{
147154
send(Messages::WebSWClientConnection::FireUpdateFoundEvent(identifier));
155+
if (auto contextConnection = m_networkConnectionToWebProcess->swContextConnection())
156+
sendToContextProcess(*contextConnection, Messages::WebSWContextManagerConnection::FireUpdateFoundEvent(identifier));
148157
}
149158

150159
void WebSWServerConnection::setRegistrationLastUpdateTime(ServiceWorkerRegistrationIdentifier identifier, WallTime lastUpdateTime)
151160
{
152161
send(Messages::WebSWClientConnection::SetRegistrationLastUpdateTime(identifier, lastUpdateTime));
162+
if (auto contextConnection = m_networkConnectionToWebProcess->swContextConnection())
163+
sendToContextProcess(*contextConnection, Messages::WebSWContextManagerConnection::SetRegistrationLastUpdateTime(identifier, lastUpdateTime));
153164
}
154165

155166
void WebSWServerConnection::setRegistrationUpdateViaCache(ServiceWorkerRegistrationIdentifier identifier, ServiceWorkerUpdateViaCache updateViaCache)
156167
{
157168
send(Messages::WebSWClientConnection::SetRegistrationUpdateViaCache(identifier, updateViaCache));
169+
if (auto contextConnection = m_networkConnectionToWebProcess->swContextConnection())
170+
sendToContextProcess(*contextConnection, Messages::WebSWContextManagerConnection::SetRegistrationUpdateViaCache(identifier, updateViaCache));
158171
}
159172

160173
void WebSWServerConnection::notifyClientsOfControllerChange(const HashSet<ScriptExecutionContextIdentifier>& contextIdentifiers, const std::optional<ServiceWorkerData>& newController)
@@ -165,6 +178,8 @@ void WebSWServerConnection::notifyClientsOfControllerChange(const HashSet<Script
165178
void WebSWServerConnection::updateWorkerStateInClient(ServiceWorkerIdentifier worker, ServiceWorkerState state)
166179
{
167180
send(Messages::WebSWClientConnection::UpdateWorkerState(worker, state));
181+
if (auto contextConnection = m_networkConnectionToWebProcess->swContextConnection())
182+
sendToContextProcess(*contextConnection, Messages::WebSWContextManagerConnection::UpdateWorkerState(worker, state));
168183
}
169184

170185
void WebSWServerConnection::controlClient(const NetworkResourceLoadParameters& parameters, SWServerRegistration& registration, const ResourceRequest& request, WebCore::ProcessIdentifier webProcessIdentifier)
@@ -332,7 +347,7 @@ void WebSWServerConnection::postMessageToServiceWorker(ServiceWorkerIdentifier d
332347

333348
void WebSWServerConnection::scheduleJobInServer(ServiceWorkerJobData&& jobData)
334349
{
335-
CONNECTION_MESSAGE_CHECK(m_networkProcess->allowsFirstPartyForCookies(identifier(), WebCore::RegistrableDomain::uncheckedCreateFromHost(jobData.topOrigin.host())));
350+
CONNECTION_MESSAGE_CHECK(networkProcess().allowsFirstPartyForCookies(identifier(), WebCore::RegistrableDomain::uncheckedCreateFromHost(jobData.topOrigin.host())));
336351

337352
ASSERT(!jobData.scopeURL.isNull());
338353
if (jobData.scopeURL.isNull()) {
@@ -443,7 +458,7 @@ void WebSWServerConnection::registerServiceWorkerClientInternal(WebCore::ClientO
443458

444459
if (contextConnection) {
445460
auto& connection = static_cast<WebSWServerToContextConnection&>(*contextConnection);
446-
m_networkProcess->parentProcessConnection()->send(Messages::NetworkProcessProxy::RegisterRemoteWorkerClientProcess { RemoteWorkerType::ServiceWorker, identifier(), connection.webProcessIdentifier() }, 0);
461+
networkProcess().parentProcessConnection()->send(Messages::NetworkProcessProxy::RegisterRemoteWorkerClientProcess { RemoteWorkerType::ServiceWorker, identifier(), connection.webProcessIdentifier() }, 0);
447462
}
448463
}
449464

@@ -471,7 +486,7 @@ void WebSWServerConnection::unregisterServiceWorkerClient(const ScriptExecutionC
471486
if (!hasMatchingClient(potentiallyRemovedDomain)) {
472487
if (auto* contextConnection = server().contextConnectionForRegistrableDomain(potentiallyRemovedDomain)) {
473488
auto& connection = static_cast<WebSWServerToContextConnection&>(*contextConnection);
474-
m_networkProcess->parentProcessConnection()->send(Messages::NetworkProcessProxy::UnregisterRemoteWorkerClientProcess { RemoteWorkerType::ServiceWorker, identifier(), connection.webProcessIdentifier() }, 0);
489+
networkProcess().parentProcessConnection()->send(Messages::NetworkProcessProxy::UnregisterRemoteWorkerClientProcess { RemoteWorkerType::ServiceWorker, identifier(), connection.webProcessIdentifier() }, 0);
475490
}
476491
}
477492
}
@@ -620,7 +635,7 @@ void WebSWServerConnection::contextConnectionCreated(SWServerToContextConnection
620635
connection.setThrottleState(computeThrottleState(connection.registrableDomain()));
621636

622637
if (hasMatchingClient(connection.registrableDomain()))
623-
m_networkProcess->parentProcessConnection()->send(Messages::NetworkProcessProxy::RegisterRemoteWorkerClientProcess { RemoteWorkerType::ServiceWorker, identifier(), connection.webProcessIdentifier() }, 0);
638+
networkProcess().parentProcessConnection()->send(Messages::NetworkProcessProxy::RegisterRemoteWorkerClientProcess { RemoteWorkerType::ServiceWorker, identifier(), connection.webProcessIdentifier() }, 0);
624639
}
625640

626641
void WebSWServerConnection::terminateWorkerFromClient(ServiceWorkerIdentifier serviceWorkerIdentifier, CompletionHandler<void()>&& callback)
@@ -646,7 +661,7 @@ PAL::SessionID WebSWServerConnection::sessionID() const
646661

647662
NetworkSession* WebSWServerConnection::session()
648663
{
649-
return m_networkProcess->networkSession(sessionID());
664+
return networkProcess().networkSession(sessionID());
650665
}
651666

652667
template<typename U> void WebSWServerConnection::sendToContextProcess(WebCore::SWServerToContextConnection& connection, U&& message)

0 commit comments

Comments
 (0)