Changeset 293329 in webkit


Ignore:
Timestamp:
Apr 25, 2022 9:10:59 AM (3 months ago)
Author:
Chris Dumez
Message:

Web Locks held in a Worker are not released on page refresh or exit
https://bugs.webkit.org/show_bug.cgi?id=239614
<rdar://problem/92173575>

Reviewed by Alex Christensen.

Before a web worker olding a lock would terminate, WebLockManager::stop() would get called
and it would attempt to release all locks held by the worker. However, because we're off
the main thread and because the lock registry was held by the Page on the main thread,
we would rely on a call to workerLoaderProxy().postTaskToLoader() to get back to the
main thread and access the lock registry via the Document's page. However, this wasn't
reliable because the task posted to postTaskToLoader() could get dropped if the worker's
Document is also going away (which is the case when reloading or navigating away).

To address the issue, the WebLockRegistry can now be accessed directly (on the main thread),
without having to go through a Page. As a result, we can simply do a callOnMainThread()
and then access WebLockRegistry::shared(), which is always reliable. To maintain the
previous behavior for WebKitLegacy, I also partitioned the WebLockRegistry per sessionID
since we don't want views sharing the same locks if one is using the default session and
the other is using a private session. This wasn't an issue for modern WebKit since there
is a single session per WebProcess.

To achieve this, I had to made sure that WorkerOrWorkletGlobalScope::sessionID() was returning
a valid value. This worked for ServiceWorkerGlobalScope but not for other types or workers /
worklets global scopes.

Test: workers/worker-web-lock-released-on-reload.html

  • Source/WebKit/UIProcess/WebLockRegistryProxy.cpp:

(WebKit::WebLockRegistryProxy::requestLock):
(WebKit::WebLockRegistryProxy::releaseLock):
(WebKit::WebLockRegistryProxy::abortLockRequest):
(WebKit::WebLockRegistryProxy::snapshot):
(WebKit::WebLockRegistryProxy::clientIsGoingAway):

  • Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp:

(WebKit::WebSWContextManagerConnection::installServiceWorker):

  • Source/WebKit/WebProcess/Storage/WebSharedWorkerContextManagerConnection.cpp:

(WebKit::WebSharedWorkerContextManagerConnection::launchSharedWorker):

  • Source/WebKit/WebProcess/WebCoreSupport/RemoteWebLockRegistry.cpp:

(WebKit::RemoteWebLockRegistry::requestLock):
(WebKit::RemoteWebLockRegistry::releaseLock):
(WebKit::RemoteWebLockRegistry::abortLockRequest):
(WebKit::RemoteWebLockRegistry::snapshot):
(WebKit::RemoteWebLockRegistry::clientIsGoingAway):

  • Source/WebKit/WebProcess/WebCoreSupport/RemoteWebLockRegistry.h:
  • Source/WebKit/WebProcess/WebPage/WebPage.cpp:

(WebKit::m_appHighlightsVisible):

  • Source/WebKit/WebProcess/WebProcess.cpp:

(WebKit::WebProcess::WebProcess):

  • Source/WebKit/WebProcess/WebProcess.h:

(WebKit::WebProcess::broadcastChannelRegistry):
(WebKit::WebProcess::webLockRegistry): Deleted.

  • Source/WebKitLegacy/mac/WebView/WebView.mm:

(-[WebView _commonInitializationWithFrameName:groupName:]):
(-[WebView initSimpleHTMLDocumentWithStyle:frame:preferences:groupName:]):
(getOrCreateWebLockRegistry): Deleted.

  • Source/WebKitLegacy/win/WebView.cpp:

(WebView::initWithFrame):
(getOrCreateWebLockRegistry): Deleted.
Test: workers/worker-web-lock-released-on-reload.html

  • Source/WebCore/Modules/web-locks/WebLockManager.cpp:

(WebCore::WebLockManager::MainThreadBridge::create):
(WebCore::WebLockManager::MainThreadBridge::MainThreadBridge):
(WebCore::WebLockManager::MainThreadBridge::requestLock):
(WebCore::WebLockManager::MainThreadBridge::releaseLock):
(WebCore::WebLockManager::MainThreadBridge::abortLockRequest):
(WebCore::WebLockManager::MainThreadBridge::query):
(WebCore::WebLockManager::MainThreadBridge::clientIsGoingAway):
(WebCore::WebLockManager::MainThreadBridge::ensureOnMainThread): Deleted.

  • Source/WebCore/Modules/web-locks/WebLockRegistry.cpp:

(WebCore::sharedRegistry):
(WebCore::WebLockRegistry::shared):
(WebCore::WebLockRegistry::setSharedRegistry):
(WebCore::LocalWebLockRegistry::ensureRegistryForOrigin):
(WebCore::LocalWebLockRegistry::existingRegistryForOrigin const):
(WebCore::LocalWebLockRegistry::PerOriginRegistry::create):
(WebCore::LocalWebLockRegistry::PerOriginRegistry::PerOriginRegistry):
(WebCore::LocalWebLockRegistry::PerOriginRegistry::~PerOriginRegistry):
(WebCore::LocalWebLockRegistry::requestLock):
(WebCore::LocalWebLockRegistry::releaseLock):
(WebCore::LocalWebLockRegistry::abortLockRequest):
(WebCore::LocalWebLockRegistry::snapshot):
(WebCore::LocalWebLockRegistry::clientIsGoingAway):
(WebCore::LocalWebLockRegistry::clientsAreGoingAway):

  • Source/WebCore/Modules/web-locks/WebLockRegistry.h:
  • Source/WebCore/Modules/webaudio/AudioWorkletMessagingProxy.cpp:

(WebCore::generateWorkletParameters):

  • Source/WebCore/dom/Document.h:
  • Source/WebCore/loader/EmptyClients.cpp:

(WebCore::pageConfigurationWithEmptyClients):

  • Source/WebCore/page/Page.cpp:

(WebCore::Page::Page):

  • Source/WebCore/page/Page.h:

(WebCore::Page::webLockRegistry): Deleted.

  • Source/WebCore/page/PageConfiguration.cpp:

(WebCore::PageConfiguration::PageConfiguration):

  • Source/WebCore/page/PageConfiguration.h:
  • Source/WebCore/workers/Worker.cpp:

(WebCore::Worker::notifyFinished):

  • Source/WebCore/workers/WorkerGlobalScope.cpp:

(WebCore::WorkerGlobalScope::WorkerGlobalScope):

  • Source/WebCore/workers/WorkerGlobalScopeProxy.h:
  • Source/WebCore/workers/WorkerMessagingProxy.cpp:

(WebCore::WorkerMessagingProxy::startWorkerGlobalScope):

  • Source/WebCore/workers/WorkerMessagingProxy.h:
  • Source/WebCore/workers/WorkerOrWorkletGlobalScope.cpp:

(WebCore::WorkerOrWorkletGlobalScope::WorkerOrWorkletGlobalScope):

  • Source/WebCore/workers/WorkerOrWorkletGlobalScope.h:

(WebCore::WorkerOrWorkletGlobalScope::WorkerOrWorkletGlobalScope):

  • Source/WebCore/workers/WorkerThread.h:
  • Source/WebCore/workers/service/ServiceWorkerGlobalScope.cpp:

(WebCore::ServiceWorkerGlobalScope::create):
(WebCore::ServiceWorkerGlobalScope::ServiceWorkerGlobalScope):

  • Source/WebCore/workers/service/ServiceWorkerGlobalScope.h:
  • Source/WebCore/workers/service/context/ServiceWorkerThread.cpp:

(WebCore::ServiceWorkerThread::createWorkerGlobalScope):

  • Source/WebCore/workers/shared/context/SharedWorkerThreadProxy.cpp:

(WebCore::generateWorkerParameters):

  • Source/WebCore/worklets/WorkletGlobalScope.cpp:

(WebCore::WorkletGlobalScope::WorkletGlobalScope):

  • Source/WebCore/worklets/WorkletParameters.h:

(WebCore::WorkletParameters::isolatedCopy const):
(WebCore::WorkletParameters::isolatedCopy):

  • LayoutTests/workers/resources/worker-web-lock-released-on-reload-popup.html: Added.
  • LayoutTests/workers/resources/worker-web-lock-released-on-reload-worker.js: Added.
  • LayoutTests/workers/worker-web-lock-released-on-reload-expected.txt: Added.
  • LayoutTests/workers/worker-web-lock-released-on-reload.html: Added.

Canonical link: https://commits.webkit.org/249952@main

