Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Creating a shared worker connection should retry without providing a …
…specific webprocess

https://bugs.webkit.org/show_bug.cgi?id=246999
rdar://101506812

Reviewed by Chris Dumez.

We were trying to create a context connection of a shared worker by always sending a particular target process.
If this process is terminated for instance, the network process will think that the connection should be there.
But no context connection is there, so it retries to create a context connection, with the same target process.
This triggers a loop.
To break the loop, we try using the first target process on the first try but not on successive tries.
UIProcess, on second try, will then try some other processes, typically by creating a new process.

* Source/WebKit/NetworkProcess/SharedWorker/WebSharedWorkerServer.cpp:
(WebKit::WebSharedWorkerServer::createContextConnection):

Canonical link: https://commits.webkit.org/255968@main
  • Loading branch information
youennf committed Oct 25, 2022
1 parent fbdd2a5 commit 62dfaac
Showing 1 changed file with 2 additions and 2 deletions.
Expand Up @@ -134,7 +134,7 @@ void WebSharedWorkerServer::createContextConnection(const WebCore::RegistrableDo
RELEASE_LOG(SharedWorker, "WebSharedWorkerServer::createContextConnection will create a connection");

m_pendingContextConnectionDomains.add(registrableDomain);
m_session.networkProcess().parentProcessConnection()->sendWithAsyncReply(Messages::NetworkProcessProxy::EstablishRemoteWorkerContextConnectionToNetworkProcess { RemoteWorkerType::SharedWorker, registrableDomain, requestingProcessIdentifier, std::nullopt, m_session.sessionID() }, [this, weakThis = WeakPtr { *this }, registrableDomain, requestingProcessIdentifier] {
m_session.networkProcess().parentProcessConnection()->sendWithAsyncReply(Messages::NetworkProcessProxy::EstablishRemoteWorkerContextConnectionToNetworkProcess { RemoteWorkerType::SharedWorker, registrableDomain, requestingProcessIdentifier, std::nullopt, m_session.sessionID() }, [this, weakThis = WeakPtr { *this }, registrableDomain] {
if (!weakThis)
return;

Expand All @@ -146,7 +146,7 @@ void WebSharedWorkerServer::createContextConnection(const WebCore::RegistrableDo
return;

if (needsContextConnectionForRegistrableDomain(registrableDomain))
createContextConnection(registrableDomain, requestingProcessIdentifier);
createContextConnection(registrableDomain, { });
}, 0);
}

Expand Down

0 comments on commit 62dfaac

Please sign in to comment.