Diff
Modified: trunk/Source/WebCore/ChangeLog (250103 => 250104)
--- trunk/Source/WebCore/ChangeLog 2019-09-19 20:52:30 UTC (rev 250103)
+++ trunk/Source/WebCore/ChangeLog 2019-09-19 21:19:21 UTC (rev 250104)
@@ -1,3 +1,101 @@
+2019-09-19 Chris Dumez <[email protected]>
+
+ WorkerGlobalScope does not need a SessionID
+ https://bugs.webkit.org/show_bug.cgi?id=201991
+
+ Reviewed by Alex Christensen.
+
+ WorkerGlobalScope does not need a SessionID, now that we have a single session
+ per WebProcess.
+
+ * dom/Document.cpp:
+ (WebCore::Document::resume):
+ (WebCore::Document::privateBrowsingStateDidChange):
+ * dom/Document.h:
+ * dom/ScriptExecutionContext.h:
+ * loader/DocumentLoader.cpp:
+ (WebCore::DocumentLoader::matchRegistration):
+ (WebCore::DocumentLoader::commitData):
+ (WebCore::DocumentLoader::registerTemporaryServiceWorkerClient):
+ (WebCore::DocumentLoader::unregisterTemporaryServiceWorkerClient):
+ * testing/Internals.cpp:
+ (WebCore::Internals::serviceWorkerClientIdentifier const):
+ (WebCore::Internals::storeRegistrationsOnDisk):
+ (WebCore::Internals::hasServiceWorkerRegistration):
+ (WebCore::Internals::terminateServiceWorker):
+ (WebCore::Internals::hasServiceWorkerConnection):
+ * workers/DedicatedWorkerGlobalScope.cpp:
+ (WebCore::DedicatedWorkerGlobalScope::create):
+ (WebCore::DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope):
+ * workers/DedicatedWorkerGlobalScope.h:
+ * workers/DedicatedWorkerThread.cpp:
+ (WebCore::DedicatedWorkerThread::DedicatedWorkerThread):
+ (WebCore::DedicatedWorkerThread::createWorkerGlobalScope):
+ * workers/DedicatedWorkerThread.h:
+ * workers/Worker.cpp:
+ (WebCore::Worker::notifyFinished):
+ * workers/WorkerGlobalScope.cpp:
+ (WebCore::WorkerGlobalScope::WorkerGlobalScope):
+ * workers/WorkerGlobalScope.h:
+ * workers/WorkerGlobalScopeProxy.h:
+ * workers/WorkerMessagingProxy.cpp:
+ (WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
+ * workers/WorkerMessagingProxy.h:
+ * workers/WorkerThread.cpp:
+ (WebCore::WorkerThreadStartupData::WorkerThreadStartupData):
+ (WebCore::WorkerThread::WorkerThread):
+ (WebCore::WorkerThread::workerThread):
+ * workers/WorkerThread.h:
+ * workers/service/ServiceWorker.cpp:
+ (WebCore::ServiceWorker::postMessage):
+ * workers/service/ServiceWorkerContainer.cpp:
+ (WebCore::mainThreadConnection):
+ (WebCore::ServiceWorkerContainer::addRegistration):
+ (WebCore::ServiceWorkerContainer::removeRegistration):
+ (WebCore::ServiceWorkerContainer::updateRegistration):
+ (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
+ (WebCore::ServiceWorkerContainer::notifyRegistrationIsSettled):
+ (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
+ (WebCore::ServiceWorkerContainer::notifyFailedFetchingScript):
+ (WebCore::ServiceWorkerContainer::ensureSWClientConnection):
+ * workers/service/ServiceWorkerGlobalScope.cpp:
+ (WebCore::ServiceWorkerGlobalScope::create):
+ (WebCore::ServiceWorkerGlobalScope::ServiceWorkerGlobalScope):
+ * workers/service/ServiceWorkerGlobalScope.h:
+ * workers/service/ServiceWorkerProvider.cpp:
+ (WebCore::ServiceWorkerProvider::mayHaveServiceWorkerRegisteredForOrigin):
+ (WebCore::ServiceWorkerProvider::registerServiceWorkerClients):
+ * workers/service/ServiceWorkerProvider.h:
+ * workers/service/WorkerSWClientConnection.cpp:
+ (WebCore::WorkerSWClientConnection::WorkerSWClientConnection):
+ (WebCore::WorkerSWClientConnection::matchRegistration):
+ (WebCore::WorkerSWClientConnection::getRegistrations):
+ (WebCore::WorkerSWClientConnection::whenRegistrationReady):
+ (WebCore::WorkerSWClientConnection::addServiceWorkerRegistrationInServer):
+ (WebCore::WorkerSWClientConnection::removeServiceWorkerRegistrationInServer):
+ (WebCore::WorkerSWClientConnection::didResolveRegistrationPromise):
+ (WebCore::WorkerSWClientConnection::postMessageToServiceWorker):
+ (WebCore::WorkerSWClientConnection::serverConnectionIdentifier const):
+ (WebCore::WorkerSWClientConnection::syncTerminateWorker):
+ (WebCore::WorkerSWClientConnection::registerServiceWorkerClient):
+ (WebCore::WorkerSWClientConnection::finishFetchingScriptInServer):
+ (WebCore::WorkerSWClientConnection::scheduleJob):
+ * workers/service/WorkerSWClientConnection.h:
+ * workers/service/context/ServiceWorkerThread.cpp:
+ (WebCore::ServiceWorkerThread::ServiceWorkerThread):
+ (WebCore::ServiceWorkerThread::createWorkerGlobalScope):
+ * workers/service/context/ServiceWorkerThread.h:
+ * workers/service/context/ServiceWorkerThreadProxy.cpp:
+ (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
+ * workers/service/context/ServiceWorkerThreadProxy.h:
+ * worklets/WorkletGlobalScope.h:
+ (WebCore::WorkletGlobalScope::sessionID const):
+ * xml/DOMParser.cpp:
+ (WebCore::DOMParser::parseFromString):
+ * xml/DOMParser.h:
+ * xml/DOMParser.idl:
+ * xml/XMLHttpRequest.cpp:
+
2019-09-19 Said Abou-Hallawa <[email protected]>
[SVG2]: Add auto behavior for rx and ry to the SVG <ellipse> and<rect> elements
Modified: trunk/Source/WebCore/dom/Document.cpp (250103 => 250104)
--- trunk/Source/WebCore/dom/Document.cpp 2019-09-19 20:52:30 UTC (rev 250103)
+++ trunk/Source/WebCore/dom/Document.cpp 2019-09-19 21:19:21 UTC (rev 250104)
@@ -5208,7 +5208,7 @@
#if ENABLE(SERVICE_WORKER)
if (RuntimeEnabledFeatures::sharedFeatures().serviceWorkerEnabled() && reason == ReasonForSuspension::PageCache) {
ASSERT_WITH_MESSAGE(!activeServiceWorker(), "Documents with an active service worker should not go into PageCache in the first place");
- setServiceWorkerConnection(ServiceWorkerProvider::singleton().existingServiceWorkerConnectionForSession(sessionID()));
+ setServiceWorkerConnection(ServiceWorkerProvider::singleton().existingServiceWorkerConnection());
}
#endif
}
@@ -5276,11 +5276,6 @@
for (auto* element : m_privateBrowsingStateChangedElements)
element->privateBrowsingStateDidChange(sessionID);
-
-#if ENABLE(SERVICE_WORKER)
- if (RuntimeEnabledFeatures::sharedFeatures().serviceWorkerEnabled() && m_serviceWorkerConnection)
- setServiceWorkerConnection(&ServiceWorkerProvider::singleton().serviceWorkerConnectionForSession(sessionID));
-#endif
}
void Document::registerForPrivateBrowsingStateChangedCallbacks(Element& element)
Modified: trunk/Source/WebCore/dom/Document.h (250103 => 250104)
--- trunk/Source/WebCore/dom/Document.h 2019-09-19 20:52:30 UTC (rev 250103)
+++ trunk/Source/WebCore/dom/Document.h 2019-09-19 21:19:21 UTC (rev 250104)
@@ -683,7 +683,7 @@
WEBCORE_EXPORT URL completeURL(const String&) const final;
URL completeURL(const String&, const URL& baseURLOverride) const;
- WEBCORE_EXPORT PAL::SessionID sessionID() const final;
+ WEBCORE_EXPORT PAL::SessionID sessionID() const;
String userAgent(const URL&) const final;
Modified: trunk/Source/WebCore/dom/ScriptExecutionContext.h (250103 => 250104)
--- trunk/Source/WebCore/dom/ScriptExecutionContext.h 2019-09-19 20:52:30 UTC (rev 250103)
+++ trunk/Source/WebCore/dom/ScriptExecutionContext.h 2019-09-19 21:19:21 UTC (rev 250104)
@@ -52,10 +52,6 @@
class ScriptCallStack;
}
-namespace PAL {
-class SessionID;
-}
-
namespace WebCore {
class CachedScript;
@@ -95,7 +91,6 @@
virtual const URL& url() const = 0;
virtual URL completeURL(const String& url) const = 0;
- virtual PAL::SessionID sessionID() const = 0;
virtual String userAgent(const URL&) const = 0;
Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (250103 => 250104)
--- trunk/Source/WebCore/loader/DocumentLoader.cpp 2019-09-19 20:52:30 UTC (rev 250103)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp 2019-09-19 21:19:21 UTC (rev 250104)
@@ -538,14 +538,13 @@
}
auto origin = (!m_frame->isMainFrame() && m_frame->document()) ? m_frame->document()->topOrigin().data() : SecurityOriginData::fromURL(url);
- auto sessionID = m_frame->page()->sessionID();
auto& provider = ServiceWorkerProvider::singleton();
- if (!provider.mayHaveServiceWorkerRegisteredForOrigin(sessionID, origin)) {
+ if (!provider.mayHaveServiceWorkerRegisteredForOrigin(origin)) {
callback(WTF::nullopt);
return;
}
- auto& connection = ServiceWorkerProvider::singleton().serviceWorkerConnectionForSession(sessionID);
+ auto& connection = ServiceWorkerProvider::singleton().serviceWorkerConnection();
connection.matchRegistration(WTFMove(origin), url, WTFMove(callback));
}
@@ -1104,7 +1103,7 @@
}
if (m_frame->document()->activeServiceWorker() || SchemeRegistry::canServiceWorkersHandleURLScheme(m_frame->document()->url().protocol().toStringWithoutCopying()))
- m_frame->document()->setServiceWorkerConnection(ServiceWorkerProvider::singleton().existingServiceWorkerConnectionForSession(m_frame->page()->sessionID()));
+ m_frame->document()->setServiceWorkerConnection(ServiceWorkerProvider::singleton().existingServiceWorkerConnection());
// We currently unregister the temporary service worker client since we now registered the real document.
// FIXME: We should make the real document use the temporary client identifier.
@@ -1879,7 +1878,7 @@
m_frame->page()->sessionID()
};
- auto& serviceWorkerConnection = ServiceWorkerProvider::singleton().serviceWorkerConnectionForSession(m_temporaryServiceWorkerClient->sessionID);
+ auto& serviceWorkerConnection = ServiceWorkerProvider::singleton().serviceWorkerConnection();
// FIXME: Compute ServiceWorkerClientFrameType appropriately.
ServiceWorkerClientData data { { serviceWorkerConnection.serverConnectionIdentifier(), m_temporaryServiceWorkerClient->documentIdentifier }, ServiceWorkerClientType::Window, ServiceWorkerClientFrameType::None, url };
@@ -1901,7 +1900,7 @@
if (!m_temporaryServiceWorkerClient)
return;
- auto& serviceWorkerConnection = ServiceWorkerProvider::singleton().serviceWorkerConnectionForSession(m_temporaryServiceWorkerClient->sessionID);
+ auto& serviceWorkerConnection = ServiceWorkerProvider::singleton().serviceWorkerConnection();
serviceWorkerConnection.unregisterServiceWorkerClient(m_temporaryServiceWorkerClient->documentIdentifier);
m_temporaryServiceWorkerClient = WTF::nullopt;
#endif
Modified: trunk/Source/WebCore/testing/Internals.cpp (250103 => 250104)
--- trunk/Source/WebCore/testing/Internals.cpp 2019-09-19 20:52:30 UTC (rev 250103)
+++ trunk/Source/WebCore/testing/Internals.cpp 2019-09-19 21:19:21 UTC (rev 250104)
@@ -2508,7 +2508,7 @@
String Internals::serviceWorkerClientIdentifier(const Document& document) const
{
#if ENABLE(SERVICE_WORKER)
- return ServiceWorkerClientIdentifier { ServiceWorkerProvider::singleton().serviceWorkerConnectionForSession(document.sessionID()).serverConnectionIdentifier(), document.identifier() }.toString();
+ return ServiceWorkerClientIdentifier { ServiceWorkerProvider::singleton().serviceWorkerConnection().serverConnectionIdentifier(), document.identifier() }.toString();
#else
UNUSED_PARAM(document);
return String();
@@ -4875,7 +4875,7 @@
if (!contextDocument())
return;
- auto& connection = ServiceWorkerProvider::singleton().serviceWorkerConnectionForSession(contextDocument()->sessionID());
+ auto& connection = ServiceWorkerProvider::singleton().serviceWorkerConnection();
connection.storeRegistrationsOnDiskForTesting([promise = WTFMove(promise)]() mutable {
promise.resolve();
});
@@ -4961,7 +4961,7 @@
URL parsedURL = contextDocument()->completeURL(clientURL);
- return ServiceWorkerProvider::singleton().serviceWorkerConnectionForSession(contextDocument()->sessionID()).matchRegistration(SecurityOriginData { contextDocument()->topOrigin().data() }, parsedURL, [promise = WTFMove(promise)] (auto&& result) mutable {
+ return ServiceWorkerProvider::singleton().serviceWorkerConnection().matchRegistration(SecurityOriginData { contextDocument()->topOrigin().data() }, parsedURL, [promise = WTFMove(promise)] (auto&& result) mutable {
promise.resolve(!!result);
});
}
@@ -4971,7 +4971,7 @@
if (!contextDocument())
return;
- ServiceWorkerProvider::singleton().serviceWorkerConnectionForSession(contextDocument()->sessionID()).syncTerminateWorker(worker.identifier());
+ ServiceWorkerProvider::singleton().serviceWorkerConnection().syncTerminateWorker(worker.identifier());
}
bool Internals::hasServiceWorkerConnection()
@@ -4979,7 +4979,7 @@
if (!contextDocument())
return false;
- return ServiceWorkerProvider::singleton().existingServiceWorkerConnectionForSession(contextDocument()->sessionID());
+ return ServiceWorkerProvider::singleton().existingServiceWorkerConnection();
}
#endif
Modified: trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.cpp (250103 => 250104)
--- trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.cpp 2019-09-19 20:52:30 UTC (rev 250103)
+++ trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.cpp 2019-09-19 21:19:21 UTC (rev 250104)
@@ -44,16 +44,16 @@
WTF_MAKE_ISO_ALLOCATED_IMPL(DedicatedWorkerGlobalScope);
-Ref<DedicatedWorkerGlobalScope> DedicatedWorkerGlobalScope::create(const URL& url, Ref<SecurityOrigin>&& origin, const String& name, const String& identifier, const String& userAgent, bool isOnline, DedicatedWorkerThread& thread, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicyResponseHeaders, bool shouldBypassMainWorldContentSecurityPolicy, Ref<SecurityOrigin>&& topOrigin, MonotonicTime timeOrigin, IDBClient::IDBConnectionProxy* connectionProxy, SocketProvider* socketProvider, PAL::SessionID sessionID)
+Ref<DedicatedWorkerGlobalScope> DedicatedWorkerGlobalScope::create(const URL& url, Ref<SecurityOrigin>&& origin, const String& name, const String& identifier, const String& userAgent, bool isOnline, DedicatedWorkerThread& thread, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicyResponseHeaders, bool shouldBypassMainWorldContentSecurityPolicy, Ref<SecurityOrigin>&& topOrigin, MonotonicTime timeOrigin, IDBClient::IDBConnectionProxy* connectionProxy, SocketProvider* socketProvider)
{
- auto context = adoptRef(*new DedicatedWorkerGlobalScope(url, WTFMove(origin), name, identifier, userAgent, isOnline, thread, shouldBypassMainWorldContentSecurityPolicy, WTFMove(topOrigin), timeOrigin, connectionProxy, socketProvider, sessionID));
+ auto context = adoptRef(*new DedicatedWorkerGlobalScope(url, WTFMove(origin), name, identifier, userAgent, isOnline, thread, shouldBypassMainWorldContentSecurityPolicy, WTFMove(topOrigin), timeOrigin, connectionProxy, socketProvider));
if (!shouldBypassMainWorldContentSecurityPolicy)
context->applyContentSecurityPolicyResponseHeaders(contentSecurityPolicyResponseHeaders);
return context;
}
-DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope(const URL& url, Ref<SecurityOrigin>&& origin, const String& name, const String& identifier, const String& userAgent, bool isOnline, DedicatedWorkerThread& thread, bool shouldBypassMainWorldContentSecurityPolicy, Ref<SecurityOrigin>&& topOrigin, MonotonicTime timeOrigin, IDBClient::IDBConnectionProxy* connectionProxy, SocketProvider* socketProvider, PAL::SessionID sessionID)
- : WorkerGlobalScope(url, WTFMove(origin), identifier, userAgent, isOnline, thread, shouldBypassMainWorldContentSecurityPolicy, WTFMove(topOrigin), timeOrigin, connectionProxy, socketProvider, sessionID)
+DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope(const URL& url, Ref<SecurityOrigin>&& origin, const String& name, const String& identifier, const String& userAgent, bool isOnline, DedicatedWorkerThread& thread, bool shouldBypassMainWorldContentSecurityPolicy, Ref<SecurityOrigin>&& topOrigin, MonotonicTime timeOrigin, IDBClient::IDBConnectionProxy* connectionProxy, SocketProvider* socketProvider)
+ : WorkerGlobalScope(url, WTFMove(origin), identifier, userAgent, isOnline, thread, shouldBypassMainWorldContentSecurityPolicy, WTFMove(topOrigin), timeOrigin, connectionProxy, socketProvider)
, m_name(name)
{
}
Modified: trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.h (250103 => 250104)
--- trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.h 2019-09-19 20:52:30 UTC (rev 250103)
+++ trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.h 2019-09-19 21:19:21 UTC (rev 250104)
@@ -49,7 +49,7 @@
class DedicatedWorkerGlobalScope final : public WorkerGlobalScope {
WTF_MAKE_ISO_ALLOCATED(DedicatedWorkerGlobalScope);
public:
- static Ref<DedicatedWorkerGlobalScope> create(const URL&, Ref<SecurityOrigin>&&, const String& name, const String& identifier, const String& userAgent, bool isOnline, DedicatedWorkerThread&, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, Ref<SecurityOrigin>&& topOrigin, MonotonicTime timeOrigin, IDBClient::IDBConnectionProxy*, SocketProvider*, PAL::SessionID);
+ static Ref<DedicatedWorkerGlobalScope> create(const URL&, Ref<SecurityOrigin>&&, const String& name, const String& identifier, const String& userAgent, bool isOnline, DedicatedWorkerThread&, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, Ref<SecurityOrigin>&& topOrigin, MonotonicTime timeOrigin, IDBClient::IDBConnectionProxy*, SocketProvider*);
virtual ~DedicatedWorkerGlobalScope();
const String& name() const { return m_name; }
@@ -61,7 +61,7 @@
private:
using Base = WorkerGlobalScope;
- DedicatedWorkerGlobalScope(const URL&, Ref<SecurityOrigin>&&, const String& name, const String& identifier, const String& userAgent, bool isOnline, DedicatedWorkerThread&, bool shouldBypassMainWorldContentSecurityPolicy, Ref<SecurityOrigin>&& topOrigin, MonotonicTime timeOrigin, IDBClient::IDBConnectionProxy*, SocketProvider*, PAL::SessionID);
+ DedicatedWorkerGlobalScope(const URL&, Ref<SecurityOrigin>&&, const String& name, const String& identifier, const String& userAgent, bool isOnline, DedicatedWorkerThread&, bool shouldBypassMainWorldContentSecurityPolicy, Ref<SecurityOrigin>&& topOrigin, MonotonicTime timeOrigin, IDBClient::IDBConnectionProxy*, SocketProvider*);
bool isDedicatedWorkerGlobalScope() const final { return true; }
ExceptionOr<void> importScripts(const Vector<String>& urls) final;
Modified: trunk/Source/WebCore/workers/DedicatedWorkerThread.cpp (250103 => 250104)
--- trunk/Source/WebCore/workers/DedicatedWorkerThread.cpp 2019-09-19 20:52:30 UTC (rev 250103)
+++ trunk/Source/WebCore/workers/DedicatedWorkerThread.cpp 2019-09-19 21:19:21 UTC (rev 250104)
@@ -38,8 +38,8 @@
namespace WebCore {
-DedicatedWorkerThread::DedicatedWorkerThread(const URL& url, const String& name, const String& identifier, const String& userAgent, bool isOnline, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerDebuggerProxy& workerDebuggerProxy, WorkerObjectProxy& workerObjectProxy, WorkerThreadStartMode startMode, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicyResponseHeaders, bool shouldBypassMainWorldContentSecurityPolicy, const SecurityOrigin& topOrigin, MonotonicTime timeOrigin, IDBClient::IDBConnectionProxy* connectionProxy, SocketProvider* socketProvider, JSC::RuntimeFlags runtimeFlags, PAL::SessionID sessionID)
- : WorkerThread(url, name, identifier, userAgent, isOnline, sourceCode, workerLoaderProxy, workerDebuggerProxy, workerObjectProxy, startMode, contentSecurityPolicyResponseHeaders, shouldBypassMainWorldContentSecurityPolicy, topOrigin, timeOrigin, connectionProxy, socketProvider, runtimeFlags, sessionID)
+DedicatedWorkerThread::DedicatedWorkerThread(const URL& url, const String& name, const String& identifier, const String& userAgent, bool isOnline, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerDebuggerProxy& workerDebuggerProxy, WorkerObjectProxy& workerObjectProxy, WorkerThreadStartMode startMode, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicyResponseHeaders, bool shouldBypassMainWorldContentSecurityPolicy, const SecurityOrigin& topOrigin, MonotonicTime timeOrigin, IDBClient::IDBConnectionProxy* connectionProxy, SocketProvider* socketProvider, JSC::RuntimeFlags runtimeFlags)
+ : WorkerThread(url, name, identifier, userAgent, isOnline, sourceCode, workerLoaderProxy, workerDebuggerProxy, workerObjectProxy, startMode, contentSecurityPolicyResponseHeaders, shouldBypassMainWorldContentSecurityPolicy, topOrigin, timeOrigin, connectionProxy, socketProvider, runtimeFlags)
, m_workerObjectProxy(workerObjectProxy)
{
}
@@ -46,9 +46,9 @@
DedicatedWorkerThread::~DedicatedWorkerThread() = default;
-Ref<WorkerGlobalScope> DedicatedWorkerThread::createWorkerGlobalScope(const URL& url, Ref<SecurityOrigin>&& origin, const String& name, const String& identifier, const String& userAgent, bool isOnline, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicyResponseHeaders, bool shouldBypassMainWorldContentSecurityPolicy, Ref<SecurityOrigin>&& topOrigin, MonotonicTime timeOrigin, PAL::SessionID sessionID)
+Ref<WorkerGlobalScope> DedicatedWorkerThread::createWorkerGlobalScope(const URL& url, Ref<SecurityOrigin>&& origin, const String& name, const String& identifier, const String& userAgent, bool isOnline, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicyResponseHeaders, bool shouldBypassMainWorldContentSecurityPolicy, Ref<SecurityOrigin>&& topOrigin, MonotonicTime timeOrigin)
{
- return DedicatedWorkerGlobalScope::create(url, WTFMove(origin), name, identifier, userAgent, isOnline, *this, contentSecurityPolicyResponseHeaders, shouldBypassMainWorldContentSecurityPolicy, WTFMove(topOrigin), timeOrigin, idbConnectionProxy(), socketProvider(), sessionID);
+ return DedicatedWorkerGlobalScope::create(url, WTFMove(origin), name, identifier, userAgent, isOnline, *this, contentSecurityPolicyResponseHeaders, shouldBypassMainWorldContentSecurityPolicy, WTFMove(topOrigin), timeOrigin, idbConnectionProxy(), socketProvider());
}
void DedicatedWorkerThread::runEventLoop()
Modified: trunk/Source/WebCore/workers/DedicatedWorkerThread.h (250103 => 250104)
--- trunk/Source/WebCore/workers/DedicatedWorkerThread.h 2019-09-19 20:52:30 UTC (rev 250103)
+++ trunk/Source/WebCore/workers/DedicatedWorkerThread.h 2019-09-19 21:19:21 UTC (rev 250104)
@@ -50,11 +50,11 @@
void start() { WorkerThread::start(nullptr); }
protected:
- Ref<WorkerGlobalScope> createWorkerGlobalScope(const URL&, Ref<SecurityOrigin>&&, const String& name, const String& identifier, const String& userAgent, bool isOnline, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, Ref<SecurityOrigin>&& topOrigin, MonotonicTime timeOrigin, PAL::SessionID) override;
+ Ref<WorkerGlobalScope> createWorkerGlobalScope(const URL&, Ref<SecurityOrigin>&&, const String& name, const String& identifier, const String& userAgent, bool isOnline, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, Ref<SecurityOrigin>&& topOrigin, MonotonicTime timeOrigin) override;
void runEventLoop() override;
private:
- DedicatedWorkerThread(const URL&, const String& name, const String& identifier, const String& userAgent, bool isOnline, const String& sourceCode, WorkerLoaderProxy&, WorkerDebuggerProxy&, WorkerObjectProxy&, WorkerThreadStartMode, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, const SecurityOrigin& topOrigin, MonotonicTime timeOrigin, IDBClient::IDBConnectionProxy*, SocketProvider*, JSC::RuntimeFlags, PAL::SessionID);
+ DedicatedWorkerThread(const URL&, const String& name, const String& identifier, const String& userAgent, bool isOnline, const String& sourceCode, WorkerLoaderProxy&, WorkerDebuggerProxy&, WorkerObjectProxy&, WorkerThreadStartMode, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, const SecurityOrigin& topOrigin, MonotonicTime timeOrigin, IDBClient::IDBConnectionProxy*, SocketProvider*, JSC::RuntimeFlags);
WorkerObjectProxy& m_workerObjectProxy;
};
Modified: trunk/Source/WebCore/workers/Worker.cpp (250103 => 250104)
--- trunk/Source/WebCore/workers/Worker.cpp 2019-09-19 20:52:30 UTC (rev 250103)
+++ trunk/Source/WebCore/workers/Worker.cpp 2019-09-19 21:19:21 UTC (rev 250104)
@@ -198,7 +198,7 @@
bool isOnline = platformStrategies()->loaderStrategy()->isOnLine();
const ContentSecurityPolicyResponseHeaders& contentSecurityPolicyResponseHeaders = m_contentSecurityPolicyResponseHeaders ? m_contentSecurityPolicyResponseHeaders.value() : context->contentSecurityPolicy()->responseHeaders();
- m_contextProxy.startWorkerGlobalScope(m_scriptLoader->url(), m_name, context->userAgent(m_scriptLoader->url()), isOnline, m_scriptLoader->script(), contentSecurityPolicyResponseHeaders, m_shouldBypassMainWorldContentSecurityPolicy, m_workerCreationTime, m_runtimeFlags, context->sessionID());
+ m_contextProxy.startWorkerGlobalScope(m_scriptLoader->url(), m_name, context->userAgent(m_scriptLoader->url()), isOnline, m_scriptLoader->script(), contentSecurityPolicyResponseHeaders, m_shouldBypassMainWorldContentSecurityPolicy, m_workerCreationTime, m_runtimeFlags);
InspectorInstrumentation::scriptImported(*context, m_scriptLoader->identifier(), m_scriptLoader->script());
}
Modified: trunk/Source/WebCore/workers/WorkerGlobalScope.cpp (250103 => 250104)
--- trunk/Source/WebCore/workers/WorkerGlobalScope.cpp 2019-09-19 20:52:30 UTC (rev 250103)
+++ trunk/Source/WebCore/workers/WorkerGlobalScope.cpp 2019-09-19 21:19:21 UTC (rev 250104)
@@ -59,7 +59,7 @@
WTF_MAKE_ISO_ALLOCATED_IMPL(WorkerGlobalScope);
-WorkerGlobalScope::WorkerGlobalScope(const URL& url, Ref<SecurityOrigin>&& origin, const String& identifier, const String& userAgent, bool isOnline, WorkerThread& thread, bool shouldBypassMainWorldContentSecurityPolicy, Ref<SecurityOrigin>&& topOrigin, MonotonicTime timeOrigin, IDBClient::IDBConnectionProxy* connectionProxy, SocketProvider* socketProvider, PAL::SessionID sessionID)
+WorkerGlobalScope::WorkerGlobalScope(const URL& url, Ref<SecurityOrigin>&& origin, const String& identifier, const String& userAgent, bool isOnline, WorkerThread& thread, bool shouldBypassMainWorldContentSecurityPolicy, Ref<SecurityOrigin>&& topOrigin, MonotonicTime timeOrigin, IDBClient::IDBConnectionProxy* connectionProxy, SocketProvider* socketProvider)
: m_url(url)
, m_identifier(identifier)
, m_userAgent(userAgent)
@@ -76,7 +76,6 @@
#endif
, m_socketProvider(socketProvider)
, m_performance(Performance::create(this, timeOrigin))
- , m_sessionID(sessionID)
{
#if !ENABLE(INDEXED_DATABASE)
UNUSED_PARAM(connectionProxy);
Modified: trunk/Source/WebCore/workers/WorkerGlobalScope.h (250103 => 250104)
--- trunk/Source/WebCore/workers/WorkerGlobalScope.h 2019-09-19 20:52:30 UTC (rev 250103)
+++ trunk/Source/WebCore/workers/WorkerGlobalScope.h 2019-09-19 21:19:21 UTC (rev 250104)
@@ -39,7 +39,6 @@
#include "WorkerScriptController.h"
#include <_javascript_Core/ConsoleMessage.h>
#include <memory>
-#include <pal/SessionID.h>
namespace WebCore {
@@ -132,10 +131,8 @@
unsigned long createUniqueIdentifier() { return m_uniqueIdentifier++; }
- PAL::SessionID sessionID() const final { return m_sessionID; }
-
protected:
- WorkerGlobalScope(const URL&, Ref<SecurityOrigin>&&, const String& identifier, const String& userAgent, bool isOnline, WorkerThread&, bool shouldBypassMainWorldContentSecurityPolicy, Ref<SecurityOrigin>&& topOrigin, MonotonicTime timeOrigin, IDBClient::IDBConnectionProxy*, SocketProvider*, PAL::SessionID);
+ WorkerGlobalScope(const URL&, Ref<SecurityOrigin>&&, const String& identifier, const String& userAgent, bool isOnline, WorkerThread&, bool shouldBypassMainWorldContentSecurityPolicy, Ref<SecurityOrigin>&& topOrigin, MonotonicTime timeOrigin, IDBClient::IDBConnectionProxy*, SocketProvider*);
void applyContentSecurityPolicyResponseHeaders(const ContentSecurityPolicyResponseHeaders&);
@@ -214,7 +211,6 @@
RefPtr<Performance> m_performance;
mutable RefPtr<Crypto> m_crypto;
- PAL::SessionID m_sessionID;
RefPtr<WorkerCacheStorageConnection> m_cacheStorageConnection;
std::unique_ptr<WorkerMessagePortChannelProvider> m_messagePortChannelProvider;
unsigned long m_uniqueIdentifier { 1 };
Modified: trunk/Source/WebCore/workers/WorkerGlobalScopeProxy.h (250103 => 250104)
--- trunk/Source/WebCore/workers/WorkerGlobalScopeProxy.h 2019-09-19 20:52:30 UTC (rev 250103)
+++ trunk/Source/WebCore/workers/WorkerGlobalScopeProxy.h 2019-09-19 21:19:21 UTC (rev 250104)
@@ -49,7 +49,7 @@
public:
static WorkerGlobalScopeProxy& create(Worker&);
- virtual void startWorkerGlobalScope(const URL& scriptURL, const String& name, const String& userAgent, bool isOnline, const String& sourceCode, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, MonotonicTime timeOrigin, JSC::RuntimeFlags, PAL::SessionID) = 0;
+ virtual void startWorkerGlobalScope(const URL& scriptURL, const String& name, const String& userAgent, bool isOnline, const String& sourceCode, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, MonotonicTime timeOrigin, JSC::RuntimeFlags) = 0;
virtual void terminateWorkerGlobalScope() = 0;
virtual void postMessageToWorkerGlobalScope(MessageWithMessagePorts&&) = 0;
virtual bool hasPendingActivity() const = 0;
Modified: trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp (250103 => 250104)
--- trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp 2019-09-19 20:52:30 UTC (rev 250103)
+++ trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp 2019-09-19 21:19:21 UTC (rev 250104)
@@ -72,7 +72,7 @@
|| (is<WorkerGlobalScope>(*m_scriptExecutionContext) && downcast<WorkerGlobalScope>(*m_scriptExecutionContext).thread().thread() == &Thread::current()));
}
-void WorkerMessagingProxy::startWorkerGlobalScope(const URL& scriptURL, const String& name, const String& userAgent, bool isOnline, const String& sourceCode, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicyResponseHeaders, bool shouldBypassMainWorldContentSecurityPolicy, MonotonicTime timeOrigin, JSC::RuntimeFlags runtimeFlags, PAL::SessionID sessionID)
+void WorkerMessagingProxy::startWorkerGlobalScope(const URL& scriptURL, const String& name, const String& userAgent, bool isOnline, const String& sourceCode, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicyResponseHeaders, bool shouldBypassMainWorldContentSecurityPolicy, MonotonicTime timeOrigin, JSC::RuntimeFlags runtimeFlags)
{
// FIXME: This need to be revisited when we support nested worker one day
ASSERT(m_scriptExecutionContext);
@@ -88,7 +88,7 @@
SocketProvider* socketProvider = document.socketProvider();
- auto thread = DedicatedWorkerThread::create(scriptURL, name, identifier, userAgent, isOnline, sourceCode, *this, *this, *this, startMode, contentSecurityPolicyResponseHeaders, shouldBypassMainWorldContentSecurityPolicy, document.topOrigin(), timeOrigin, proxy, socketProvider, runtimeFlags, sessionID);
+ auto thread = DedicatedWorkerThread::create(scriptURL, name, identifier, userAgent, isOnline, sourceCode, *this, *this, *this, startMode, contentSecurityPolicyResponseHeaders, shouldBypassMainWorldContentSecurityPolicy, document.topOrigin(), timeOrigin, proxy, socketProvider, runtimeFlags);
workerThreadCreated(thread.get());
thread->start();
Modified: trunk/Source/WebCore/workers/WorkerMessagingProxy.h (250103 => 250104)
--- trunk/Source/WebCore/workers/WorkerMessagingProxy.h 2019-09-19 20:52:30 UTC (rev 250103)
+++ trunk/Source/WebCore/workers/WorkerMessagingProxy.h 2019-09-19 21:19:21 UTC (rev 250104)
@@ -46,7 +46,7 @@
private:
// Implementations of WorkerGlobalScopeProxy.
// (Only use these functions in the worker object thread.)
- void startWorkerGlobalScope(const URL& scriptURL, const String& name, const String& userAgent, bool isOnline, const String& sourceCode, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, MonotonicTime timeOrigin, JSC::RuntimeFlags, PAL::SessionID) final;
+ void startWorkerGlobalScope(const URL& scriptURL, const String& name, const String& userAgent, bool isOnline, const String& sourceCode, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, MonotonicTime timeOrigin, JSC::RuntimeFlags) final;
void terminateWorkerGlobalScope() final;
void postMessageToWorkerGlobalScope(MessageWithMessagePorts&&) final;
bool hasPendingActivity() const final;
Modified: trunk/Source/WebCore/workers/WorkerThread.cpp (250103 => 250104)
--- trunk/Source/WebCore/workers/WorkerThread.cpp 2019-09-19 20:52:30 UTC (rev 250103)
+++ trunk/Source/WebCore/workers/WorkerThread.cpp 2019-09-19 21:19:21 UTC (rev 250104)
@@ -74,7 +74,7 @@
struct WorkerThreadStartupData {
WTF_MAKE_NONCOPYABLE(WorkerThreadStartupData); WTF_MAKE_FAST_ALLOCATED;
public:
- WorkerThreadStartupData(const URL& scriptURL, const String& name, const String& identifier, const String& userAgent, bool isOnline, const String& sourceCode, WorkerThreadStartMode, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, const SecurityOrigin& topOrigin, MonotonicTime timeOrigin, PAL::SessionID);
+ WorkerThreadStartupData(const URL& scriptURL, const String& name, const String& identifier, const String& userAgent, bool isOnline, const String& sourceCode, WorkerThreadStartMode, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, const SecurityOrigin& topOrigin, MonotonicTime timeOrigin);
URL m_scriptURL;
Ref<SecurityOrigin> m_origin;
@@ -88,10 +88,9 @@
bool m_isOnline;
Ref<SecurityOrigin> m_topOrigin;
MonotonicTime m_timeOrigin;
- PAL::SessionID m_sessionID;
};
-WorkerThreadStartupData::WorkerThreadStartupData(const URL& scriptURL, const String& name, const String& identifier, const String& userAgent, bool isOnline, const String& sourceCode, WorkerThreadStartMode startMode, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicyResponseHeaders, bool shouldBypassMainWorldContentSecurityPolicy, const SecurityOrigin& topOrigin, MonotonicTime timeOrigin, PAL::SessionID sessionID)
+WorkerThreadStartupData::WorkerThreadStartupData(const URL& scriptURL, const String& name, const String& identifier, const String& userAgent, bool isOnline, const String& sourceCode, WorkerThreadStartMode startMode, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicyResponseHeaders, bool shouldBypassMainWorldContentSecurityPolicy, const SecurityOrigin& topOrigin, MonotonicTime timeOrigin)
: m_scriptURL(scriptURL.isolatedCopy())
, m_origin(SecurityOrigin::create(m_scriptURL)->isolatedCopy())
, m_name(name.isolatedCopy())
@@ -104,17 +103,16 @@
, m_isOnline(isOnline)
, m_topOrigin(topOrigin.isolatedCopy())
, m_timeOrigin(timeOrigin)
- , m_sessionID(sessionID.isolatedCopy())
{
}
-WorkerThread::WorkerThread(const URL& scriptURL, const String& name, const String& identifier, const String& userAgent, bool isOnline, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerDebuggerProxy& workerDebuggerProxy, WorkerReportingProxy& workerReportingProxy, WorkerThreadStartMode startMode, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicyResponseHeaders, bool shouldBypassMainWorldContentSecurityPolicy, const SecurityOrigin& topOrigin, MonotonicTime timeOrigin, IDBClient::IDBConnectionProxy* connectionProxy, SocketProvider* socketProvider, JSC::RuntimeFlags runtimeFlags, PAL::SessionID sessionID)
+WorkerThread::WorkerThread(const URL& scriptURL, const String& name, const String& identifier, const String& userAgent, bool isOnline, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerDebuggerProxy& workerDebuggerProxy, WorkerReportingProxy& workerReportingProxy, WorkerThreadStartMode startMode, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicyResponseHeaders, bool shouldBypassMainWorldContentSecurityPolicy, const SecurityOrigin& topOrigin, MonotonicTime timeOrigin, IDBClient::IDBConnectionProxy* connectionProxy, SocketProvider* socketProvider, JSC::RuntimeFlags runtimeFlags)
: m_identifier(identifier.isolatedCopy())
, m_workerLoaderProxy(workerLoaderProxy)
, m_workerDebuggerProxy(workerDebuggerProxy)
, m_workerReportingProxy(workerReportingProxy)
, m_runtimeFlags(runtimeFlags)
- , m_startupData(makeUnique<WorkerThreadStartupData>(scriptURL, name, identifier, userAgent, isOnline, sourceCode, startMode, contentSecurityPolicyResponseHeaders, shouldBypassMainWorldContentSecurityPolicy, topOrigin, timeOrigin, sessionID))
+ , m_startupData(makeUnique<WorkerThreadStartupData>(scriptURL, name, identifier, userAgent, isOnline, sourceCode, startMode, contentSecurityPolicyResponseHeaders, shouldBypassMainWorldContentSecurityPolicy, topOrigin, timeOrigin))
#if ENABLE(INDEXED_DATABASE)
, m_idbConnectionProxy(connectionProxy)
#endif
@@ -170,7 +168,7 @@
// while WorkerThread::stop() is accessing it. Note that WorkerThread::stop() can
// be called before we've finished creating the WorkerGlobalScope.
LockHolder lock(m_threadCreationAndWorkerGlobalScopeMutex);
- m_workerGlobalScope = createWorkerGlobalScope(m_startupData->m_scriptURL, WTFMove(m_startupData->m_origin), m_startupData->m_name, m_startupData->m_identifier, m_startupData->m_userAgent, m_startupData->m_isOnline, m_startupData->m_contentSecurityPolicyResponseHeaders, m_startupData->m_shouldBypassMainWorldContentSecurityPolicy, WTFMove(m_startupData->m_topOrigin), m_startupData->m_timeOrigin, m_startupData->m_sessionID);
+ m_workerGlobalScope = createWorkerGlobalScope(m_startupData->m_scriptURL, WTFMove(m_startupData->m_origin), m_startupData->m_name, m_startupData->m_identifier, m_startupData->m_userAgent, m_startupData->m_isOnline, m_startupData->m_contentSecurityPolicyResponseHeaders, m_startupData->m_shouldBypassMainWorldContentSecurityPolicy, WTFMove(m_startupData->m_topOrigin), m_startupData->m_timeOrigin);
scriptController = m_workerGlobalScope->script();
Modified: trunk/Source/WebCore/workers/WorkerThread.h (250103 => 250104)
--- trunk/Source/WebCore/workers/WorkerThread.h 2019-09-19 20:52:30 UTC (rev 250103)
+++ trunk/Source/WebCore/workers/WorkerThread.h 2019-09-19 21:19:21 UTC (rev 250104)
@@ -32,10 +32,6 @@
#include <wtf/Function.h>
#include <wtf/RefCounted.h>
-namespace PAL {
-class SessionID;
-}
-
namespace WebCore {
class ContentSecurityPolicyResponseHeaders;
@@ -90,10 +86,10 @@
String identifier() const { return m_identifier; }
protected:
- WorkerThread(const URL&, const String& name, const String& identifier, const String& userAgent, bool isOnline, const String& sourceCode, WorkerLoaderProxy&, WorkerDebuggerProxy&, WorkerReportingProxy&, WorkerThreadStartMode, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, const SecurityOrigin& topOrigin, MonotonicTime timeOrigin, IDBClient::IDBConnectionProxy*, SocketProvider*, JSC::RuntimeFlags, PAL::SessionID);
+ WorkerThread(const URL&, const String& name, const String& identifier, const String& userAgent, bool isOnline, const String& sourceCode, WorkerLoaderProxy&, WorkerDebuggerProxy&, WorkerReportingProxy&, WorkerThreadStartMode, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, const SecurityOrigin& topOrigin, MonotonicTime timeOrigin, IDBClient::IDBConnectionProxy*, SocketProvider*, JSC::RuntimeFlags);
// Factory method for creating a new worker context for the thread.
- virtual Ref<WorkerGlobalScope> createWorkerGlobalScope(const URL&, Ref<SecurityOrigin>&&, const String& name, const String& identifier, const String& userAgent, bool isOnline, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, Ref<SecurityOrigin>&& topOrigin, MonotonicTime timeOrigin, PAL::SessionID) = 0;
+ virtual Ref<WorkerGlobalScope> createWorkerGlobalScope(const URL&, Ref<SecurityOrigin>&&, const String& name, const String& identifier, const String& userAgent, bool isOnline, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, Ref<SecurityOrigin>&& topOrigin, MonotonicTime timeOrigin) = 0;
// Executes the event loop for the worker thread. Derived classes can override to perform actions before/after entering the event loop.
virtual void runEventLoop();
Modified: trunk/Source/WebCore/workers/service/ServiceWorker.cpp (250103 => 250104)
--- trunk/Source/WebCore/workers/service/ServiceWorker.cpp 2019-09-19 20:52:30 UTC (rev 250103)
+++ trunk/Source/WebCore/workers/service/ServiceWorker.cpp 2019-09-19 21:19:21 UTC (rev 250104)
@@ -92,7 +92,7 @@
ExceptionOr<void> ServiceWorker::postMessage(ScriptExecutionContext& context, JSC::JSValue messageValue, Vector<JSC::Strong<JSC::JSObject>>&& transfer)
{
- if (m_isStopped || !context.sessionID().isValid())
+ if (m_isStopped)
return Exception { InvalidStateError };
auto* execState = context.execState();
@@ -112,13 +112,13 @@
if (is<ServiceWorkerGlobalScope>(context))
sourceIdentifier = downcast<ServiceWorkerGlobalScope>(context).thread().identifier();
else {
- auto& connection = ServiceWorkerProvider::singleton().serviceWorkerConnectionForSession(context.sessionID());
+ auto& connection = ServiceWorkerProvider::singleton().serviceWorkerConnection();
sourceIdentifier = ServiceWorkerClientIdentifier { connection.serverConnectionIdentifier(), downcast<Document>(context).identifier() };
}
MessageWithMessagePorts message = { messageData.releaseReturnValue(), portsOrException.releaseReturnValue() };
- callOnMainThread([sessionID = context.sessionID(), destinationIdentifier = identifier(), message = WTFMove(message), sourceIdentifier = WTFMove(sourceIdentifier)]() mutable {
- auto& connection = ServiceWorkerProvider::singleton().serviceWorkerConnectionForSession(sessionID);
+ callOnMainThread([destinationIdentifier = identifier(), message = WTFMove(message), sourceIdentifier = WTFMove(sourceIdentifier)]() mutable {
+ auto& connection = ServiceWorkerProvider::singleton().serviceWorkerConnection();
connection.postMessageToServiceWorker(destinationIdentifier, WTFMove(message), sourceIdentifier);
});
return { };
Modified: trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp (250103 => 250104)
--- trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp 2019-09-19 20:52:30 UTC (rev 250103)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp 2019-09-19 21:19:21 UTC (rev 250104)
@@ -60,9 +60,9 @@
namespace WebCore {
-static inline SWClientConnection& mainThreadConnection(PAL::SessionID sessionID)
+static inline SWClientConnection& mainThreadConnection()
{
- return ServiceWorkerProvider::singleton().serviceWorkerConnectionForSession(sessionID);
+ return ServiceWorkerProvider::singleton().serviceWorkerConnection();
}
WTF_MAKE_ISO_ALLOCATED_IMPL(ServiceWorkerContainer);
@@ -126,7 +126,7 @@
void ServiceWorkerContainer::addRegistration(const String& relativeScriptURL, const RegistrationOptions& options, Ref<DeferredPromise>&& promise)
{
auto* context = scriptExecutionContext();
- if (m_isStopped || !context->sessionID().isValid()) {
+ if (m_isStopped) {
promise->reject(Exception(InvalidStateError));
return;
}
@@ -189,7 +189,7 @@
void ServiceWorkerContainer::removeRegistration(const URL& scopeURL, Ref<DeferredPromise>&& promise)
{
auto* context = scriptExecutionContext();
- if (!context || !context->sessionID().isValid()) {
+ if (!context) {
ASSERT_NOT_REACHED();
promise->reject(Exception(InvalidStateError));
return;
@@ -217,7 +217,6 @@
ASSERT(!m_isStopped);
auto& context = *scriptExecutionContext();
- ASSERT(context.sessionID().isValid());
if (!m_swConnection) {
ASSERT_NOT_REACHED();
@@ -386,7 +385,7 @@
notifyIfExitEarly.release();
scriptExecutionContext()->postTask([this, protectedThis = RefPtr<ServiceWorkerContainer>(this), promise = WTFMove(promise), jobIdentifier = job.identifier(), data = "" shouldNotifyWhenResolved](ScriptExecutionContext& context) mutable {
- if (isStopped() || !context.sessionID().isValid()) {
+ if (isStopped()) {
if (shouldNotifyWhenResolved == ShouldNotifyWhenResolved::Yes)
notifyRegistrationIsSettled(data.key);
return;
@@ -419,8 +418,8 @@
void ServiceWorkerContainer::notifyRegistrationIsSettled(const ServiceWorkerRegistrationKey& registrationKey)
{
- callOnMainThread([sessionID = scriptExecutionContext()->sessionID(), registrationKey = registrationKey.isolatedCopy()] {
- mainThreadConnection(sessionID).didResolveRegistrationPromise(registrationKey);
+ callOnMainThread([registrationKey = registrationKey.isolatedCopy()] {
+ mainThreadConnection().didResolveRegistrationPromise(registrationKey);
});
}
@@ -476,8 +475,8 @@
CONTAINER_RELEASE_LOG_IF_ALLOWED("jobFinishedLoadingScript: Successfuly finished fetching script for job %" PRIu64, job.identifier().toUInt64());
- callOnMainThread([sessionID = scriptExecutionContext()->sessionID(), jobDataIdentifier = job.data().identifier(), registrationKey = job.data().registrationKey().isolatedCopy(), script = script.isolatedCopy(), contentSecurityPolicy = contentSecurityPolicy.isolatedCopy(), referrerPolicy = referrerPolicy.isolatedCopy()] {
- mainThreadConnection(sessionID).finishFetchingScriptInServer({ jobDataIdentifier, registrationKey, script, contentSecurityPolicy, referrerPolicy, { } });
+ callOnMainThread([jobDataIdentifier = job.data().identifier(), registrationKey = job.data().registrationKey().isolatedCopy(), script = script.isolatedCopy(), contentSecurityPolicy = contentSecurityPolicy.isolatedCopy(), referrerPolicy = referrerPolicy.isolatedCopy()] {
+ mainThreadConnection().finishFetchingScriptInServer({ jobDataIdentifier, registrationKey, script, contentSecurityPolicy, referrerPolicy, { } });
});
}
@@ -499,8 +498,8 @@
void ServiceWorkerContainer::notifyFailedFetchingScript(ServiceWorkerJob& job, const ResourceError& error)
{
- callOnMainThread([sessionID = scriptExecutionContext()->sessionID(), jobIdentifier = job.identifier(), registrationKey = job.data().registrationKey().isolatedCopy(), error = error.isolatedCopy()] {
- mainThreadConnection(sessionID).failedFetchingScript(jobIdentifier, registrationKey, error);
+ callOnMainThread([jobIdentifier = job.identifier(), registrationKey = job.data().registrationKey().isolatedCopy(), error = error.isolatedCopy()] {
+ mainThreadConnection().failedFetchingScript(jobIdentifier, registrationKey, error);
});
}
@@ -537,13 +536,12 @@
SWClientConnection& ServiceWorkerContainer::ensureSWClientConnection()
{
ASSERT(scriptExecutionContext());
- ASSERT(scriptExecutionContext()->sessionID().isValid());
if (!m_swConnection) {
auto& context = *scriptExecutionContext();
if (is<WorkerGlobalScope>(context))
m_swConnection = &downcast<WorkerGlobalScope>(context).swClientConnection();
else
- m_swConnection = &mainThreadConnection(context.sessionID());
+ m_swConnection = &mainThreadConnection();
}
return *m_swConnection;
}
Modified: trunk/Source/WebCore/workers/service/ServiceWorkerGlobalScope.cpp (250103 => 250104)
--- trunk/Source/WebCore/workers/service/ServiceWorkerGlobalScope.cpp 2019-09-19 20:52:30 UTC (rev 250103)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerGlobalScope.cpp 2019-09-19 21:19:21 UTC (rev 250104)
@@ -42,15 +42,15 @@
WTF_MAKE_ISO_ALLOCATED_IMPL(ServiceWorkerGlobalScope);
-Ref<ServiceWorkerGlobalScope> ServiceWorkerGlobalScope::create(const ServiceWorkerContextData& data, const URL& url, Ref<SecurityOrigin>&& origin, const String& identifier, const String& userAgent, bool isOnline, ServiceWorkerThread& thread, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicy, bool shouldBypassMainWorldContentSecurityPolicy, Ref<SecurityOrigin>&& topOrigin, MonotonicTime timeOrigin, IDBClient::IDBConnectionProxy* connectionProxy, SocketProvider* socketProvider, PAL::SessionID sessionID)
+Ref<ServiceWorkerGlobalScope> ServiceWorkerGlobalScope::create(const ServiceWorkerContextData& data, const URL& url, Ref<SecurityOrigin>&& origin, const String& identifier, const String& userAgent, bool isOnline, ServiceWorkerThread& thread, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicy, bool shouldBypassMainWorldContentSecurityPolicy, Ref<SecurityOrigin>&& topOrigin, MonotonicTime timeOrigin, IDBClient::IDBConnectionProxy* connectionProxy, SocketProvider* socketProvider)
{
- auto scope = adoptRef(*new ServiceWorkerGlobalScope { data, url, WTFMove(origin), identifier, userAgent, isOnline, thread, shouldBypassMainWorldContentSecurityPolicy, WTFMove(topOrigin), timeOrigin, connectionProxy, socketProvider, sessionID });
+ auto scope = adoptRef(*new ServiceWorkerGlobalScope { data, url, WTFMove(origin), identifier, userAgent, isOnline, thread, shouldBypassMainWorldContentSecurityPolicy, WTFMove(topOrigin), timeOrigin, connectionProxy, socketProvider });
scope->applyContentSecurityPolicyResponseHeaders(contentSecurityPolicy);
return scope;
}
-ServiceWorkerGlobalScope::ServiceWorkerGlobalScope(const ServiceWorkerContextData& data, const URL& url, Ref<SecurityOrigin>&& origin, const String& identifier, const String& userAgent, bool isOnline, ServiceWorkerThread& thread, bool shouldBypassMainWorldContentSecurityPolicy, Ref<SecurityOrigin>&& topOrigin, MonotonicTime timeOrigin, IDBClient::IDBConnectionProxy* connectionProxy, SocketProvider* socketProvider, PAL::SessionID sessionID)
- : WorkerGlobalScope(url, WTFMove(origin), identifier, userAgent, isOnline, thread, shouldBypassMainWorldContentSecurityPolicy, WTFMove(topOrigin), timeOrigin, connectionProxy, socketProvider, sessionID)
+ServiceWorkerGlobalScope::ServiceWorkerGlobalScope(const ServiceWorkerContextData& data, const URL& url, Ref<SecurityOrigin>&& origin, const String& identifier, const String& userAgent, bool isOnline, ServiceWorkerThread& thread, bool shouldBypassMainWorldContentSecurityPolicy, Ref<SecurityOrigin>&& topOrigin, MonotonicTime timeOrigin, IDBClient::IDBConnectionProxy* connectionProxy, SocketProvider* socketProvider)
+ : WorkerGlobalScope(url, WTFMove(origin), identifier, userAgent, isOnline, thread, shouldBypassMainWorldContentSecurityPolicy, WTFMove(topOrigin), timeOrigin, connectionProxy, socketProvider)
, m_contextData(crossThreadCopy(data))
, m_registration(ServiceWorkerRegistration::getOrCreate(*this, navigator().serviceWorker(), WTFMove(m_contextData.registration)))
, m_clients(ServiceWorkerClients::create())
Modified: trunk/Source/WebCore/workers/service/ServiceWorkerGlobalScope.h (250103 => 250104)
--- trunk/Source/WebCore/workers/service/ServiceWorkerGlobalScope.h 2019-09-19 20:52:30 UTC (rev 250103)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerGlobalScope.h 2019-09-19 21:19:21 UTC (rev 250104)
@@ -44,7 +44,7 @@
class ServiceWorkerGlobalScope final : public WorkerGlobalScope {
WTF_MAKE_ISO_ALLOCATED(ServiceWorkerGlobalScope);
public:
- static Ref<ServiceWorkerGlobalScope> create(const ServiceWorkerContextData&, const URL&, Ref<SecurityOrigin>&&, const String& identifier, const String& userAgent, bool isOnline, ServiceWorkerThread&, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, Ref<SecurityOrigin>&& topOrigin, MonotonicTime timeOrigin, IDBClient::IDBConnectionProxy*, SocketProvider*, PAL::SessionID);
+ static Ref<ServiceWorkerGlobalScope> create(const ServiceWorkerContextData&, const URL&, Ref<SecurityOrigin>&&, const String& identifier, const String& userAgent, bool isOnline, ServiceWorkerThread&, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, Ref<SecurityOrigin>&& topOrigin, MonotonicTime timeOrigin, IDBClient::IDBConnectionProxy*, SocketProvider*);
~ServiceWorkerGlobalScope();
@@ -69,7 +69,7 @@
void setScriptResource(const URL&, ServiceWorkerContextData::ImportedScript&&);
private:
- ServiceWorkerGlobalScope(const ServiceWorkerContextData&, const URL&, Ref<SecurityOrigin>&&, const String& identifier, const String& userAgent, bool isOnline, ServiceWorkerThread&, bool shouldBypassMainWorldContentSecurityPolicy, Ref<SecurityOrigin>&& topOrigin, MonotonicTime timeOrigin, IDBClient::IDBConnectionProxy*, SocketProvider*, PAL::SessionID);
+ ServiceWorkerGlobalScope(const ServiceWorkerContextData&, const URL&, Ref<SecurityOrigin>&&, const String& identifier, const String& userAgent, bool isOnline, ServiceWorkerThread&, bool shouldBypassMainWorldContentSecurityPolicy, Ref<SecurityOrigin>&& topOrigin, MonotonicTime timeOrigin, IDBClient::IDBConnectionProxy*, SocketProvider*);
bool hasPendingEvents() const { return !m_extendedEvents.isEmpty(); }
Modified: trunk/Source/WebCore/workers/service/ServiceWorkerProvider.cpp (250103 => 250104)
--- trunk/Source/WebCore/workers/service/ServiceWorkerProvider.cpp 2019-09-19 20:52:30 UTC (rev 250103)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerProvider.cpp 2019-09-19 21:19:21 UTC (rev 250104)
@@ -31,7 +31,6 @@
#include "Document.h"
#include "SWClientConnection.h"
#include "SchemeRegistry.h"
-#include <pal/SessionID.h>
namespace WebCore {
@@ -52,9 +51,9 @@
sharedProvider = &newProvider;
}
-bool ServiceWorkerProvider::mayHaveServiceWorkerRegisteredForOrigin(PAL::SessionID sessionID, const SecurityOriginData& origin)
+bool ServiceWorkerProvider::mayHaveServiceWorkerRegisteredForOrigin(const SecurityOriginData& origin)
{
- auto* connection = existingServiceWorkerConnectionForSession(sessionID);
+ auto* connection = existingServiceWorkerConnection();
if (!connection)
return m_mayHaveRegisteredServiceWorkers;
@@ -65,9 +64,8 @@
{
setMayHaveRegisteredServiceWorkers();
for (auto* document : Document::allDocuments()) {
- auto sessionID = document->sessionID();
if (SchemeRegistry::canServiceWorkersHandleURLScheme(document->url().protocol().toStringWithoutCopying()))
- document->setServiceWorkerConnection(&serviceWorkerConnectionForSession(sessionID));
+ document->setServiceWorkerConnection(&serviceWorkerConnection());
}
}
Modified: trunk/Source/WebCore/workers/service/ServiceWorkerProvider.h (250103 => 250104)
--- trunk/Source/WebCore/workers/service/ServiceWorkerProvider.h 2019-09-19 20:52:30 UTC (rev 250103)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerProvider.h 2019-09-19 21:19:21 UTC (rev 250104)
@@ -44,9 +44,9 @@
static ServiceWorkerProvider& singleton();
static void setSharedProvider(ServiceWorkerProvider&);
- bool mayHaveServiceWorkerRegisteredForOrigin(PAL::SessionID, const SecurityOriginData&);
- virtual SWClientConnection* existingServiceWorkerConnectionForSession(PAL::SessionID) = 0;
- virtual SWClientConnection& serviceWorkerConnectionForSession(PAL::SessionID) = 0;
+ bool mayHaveServiceWorkerRegisteredForOrigin(const SecurityOriginData&);
+ virtual SWClientConnection* existingServiceWorkerConnection() = 0;
+ virtual SWClientConnection& serviceWorkerConnection() = 0;
void registerServiceWorkerClients();
Modified: trunk/Source/WebCore/workers/service/WorkerSWClientConnection.cpp (250103 => 250104)
--- trunk/Source/WebCore/workers/service/WorkerSWClientConnection.cpp 2019-09-19 20:52:30 UTC (rev 250103)
+++ trunk/Source/WebCore/workers/service/WorkerSWClientConnection.cpp 2019-09-19 21:19:21 UTC (rev 250104)
@@ -40,8 +40,7 @@
namespace WebCore {
WorkerSWClientConnection::WorkerSWClientConnection(WorkerGlobalScope& scope)
- : m_sessionID(scope.sessionID())
- , m_thread(scope.thread())
+ : m_thread(scope.thread())
{
}
@@ -65,8 +64,8 @@
uint64_t requestIdentifier = ++m_lastRequestIdentifier;
m_matchRegistrationRequests.add(requestIdentifier, WTFMove(callback));
- callOnMainThread([sessionID = m_sessionID, thread = m_thread.copyRef(), requestIdentifier, topOrigin = crossThreadCopy(WTFMove(topOrigin)), clientURL = crossThreadCopy(clientURL)]() mutable {
- auto& connection = ServiceWorkerProvider::singleton().serviceWorkerConnectionForSession(sessionID);
+ callOnMainThread([thread = m_thread.copyRef(), requestIdentifier, topOrigin = crossThreadCopy(WTFMove(topOrigin)), clientURL = crossThreadCopy(clientURL)]() mutable {
+ auto& connection = ServiceWorkerProvider::singleton().serviceWorkerConnection();
connection.matchRegistration(WTFMove(topOrigin), clientURL, [thread = WTFMove(thread), requestIdentifier](auto&& result) mutable {
thread->runLoop().postTaskForMode([requestIdentifier, result = WTFMove(result)] (auto& scope) mutable {
auto callback = downcast<WorkerGlobalScope>(scope).swClientConnection().m_matchRegistrationRequests.take(requestIdentifier);
@@ -81,8 +80,8 @@
uint64_t requestIdentifier = ++m_lastRequestIdentifier;
m_getRegistrationsRequests.add(requestIdentifier, WTFMove(callback));
- callOnMainThread([sessionID = m_sessionID, thread = m_thread.copyRef(), requestIdentifier, topOrigin = crossThreadCopy(WTFMove(topOrigin)), clientURL = crossThreadCopy(clientURL)]() mutable {
- auto& connection = ServiceWorkerProvider::singleton().serviceWorkerConnectionForSession(sessionID);
+ callOnMainThread([thread = m_thread.copyRef(), requestIdentifier, topOrigin = crossThreadCopy(WTFMove(topOrigin)), clientURL = crossThreadCopy(clientURL)]() mutable {
+ auto& connection = ServiceWorkerProvider::singleton().serviceWorkerConnection();
connection.getRegistrations(WTFMove(topOrigin), clientURL, [thread = WTFMove(thread), requestIdentifier](auto&& data) mutable {
thread->runLoop().postTaskForMode([requestIdentifier, data = "" (auto& scope) mutable {
auto callback = downcast<WorkerGlobalScope>(scope).swClientConnection().m_getRegistrationsRequests.take(requestIdentifier);
@@ -97,8 +96,8 @@
uint64_t requestIdentifier = ++m_lastRequestIdentifier;
m_whenRegistrationReadyRequests.add(requestIdentifier, WTFMove(callback));
- callOnMainThread([sessionID = m_sessionID, thread = m_thread.copyRef(), requestIdentifier, topOrigin = topOrigin.isolatedCopy(), clientURL = crossThreadCopy(clientURL)]() mutable {
- auto& connection = ServiceWorkerProvider::singleton().serviceWorkerConnectionForSession(sessionID);
+ callOnMainThread([thread = m_thread.copyRef(), requestIdentifier, topOrigin = topOrigin.isolatedCopy(), clientURL = crossThreadCopy(clientURL)]() mutable {
+ auto& connection = ServiceWorkerProvider::singleton().serviceWorkerConnection();
connection.whenRegistrationReady(topOrigin, clientURL, [thread = WTFMove(thread), requestIdentifier](auto&& result) mutable {
thread->runLoop().postTaskForMode([requestIdentifier, result = crossThreadCopy(WTFMove(result))] (auto& scope) mutable {
auto callback = downcast<WorkerGlobalScope>(scope).swClientConnection().m_whenRegistrationReadyRequests.take(requestIdentifier);
@@ -110,8 +109,8 @@
void WorkerSWClientConnection::addServiceWorkerRegistrationInServer(ServiceWorkerRegistrationIdentifier identifier)
{
- callOnMainThread([sessionID = m_sessionID, identifier]() mutable {
- auto& connection = ServiceWorkerProvider::singleton().serviceWorkerConnectionForSession(sessionID);
+ callOnMainThread([identifier]() mutable {
+ auto& connection = ServiceWorkerProvider::singleton().serviceWorkerConnection();
connection.addServiceWorkerRegistrationInServer(identifier);
});
}
@@ -118,8 +117,8 @@
void WorkerSWClientConnection::removeServiceWorkerRegistrationInServer(ServiceWorkerRegistrationIdentifier identifier)
{
- callOnMainThread([sessionID = m_sessionID, identifier]() mutable {
- auto& connection = ServiceWorkerProvider::singleton().serviceWorkerConnectionForSession(sessionID);
+ callOnMainThread([identifier]() mutable {
+ auto& connection = ServiceWorkerProvider::singleton().serviceWorkerConnection();
connection.removeServiceWorkerRegistrationInServer(identifier);
});
}
@@ -126,8 +125,8 @@
void WorkerSWClientConnection::didResolveRegistrationPromise(const ServiceWorkerRegistrationKey& key)
{
- callOnMainThread([sessionID = m_sessionID, key = crossThreadCopy(key)]() mutable {
- auto& connection = ServiceWorkerProvider::singleton().serviceWorkerConnectionForSession(sessionID);
+ callOnMainThread([key = crossThreadCopy(key)]() mutable {
+ auto& connection = ServiceWorkerProvider::singleton().serviceWorkerConnection();
connection.didResolveRegistrationPromise(key);
});
}
@@ -135,7 +134,7 @@
void WorkerSWClientConnection::postMessageToServiceWorker(ServiceWorkerIdentifier destination, MessageWithMessagePorts&& ports, const ServiceWorkerOrClientIdentifier& source)
{
callOnMainThreadAndWait([&] {
- auto& connection = ServiceWorkerProvider::singleton().serviceWorkerConnectionForSession(m_sessionID);
+ auto& connection = ServiceWorkerProvider::singleton().serviceWorkerConnection();
connection.postMessageToServiceWorker(destination, WTFMove(ports), source);
});
}
@@ -144,7 +143,7 @@
{
SWServerConnectionIdentifier identifier;
callOnMainThreadAndWait([&] {
- auto& connection = ServiceWorkerProvider::singleton().serviceWorkerConnectionForSession(m_sessionID);
+ auto& connection = ServiceWorkerProvider::singleton().serviceWorkerConnection();
identifier = connection.serverConnectionIdentifier();
});
return identifier;
@@ -158,8 +157,8 @@
void WorkerSWClientConnection::syncTerminateWorker(ServiceWorkerIdentifier identifier)
{
- callOnMainThread([sessionID = m_sessionID, identifier]() mutable {
- auto& connection = ServiceWorkerProvider::singleton().serviceWorkerConnectionForSession(sessionID);
+ callOnMainThread([identifier]() mutable {
+ auto& connection = ServiceWorkerProvider::singleton().serviceWorkerConnection();
connection.syncTerminateWorker(identifier);
});
}
@@ -166,8 +165,8 @@
void WorkerSWClientConnection::registerServiceWorkerClient(const SecurityOrigin& topOrigin, const ServiceWorkerClientData& data, const Optional<ServiceWorkerRegistrationIdentifier>& identifier, const String& userAgent)
{
- callOnMainThread([sessionID = m_sessionID, topOrigin = topOrigin.isolatedCopy(), data = "" identifier, userAgent = crossThreadCopy(userAgent)] {
- auto& connection = ServiceWorkerProvider::singleton().serviceWorkerConnectionForSession(sessionID);
+ callOnMainThread([topOrigin = topOrigin.isolatedCopy(), data = "" identifier, userAgent = crossThreadCopy(userAgent)] {
+ auto& connection = ServiceWorkerProvider::singleton().serviceWorkerConnection();
connection.registerServiceWorkerClient(topOrigin, data, identifier, userAgent);
});
}
@@ -179,8 +178,8 @@
void WorkerSWClientConnection::finishFetchingScriptInServer(const ServiceWorkerFetchResult& result)
{
- callOnMainThread([sessionID = m_sessionID, result = crossThreadCopy(result)]() mutable {
- auto& connection = ServiceWorkerProvider::singleton().serviceWorkerConnectionForSession(sessionID);
+ callOnMainThread([result = crossThreadCopy(result)]() mutable {
+ auto& connection = ServiceWorkerProvider::singleton().serviceWorkerConnection();
connection.finishFetchingScriptInServer(result);
});
}
@@ -196,8 +195,8 @@
void WorkerSWClientConnection::scheduleJob(DocumentOrWorkerIdentifier identifier, const ServiceWorkerJobData& data)
{
- callOnMainThread([sessionID = m_sessionID, identifier, data = "" mutable {
- auto& connection = ServiceWorkerProvider::singleton().serviceWorkerConnectionForSession(sessionID);
+ callOnMainThread([identifier, data = "" mutable {
+ auto& connection = ServiceWorkerProvider::singleton().serviceWorkerConnection();
connection.scheduleJob(identifier, data);
});
}
Modified: trunk/Source/WebCore/workers/service/WorkerSWClientConnection.h (250103 => 250104)
--- trunk/Source/WebCore/workers/service/WorkerSWClientConnection.h 2019-09-19 20:52:30 UTC (rev 250103)
+++ trunk/Source/WebCore/workers/service/WorkerSWClientConnection.h 2019-09-19 21:19:21 UTC (rev 250104)
@@ -60,7 +60,6 @@
void scheduleJobInServer(const ServiceWorkerJobData&) final;
void scheduleJob(DocumentOrWorkerIdentifier, const ServiceWorkerJobData&) final;
- PAL::SessionID m_sessionID;
Ref<WorkerThread> m_thread;
uint64_t m_lastRequestIdentifier { 0 };
Modified: trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.cpp (250103 => 250104)
--- trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.cpp 2019-09-19 20:52:30 UTC (rev 250103)
+++ trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.cpp 2019-09-19 21:19:21 UTC (rev 250104)
@@ -45,7 +45,6 @@
#include "WorkerObjectProxy.h"
#include <_javascript_Core/IdentifiersFactory.h>
#include <_javascript_Core/RuntimeFlags.h>
-#include <pal/SessionID.h>
#include <wtf/NeverDestroyed.h>
using namespace PAL;
@@ -72,8 +71,8 @@
// FIXME: Use a valid WorkerObjectProxy
// FIXME: Use valid runtime flags
-ServiceWorkerThread::ServiceWorkerThread(const ServiceWorkerContextData& data, PAL::SessionID, String&& userAgent, WorkerLoaderProxy& loaderProxy, WorkerDebuggerProxy& debuggerProxy, IDBClient::IDBConnectionProxy* idbConnectionProxy, SocketProvider* socketProvider)
- : WorkerThread(data.scriptURL, emptyString(), "serviceworker:" + Inspector::IdentifiersFactory::createIdentifier(), WTFMove(userAgent), platformStrategies()->loaderStrategy()->isOnLine(), data.script, loaderProxy, debuggerProxy, DummyServiceWorkerThreadProxy::shared(), WorkerThreadStartMode::Normal, data.contentSecurityPolicy, false, data.registration.key.topOrigin().securityOrigin().get(), MonotonicTime::now(), idbConnectionProxy, socketProvider, JSC::RuntimeFlags::createAllEnabled(), data.sessionID)
+ServiceWorkerThread::ServiceWorkerThread(const ServiceWorkerContextData& data, String&& userAgent, WorkerLoaderProxy& loaderProxy, WorkerDebuggerProxy& debuggerProxy, IDBClient::IDBConnectionProxy* idbConnectionProxy, SocketProvider* socketProvider)
+ : WorkerThread(data.scriptURL, emptyString(), "serviceworker:" + Inspector::IdentifiersFactory::createIdentifier(), WTFMove(userAgent), platformStrategies()->loaderStrategy()->isOnLine(), data.script, loaderProxy, debuggerProxy, DummyServiceWorkerThreadProxy::shared(), WorkerThreadStartMode::Normal, data.contentSecurityPolicy, false, data.registration.key.topOrigin().securityOrigin().get(), MonotonicTime::now(), idbConnectionProxy, socketProvider, JSC::RuntimeFlags::createAllEnabled())
, m_data(data.isolatedCopy())
, m_workerObjectProxy(DummyServiceWorkerThreadProxy::shared())
{
@@ -82,10 +81,10 @@
ServiceWorkerThread::~ServiceWorkerThread() = default;
-Ref<WorkerGlobalScope> ServiceWorkerThread::createWorkerGlobalScope(const URL& url, Ref<SecurityOrigin>&& origin, const String& name, const String& identifier, const String& userAgent, bool isOnline, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicy, bool shouldBypassMainWorldContentSecurityPolicy, Ref<SecurityOrigin>&& topOrigin, MonotonicTime timeOrigin, PAL::SessionID sessionID)
+Ref<WorkerGlobalScope> ServiceWorkerThread::createWorkerGlobalScope(const URL& url, Ref<SecurityOrigin>&& origin, const String& name, const String& identifier, const String& userAgent, bool isOnline, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicy, bool shouldBypassMainWorldContentSecurityPolicy, Ref<SecurityOrigin>&& topOrigin, MonotonicTime timeOrigin)
{
UNUSED_PARAM(name);
- return ServiceWorkerGlobalScope::create(m_data, url, WTFMove(origin), identifier, userAgent, isOnline, *this, contentSecurityPolicy, shouldBypassMainWorldContentSecurityPolicy, WTFMove(topOrigin), timeOrigin, idbConnectionProxy(), socketProvider(), sessionID);
+ return ServiceWorkerGlobalScope::create(m_data, url, WTFMove(origin), identifier, userAgent, isOnline, *this, contentSecurityPolicy, shouldBypassMainWorldContentSecurityPolicy, WTFMove(topOrigin), timeOrigin, idbConnectionProxy(), socketProvider());
}
void ServiceWorkerThread::runEventLoop()
Modified: trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.h (250103 => 250104)
--- trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.h 2019-09-19 20:52:30 UTC (rev 250103)
+++ trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.h 2019-09-19 21:19:21 UTC (rev 250104)
@@ -69,11 +69,11 @@
bool doesHandleFetch() const { return m_doesHandleFetch; }
protected:
- Ref<WorkerGlobalScope> createWorkerGlobalScope(const URL&, Ref<SecurityOrigin>&&, const String& name, const String& identifier, const String& userAgent, bool isOnline, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, Ref<SecurityOrigin>&& topOrigin, MonotonicTime timeOrigin, PAL::SessionID) final;
+ Ref<WorkerGlobalScope> createWorkerGlobalScope(const URL&, Ref<SecurityOrigin>&&, const String& name, const String& identifier, const String& userAgent, bool isOnline, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, Ref<SecurityOrigin>&& topOrigin, MonotonicTime timeOrigin) final;
void runEventLoop() override;
private:
- WEBCORE_EXPORT ServiceWorkerThread(const ServiceWorkerContextData&, PAL::SessionID, String&& userAgent, WorkerLoaderProxy&, WorkerDebuggerProxy&, IDBClient::IDBConnectionProxy*, SocketProvider*);
+ WEBCORE_EXPORT ServiceWorkerThread(const ServiceWorkerContextData&, String&& userAgent, WorkerLoaderProxy&, WorkerDebuggerProxy&, IDBClient::IDBConnectionProxy*, SocketProvider*);
bool isServiceWorkerThread() const final { return true; }
void finishedEvaluatingScript() final;
Modified: trunk/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp (250103 => 250104)
--- trunk/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp 2019-09-19 20:52:30 UTC (rev 250103)
+++ trunk/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp 2019-09-19 21:19:21 UTC (rev 250104)
@@ -38,7 +38,6 @@
#include "ServiceWorkerClientIdentifier.h"
#include "Settings.h"
#include "WorkerGlobalScope.h"
-#include <pal/SessionID.h>
#include <wtf/MainThread.h>
#include <wtf/RunLoop.h>
@@ -95,10 +94,10 @@
return set;
}
-ServiceWorkerThreadProxy::ServiceWorkerThreadProxy(PageConfiguration&& pageConfiguration, const ServiceWorkerContextData& data, PAL::SessionID sessionID, String&& userAgent, CacheStorageProvider& cacheStorageProvider, SecurityOrigin::StorageBlockingPolicy storageBlockingPolicy)
+ServiceWorkerThreadProxy::ServiceWorkerThreadProxy(PageConfiguration&& pageConfiguration, const ServiceWorkerContextData& data, String&& userAgent, CacheStorageProvider& cacheStorageProvider, SecurityOrigin::StorageBlockingPolicy storageBlockingPolicy)
: m_page(createPageForServiceWorker(WTFMove(pageConfiguration), data, storageBlockingPolicy))
, m_document(*m_page->mainFrame().document())
- , m_serviceWorkerThread(ServiceWorkerThread::create(data, sessionID, WTFMove(userAgent), *this, *this, idbConnectionProxy(m_document), m_document->socketProvider()))
+ , m_serviceWorkerThread(ServiceWorkerThread::create(data, WTFMove(userAgent), *this, *this, idbConnectionProxy(m_document), m_document->socketProvider()))
, m_cacheStorageProvider(cacheStorageProvider)
, m_inspectorProxy(*this)
{
Modified: trunk/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.h (250103 => 250104)
--- trunk/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.h 2019-09-19 20:52:30 UTC (rev 250103)
+++ trunk/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.h 2019-09-19 21:19:21 UTC (rev 250104)
@@ -77,7 +77,7 @@
WEBCORE_EXPORT void removeFetch(SWServerConnectionIdentifier, FetchIdentifier);
private:
- WEBCORE_EXPORT ServiceWorkerThreadProxy(PageConfiguration&&, const ServiceWorkerContextData&, PAL::SessionID, String&& userAgent, CacheStorageProvider&, SecurityOrigin::StorageBlockingPolicy);
+ WEBCORE_EXPORT ServiceWorkerThreadProxy(PageConfiguration&&, const ServiceWorkerContextData&, String&& userAgent, CacheStorageProvider&, SecurityOrigin::StorageBlockingPolicy);
WEBCORE_EXPORT static void networkStateChanged(bool isOnLine);
Modified: trunk/Source/WebCore/worklets/WorkletGlobalScope.h (250103 => 250104)
--- trunk/Source/WebCore/worklets/WorkletGlobalScope.h 2019-09-19 20:52:30 UTC (rev 250103)
+++ trunk/Source/WebCore/worklets/WorkletGlobalScope.h 2019-09-19 21:19:21 UTC (rev 250104)
@@ -120,7 +120,7 @@
bool unwrapCryptoKey(const Vector<uint8_t>&, Vector<uint8_t>&) final { RELEASE_ASSERT_NOT_REACHED(); return false; }
#endif
URL completeURL(const String&) const final;
- PAL::SessionID sessionID() const final { return m_sessionID; }
+ PAL::SessionID sessionID() const { return m_sessionID; }
String userAgent(const URL&) const final;
void disableEval(const String&) final;
void disableWebAssembly(const String&) final;
Modified: trunk/Source/WebCore/xml/DOMParser.cpp (250103 => 250104)
--- trunk/Source/WebCore/xml/DOMParser.cpp 2019-09-19 20:52:30 UTC (rev 250103)
+++ trunk/Source/WebCore/xml/DOMParser.cpp 2019-09-19 21:19:21 UTC (rev 250104)
@@ -34,11 +34,11 @@
return adoptRef(*new DOMParser(contextDocument));
}
-ExceptionOr<Ref<Document>> DOMParser::parseFromString(ScriptExecutionContext& context, const String& string, const String& contentType)
+ExceptionOr<Ref<Document>> DOMParser::parseFromString(Document& callingDocument, const String& string, const String& contentType)
{
if (contentType != "text/html" && contentType != "text/xml" && contentType != "application/xml" && contentType != "application/xhtml+xml" && contentType != "image/svg+xml")
return Exception { TypeError };
- auto document = DOMImplementation::createDocument(context.sessionID(), contentType, nullptr, URL { });
+ auto document = DOMImplementation::createDocument(callingDocument.sessionID(), contentType, nullptr, URL { });
if (m_contextDocument)
document->setContextDocument(*m_contextDocument.get());
document->setContent(string);
Modified: trunk/Source/WebCore/xml/DOMParser.h (250103 => 250104)
--- trunk/Source/WebCore/xml/DOMParser.h 2019-09-19 20:52:30 UTC (rev 250103)
+++ trunk/Source/WebCore/xml/DOMParser.h 2019-09-19 21:19:21 UTC (rev 250104)
@@ -24,12 +24,11 @@
namespace WebCore {
class Document;
-class ScriptExecutionContext;
class DOMParser : public RefCounted<DOMParser> {
public:
static Ref<DOMParser> create(Document& contextDocument);
- ExceptionOr<Ref<Document>> parseFromString(ScriptExecutionContext&, const String&, const String& contentType);
+ ExceptionOr<Ref<Document>> parseFromString(Document&, const String&, const String& contentType);
private:
explicit DOMParser(Document& contextDocument);
Modified: trunk/Source/WebCore/xml/DOMParser.idl (250103 => 250104)
--- trunk/Source/WebCore/xml/DOMParser.idl 2019-09-19 20:52:30 UTC (rev 250103)
+++ trunk/Source/WebCore/xml/DOMParser.idl 2019-09-19 21:19:21 UTC (rev 250104)
@@ -22,5 +22,5 @@
ConstructorCallWith=Document,
ImplementationLacksVTable,
] interface DOMParser {
- [MayThrowException, NewObject, CallWith=ScriptExecutionContext] Document parseFromString(DOMString string, DOMString contentType);
+ [MayThrowException, NewObject, CallWith=Document] Document parseFromString(DOMString string, DOMString contentType);
};
Modified: trunk/Source/WebCore/xml/XMLHttpRequest.cpp (250103 => 250104)
--- trunk/Source/WebCore/xml/XMLHttpRequest.cpp 2019-09-19 20:52:30 UTC (rev 250103)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.cpp 2019-09-19 21:19:21 UTC (rev 250104)
@@ -173,7 +173,7 @@
return nullptr;
if (!m_createdDocument) {
- auto& context = *scriptExecutionContext();
+ auto& context = downcast<Document>(*scriptExecutionContext());
String mimeType = responseMIMEType();
bool isHTML = equalLettersIgnoringASCIICase(mimeType, "text/html");
@@ -190,7 +190,7 @@
m_responseDocument = XMLDocument::create(context.sessionID(), nullptr, m_url);
m_responseDocument->overrideLastModified(m_response.lastModified());
m_responseDocument->setContent(m_responseBuilder.toStringPreserveCapacity());
- m_responseDocument->setContextDocument(downcast<Document>(context));
+ m_responseDocument->setContextDocument(context);
m_responseDocument->setSecurityOriginPolicy(context.securityOriginPolicy());
m_responseDocument->overrideMIMEType(mimeType);
Modified: trunk/Source/WebKit/ChangeLog (250103 => 250104)
--- trunk/Source/WebKit/ChangeLog 2019-09-19 20:52:30 UTC (rev 250103)
+++ trunk/Source/WebKit/ChangeLog 2019-09-19 21:19:21 UTC (rev 250104)
@@ -1,3 +1,24 @@
+2019-09-19 Chris Dumez <[email protected]>
+
+ WorkerGlobalScope does not need a SessionID
+ https://bugs.webkit.org/show_bug.cgi?id=201991
+
+ Reviewed by Alex Christensen.
+
+ WorkerGlobalScope does not need a SessionID, now that we have a single session
+ per WebProcess.
+
+ * WebProcess/Storage/WebSWContextManagerConnection.cpp:
+ (WebKit::WebSWContextManagerConnection::installServiceWorker):
+ * WebProcess/Storage/WebServiceWorkerProvider.cpp:
+ (WebKit::WebServiceWorkerProvider::serviceWorkerConnection):
+ (WebKit::WebServiceWorkerProvider::existingServiceWorkerConnection):
+ (WebKit::WebServiceWorkerProvider::serviceWorkerConnectionForSession): Deleted.
+ (WebKit::WebServiceWorkerProvider::existingServiceWorkerConnectionForSession): Deleted.
+ * WebProcess/Storage/WebServiceWorkerProvider.h:
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::updateThrottleState):
+
2019-09-19 Brent Fulgham <[email protected]>
Create InjectedBundle SPI to better support NSSecureCoding
Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp (250103 => 250104)
--- trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp 2019-09-19 20:52:30 UTC (rev 250103)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp 2019-09-19 21:19:21 UTC (rev 250104)
@@ -142,7 +142,7 @@
pageConfiguration.loaderClientForMainFrame = frameLoaderClient.get();
m_loaders.add(WTFMove(frameLoaderClient));
- auto serviceWorkerThreadProxy = ServiceWorkerThreadProxy::create(WTFMove(pageConfiguration), data, WebProcess::singleton().sessionID(), WTFMove(effectiveUserAgent), WebProcess::singleton().cacheStorageProvider(), m_storageBlockingPolicy);
+ auto serviceWorkerThreadProxy = ServiceWorkerThreadProxy::create(WTFMove(pageConfiguration), data, WTFMove(effectiveUserAgent), WebProcess::singleton().cacheStorageProvider(), m_storageBlockingPolicy);
SWContextManager::singleton().registerServiceWorkerThreadForInstall(WTFMove(serviceWorkerThreadProxy));
LOG(ServiceWorker, "Context process PID: %i created worker thread\n", getCurrentProcessID());
Modified: trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.cpp (250103 => 250104)
--- trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.cpp 2019-09-19 20:52:30 UTC (rev 250103)
+++ trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.cpp 2019-09-19 21:19:21 UTC (rev 250104)
@@ -54,15 +54,13 @@
{
}
-WebCore::SWClientConnection& WebServiceWorkerProvider::serviceWorkerConnectionForSession(SessionID sessionID)
+WebCore::SWClientConnection& WebServiceWorkerProvider::serviceWorkerConnection()
{
- ASSERT_UNUSED(sessionID, sessionID == WebProcess::singleton().sessionID());
return WebProcess::singleton().ensureNetworkProcessConnection().serviceWorkerConnection();
}
-WebCore::SWClientConnection* WebServiceWorkerProvider::existingServiceWorkerConnectionForSession(SessionID sessionID)
+WebCore::SWClientConnection* WebServiceWorkerProvider::existingServiceWorkerConnection()
{
- ASSERT_UNUSED(sessionID, sessionID == WebProcess::singleton().sessionID());
auto* networkProcessConnection = WebProcess::singleton().existingNetworkProcessConnection();
if (!networkProcessConnection)
return nullptr;
Modified: trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.h (250103 => 250104)
--- trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.h 2019-09-19 20:52:30 UTC (rev 250103)
+++ trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.h 2019-09-19 21:19:21 UTC (rev 250104)
@@ -52,8 +52,8 @@
friend NeverDestroyed<WebServiceWorkerProvider>;
WebServiceWorkerProvider();
- WebCore::SWClientConnection* existingServiceWorkerConnectionForSession(PAL::SessionID) final;
- WebCore::SWClientConnection& serviceWorkerConnectionForSession(PAL::SessionID) final;
+ WebCore::SWClientConnection* existingServiceWorkerConnection() final;
+ WebCore::SWClientConnection& serviceWorkerConnection() final;
HashMap<WebCore::FetchIdentifier, Ref<ServiceWorkerClientFetch>> m_ongoingFetchTasks;
}; // class WebServiceWorkerProvider
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (250103 => 250104)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2019-09-19 20:52:30 UTC (rev 250103)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2019-09-19 21:19:21 UTC (rev 250104)
@@ -788,8 +788,8 @@
m_userActivity.start();
#if ENABLE(SERVICE_WORKER)
- RunLoop::main().dispatch([isThrottleable, sessionID = sessionID()] {
- if (auto* connection = ServiceWorkerProvider::singleton().existingServiceWorkerConnectionForSession(sessionID)) {
+ RunLoop::main().dispatch([isThrottleable] {
+ if (auto* connection = ServiceWorkerProvider::singleton().existingServiceWorkerConnection()) {
if (isThrottleable != connection->isThrottleable())
connection->updateThrottleState();
}