Location:
trunk
Files:
5 added
35 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/Modules/web-locks/WebLockManager.cpp

    r291863 r293329  
    7474            return nullptr;
    7575
    76         return adoptRef(*new MainThreadBridge(*context, WTFMove(*clientOrigin)));
     76        auto sessionID = context->sessionID();
     77        if (!sessionID)
     78            return nullptr;
     79
     80        return adoptRef(*new MainThreadBridge(*context, *sessionID, WTFMove(*clientOrigin)));
    7781    }
    7882
     
    8488
    8589private:
    86     MainThreadBridge(ScriptExecutionContext&, ClientOrigin&&);
    87 
    88     void ensureOnMainThread(Function<void(WebLockRegistry&)>&& task);
    89 
    90     WeakPtr<ScriptExecutionContext> m_context;
     90    MainThreadBridge(ScriptExecutionContext&, PAL::SessionID, ClientOrigin&&);
     91
    9192    const ScriptExecutionContextIdentifier m_clientID;
     93    const PAL::SessionID m_sessionID;
    9294    const ClientOrigin m_clientOrigin; // Main thread only.
    9395};
    9496
    95 WebLockManager::MainThreadBridge::MainThreadBridge(ScriptExecutionContext& context, ClientOrigin&& clientOrigin)
    96     : m_context(context)
    97     , m_clientID(context.identifier())
     97WebLockManager::MainThreadBridge::MainThreadBridge(ScriptExecutionContext& context, PAL::SessionID sessionID, ClientOrigin&& clientOrigin)
     98    : m_clientID(context.identifier())
     99    , m_sessionID(sessionID)
    98100    , m_clientOrigin(WTFMove(clientOrigin).isolatedCopy())
    99101{
     
    102104void WebLockManager::MainThreadBridge::requestLock(WebLockIdentifier lockIdentifier, const String& name, const Options& options, Function<void(bool)>&& grantedHandler, Function<void()>&& lockStolenHandler)
    103105{
    104     ensureOnMainThread([this, name = crossThreadCopy(name), mode = options.mode, steal = options.steal, ifAvailable = options.ifAvailable, lockIdentifier, grantedHandler = WTFMove(grantedHandler), lockStolenHandler = WTFMove(lockStolenHandler)](auto& registry) mutable {
    105         registry.requestLock(m_clientOrigin, lockIdentifier, m_clientID, name, mode, steal, ifAvailable, [clientID = m_clientID, grantedHandler = WTFMove(grantedHandler)] (bool success) mutable {
     106    callOnMainThread([this, protectedThis = Ref { *this }, name = crossThreadCopy(name), mode = options.mode, steal = options.steal, ifAvailable = options.ifAvailable, lockIdentifier, grantedHandler = WTFMove(grantedHandler), lockStolenHandler = WTFMove(lockStolenHandler)]() mutable {
     107        WebLockRegistry::shared().requestLock(m_sessionID, m_clientOrigin, lockIdentifier, m_clientID, name, mode, steal, ifAvailable, [clientID = m_clientID, grantedHandler = WTFMove(grantedHandler)] (bool success) mutable {
    106108            ScriptExecutionContext::ensureOnContextThread(clientID, [grantedHandler = WTFMove(grantedHandler), success](auto&) mutable {
    107109                grantedHandler(success);
     
    117119void WebLockManager::MainThreadBridge::releaseLock(WebLockIdentifier lockIdentifier, const String& name)
    118120{
    119     ensureOnMainThread([this, lockIdentifier, name = crossThreadCopy(name)](auto& registry) {
    120         registry.releaseLock(m_clientOrigin, lockIdentifier, m_clientID, name);
     121    callOnMainThread([this, protectedThis = Ref { *this }, lockIdentifier, name = crossThreadCopy(name)] {
     122        WebLockRegistry::shared().releaseLock(m_sessionID, m_clientOrigin, lockIdentifier, m_clientID, name);
    121123    });
    122124}
     
    124126void WebLockManager::MainThreadBridge::abortLockRequest(WebLockIdentifier lockIdentifier, const String& name, CompletionHandler<void(bool)>&& completionHandler)
    125127{
    126     ensureOnMainThread([this, lockIdentifier, name = crossThreadCopy(name), completionHandler = WTFMove(completionHandler)](auto& registry) mutable {
    127         registry.abortLockRequest(m_clientOrigin, lockIdentifier, m_clientID, name, [clientID = m_clientID, completionHandler = WTFMove(completionHandler)](bool wasAborted) mutable {
     128    callOnMainThread([this, protectedThis = Ref { *this }, lockIdentifier, name = crossThreadCopy(name), completionHandler = WTFMove(completionHandler)]() mutable {
     129        WebLockRegistry::shared().abortLockRequest(m_sessionID, m_clientOrigin, lockIdentifier, m_clientID, name, [clientID = m_clientID, completionHandler = WTFMove(completionHandler)](bool wasAborted) mutable {
    128130            ScriptExecutionContext::ensureOnContextThread(clientID, [completionHandler = WTFMove(completionHandler), wasAborted](auto&) mutable {
    129131                completionHandler(wasAborted);
     
    135137void WebLockManager::MainThreadBridge::query(CompletionHandler<void(Snapshot&&)>&& completionHandler)
    136138{
    137     ensureOnMainThread([this, completionHandler = WTFMove(completionHandler)](auto& registry) mutable {
    138         registry.snapshot(m_clientOrigin, [clientID = m_clientID, completionHandler = WTFMove(completionHandler)](Snapshot&& snapshot) mutable {
     139    callOnMainThread([this, protectedThis = Ref { *this }, completionHandler = WTFMove(completionHandler)]() mutable {
     140        WebLockRegistry::shared().snapshot(m_sessionID, m_clientOrigin, [clientID = m_clientID, completionHandler = WTFMove(completionHandler)](Snapshot&& snapshot) mutable {
    139141            ScriptExecutionContext::ensureOnContextThread(clientID, [completionHandler = WTFMove(completionHandler), snapshot = crossThreadCopy(snapshot)](auto&) mutable {
    140142                completionHandler(WTFMove(snapshot));
     
    146148void WebLockManager::MainThreadBridge::clientIsGoingAway()
    147149{
    148     ensureOnMainThread([this](auto& registry) {
    149         registry.clientIsGoingAway(m_clientOrigin, m_clientID);
    150     });
    151 }
    152 
    153 void WebLockManager::MainThreadBridge::ensureOnMainThread(Function<void(WebLockRegistry&)>&& task)
    154 {
    155     if (!m_context)
    156         return;
    157     ASSERT(m_context->isContextThread());
    158 
    159     if (is<Document>(*m_context)) {
    160         if (auto page = downcast<Document>(*m_context).page()) {
    161             Ref protectedThis { *this };
    162             task(page->webLockRegistry());
    163         }
    164     } else {
    165         downcast<WorkerGlobalScope>(*m_context).thread().workerLoaderProxy().postTaskToLoader([task = WTFMove(task), protectedThis = Ref { *this }](auto& context) {
    166             if (auto page = downcast<Document>(context).page())
    167                 task(page->webLockRegistry());
    168         });
    169     }
     150    callOnMainThread([this, protectedThis = Ref { *this }] {
     151        WebLockRegistry::shared().clientIsGoingAway(m_sessionID, m_clientOrigin, m_clientID);
     152    });
    170153}
    171154
  • trunk/Source/WebCore/Modules/web-locks/WebLockRegistry.cpp

    r293195 r293329  
    3636namespace WebCore {
    3737
     38static RefPtr<WebLockRegistry>& sharedRegistry()
     39{
     40    static MainThreadNeverDestroyed<RefPtr<WebLockRegistry>> registry;
     41    return registry;
     42}
     43
     44WebLockRegistry& WebLockRegistry::shared()
     45{
     46    auto& registry = sharedRegistry();
     47    if (!registry)
     48        registry= LocalWebLockRegistry::create();
     49    return *registry;
     50}
     51
     52void WebLockRegistry::setSharedRegistry(Ref<WebLockRegistry>&& registry)
     53{
     54    ASSERT(!sharedRegistry());
     55    sharedRegistry() = WTFMove(registry);
     56}
     57
    3858class LocalWebLockRegistry::PerOriginRegistry : public RefCounted<PerOriginRegistry>, public CanMakeWeakPtr<PerOriginRegistry> {
    3959public:
    40     static Ref<PerOriginRegistry> create(LocalWebLockRegistry&, const ClientOrigin&);
     60    static Ref<PerOriginRegistry> create(LocalWebLockRegistry&, PAL::SessionID, const ClientOrigin&);
    4161    ~PerOriginRegistry();
    4262
     
    5676
    5777private:
    58     PerOriginRegistry(LocalWebLockRegistry&, const ClientOrigin&);
     78    PerOriginRegistry(LocalWebLockRegistry&, PAL::SessionID, const ClientOrigin&);
    5979
    6080    struct LockRequest : LockInfo {
     
    6787
    6888    WeakPtr<LocalWebLockRegistry> m_globalRegistry;
     89    PAL::SessionID m_sessionID;
    6990    ClientOrigin m_clientOrigin;
    7091    FastRobinHoodHashMap<String, Deque<LockRequest>> m_lockRequestQueueMap;
     
    7697LocalWebLockRegistry::~LocalWebLockRegistry() = default;
    7798
    78 auto LocalWebLockRegistry::ensureRegistryForOrigin(const ClientOrigin& clientOrigin) -> Ref<PerOriginRegistry>
    79 {
    80     if (auto existingRegistry = m_perOriginRegistries.get(clientOrigin))
     99auto LocalWebLockRegistry::ensureRegistryForOrigin(PAL::SessionID sessionID, const ClientOrigin& clientOrigin) -> Ref<PerOriginRegistry>
     100{
     101    if (auto existingRegistry = m_perOriginRegistries.get({ sessionID, clientOrigin }))
    81102        return *existingRegistry;
    82103
    83     return PerOriginRegistry::create(*this, clientOrigin);
    84 }
    85 
    86 auto LocalWebLockRegistry::existingRegistryForOrigin(const ClientOrigin& clientOrigin) const -> RefPtr<PerOriginRegistry>
    87 {
    88     return m_perOriginRegistries.get(clientOrigin).get();
    89 }
    90 
    91 Ref<LocalWebLockRegistry::PerOriginRegistry> LocalWebLockRegistry::PerOriginRegistry::create(LocalWebLockRegistry& globalRegistry, const ClientOrigin& clientOrigin)
    92 {
    93     return adoptRef(*new PerOriginRegistry(globalRegistry, clientOrigin));
    94 }
    95 
    96 LocalWebLockRegistry::PerOriginRegistry::PerOriginRegistry(LocalWebLockRegistry& globalRegistry, const ClientOrigin& clientOrigin)
     104    return PerOriginRegistry::create(*this, sessionID, clientOrigin);
     105}
     106
     107auto LocalWebLockRegistry::existingRegistryForOrigin(PAL::SessionID sessionID, const ClientOrigin& clientOrigin) const -> RefPtr<PerOriginRegistry>
     108{
     109    return m_perOriginRegistries.get({ sessionID, clientOrigin }).get();
     110}
     111
     112Ref<LocalWebLockRegistry::PerOriginRegistry> LocalWebLockRegistry::PerOriginRegistry::create(LocalWebLockRegistry& globalRegistry, PAL::SessionID sessionID, const ClientOrigin& clientOrigin)
     113{
     114    return adoptRef(*new PerOriginRegistry(globalRegistry, sessionID, clientOrigin));
     115}
     116
     117LocalWebLockRegistry::PerOriginRegistry::PerOriginRegistry(LocalWebLockRegistry& globalRegistry, PAL::SessionID sessionID, const ClientOrigin& clientOrigin)
    97118    : m_globalRegistry(globalRegistry)
     119    , m_sessionID(sessionID)
    98120    , m_clientOrigin(clientOrigin)
    99121{
    100     globalRegistry.m_perOriginRegistries.add(clientOrigin, WeakPtr { * this });
     122    globalRegistry.m_perOriginRegistries.add({ sessionID, clientOrigin }, WeakPtr { * this });
    101123}
    102124
     
    104126{
    105127    if (m_globalRegistry)
    106         m_globalRegistry->m_perOriginRegistries.remove(m_clientOrigin);
    107 }
    108 
    109 void LocalWebLockRegistry::requestLock(const ClientOrigin& clientOrigin, WebLockIdentifier lockIdentifier, ScriptExecutionContextIdentifier clientID, const String& name, WebLockMode mode, bool steal, bool ifAvailable, Function<void(bool)>&& grantedHandler, Function<void()>&& lockStolenHandler)
    110 {
    111     ensureRegistryForOrigin(clientOrigin)->requestLock(lockIdentifier, clientID, name, mode, steal, ifAvailable, WTFMove(grantedHandler), WTFMove(lockStolenHandler));
     128        m_globalRegistry->m_perOriginRegistries.remove({ m_sessionID, m_clientOrigin });
     129}
     130
     131void LocalWebLockRegistry::requestLock(PAL::SessionID sessionID, const ClientOrigin& clientOrigin, WebLockIdentifier lockIdentifier, ScriptExecutionContextIdentifier clientID, const String& name, WebLockMode mode, bool steal, bool ifAvailable, Function<void(bool)>&& grantedHandler, Function<void()>&& lockStolenHandler)
     132{
     133    ensureRegistryForOrigin(sessionID, clientOrigin)->requestLock(lockIdentifier, clientID, name, mode, steal, ifAvailable, WTFMove(grantedHandler), WTFMove(lockStolenHandler));
    112134}
    113135
     
    136158}
    137159
    138 void LocalWebLockRegistry::releaseLock(const ClientOrigin& clientOrigin, WebLockIdentifier lockIdentifier, ScriptExecutionContextIdentifier, const String& name)
    139 {
    140     if (auto registry = existingRegistryForOrigin(clientOrigin))
     160void LocalWebLockRegistry::releaseLock(PAL::SessionID sessionID, const ClientOrigin& clientOrigin, WebLockIdentifier lockIdentifier, ScriptExecutionContextIdentifier, const String& name)
     161{
     162    if (auto registry = existingRegistryForOrigin(sessionID, clientOrigin))
    141163        registry->releaseLock(lockIdentifier, name);
    142164}
     
    159181}
    160182
    161 void LocalWebLockRegistry::abortLockRequest(const ClientOrigin& clientOrigin, WebLockIdentifier lockIdentifier, ScriptExecutionContextIdentifier, const String& name, CompletionHandler<void(bool)>&& completionHandler)
    162 {
    163     auto registry = existingRegistryForOrigin(clientOrigin);
     183void LocalWebLockRegistry::abortLockRequest(PAL::SessionID sessionID, const ClientOrigin& clientOrigin, WebLockIdentifier lockIdentifier, ScriptExecutionContextIdentifier, const String& name, CompletionHandler<void(bool)>&& completionHandler)
     184{
     185    auto registry = existingRegistryForOrigin(sessionID, clientOrigin);
    164186    if (!registry)
    165187        return completionHandler(false);
     
    223245}
    224246
    225 void LocalWebLockRegistry::snapshot(const ClientOrigin& clientOrigin, CompletionHandler<void(WebLockManager::Snapshot&&)>&& completionHandler)
    226 {
    227     auto registry = existingRegistryForOrigin(clientOrigin);
     247void LocalWebLockRegistry::snapshot(PAL::SessionID sessionID, const ClientOrigin& clientOrigin, CompletionHandler<void(WebLockManager::Snapshot&&)>&& completionHandler)
     248{
     249    auto registry = existingRegistryForOrigin(sessionID, clientOrigin);
    228250    if (!registry)
    229251        return completionHandler({ });
     
    248270}
    249271
    250 void LocalWebLockRegistry::clientIsGoingAway(const ClientOrigin& clientOrigin, ScriptExecutionContextIdentifier clientID)
    251 {
    252     if (auto registry = existingRegistryForOrigin(clientOrigin))
     272void LocalWebLockRegistry::clientIsGoingAway(PAL::SessionID sessionID, const ClientOrigin& clientOrigin, ScriptExecutionContextIdentifier clientID)
     273{
     274    if (auto registry = existingRegistryForOrigin(sessionID, clientOrigin))
    253275        registry->clientsAreGoingAway([clientID](auto& lockInfo) { return lockInfo.clientID == clientID; });
    254276}
     
    292314void LocalWebLockRegistry::clientsAreGoingAway(ProcessIdentifier processIdentifier)
    293315{
    294     Vector<ClientOrigin> clientOrigins = copyToVector(m_perOriginRegistries.keys());
    295     for (auto& clientOrigin : clientOrigins) {
    296         if (auto registry = existingRegistryForOrigin(clientOrigin))
     316    Vector<std::pair<PAL::SessionID, ClientOrigin>> clientOrigins = copyToVector(m_perOriginRegistries.keys());
     317    for (auto& [sessionID, clientOrigin] : clientOrigins) {
     318        if (auto registry = existingRegistryForOrigin(sessionID, clientOrigin))
    297319            registry->clientsAreGoingAway([processIdentifier](auto& lockInfo) { return lockInfo.clientID.processIdentifier() == processIdentifier; });
    298320    }
  • trunk/Source/WebCore/Modules/web-locks/WebLockRegistry.h

    r286455 r293329  
    3030#include "WebLockIdentifier.h"
    3131#include "WebLockMode.h"
     32#include <pal/SessionID.h>
    3233#include <wtf/Deque.h>
    3334#include <wtf/HashMap.h>
     
    4344class WebLockRegistry : public RefCounted<WebLockRegistry> {
    4445public:
     46    static WebLockRegistry& shared();
     47    WEBCORE_EXPORT static void setSharedRegistry(Ref<WebLockRegistry>&&);
     48
    4549    virtual ~WebLockRegistry() { }
    4650
    47     virtual void requestLock(const ClientOrigin&, WebLockIdentifier, ScriptExecutionContextIdentifier, const String& name, WebLockMode, bool steal, bool ifAvailable, Function<void(bool)>&& grantedHandler, Function<void()>&& lockStolenHandler) = 0;
    48     virtual void releaseLock(const ClientOrigin&, WebLockIdentifier, ScriptExecutionContextIdentifier, const String& name) = 0;
    49     virtual void abortLockRequest(const ClientOrigin&, WebLockIdentifier, ScriptExecutionContextIdentifier, const String& name, CompletionHandler<void(bool)>&&) = 0;
    50     virtual void snapshot(const ClientOrigin&, CompletionHandler<void(WebLockManagerSnapshot&&)>&&) = 0;
    51     virtual void clientIsGoingAway(const ClientOrigin&, ScriptExecutionContextIdentifier) = 0;
     51    virtual void requestLock(PAL::SessionID, const ClientOrigin&, WebLockIdentifier, ScriptExecutionContextIdentifier, const String& name, WebLockMode, bool steal, bool ifAvailable, Function<void(bool)>&& grantedHandler, Function<void()>&& lockStolenHandler) = 0;
     52    virtual void releaseLock(PAL::SessionID, const ClientOrigin&, WebLockIdentifier, ScriptExecutionContextIdentifier, const String& name) = 0;
     53    virtual void abortLockRequest(PAL::SessionID, const ClientOrigin&, WebLockIdentifier, ScriptExecutionContextIdentifier, const String& name, CompletionHandler<void(bool)>&&) = 0;
     54    virtual void snapshot(PAL::SessionID, const ClientOrigin&, CompletionHandler<void(WebLockManagerSnapshot&&)>&&) = 0;
     55    virtual void clientIsGoingAway(PAL::SessionID, const ClientOrigin&, ScriptExecutionContextIdentifier) = 0;
    5256
    5357protected:
     
    6064    ~LocalWebLockRegistry();
    6165
    62     WEBCORE_EXPORT void requestLock(const ClientOrigin&, WebLockIdentifier, ScriptExecutionContextIdentifier, const String& name, WebLockMode, bool steal, bool ifAvailable, Function<void(bool)>&& grantedHandler, Function<void()>&& lockStolenHandler) final;
    63     WEBCORE_EXPORT void releaseLock(const ClientOrigin&, WebLockIdentifier, ScriptExecutionContextIdentifier, const String& name) final;
    64     WEBCORE_EXPORT void abortLockRequest(const ClientOrigin&, WebLockIdentifier, ScriptExecutionContextIdentifier, const String& name, CompletionHandler<void(bool)>&&) final;
    65     WEBCORE_EXPORT void snapshot(const ClientOrigin&, CompletionHandler<void(WebLockManagerSnapshot&&)>&&) final;
    66     WEBCORE_EXPORT void clientIsGoingAway(const ClientOrigin&, ScriptExecutionContextIdentifier) final;
     66    WEBCORE_EXPORT void requestLock(PAL::SessionID, const ClientOrigin&, WebLockIdentifier, ScriptExecutionContextIdentifier, const String& name, WebLockMode, bool steal, bool ifAvailable, Function<void(bool)>&& grantedHandler, Function<void()>&& lockStolenHandler) final;
     67    WEBCORE_EXPORT void releaseLock(PAL::SessionID, const ClientOrigin&, WebLockIdentifier, ScriptExecutionContextIdentifier, const String& name) final;
     68    WEBCORE_EXPORT void abortLockRequest(PAL::SessionID, const ClientOrigin&, WebLockIdentifier, ScriptExecutionContextIdentifier, const String& name, CompletionHandler<void(bool)>&&) final;
     69    WEBCORE_EXPORT void snapshot(PAL::SessionID, const ClientOrigin&, CompletionHandler<void(WebLockManagerSnapshot&&)>&&) final;
     70    WEBCORE_EXPORT void clientIsGoingAway(PAL::SessionID, const ClientOrigin&, ScriptExecutionContextIdentifier) final;
    6771    WEBCORE_EXPORT void clientsAreGoingAway(ProcessIdentifier);
    6872
     
    7175
    7276    class PerOriginRegistry;
    73     Ref<PerOriginRegistry> ensureRegistryForOrigin(const ClientOrigin&);
    74     RefPtr<PerOriginRegistry> existingRegistryForOrigin(const ClientOrigin&) const;
     77    Ref<PerOriginRegistry> ensureRegistryForOrigin(PAL::SessionID, const ClientOrigin&);
     78    RefPtr<PerOriginRegistry> existingRegistryForOrigin(PAL::SessionID, const ClientOrigin&) const;
    7579
    76     HashMap<ClientOrigin, WeakPtr<PerOriginRegistry>> m_perOriginRegistries;
     80    HashMap<std::pair<PAL::SessionID, ClientOrigin>, WeakPtr<PerOriginRegistry>> m_perOriginRegistries;
    7781};
    7882
  • trunk/Source/WebCore/Modules/webaudio/AudioWorkletMessagingProxy.cpp

    r284057 r293329  
    5050    auto* document = worklet.document();
    5151    auto jsRuntimeFlags = document->settings().javaScriptRuntimeFlags();
     52    RELEASE_ASSERT(document->sessionID());
    5253
    5354    return {
     
    5657        worklet.audioContext() ? worklet.audioContext()->sampleRate() : 0.0f,
    5758        worklet.identifier(),
     59        *document->sessionID(),
    5860        document->settingsValues(),
    5961        worklet.audioContext() ? !worklet.audioContext()->isOfflineContext() : false
  • trunk/Source/WebCore/dom/Document.h

    r293059 r293329  
    16841684    WEBCORE_EXPORT void removeElementWithPendingUserAgentShadowTreeUpdate(Element&);
    16851685
     1686    std::optional<PAL::SessionID> sessionID() const final;
     1687
    16861688protected:
    16871689    enum ConstructionFlags { Synthesized = 1, NonRenderedPlaceholder = 1 << 1 };
     
    18061808
    18071809    NotificationClient* notificationClient() final;
    1808     std::optional<PAL::SessionID> sessionID() const final;
    18091810
    18101811    const Ref<const Settings> m_settings;
  • trunk/Source/WebCore/loader/EmptyClients.cpp

    r293292 r293329  
    8383#include "UserContentProvider.h"
    8484#include "VisitedLinkStore.h"
    85 #include "WebLockRegistry.h"
    8685#include <JavaScriptCore/HeapInlines.h>
    8786#include <pal/SessionID.h>
     
    11931192};
    11941193
    1195 class EmptyWebLockRegistry final : public WebLockRegistry {
    1196 public:
    1197     static Ref<EmptyWebLockRegistry> create()
    1198     {
    1199         return adoptRef(*new EmptyWebLockRegistry);
    1200     }
    1201 private:
    1202     void requestLock(const ClientOrigin&, WebLockIdentifier, ScriptExecutionContextIdentifier, const String&, WebLockMode, bool, bool, Function<void(bool)>&&, Function<void()>&&) { }
    1203     void releaseLock(const ClientOrigin&, WebLockIdentifier, ScriptExecutionContextIdentifier, const String&) final { }
    1204     void abortLockRequest(const ClientOrigin&, WebLockIdentifier, ScriptExecutionContextIdentifier, const String&, CompletionHandler<void(bool)>&&) final { }
    1205     void snapshot(const ClientOrigin&, CompletionHandler<void(WebLockManagerSnapshot&&)>&&) { }
    1206     void clientIsGoingAway(const ClientOrigin&, ScriptExecutionContextIdentifier) { }
    1207 };
    1208 
    12091194PageConfiguration pageConfigurationWithEmptyClients(PAL::SessionID sessionID)
    12101195{
     
    12231208        makeUniqueRef<EmptyMediaRecorderProvider>(),
    12241209        EmptyBroadcastChannelRegistry::create(),
    1225         EmptyWebLockRegistry::create(),
    12261210        DummyPermissionController::create(),
    12271211        makeUniqueRef<DummyStorageProvider>(),
  • trunk/Source/WebCore/page/Page.cpp

    r293285 r293329  
    165165#include "VoidCallback.h"
    166166#include "WebCoreJSClientData.h"
    167 #include "WebLockRegistry.h"
    168167#include "WheelEventDeltaFilter.h"
    169168#include "WheelEventTestMonitor.h"
     
    313312    , m_visitedLinkStore(*WTFMove(pageConfiguration.visitedLinkStore))
    314313    , m_broadcastChannelRegistry(WTFMove(pageConfiguration.broadcastChannelRegistry))
    315     , m_webLockRegistry(WTFMove(pageConfiguration.webLockRegistry))
    316314    , m_sessionID(pageConfiguration.sessionID)
    317315#if ENABLE(VIDEO)
  • trunk/Source/WebCore/page/Page.h

    r293195 r293329  
    172172class VisitedLinkStore;
    173173class WebGLStateTracker;
    174 class WebLockRegistry;
    175174class WheelEventDeltaFilter;
    176175class WheelEventTestMonitor;
     
    309308    WEBCORE_EXPORT void setBroadcastChannelRegistry(Ref<BroadcastChannelRegistry>&&); // Only used by WebKitLegacy.
    310309
    311     WebLockRegistry& webLockRegistry() { return m_webLockRegistry; }
    312 
    313310    WEBCORE_EXPORT static void forEachPage(const Function<void(Page&)>&);
    314311    WEBCORE_EXPORT static unsigned nonUtilityPageCount();
     
    11831180    Ref<VisitedLinkStore> m_visitedLinkStore;
    11841181    Ref<BroadcastChannelRegistry> m_broadcastChannelRegistry;
    1185     Ref<WebLockRegistry> m_webLockRegistry;
    11861182    RefPtr<WheelEventTestMonitor> m_wheelEventTestMonitor;
    11871183    WeakHashSet<ActivityStateChangeObserver> m_activityStateChangeObservers;
  • trunk/Source/WebCore/page/PageConfiguration.cpp

    r289994 r293329  
    5555#include "ValidationMessageClient.h"
    5656#include "VisitedLinkStore.h"
    57 #include "WebLockRegistry.h"
    5857#if ENABLE(WEBGL)
    5958#include "WebGLStateTracker.h"
     
    6564namespace WebCore {
    6665
    67 PageConfiguration::PageConfiguration(PAL::SessionID sessionID, UniqueRef<EditorClient>&& editorClient, Ref<SocketProvider>&& socketProvider, UniqueRef<LibWebRTCProvider>&& libWebRTCProvider, Ref<CacheStorageProvider>&& cacheStorageProvider, Ref<UserContentProvider>&& userContentProvider, Ref<BackForwardClient>&& backForwardClient, Ref<CookieJar>&& cookieJar, UniqueRef<ProgressTrackerClient>&& progressTrackerClient, UniqueRef<FrameLoaderClient>&& loaderClientForMainFrame, UniqueRef<SpeechRecognitionProvider>&& speechRecognitionProvider, UniqueRef<MediaRecorderProvider>&& mediaRecorderProvider, Ref<BroadcastChannelRegistry>&& broadcastChannelRegistry, Ref<WebLockRegistry>&& webLockRegistry, Ref<PermissionController>&& permissionController, UniqueRef<StorageProvider>&& storageProvider, UniqueRef<ModelPlayerProvider>&& modelPlayerProvider)
     66PageConfiguration::PageConfiguration(PAL::SessionID sessionID, UniqueRef<EditorClient>&& editorClient, Ref<SocketProvider>&& socketProvider, UniqueRef<LibWebRTCProvider>&& libWebRTCProvider, Ref<CacheStorageProvider>&& cacheStorageProvider, Ref<UserContentProvider>&& userContentProvider, Ref<BackForwardClient>&& backForwardClient, Ref<CookieJar>&& cookieJar, UniqueRef<ProgressTrackerClient>&& progressTrackerClient, UniqueRef<FrameLoaderClient>&& loaderClientForMainFrame, UniqueRef<SpeechRecognitionProvider>&& speechRecognitionProvider, UniqueRef<MediaRecorderProvider>&& mediaRecorderProvider, Ref<BroadcastChannelRegistry>&& broadcastChannelRegistry, Ref<PermissionController>&& permissionController, UniqueRef<StorageProvider>&& storageProvider, UniqueRef<ModelPlayerProvider>&& modelPlayerProvider)
    6867    : sessionID(sessionID)
    6968    , editorClient(WTFMove(editorClient))
     
    7776    , userContentProvider(WTFMove(userContentProvider))
    7877    , broadcastChannelRegistry(WTFMove(broadcastChannelRegistry))
    79     , webLockRegistry(WTFMove(webLockRegistry))
    8078    , speechRecognitionProvider(WTFMove(speechRecognitionProvider))
    8179    , mediaRecorderProvider(WTFMove(mediaRecorderProvider))
  • trunk/Source/WebCore/page/PageConfiguration.h

    r293279 r293329  
    8181class VisitedLinkStore;
    8282class WebGLStateTracker;
    83 class WebLockRegistry;
    8483
    8584class PageConfiguration {
    8685    WTF_MAKE_NONCOPYABLE(PageConfiguration); WTF_MAKE_FAST_ALLOCATED;
    8786public:
    88     WEBCORE_EXPORT PageConfiguration(PAL::SessionID, UniqueRef<EditorClient>&&, Ref<SocketProvider>&&, UniqueRef<LibWebRTCProvider>&&, Ref<CacheStorageProvider>&&, Ref<UserContentProvider>&&, Ref<BackForwardClient>&&, Ref<CookieJar>&&, UniqueRef<ProgressTrackerClient>&&, UniqueRef<FrameLoaderClient>&&, UniqueRef<SpeechRecognitionProvider>&&, UniqueRef<MediaRecorderProvider>&&, Ref<BroadcastChannelRegistry>&&, Ref<WebLockRegistry>&&, Ref<PermissionController>&&, UniqueRef<StorageProvider>&&, UniqueRef<ModelPlayerProvider>&&);
     87    WEBCORE_EXPORT PageConfiguration(PAL::SessionID, UniqueRef<EditorClient>&&, Ref<SocketProvider>&&, UniqueRef<LibWebRTCProvider>&&, Ref<CacheStorageProvider>&&, Ref<UserContentProvider>&&, Ref<BackForwardClient>&&, Ref<CookieJar>&&, UniqueRef<ProgressTrackerClient>&&, UniqueRef<FrameLoaderClient>&&, UniqueRef<SpeechRecognitionProvider>&&, UniqueRef<MediaRecorderProvider>&&, Ref<BroadcastChannelRegistry>&&, Ref<PermissionController>&&, UniqueRef<StorageProvider>&&, UniqueRef<ModelPlayerProvider>&&);
    8988    WEBCORE_EXPORT ~PageConfiguration();
    9089    PageConfiguration(PageConfiguration&&);
     
    136135    RefPtr<VisitedLinkStore> visitedLinkStore;
    137136    Ref<BroadcastChannelRegistry> broadcastChannelRegistry;
    138     Ref<WebLockRegistry> webLockRegistry;
    139137   
    140138#if ENABLE(DEVICE_ORIENTATION) && PLATFORM(IOS_FAMILY)
  • trunk/Source/WebCore/workers/Worker.cpp

    r292861 r293329  
    206206        return;
    207207
     208    auto sessionID = context->sessionID();
     209    if (!sessionID)
     210        return;
     211
    208212    if (m_scriptLoader->failed()) {
    209213        queueTaskToDispatchEvent(*this, TaskSource::DOMManipulation, Event::create(eventNames().errorEvent, Event::CanBubble::No, Event::IsCancelable::Yes));
     
    223227        context->userAgent(m_scriptLoader->lastRequestURL())
    224228    };
    225     m_contextProxy.startWorkerGlobalScope(m_scriptLoader->lastRequestURL(), m_options.name, WTFMove(initializationData), m_scriptLoader->script(), contentSecurityPolicyResponseHeaders, m_shouldBypassMainWorldContentSecurityPolicy, m_scriptLoader->crossOriginEmbedderPolicy(), m_workerCreationTime, referrerPolicy, m_options.type, m_options.credentials, m_runtimeFlags);
     229    m_contextProxy.startWorkerGlobalScope(m_scriptLoader->lastRequestURL(), *sessionID, m_options.name, WTFMove(initializationData), m_scriptLoader->script(), contentSecurityPolicyResponseHeaders, m_shouldBypassMainWorldContentSecurityPolicy, m_scriptLoader->crossOriginEmbedderPolicy(), m_workerCreationTime, referrerPolicy, m_options.type, m_options.credentials, m_runtimeFlags);
    226230    InspectorInstrumentation::scriptImported(*context, m_scriptLoader->identifier(), m_scriptLoader->script().toString());
    227231}
  • trunk/Source/WebCore/workers/WorkerGlobalScope.cpp

    r292949 r293329  
    9494
    9595WorkerGlobalScope::WorkerGlobalScope(WorkerThreadType type, const WorkerParameters& params, Ref<SecurityOrigin>&& origin, WorkerThread& thread, Ref<SecurityOrigin>&& topOrigin, IDBClient::IDBConnectionProxy* connectionProxy, SocketProvider* socketProvider)
    96     : WorkerOrWorkletGlobalScope(type, isMainThread() ? Ref { commonVM() } : JSC::VM::create(), &thread, params.clientIdentifier)
     96    : WorkerOrWorkletGlobalScope(type, params.sessionID, isMainThread() ? Ref { commonVM() } : JSC::VM::create(), &thread, params.clientIdentifier)
    9797    , m_url(params.scriptURL)
    9898    , m_inspectorIdentifier(params.inspectorIdentifier)
  • trunk/Source/WebCore/workers/WorkerGlobalScopeProxy.h

    r292861 r293329  
    5353    static WorkerGlobalScopeProxy& create(Worker&);
    5454
    55     virtual void startWorkerGlobalScope(const URL& scriptURL, const String& name, WorkerInitializationData&&, const ScriptBuffer& sourceCode, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, const CrossOriginEmbedderPolicy&, MonotonicTime timeOrigin, ReferrerPolicy, WorkerType, FetchRequestCredentials, JSC::RuntimeFlags) = 0;
     55    virtual void startWorkerGlobalScope(const URL& scriptURL, PAL::SessionID, const String& name, WorkerInitializationData&&, const ScriptBuffer& sourceCode, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, const CrossOriginEmbedderPolicy&, MonotonicTime timeOrigin, ReferrerPolicy, WorkerType, FetchRequestCredentials, JSC::RuntimeFlags) = 0;
    5656    virtual void terminateWorkerGlobalScope() = 0;
    5757    virtual void postMessageToWorkerGlobalScope(MessageWithMessagePorts&&) = 0;
  • trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp

    r292861 r293329  
    7979}
    8080
    81 void WorkerMessagingProxy::startWorkerGlobalScope(const URL& scriptURL, const String& name, WorkerInitializationData&& initializationData, const ScriptBuffer& sourceCode, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicyResponseHeaders, bool shouldBypassMainWorldContentSecurityPolicy, const CrossOriginEmbedderPolicy& crossOriginEmbedderPolicy, MonotonicTime timeOrigin, ReferrerPolicy referrerPolicy, WorkerType workerType, FetchRequestCredentials credentials, JSC::RuntimeFlags runtimeFlags)
     81void WorkerMessagingProxy::startWorkerGlobalScope(const URL& scriptURL, PAL::SessionID sessionID, const String& name, WorkerInitializationData&& initializationData, const ScriptBuffer& sourceCode, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicyResponseHeaders, bool shouldBypassMainWorldContentSecurityPolicy, const CrossOriginEmbedderPolicy& crossOriginEmbedderPolicy, MonotonicTime timeOrigin, ReferrerPolicy referrerPolicy, WorkerType workerType, FetchRequestCredentials credentials, JSC::RuntimeFlags runtimeFlags)
    8282{
    8383    // FIXME: This need to be revisited when we support nested worker one day
     
    9191    SocketProvider* socketProvider = document.socketProvider();
    9292
    93     WorkerParameters params { scriptURL, name, identifier, WTFMove(initializationData.userAgent), platformStrategies()->loaderStrategy()->isOnLine(), contentSecurityPolicyResponseHeaders, shouldBypassMainWorldContentSecurityPolicy, crossOriginEmbedderPolicy, timeOrigin, referrerPolicy, workerType, credentials, document.settingsValues(), WorkerThreadMode::CreateNewThread, { },
     93    WorkerParameters params { scriptURL, name, identifier, WTFMove(initializationData.userAgent), platformStrategies()->loaderStrategy()->isOnLine(), contentSecurityPolicyResponseHeaders, shouldBypassMainWorldContentSecurityPolicy, crossOriginEmbedderPolicy, timeOrigin, referrerPolicy, workerType, credentials, document.settingsValues(), WorkerThreadMode::CreateNewThread, sessionID,
    9494#if ENABLE(SERVICE_WORKER)
    9595        WTFMove(initializationData.serviceWorkerData),
  • trunk/Source/WebCore/workers/WorkerMessagingProxy.h

    r292861 r293329  
    5151    // Implementations of WorkerGlobalScopeProxy.
    5252    // (Only use these functions in the worker object thread.)
    53     void startWorkerGlobalScope(const URL& scriptURL, const String& name, WorkerInitializationData&&, const ScriptBuffer& sourceCode, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, const CrossOriginEmbedderPolicy&, MonotonicTime timeOrigin, ReferrerPolicy, WorkerType, FetchRequestCredentials, JSC::RuntimeFlags) final;
     53    void startWorkerGlobalScope(const URL& scriptURL, PAL::SessionID, const String& name, WorkerInitializationData&&, const ScriptBuffer& sourceCode, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, const CrossOriginEmbedderPolicy&, MonotonicTime timeOrigin, ReferrerPolicy, WorkerType, FetchRequestCredentials, JSC::RuntimeFlags) final;
    5454    void terminateWorkerGlobalScope() final;
    5555    void postMessageToWorkerGlobalScope(MessageWithMessagePorts&&) final;
  • trunk/Source/WebCore/workers/WorkerOrWorkletGlobalScope.cpp

    r292861 r293329  
    4141WTF_MAKE_ISO_ALLOCATED_IMPL(WorkerOrWorkletGlobalScope);
    4242
    43 WorkerOrWorkletGlobalScope::WorkerOrWorkletGlobalScope(WorkerThreadType type, Ref<JSC::VM>&& vm, WorkerOrWorkletThread* thread, ScriptExecutionContextIdentifier contextIdentifier)
     43WorkerOrWorkletGlobalScope::WorkerOrWorkletGlobalScope(WorkerThreadType type, PAL::SessionID sessionID, Ref<JSC::VM>&& vm, WorkerOrWorkletThread* thread, ScriptExecutionContextIdentifier contextIdentifier)
    4444    : ScriptExecutionContext(contextIdentifier)
    4545    , m_script(makeUnique<WorkerOrWorkletScriptController>(type, WTFMove(vm), this))
     
    4747    , m_thread(thread)
    4848    , m_inspectorController(makeUnique<WorkerInspectorController>(*this))
     49    , m_sessionID(sessionID)
    4950{
    5051}
  • trunk/Source/WebCore/workers/WorkerOrWorkletGlobalScope.h

    r292861 r293329  
    6565    bool isContextThread() const final;
    6666    void postTask(Task&&) final; // Executes the task on context's thread asynchronously.
     67    std::optional<PAL::SessionID> sessionID() const final { return m_sessionID; }
    6768
    6869    // Defined specifcially for WorkerOrWorkletGlobalScope for cooperation with
     
    8182
    8283protected:
    83     WorkerOrWorkletGlobalScope(WorkerThreadType, Ref<JSC::VM>&&, WorkerOrWorkletThread*, ScriptExecutionContextIdentifier = { });
     84    WorkerOrWorkletGlobalScope(WorkerThreadType, PAL::SessionID, Ref<JSC::VM>&&, WorkerOrWorkletThread*, ScriptExecutionContextIdentifier = { });
    8485
    8586    // ScriptExecutionContext.
     
    109110    std::unique_ptr<EventLoopTaskGroup> m_defaultTaskGroup;
    110111    std::unique_ptr<WorkerInspectorController> m_inspectorController;
     112    PAL::SessionID m_sessionID;
    111113    bool m_isClosing { false };
    112114};
  • trunk/Source/WebCore/workers/WorkerThread.h

    r292861 r293329  
    7878    Settings::Values settingsValues;
    7979    WorkerThreadMode workerThreadMode { WorkerThreadMode::CreateNewThread };
    80     std::optional<PAL::SessionID> sessionID { std::nullopt };
     80    PAL::SessionID sessionID;
    8181#if ENABLE(SERVICE_WORKER)
    8282    std::optional<ServiceWorkerData> serviceWorkerData;
  • trunk/Source/WebCore/workers/service/ServiceWorkerGlobalScope.cpp

    r292110 r293329  
    5353WTF_MAKE_ISO_ALLOCATED_IMPL(ServiceWorkerGlobalScope);
    5454
    55 Ref<ServiceWorkerGlobalScope> ServiceWorkerGlobalScope::create(ServiceWorkerContextData&& contextData, ServiceWorkerData&& workerData, const WorkerParameters& params, Ref<SecurityOrigin>&& origin, ServiceWorkerThread& thread, Ref<SecurityOrigin>&& topOrigin, IDBClient::IDBConnectionProxy* connectionProxy, SocketProvider* socketProvider, std::unique_ptr<NotificationClient>&& notificationClient, PAL::SessionID sessionID)
    56 {
    57     auto scope = adoptRef(*new ServiceWorkerGlobalScope { WTFMove(contextData), WTFMove(workerData), params, WTFMove(origin), thread, WTFMove(topOrigin), connectionProxy, socketProvider, WTFMove(notificationClient), sessionID });
     55Ref<ServiceWorkerGlobalScope> ServiceWorkerGlobalScope::create(ServiceWorkerContextData&& contextData, ServiceWorkerData&& workerData, const WorkerParameters& params, Ref<SecurityOrigin>&& origin, ServiceWorkerThread& thread, Ref<SecurityOrigin>&& topOrigin, IDBClient::IDBConnectionProxy* connectionProxy, SocketProvider* socketProvider, std::unique_ptr<NotificationClient>&& notificationClient)
     56{
     57    auto scope = adoptRef(*new ServiceWorkerGlobalScope { WTFMove(contextData), WTFMove(workerData), params, WTFMove(origin), thread, WTFMove(topOrigin), connectionProxy, socketProvider, WTFMove(notificationClient) });
    5858    scope->applyContentSecurityPolicyResponseHeaders(params.contentSecurityPolicyResponseHeaders);
    5959    scope->notifyServiceWorkerPageOfCreationIfNecessary();
     
    6161}
    6262
    63 ServiceWorkerGlobalScope::ServiceWorkerGlobalScope(ServiceWorkerContextData&& contextData, ServiceWorkerData&& workerData, const WorkerParameters& params, Ref<SecurityOrigin>&& origin, ServiceWorkerThread& thread, Ref<SecurityOrigin>&& topOrigin, IDBClient::IDBConnectionProxy* connectionProxy, SocketProvider* socketProvider, std::unique_ptr<NotificationClient>&& notificationClient, PAL::SessionID sessionID)
     63ServiceWorkerGlobalScope::ServiceWorkerGlobalScope(ServiceWorkerContextData&& contextData, ServiceWorkerData&& workerData, const WorkerParameters& params, Ref<SecurityOrigin>&& origin, ServiceWorkerThread& thread, Ref<SecurityOrigin>&& topOrigin, IDBClient::IDBConnectionProxy* connectionProxy, SocketProvider* socketProvider, std::unique_ptr<NotificationClient>&& notificationClient)
    6464    : WorkerGlobalScope(WorkerThreadType::ServiceWorker, params, WTFMove(origin), thread, WTFMove(topOrigin), connectionProxy, socketProvider)
    6565    , m_contextData(WTFMove(contextData))
     
    6767    , m_serviceWorker(ServiceWorker::getOrCreate(*this, WTFMove(workerData)))
    6868    , m_clients(ServiceWorkerClients::create())
    69     , m_sessionID(sessionID)
    7069    , m_notificationClient(WTFMove(notificationClient))
    7170    , m_userGestureTimer(*this, &ServiceWorkerGlobalScope::resetUserGesture)
  • trunk/Source/WebCore/workers/service/ServiceWorkerGlobalScope.h

    r292110 r293329  
    5252    WTF_MAKE_ISO_ALLOCATED(ServiceWorkerGlobalScope);
    5353public:
    54     static Ref<ServiceWorkerGlobalScope> create(ServiceWorkerContextData&&, ServiceWorkerData&&, const WorkerParameters&, Ref<SecurityOrigin>&&, ServiceWorkerThread&, Ref<SecurityOrigin>&& topOrigin, IDBClient::IDBConnectionProxy*, SocketProvider*, std::unique_ptr<NotificationClient>&&, PAL::SessionID);
     54    static Ref<ServiceWorkerGlobalScope> create(ServiceWorkerContextData&&, ServiceWorkerData&&, const WorkerParameters&, Ref<SecurityOrigin>&&, ServiceWorkerThread&, Ref<SecurityOrigin>&& topOrigin, IDBClient::IDBConnectionProxy*, SocketProvider*, std::unique_ptr<NotificationClient>&&);
    5555
    5656    ~ServiceWorkerGlobalScope();
     
    9191
    9292private:
    93     ServiceWorkerGlobalScope(ServiceWorkerContextData&&, ServiceWorkerData&&, const WorkerParameters&, Ref<SecurityOrigin>&&, ServiceWorkerThread&, Ref<SecurityOrigin>&& topOrigin, IDBClient::IDBConnectionProxy*, SocketProvider*, std::unique_ptr<NotificationClient>&&, PAL::SessionID);
     93    ServiceWorkerGlobalScope(ServiceWorkerContextData&&, ServiceWorkerData&&, const WorkerParameters&, Ref<SecurityOrigin>&&, ServiceWorkerThread&, Ref<SecurityOrigin>&& topOrigin, IDBClient::IDBConnectionProxy*, SocketProvider*, std::unique_ptr<NotificationClient>&&);
    9494    void notifyServiceWorkerPageOfCreationIfNecessary();
    9595
     
    9898
    9999    NotificationClient* notificationClient() final { return m_notificationClient.get(); }
    100 
    101     std::optional<PAL::SessionID> sessionID() const final { return m_sessionID; }
    102100
    103101    void resetUserGesture() { m_isProcessingUserGesture = false; }
     
    111109    uint64_t m_lastRequestIdentifier { 0 };
    112110    HashMap<uint64_t, RefPtr<DeferredPromise>> m_pendingSkipWaitingPromises;
    113     PAL::SessionID m_sessionID;
    114111    std::unique_ptr<NotificationClient> m_notificationClient;
    115112    bool m_hasPendingSilentPushEvent { false };
  • trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.cpp

    r293285 r293329  
    123123{
    124124    RELEASE_ASSERT(m_contextData);
    125     RELEASE_ASSERT(params.sessionID);
    126     return ServiceWorkerGlobalScope::create(*std::exchange(m_contextData, std::nullopt), *std::exchange(m_workerData, std::nullopt), params, WTFMove(origin), *this, WTFMove(topOrigin), idbConnectionProxy(), socketProvider(), WTFMove(m_notificationClient), *params.sessionID);
     125    return ServiceWorkerGlobalScope::create(*std::exchange(m_contextData, std::nullopt), *std::exchange(m_workerData, std::nullopt), params, WTFMove(origin), *this, WTFMove(topOrigin), idbConnectionProxy(), socketProvider(), WTFMove(m_notificationClient));
    127126}
    128127
  • trunk/Source/WebCore/workers/shared/context/SharedWorkerThreadProxy.cpp

    r292861 r293329  
    5858static WorkerParameters generateWorkerParameters(const WorkerFetchResult& workerFetchResult, WorkerOptions&& workerOptions, const String& userAgent, Document& document)
    5959{
     60    RELEASE_ASSERT(document.sessionID());
    6061    return {
    6162        workerFetchResult.lastRequestURL,
     
    7374        document.settingsValues(),
    7475        WorkerThreadMode::CreateNewThread,
    75         { },
     76        *document.sessionID(),
    7677#if ENABLE(SERVICE_WORKER)
    7778        { },
  • trunk/Source/WebCore/worklets/Worklet.cpp

    r291003 r293329  
    6060{
    6161    auto* document = this->document();
    62     if (!document) {
     62    if (!document || !document->page()) {
    6363        promise.reject(Exception { InvalidStateError, "This frame is detached"_s });
    6464        return;
  • trunk/Source/WebCore/worklets/WorkletGlobalScope.cpp

    r292677 r293329  
    5151
    5252WorkletGlobalScope::WorkletGlobalScope(WorkerOrWorkletThread& thread, Ref<JSC::VM>&& vm, const WorkletParameters& parameters)
    53     : WorkerOrWorkletGlobalScope(WorkerThreadType::Worklet, WTFMove(vm), &thread)
     53    : WorkerOrWorkletGlobalScope(WorkerThreadType::Worklet, parameters.sessionID, WTFMove(vm), &thread)
    5454    , m_topOrigin(SecurityOrigin::createUnique())
    5555    , m_url(parameters.windowURL)
     
    6565
    6666WorkletGlobalScope::WorkletGlobalScope(Document& document, Ref<JSC::VM>&& vm, ScriptSourceCode&& code)
    67     : WorkerOrWorkletGlobalScope(WorkerThreadType::Worklet, WTFMove(vm), nullptr)
     67    : WorkerOrWorkletGlobalScope(WorkerThreadType::Worklet, *document.sessionID(), WTFMove(vm), nullptr)
    6868    , m_document(document)
    6969    , m_topOrigin(SecurityOrigin::createUnique())
  • trunk/Source/WebCore/worklets/WorkletParameters.h

    r290901 r293329  
    3737    float sampleRate;
    3838    String identifier;
     39    PAL::SessionID sessionID;
    3940    Settings::Values settingsValues;
    4041    bool isAudioContextRealTime;
    4142
    42     WorkletParameters isolatedCopy() const & { return { windowURL.isolatedCopy(), jsRuntimeFlags, sampleRate, identifier.isolatedCopy(), settingsValues.isolatedCopy(), isAudioContextRealTime }; }
    43     WorkletParameters isolatedCopy() && { return { WTFMove(windowURL).isolatedCopy(), jsRuntimeFlags, sampleRate, WTFMove(identifier).isolatedCopy(), WTFMove(settingsValues).isolatedCopy(), isAudioContextRealTime }; }
     43    WorkletParameters isolatedCopy() const & { return { windowURL.isolatedCopy(), jsRuntimeFlags, sampleRate, identifier.isolatedCopy(), sessionID, settingsValues.isolatedCopy(), isAudioContextRealTime }; }
     44    WorkletParameters isolatedCopy() && { return { WTFMove(windowURL).isolatedCopy(), jsRuntimeFlags, sampleRate, WTFMove(identifier).isolatedCopy(), sessionID, WTFMove(settingsValues).isolatedCopy(), isAudioContextRealTime }; }
    4445};
    4546
  • trunk/Source/WebKit/UIProcess/WebLockRegistryProxy.cpp

    r286604 r293329  
    5656    m_hasEverRequestedLocks = true;
    5757
    58     m_process.websiteDataStore().webLockRegistry().requestLock(WTFMove(clientOrigin), lockIdentifier, clientID, WTFMove(name), lockMode, steal, ifAvailable, [weakThis = WeakPtr { *this }, lockIdentifier, clientID](bool success) {
     58    m_process.websiteDataStore().webLockRegistry().requestLock(m_process.sessionID(), WTFMove(clientOrigin), lockIdentifier, clientID, WTFMove(name), lockMode, steal, ifAvailable, [weakThis = WeakPtr { *this }, lockIdentifier, clientID](bool success) {
    5959        if (weakThis)
    6060            weakThis->m_process.send(Messages::RemoteWebLockRegistry::DidCompleteLockRequest(lockIdentifier, clientID, success), 0);
     
    6969    MESSAGE_CHECK(lockIdentifier.processIdentifier() == m_process.coreProcessIdentifier());
    7070    MESSAGE_CHECK(clientID.processIdentifier() == m_process.coreProcessIdentifier());
    71     m_process.websiteDataStore().webLockRegistry().releaseLock(WTFMove(clientOrigin), lockIdentifier, clientID, WTFMove(name));
     71    m_process.websiteDataStore().webLockRegistry().releaseLock(m_process.sessionID(), WTFMove(clientOrigin), lockIdentifier, clientID, WTFMove(name));
    7272}
    7373
     
    7676    MESSAGE_CHECK(lockIdentifier.processIdentifier() == m_process.coreProcessIdentifier());
    7777    MESSAGE_CHECK(clientID.processIdentifier() == m_process.coreProcessIdentifier());
    78     m_process.websiteDataStore().webLockRegistry().abortLockRequest(WTFMove(clientOrigin), lockIdentifier, clientID, WTFMove(name), WTFMove(completionHandler));
     78    m_process.websiteDataStore().webLockRegistry().abortLockRequest(m_process.sessionID(), WTFMove(clientOrigin), lockIdentifier, clientID, WTFMove(name), WTFMove(completionHandler));
    7979}
    8080
    8181void WebLockRegistryProxy::snapshot(WebCore::ClientOrigin&& clientOrigin, CompletionHandler<void(WebCore::WebLockManagerSnapshot&&)>&& completionHandler)
    8282{
    83     m_process.websiteDataStore().webLockRegistry().snapshot(WTFMove(clientOrigin), WTFMove(completionHandler));
     83    m_process.websiteDataStore().webLockRegistry().snapshot(m_process.sessionID(), WTFMove(clientOrigin), WTFMove(completionHandler));
    8484}
    8585
     
    8787{
    8888    MESSAGE_CHECK(clientID.processIdentifier() == m_process.coreProcessIdentifier());
    89     m_process.websiteDataStore().webLockRegistry().clientIsGoingAway(WTFMove(clientOrigin), clientID);
     89    m_process.websiteDataStore().webLockRegistry().clientIsGoingAway(m_process.sessionID(), WTFMove(clientOrigin), clientID);
    9090}
    9191
  • trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp

    r292869 r293329  
    126126    pageConfiguration.socketProvider = WebSocketProvider::create(m_webPageProxyID);
    127127    pageConfiguration.broadcastChannelRegistry = WebProcess::singleton().broadcastChannelRegistry();
    128     pageConfiguration.webLockRegistry = WebProcess::singleton().webLockRegistry();
    129128    pageConfiguration.userContentProvider = m_userContentController;
    130129#if ENABLE(WEB_RTC)
  • trunk/Source/WebKit/WebProcess/Storage/WebSharedWorkerContextManagerConnection.cpp

    r292869 r293329  
    9898    pageConfiguration.socketProvider = WebSocketProvider::create(m_webPageProxyID);
    9999    pageConfiguration.broadcastChannelRegistry = WebProcess::singleton().broadcastChannelRegistry();
    100     pageConfiguration.webLockRegistry = WebProcess::singleton().webLockRegistry();
    101100    pageConfiguration.userContentProvider = m_userContentController;
    102101#if ENABLE(WEB_RTC)
  • trunk/Source/WebKit/WebProcess/WebCoreSupport/RemoteWebLockRegistry.cpp

    r286455 r293329  
    5858}
    5959
    60 void RemoteWebLockRegistry::requestLock(const WebCore::ClientOrigin& clientOrigin, WebCore::WebLockIdentifier lockIdentifier, WebCore::ScriptExecutionContextIdentifier clientID, const String& name, WebCore::WebLockMode lockMode, bool steal, bool ifAvailable, Function<void(bool)>&& grantedHandler, Function<void()>&& lockStolenHandler)
     60void RemoteWebLockRegistry::requestLock(PAL::SessionID sessionID, const WebCore::ClientOrigin& clientOrigin, WebCore::WebLockIdentifier lockIdentifier, WebCore::ScriptExecutionContextIdentifier clientID, const String& name, WebCore::WebLockMode lockMode, bool steal, bool ifAvailable, Function<void(bool)>&& grantedHandler, Function<void()>&& lockStolenHandler)
    6161{
     62    ASSERT_UNUSED(sessionID, WebProcess::singleton().sessionID());
    6263    LockRequest request { { WTFMove(lockStolenHandler) }, WTFMove(grantedHandler) };
    6364    auto& snapshot = m_locksSnapshotPerClient.ensure(clientID, [] { return LocksSnapshot { }; }).iterator->value;
     
    6768}
    6869
    69 void RemoteWebLockRegistry::releaseLock(const WebCore::ClientOrigin& clientOrigin, WebCore::WebLockIdentifier lockIdentifier, WebCore::ScriptExecutionContextIdentifier clientID, const String& name)
     70void RemoteWebLockRegistry::releaseLock(PAL::SessionID sessionID, const WebCore::ClientOrigin& clientOrigin, WebCore::WebLockIdentifier lockIdentifier, WebCore::ScriptExecutionContextIdentifier clientID, const String& name)
    7071{
     72    ASSERT_UNUSED(sessionID, WebProcess::singleton().sessionID());
    7173    auto it = m_locksSnapshotPerClient.find(clientID);
    7274    if (it != m_locksSnapshotPerClient.end()) {
     
    7981}
    8082
    81 void RemoteWebLockRegistry::abortLockRequest(const WebCore::ClientOrigin& clientOrigin, WebCore::WebLockIdentifier lockIdentifier, WebCore::ScriptExecutionContextIdentifier clientID, const String& name, CompletionHandler<void(bool)>&& completionHandler)
     83void RemoteWebLockRegistry::abortLockRequest(PAL::SessionID sessionID, const WebCore::ClientOrigin& clientOrigin, WebCore::WebLockIdentifier lockIdentifier, WebCore::ScriptExecutionContextIdentifier clientID, const String& name, CompletionHandler<void(bool)>&& completionHandler)
    8284{
     85    ASSERT_UNUSED(sessionID, WebProcess::singleton().sessionID());
    8386    WebProcess::singleton().sendWithAsyncReply(Messages::WebLockRegistryProxy::AbortLockRequest(clientOrigin, lockIdentifier, clientID, name), [weakThis = WeakPtr { *this }, lockIdentifier, clientID, completionHandler = WTFMove(completionHandler)](bool didAbort) mutable {
    8487        if (weakThis && didAbort) {
     
    9497}
    9598
    96 void RemoteWebLockRegistry::snapshot(const WebCore::ClientOrigin& clientOrigin, CompletionHandler<void(WebCore::WebLockManagerSnapshot&&)>&& completionHandler)
     99void RemoteWebLockRegistry::snapshot(PAL::SessionID sessionID, const WebCore::ClientOrigin& clientOrigin, CompletionHandler<void(WebCore::WebLockManagerSnapshot&&)>&& completionHandler)
    97100{
     101    ASSERT_UNUSED(sessionID, WebProcess::singleton().sessionID());
    98102    WebProcess::singleton().sendWithAsyncReply(Messages::WebLockRegistryProxy::Snapshot(clientOrigin), WTFMove(completionHandler), 0);
    99103}
    100104
    101 void RemoteWebLockRegistry::clientIsGoingAway(const WebCore::ClientOrigin& clientOrigin, WebCore::ScriptExecutionContextIdentifier clientID)
     105void RemoteWebLockRegistry::clientIsGoingAway(PAL::SessionID sessionID, const WebCore::ClientOrigin& clientOrigin, WebCore::ScriptExecutionContextIdentifier clientID)
    102106{
     107    ASSERT_UNUSED(sessionID, WebProcess::singleton().sessionID());
    103108    m_locksSnapshotPerClient.remove(clientID);
    104109    WebProcess::singleton().send(Messages::WebLockRegistryProxy::ClientIsGoingAway(clientOrigin, clientID), 0);
  • trunk/Source/WebKit/WebProcess/WebCoreSupport/RemoteWebLockRegistry.h

    r286455 r293329  
    4242
    4343    // WebCore::WebLockRegistry.
    44     void requestLock(const WebCore::ClientOrigin&, WebCore::WebLockIdentifier, WebCore::ScriptExecutionContextIdentifier, const String& name, WebCore::WebLockMode, bool steal, bool ifAvailable, Function<void(bool)>&& grantedHandler, Function<void()>&& lockStolenHandler) final;
    45     void releaseLock(const WebCore::ClientOrigin&, WebCore::WebLockIdentifier, WebCore::ScriptExecutionContextIdentifier, const String& name) final;
    46     void abortLockRequest(const WebCore::ClientOrigin&, WebCore::WebLockIdentifier, WebCore::ScriptExecutionContextIdentifier, const String& name, CompletionHandler<void(bool)>&&) final;
    47     void snapshot(const WebCore::ClientOrigin&, CompletionHandler<void(WebCore::WebLockManagerSnapshot&&)>&&) final;
    48     void clientIsGoingAway(const WebCore::ClientOrigin&, WebCore::ScriptExecutionContextIdentifier) final;
     44    void requestLock(PAL::SessionID, const WebCore::ClientOrigin&, WebCore::WebLockIdentifier, WebCore::ScriptExecutionContextIdentifier, const String& name, WebCore::WebLockMode, bool steal, bool ifAvailable, Function<void(bool)>&& grantedHandler, Function<void()>&& lockStolenHandler) final;
     45    void releaseLock(PAL::SessionID, const WebCore::ClientOrigin&, WebCore::WebLockIdentifier, WebCore::ScriptExecutionContextIdentifier, const String& name) final;
     46    void abortLockRequest(PAL::SessionID, const WebCore::ClientOrigin&, WebCore::WebLockIdentifier, WebCore::ScriptExecutionContextIdentifier, const String& name, CompletionHandler<void(bool)>&&) final;
     47    void snapshot(PAL::SessionID, const WebCore::ClientOrigin&, CompletionHandler<void(WebCore::WebLockManagerSnapshot&&)>&&) final;
     48    void clientIsGoingAway(PAL::SessionID, const WebCore::ClientOrigin&, WebCore::ScriptExecutionContextIdentifier) final;
    4949
    5050    // IPC::MessageReceiver.
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r293137 r293329  
    5959#include "RemoteWebInspectorUI.h"
    6060#include "RemoteWebInspectorUIMessages.h"
    61 #include "RemoteWebLockRegistry.h"
    6261#include "SessionState.h"
    6362#include "SessionStateConversion.h"
     
    597596        makeUniqueRef<MediaRecorderProvider>(*this),
    598597        WebProcess::singleton().broadcastChannelRegistry(),
    599         WebProcess::singleton().webLockRegistry(),
    600598        WebPermissionController::create(*this),
    601599        makeUniqueRef<WebStorageProvider>(),
  • trunk/Source/WebKit/WebProcess/WebProcess.cpp

    r293266 r293329  
    294294    , m_cacheStorageProvider(WebCacheStorageProvider::create())
    295295    , m_broadcastChannelRegistry(WebBroadcastChannelRegistry::create())
    296     , m_webLockRegistry(RemoteWebLockRegistry::create(*this))
    297296    , m_cookieJar(WebCookieJar::create())
    298297    , m_dnsPrefetchHystereris([this](PAL::HysteresisState state) { if (state == PAL::HysteresisState::Stopped) m_dnsPrefetchedHosts.clear(); })
     
    354353    WebMockContentFilterManager::singleton().startObservingSettings();
    355354#endif
     355
     356    WebCore::WebLockRegistry::setSharedRegistry(RemoteWebLockRegistry::create(*this));
    356357}
    357358
  • trunk/Source/WebKit/WebProcess/WebProcess.h

    r293266 r293329  
    128128class RemoteLegacyCDMFactory;
    129129class RemoteMediaEngineConfigurationFactory;
    130 class RemoteWebLockRegistry;
    131130class StorageAreaMap;
    132131class UserData;
     
    336335    WebCacheStorageProvider& cacheStorageProvider() { return m_cacheStorageProvider.get(); }
    337336    WebBroadcastChannelRegistry& broadcastChannelRegistry() { return m_broadcastChannelRegistry.get(); }
    338     RemoteWebLockRegistry& webLockRegistry() { return m_webLockRegistry.get(); }
    339337    WebCookieJar& cookieJar() { return m_cookieJar.get(); }
    340338    WebSocketChannelManager& webSocketChannelManager() { return m_webSocketChannelManager; }
     
    668666    Ref<WebCacheStorageProvider> m_cacheStorageProvider;
    669667    Ref<WebBroadcastChannelRegistry> m_broadcastChannelRegistry;
    670     Ref<RemoteWebLockRegistry> m_webLockRegistry;
    671668    Ref<WebCookieJar> m_cookieJar;
    672669    WebSocketChannelManager m_webSocketChannelManager;
  • trunk/Source/WebKitLegacy/mac/WebView/WebView.mm

    r292929 r293329  
    232232#import <WebCore/WebCoreObjCExtras.h>
    233233#import <WebCore/WebCoreView.h>
    234 #import <WebCore/WebLockRegistry.h>
    235234#import <WebCore/WebViewVisualIdentificationOverlay.h>
    236235#import <WebCore/Widget.h>
     
    14411440#endif
    14421441
    1443 static Ref<WebCore::LocalWebLockRegistry> getOrCreateWebLockRegistry(bool isPrivateBrowsingEnabled)
    1444 {
    1445     static NeverDestroyed<WeakPtr<WebCore::LocalWebLockRegistry>> defaultRegistry;
    1446     static NeverDestroyed<WeakPtr<WebCore::LocalWebLockRegistry>> privateRegistry;
    1447     auto& existingRegistry = isPrivateBrowsingEnabled ? privateRegistry : defaultRegistry;
    1448     if (existingRegistry.get())
    1449         return *existingRegistry.get();
    1450     auto registry = WebCore::LocalWebLockRegistry::create();
    1451     existingRegistry.get() = registry;
    1452     return registry;
    1453 }
    1454 
    14551442- (void)_commonInitializationWithFrameName:(NSString *)frameName groupName:(NSString *)groupName
    14561443{
     
    15581545        makeUniqueRef<WebCore::MediaRecorderProvider>(),
    15591546        WebBroadcastChannelRegistry::getOrCreate([[self preferences] privateBrowsingEnabled]),
    1560         getOrCreateWebLockRegistry([[self preferences] privateBrowsingEnabled]),
    15611547        WebCore::DummyPermissionController::create(),
    15621548        makeUniqueRef<WebCore::DummyStorageProvider>(),
     
    18401826        makeUniqueRef<WebCore::MediaRecorderProvider>(),
    18411827        WebBroadcastChannelRegistry::getOrCreate([[self preferences] privateBrowsingEnabled]),
    1842         getOrCreateWebLockRegistry([[self preferences] privateBrowsingEnabled]),
    18431828        WebCore::DummyPermissionController::create(),
    18441829        makeUniqueRef<WebCore::DummyStorageProvider>(),
  • trunk/Source/WebKitLegacy/win/WebView.cpp

    r293205 r293329  
    174174#include <WebCore/WebCoreJITOperations.h>
    175175#include <WebCore/WebCoreTextRenderer.h>
    176 #include <WebCore/WebLockRegistry.h>
    177176#include <WebCore/WindowMessageBroadcaster.h>
    178177#include <WebCore/WindowsTouch.h>
     
    28402839}
    28412840
    2842 static Ref<WebCore::LocalWebLockRegistry> getOrCreateWebLockRegistry()
    2843 {
    2844     static NeverDestroyed<WeakPtr<WebCore::LocalWebLockRegistry>> existingRegistry;
    2845     if (existingRegistry.get())
    2846         return *existingRegistry.get();
    2847     auto registry = WebCore::LocalWebLockRegistry::create();
    2848     existingRegistry.get() = registry;
    2849     return registry;
    2850 }
    2851 
    28522841HRESULT WebView::initWithFrame(RECT frame, _In_ BSTR frameName, _In_ BSTR groupName)
    28532842{
     
    29232912        makeUniqueRef<MediaRecorderProvider>(),
    29242913        WebBroadcastChannelRegistry::getOrCreate(false),
    2925         getOrCreateWebLockRegistry(),
    29262914        WebCore::DummyPermissionController::create(),
    29272915        makeUniqueRef<WebCore::DummyStorageProvider>(),
Note: See TracChangeset for help on using the changeset viewer.