Diff
Modified: trunk/Source/WTF/ChangeLog (224402 => 224403)
--- trunk/Source/WTF/ChangeLog 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WTF/ChangeLog 2017-11-03 16:37:04 UTC (rev 224403)
@@ -1,3 +1,27 @@
+2017-11-03 Chris Dumez <cdu...@apple.com>
+
+ Use a single identifier type to identify Service Workers
+ https://bugs.webkit.org/show_bug.cgi?id=179192
+
+ Reviewed by Brady Eidson.
+
+ Introduce class for strongly typed identifiers. This avoids mixing up
+ different types of identifiers.
+
+ * WTF.xcodeproj/project.pbxproj:
+ * wtf/ObjectIdentifier.h: Added.
+ (WTF::ObjectIdentifier::encode const):
+ (WTF::ObjectIdentifier::decode):
+ (WTF::ObjectIdentifier::operator== const):
+ (WTF::ObjectIdentifier::operator!= const):
+ (WTF::ObjectIdentifier::ObjectIdentifier):
+ (WTF::makeObjectIdentifier):
+ (WTF::ObjectIdentifierHash::hash):
+ (WTF::ObjectIdentifierHash::equal):
+ (WTF::HashTraits<ObjectIdentifier<T>>::emptyValue):
+ (WTF::HashTraits<ObjectIdentifier<T>>::constructDeletedValue):
+ (WTF::HashTraits<ObjectIdentifier<T>>::isDeletedValue):
+
2017-11-02 Ryan Haddad <ryanhad...@apple.com>
Unreviewed, rolling out r224353.
Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (224402 => 224403)
--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj 2017-11-03 16:37:04 UTC (rev 224403)
@@ -360,6 +360,7 @@
7E29C33D15FFD79B00516D61 /* ObjcRuntimeExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObjcRuntimeExtras.h; sourceTree = "<group>"; };
8134013615B092FD001FF0B8 /* Base64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Base64.cpp; sourceTree = "<group>"; };
8134013715B092FD001FF0B8 /* Base64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Base64.h; sourceTree = "<group>"; };
+ 83A8AC3D1FABBE94002064AC /* ObjectIdentifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObjectIdentifier.h; sourceTree = "<group>"; };
83F2BADE1CF9524E003E99C3 /* Function.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Function.h; sourceTree = "<group>"; };
83FBA93119DF459700F30ADB /* TypeCasts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TypeCasts.h; sourceTree = "<group>"; };
86F46F5F1A2840EE00CCBF22 /* RefCounter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RefCounter.h; sourceTree = "<group>"; };
@@ -906,6 +907,7 @@
A8A472D5151A825B004123FF /* NumberOfCores.cpp */,
A8A472D6151A825B004123FF /* NumberOfCores.h */,
7E29C33D15FFD79B00516D61 /* ObjcRuntimeExtras.h */,
+ 83A8AC3D1FABBE94002064AC /* ObjectIdentifier.h */,
1AFDE6521953B23D00C48FFA /* Optional.h */,
1A4656181C7FC68E00F5920F /* OptionSet.h */,
0F9495831C571CC900413A48 /* OrderMaker.h */,
Added: trunk/Source/WTF/wtf/ObjectIdentifier.h (0 => 224403)
--- trunk/Source/WTF/wtf/ObjectIdentifier.h (rev 0)
+++ trunk/Source/WTF/wtf/ObjectIdentifier.h 2017-11-03 16:37:04 UTC (rev 224403)
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <wtf/HashTraits.h>
+
+namespace WTF {
+
+template<typename T> class ObjectIdentifier {
+public:
+ ObjectIdentifier() = default;
+
+ ObjectIdentifier(HashTableDeletedValueType) : m_identifier(hashTableDeletedValue()) { }
+ bool isHashTableDeletedValue() const { return m_identifier == hashTableDeletedValue(); }
+
+ template<typename Encoder> void encode(Encoder& encoder) const
+ {
+ ASSERT(isValidIdentifier(m_identifier));
+ encoder << m_identifier;
+ }
+ template<typename Decoder> static std::optional<ObjectIdentifier> decode(Decoder& decoder)
+ {
+ std::optional<uint64_t> identifier;
+ decoder >> identifier;
+ if (!identifier)
+ return std::nullopt;
+ ASSERT(isValidIdentifier(*identifier));
+ return ObjectIdentifier { *identifier };
+ }
+
+ bool operator==(const ObjectIdentifier& other) const
+ {
+ return m_identifier == other.m_identifier;
+ }
+
+ bool operator!=(const ObjectIdentifier& other) const
+ {
+ return m_identifier != other.m_identifier;
+ }
+
+private:
+ template<typename U> friend ObjectIdentifier<U> makeObjectIdentifier(uint64_t);
+ friend struct HashTraits<ObjectIdentifier>;
+ template<typename U> friend struct ObjectIdentifierHash;
+
+ static uint64_t hashTableDeletedValue() { return std::numeric_limits<uint64_t>::max(); }
+ static bool isValidIdentifier(uint64_t identifier) { return identifier && identifier != hashTableDeletedValue(); }
+
+ explicit ObjectIdentifier(uint64_t identifier)
+ : m_identifier(identifier)
+ {
+ }
+
+ uint64_t m_identifier { 0 };
+};
+
+template<typename T> inline ObjectIdentifier<T> makeObjectIdentifier(uint64_t identifier)
+{
+ ASSERT(ObjectIdentifier<T>::isValidIdentifier(identifier));
+ return ObjectIdentifier<T> { identifier };
+}
+
+template<typename T> struct ObjectIdentifierHash {
+ static unsigned hash(const ObjectIdentifier<T>& identifier) { return intHash(identifier.m_identifier); }
+ static bool equal(const ObjectIdentifier<T>& a, const ObjectIdentifier<T>& b) { return a == b; }
+ static const bool safeToCompareToEmptyOrDeleted = true;
+};
+
+template<typename T> struct HashTraits<ObjectIdentifier<T>> : SimpleClassHashTraits<ObjectIdentifier<T>> { };
+
+template<typename T> struct DefaultHash<ObjectIdentifier<T>> {
+ typedef ObjectIdentifierHash<T> Hash;
+};
+
+} // namespace WTF
+
+using WTF::ObjectIdentifier;
+using WTF::makeObjectIdentifier;
Modified: trunk/Source/WebCore/ChangeLog (224402 => 224403)
--- trunk/Source/WebCore/ChangeLog 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebCore/ChangeLog 2017-11-03 16:37:04 UTC (rev 224403)
@@ -1,3 +1,67 @@
+2017-11-03 Chris Dumez <cdu...@apple.com>
+
+ Use a single identifier type to identify Service Workers
+ https://bugs.webkit.org/show_bug.cgi?id=179192
+
+ Reviewed by Brady Eidson.
+
+ Use a single identifier type to identify Service Workers. We had both a String
+ identifier and a uint64_t identifier for each service worker. We now consistently
+ use a ServiceWorkerIdentifier which is a strongly typed identifier backed by a
+ uint64_t.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * loader/ResourceLoaderOptions.h:
+ * loader/cache/CachedResourceRequest.cpp:
+ (WebCore::CachedResourceRequest::setSelectedServiceWorkerIdentifierIfNeeded):
+ * loader/cache/CachedResourceRequest.h:
+ * workers/service/ServiceWorker.cpp:
+ (WebCore::ServiceWorker::ServiceWorker):
+ * workers/service/ServiceWorker.h:
+ * workers/service/ServiceWorkerClient.cpp:
+ (WebCore::ServiceWorkerClient::postMessage):
+ * workers/service/ServiceWorkerContainer.cpp:
+ (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
+ * workers/service/ServiceWorkerContextData.cpp:
+ (WebCore::ServiceWorkerContextData::isolatedCopy const):
+ * workers/service/ServiceWorkerContextData.h:
+ (WebCore::ServiceWorkerContextData::encode const):
+ (WebCore::ServiceWorkerContextData::decode):
+ * workers/service/ServiceWorkerIdentifier.h: Copied from Source/WebCore/workers/service/ServiceWorkerContextData.cpp.
+ * workers/service/ServiceWorkerRegistrationData.h:
+ (WebCore::ServiceWorkerRegistrationData::decode):
+ * workers/service/context/SWContextManager.cpp:
+ (WebCore::SWContextManager::serviceWorkerThreadProxy const):
+ (WebCore::SWContextManager::postMessageToServiceWorkerGlobalScope):
+ * workers/service/context/SWContextManager.h:
+ * workers/service/context/ServiceWorkerThread.cpp:
+ (WebCore::ServiceWorkerThread::ServiceWorkerThread):
+ * workers/service/context/ServiceWorkerThread.h:
+ (WebCore::ServiceWorkerThread::identifier const):
+ * workers/service/context/ServiceWorkerThreadProxy.h:
+ * workers/service/server/SWClientConnection.cpp:
+ (WebCore::SWClientConnection::postMessageToServiceWorkerClient):
+ * workers/service/server/SWClientConnection.h:
+ * workers/service/server/SWServer.cpp:
+ (WebCore::generateServiceWorkerIdentifier):
+ (WebCore::SWServer::Connection::scriptContextFailedToStart):
+ (WebCore::SWServer::Connection::scriptContextStarted):
+ (WebCore::SWServer::scriptContextFailedToStart):
+ (WebCore::SWServer::scriptContextStarted):
+ (WebCore::SWServer::updateWorker):
+ * workers/service/server/SWServer.h:
+ * workers/service/server/SWServerJobQueue.cpp:
+ (WebCore::SWServerJobQueue::scriptContextFailedToStart):
+ (WebCore::SWServerJobQueue::scriptContextStarted):
+ * workers/service/server/SWServerJobQueue.h:
+ * workers/service/server/SWServerRegistration.h:
+ (WebCore::SWServerRegistration::setActiveServiceWorkerIdentifier):
+ * workers/service/server/SWServerWorker.cpp:
+ (WebCore::SWServerWorker::SWServerWorker):
+ * workers/service/server/SWServerWorker.h:
+ (WebCore::SWServerWorker::create):
+ (WebCore::SWServerWorker::identifier const):
+
2017-11-02 Andy Estes <aes...@apple.com>
[Payment Request] show() should only be called with user activation
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (224402 => 224403)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2017-11-03 16:37:04 UTC (rev 224403)
@@ -2210,6 +2210,7 @@
839947101F50B6FA00E9D86B /* JSDOMFileSystem.h in Headers */ = {isa = PBXBuildFile; fileRef = 8399470E1F50B6F300E9D86B /* JSDOMFileSystem.h */; };
839A2F2E1E204A710039057E /* WebGLStateTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 839A2F2C1E204A6D0039057E /* WebGLStateTracker.h */; settings = {ATTRIBUTES = (Private, ); }; };
839AAFED1A0C0C8D00605F99 /* HTMLWBRElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 839AAFEB1A0C0C8D00605F99 /* HTMLWBRElement.h */; };
+ 83A8AC401FABBFE5002064AC /* ServiceWorkerIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 83A8AC3E1FABBFD1002064AC /* ServiceWorkerIdentifier.h */; settings = {ATTRIBUTES = (Private, ); }; };
83B2D1751B8BCD6A00A02E47 /* NativeNodeFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 83E959E11B8BC22B004D9385 /* NativeNodeFilter.h */; settings = {ATTRIBUTES = (Private, ); }; };
83B74EF61F3E0BF200996BC7 /* KeepaliveRequestTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 83B74EF31F3E0BD700996BC7 /* KeepaliveRequestTracker.h */; settings = {ATTRIBUTES = (Private, ); }; };
83B9687B19F8AB83004EF7AF /* StyleBuilderConverter.h in Headers */ = {isa = PBXBuildFile; fileRef = 83B9687919F8AB83004EF7AF /* StyleBuilderConverter.h */; };
@@ -9470,6 +9471,7 @@
839AAFEA1A0C0C8D00605F99 /* HTMLWBRElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLWBRElement.cpp; sourceTree = "<group>"; };
839AAFEB1A0C0C8D00605F99 /* HTMLWBRElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLWBRElement.h; sourceTree = "<group>"; };
83A4A9F81CE7FD7E00709B00 /* JSXMLDocumentCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSXMLDocumentCustom.cpp; sourceTree = "<group>"; };
+ 83A8AC3E1FABBFD1002064AC /* ServiceWorkerIdentifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ServiceWorkerIdentifier.h; sourceTree = "<group>"; };
83B250091FA1181C00BC02D9 /* JSServiceWorkerClientType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSServiceWorkerClientType.h; sourceTree = "<group>"; };
83B2500B1FA1181D00BC02D9 /* JSServiceWorkerClientType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSServiceWorkerClientType.cpp; sourceTree = "<group>"; };
83B5DA451FA9079300B59DF4 /* JSNavigatorCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSNavigatorCustom.cpp; sourceTree = "<group>"; };
@@ -17252,6 +17254,7 @@
51F175551F3EBC0C00C74950 /* ServiceWorkerGlobalScope.cpp */,
51F175541F3EBC0C00C74950 /* ServiceWorkerGlobalScope.h */,
51F175531F3EBC0C00C74950 /* ServiceWorkerGlobalScope.idl */,
+ 83A8AC3E1FABBFD1002064AC /* ServiceWorkerIdentifier.h */,
51F175521F3EBC0C00C74950 /* ServiceWorkerJob.cpp */,
51F175511F3EBC0C00C74950 /* ServiceWorkerJob.h */,
51F175501F3EBC0C00C74950 /* ServiceWorkerJobClient.h */,
@@ -28897,6 +28900,7 @@
419ACF921F97E7DA009F1A83 /* ServiceWorkerFetch.h in Headers */,
517A535D1F5899FE00DCDC0A /* ServiceWorkerFetchResult.h in Headers */,
51F175611F3EBC8300C74950 /* ServiceWorkerGlobalScope.h in Headers */,
+ 83A8AC401FABBFE5002064AC /* ServiceWorkerIdentifier.h in Headers */,
A52B34961FA3E290008B6246 /* ServiceWorkerInspectorProxy.h in Headers */,
51F175631F3EBC8300C74950 /* ServiceWorkerJob.h in Headers */,
51F175641F3EBC8300C74950 /* ServiceWorkerJobClient.h in Headers */,
Modified: trunk/Source/WebCore/loader/ResourceLoaderOptions.h (224402 => 224403)
--- trunk/Source/WebCore/loader/ResourceLoaderOptions.h 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebCore/loader/ResourceLoaderOptions.h 2017-11-03 16:37:04 UTC (rev 224403)
@@ -31,6 +31,7 @@
#pragma once
#include "FetchOptions.h"
+#include "ServiceWorkerIdentifier.h"
#include "StoredCredentialsPolicy.h"
#include <wtf/Vector.h>
#include <wtf/text/WTFString.h>
@@ -136,7 +137,9 @@
SameOriginDataURLFlag sameOriginDataURLFlag { SameOriginDataURLFlag::Unset };
InitiatorContext initiatorContext { InitiatorContext::Document };
ServiceWorkersMode serviceWorkersMode { ServiceWorkersMode::All };
- uint64_t serviceWorkerIdentifier { 0 };
+#if ENABLE(SERVICE_WORKER)
+ std::optional<ServiceWorkerIdentifier> serviceWorkerIdentifier;
+#endif
ClientCredentialPolicy clientCredentialPolicy { ClientCredentialPolicy::CannotAskClientForCredentials };
unsigned maxRedirectCount { 20 };
Modified: trunk/Source/WebCore/loader/cache/CachedResourceRequest.cpp (224402 => 224403)
--- trunk/Source/WebCore/loader/cache/CachedResourceRequest.cpp 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebCore/loader/cache/CachedResourceRequest.cpp 2017-11-03 16:37:04 UTC (rev 224403)
@@ -274,7 +274,7 @@
}
#if ENABLE(SERVICE_WORKER)
-void CachedResourceRequest::setSelectedServiceWorkerIdentifierIfNeeded(uint64_t serviceWorkerIdentifier)
+void CachedResourceRequest::setSelectedServiceWorkerIdentifierIfNeeded(ServiceWorkerIdentifier identifier)
{
if (isNonSubresourceRequest(m_options.destination))
return;
@@ -286,7 +286,7 @@
if (m_options.serviceWorkerIdentifier)
return;
- m_options.serviceWorkerIdentifier = serviceWorkerIdentifier;
+ m_options.serviceWorkerIdentifier = identifier;
}
#endif
Modified: trunk/Source/WebCore/loader/cache/CachedResourceRequest.h (224402 => 224403)
--- trunk/Source/WebCore/loader/cache/CachedResourceRequest.h 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebCore/loader/cache/CachedResourceRequest.h 2017-11-03 16:37:04 UTC (rev 224403)
@@ -31,6 +31,7 @@
#include "ResourceLoaderOptions.h"
#include "ResourceRequest.h"
#include "SecurityOrigin.h"
+#include "ServiceWorkerIdentifier.h"
#include <wtf/RefPtr.h>
#include <wtf/text/AtomicString.h>
@@ -96,7 +97,7 @@
static String splitFragmentIdentifierFromRequestURL(ResourceRequest&);
#if ENABLE(SERVICE_WORKER)
- void setSelectedServiceWorkerIdentifierIfNeeded(uint64_t serviceWorkerIdentifier);
+ void setSelectedServiceWorkerIdentifierIfNeeded(ServiceWorkerIdentifier);
#endif
private:
Modified: trunk/Source/WebCore/workers/service/ServiceWorker.cpp (224402 => 224403)
--- trunk/Source/WebCore/workers/service/ServiceWorker.cpp 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebCore/workers/service/ServiceWorker.cpp 2017-11-03 16:37:04 UTC (rev 224403)
@@ -38,9 +38,9 @@
namespace WebCore {
-ServiceWorker::ServiceWorker(ScriptExecutionContext& context, uint64_t serviceWorkerIdentifier, const URL& scriptURL)
+ServiceWorker::ServiceWorker(ScriptExecutionContext& context, ServiceWorkerIdentifier identifier, const URL& scriptURL)
: ContextDestructionObserver(&context)
- , m_identifier(serviceWorkerIdentifier)
+ , m_identifier(identifier)
, m_scriptURL(scriptURL)
{
}
Modified: trunk/Source/WebCore/workers/service/ServiceWorker.h (224402 => 224403)
--- trunk/Source/WebCore/workers/service/ServiceWorker.h 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebCore/workers/service/ServiceWorker.h 2017-11-03 16:37:04 UTC (rev 224403)
@@ -29,6 +29,7 @@
#include "ContextDestructionObserver.h"
#include "EventTarget.h"
+#include "ServiceWorkerIdentifier.h"
#include "URL.h"
#include <heap/Strong.h>
#include <wtf/RefCounted.h>
@@ -43,9 +44,9 @@
class ServiceWorker final : public RefCounted<ServiceWorker>, public EventTargetWithInlineData, public ContextDestructionObserver {
public:
- static Ref<ServiceWorker> create(ScriptExecutionContext& context, uint64_t serviceWorkerIdentifier, const URL& scriptURL)
+ static Ref<ServiceWorker> create(ScriptExecutionContext& context, ServiceWorkerIdentifier identifier, const URL& scriptURL)
{
- return adoptRef(*new ServiceWorker(context, serviceWorkerIdentifier, scriptURL));
+ return adoptRef(*new ServiceWorker(context, identifier, scriptURL));
}
virtual ~ServiceWorker() = default;
@@ -65,13 +66,13 @@
ExceptionOr<void> postMessage(ScriptExecutionContext&, JSC::JSValue message, Vector<JSC::Strong<JSC::JSObject>>&&);
- uint64_t identifier() const { return m_identifier; }
+ ServiceWorkerIdentifier identifier() const { return m_identifier; }
using RefCounted::ref;
using RefCounted::deref;
private:
- ServiceWorker(ScriptExecutionContext&, uint64_t serviceWorkerIdentifier, const URL& scriptURL);
+ ServiceWorker(ScriptExecutionContext&, ServiceWorkerIdentifier, const URL& scriptURL);
virtual EventTargetInterface eventTargetInterface() const;
virtual ScriptExecutionContext* scriptExecutionContext() const;
@@ -78,7 +79,7 @@
void refEventTarget() final { ref(); }
void derefEventTarget() final { deref(); }
- uint64_t m_identifier;
+ ServiceWorkerIdentifier m_identifier;
URL m_scriptURL;
State m_state { State::Installing };
};
Modified: trunk/Source/WebCore/workers/service/ServiceWorkerClient.cpp (224402 => 224403)
--- trunk/Source/WebCore/workers/service/ServiceWorkerClient.cpp 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerClient.cpp 2017-11-03 16:37:04 UTC (rev 224403)
@@ -83,7 +83,7 @@
if (channels && !channels->isEmpty())
return Exception { NotSupportedError, ASCIILiteral("Passing MessagePort objects to postMessage is not yet supported") };
- uint64_t sourceIdentifier = downcast<ServiceWorkerGlobalScope>(context).thread().identifier();
+ auto sourceIdentifier = downcast<ServiceWorkerGlobalScope>(context).thread().identifier();
callOnMainThread([message = message.releaseReturnValue(), destinationIdentifier = m_identifier, sourceIdentifier, sourceOrigin = context.origin().isolatedCopy()] () mutable {
if (auto* connection = SWContextManager::singleton().connection())
connection->postMessageToServiceWorkerClient(destinationIdentifier, WTFMove(message), sourceIdentifier, sourceOrigin);
Modified: trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp (224402 => 224403)
--- trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp 2017-11-03 16:37:04 UTC (rev 224403)
@@ -244,8 +244,9 @@
// FIXME: Implement proper selection of service workers.
auto* activeServiceWorker = context->activeServiceWorker();
- if (!activeServiceWorker || activeServiceWorker->identifier() != data.activeServiceWorkerIdentifier) {
- context->setActiveServiceWorker(ServiceWorker::create(*context, data.activeServiceWorkerIdentifier, data.scriptURL));
+ ASSERT(data.activeServiceWorkerIdentifier);
+ if (!activeServiceWorker || activeServiceWorker->identifier() != *data.activeServiceWorkerIdentifier) {
+ context->setActiveServiceWorker(ServiceWorker::create(*context, *data.activeServiceWorkerIdentifier, data.scriptURL));
activeServiceWorker = context->activeServiceWorker();
}
Modified: trunk/Source/WebCore/workers/service/ServiceWorkerContextData.cpp (224402 => 224403)
--- trunk/Source/WebCore/workers/service/ServiceWorkerContextData.cpp 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerContextData.cpp 2017-11-03 16:37:04 UTC (rev 224403)
@@ -32,7 +32,7 @@
ServiceWorkerContextData ServiceWorkerContextData::isolatedCopy() const
{
- return { registrationKey.isolatedCopy(), workerID.isolatedCopy(), script.isolatedCopy(), scriptURL.isolatedCopy() };
+ return { registrationKey.isolatedCopy(), serviceWorkerIdentifier, script.isolatedCopy(), scriptURL.isolatedCopy() };
}
} // namespace WebCore
Modified: trunk/Source/WebCore/workers/service/ServiceWorkerContextData.h (224402 => 224403)
--- trunk/Source/WebCore/workers/service/ServiceWorkerContextData.h 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerContextData.h 2017-11-03 16:37:04 UTC (rev 224403)
@@ -25,6 +25,7 @@
#pragma once
+#include "ServiceWorkerIdentifier.h"
#include "ServiceWorkerRegistrationKey.h"
#include "URL.h"
@@ -34,7 +35,7 @@
struct ServiceWorkerContextData {
ServiceWorkerRegistrationKey registrationKey;
- String workerID;
+ ServiceWorkerIdentifier serviceWorkerIdentifier;
String script;
URL scriptURL;
@@ -47,7 +48,7 @@
template<class Encoder>
void ServiceWorkerContextData::encode(Encoder& encoder) const
{
- encoder << registrationKey << workerID << script << scriptURL;
+ encoder << registrationKey << serviceWorkerIdentifier << script << scriptURL;
}
template<class Decoder>
@@ -57,8 +58,8 @@
if (!registrationKey)
return std::nullopt;
- String workerID;
- if (!decoder.decode(workerID))
+ auto serviceWorkerIdentifier = ServiceWorkerIdentifier::decode(decoder);
+ if (!serviceWorkerIdentifier)
return std::nullopt;
String script;
@@ -69,7 +70,7 @@
if (!decoder.decode(scriptURL))
return std::nullopt;
- return {{ WTFMove(*registrationKey), WTFMove(workerID), WTFMove(script), WTFMove(scriptURL) }};
+ return {{ WTFMove(*registrationKey), WTFMove(*serviceWorkerIdentifier), WTFMove(script), WTFMove(scriptURL) }};
}
} // namespace WebCore
Copied: trunk/Source/WebCore/workers/service/ServiceWorkerIdentifier.h (from rev 224402, trunk/Source/WebCore/workers/service/ServiceWorkerContextData.cpp) (0 => 224403)
--- trunk/Source/WebCore/workers/service/ServiceWorkerIdentifier.h (rev 0)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerIdentifier.h 2017-11-03 16:37:04 UTC (rev 224403)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(SERVICE_WORKER)
+
+#include <wtf/ObjectIdentifier.h>
+
+namespace WebCore {
+
+enum ServiceWorkerIdentifierType { };
+using ServiceWorkerIdentifier = ObjectIdentifier<ServiceWorkerIdentifierType>;
+
+} // namespace WebCore
+
+#endif // ENABLE(SERVICE_WORKER)
Modified: trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.cpp (224402 => 224403)
--- trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.cpp 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.cpp 2017-11-03 16:37:04 UTC (rev 224403)
@@ -106,11 +106,11 @@
container->removeRegistration(m_registrationData.scopeURL, WTFMove(promise));
}
-void ServiceWorkerRegistration::updateStateFromServer(ServiceWorkerRegistrationState state, const String& workerID)
+void ServiceWorkerRegistration::updateStateFromServer(ServiceWorkerRegistrationState state, std::optional<ServiceWorkerIdentifier> serviceWorkerIdentifier)
{
// FIXME: Implement here along with "Update Worker State" algorithm
UNUSED_PARAM(state);
- UNUSED_PARAM(workerID);
+ UNUSED_PARAM(serviceWorkerIdentifier);
}
EventTargetInterface ServiceWorkerRegistration::eventTargetInterface() const
Modified: trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.h (224402 => 224403)
--- trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.h 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.h 2017-11-03 16:37:04 UTC (rev 224403)
@@ -63,7 +63,7 @@
const ServiceWorkerRegistrationData& data() const { return m_registrationData; }
- void updateStateFromServer(ServiceWorkerRegistrationState, const String& workerID);
+ void updateStateFromServer(ServiceWorkerRegistrationState, std::optional<ServiceWorkerIdentifier>);
private:
ServiceWorkerRegistration(ScriptExecutionContext&, SWClientConnection&, ServiceWorkerRegistrationData&&, Ref<ServiceWorker>&&);
Modified: trunk/Source/WebCore/workers/service/ServiceWorkerRegistrationData.h (224402 => 224403)
--- trunk/Source/WebCore/workers/service/ServiceWorkerRegistrationData.h 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerRegistrationData.h 2017-11-03 16:37:04 UTC (rev 224403)
@@ -27,6 +27,7 @@
#if ENABLE(SERVICE_WORKER)
+#include "ServiceWorkerIdentifier.h"
#include "ServiceWorkerRegistrationKey.h"
namespace WebCore {
@@ -36,7 +37,7 @@
struct ServiceWorkerRegistrationData {
ServiceWorkerRegistrationKey key;
uint64_t identifier;
- uint64_t activeServiceWorkerIdentifier; // FIXME: This should not be part of registrationData.
+ std::optional<ServiceWorkerIdentifier> activeServiceWorkerIdentifier; // FIXME: This should not be part of registrationData.
URL scopeURL;
URL scriptURL;
ServiceWorkerUpdateViaCache updateViaCache;
@@ -67,7 +68,8 @@
if (!identifier)
return std::nullopt;
- std::optional<uint64_t> activeServiceWorkerIdentifier;
+
+ std::optional<std::optional<ServiceWorkerIdentifier>> activeServiceWorkerIdentifier;
decoder >> activeServiceWorkerIdentifier;
if (!activeServiceWorkerIdentifier)
return std::nullopt;
Modified: trunk/Source/WebCore/workers/service/context/SWContextManager.cpp (224402 => 224403)
--- trunk/Source/WebCore/workers/service/context/SWContextManager.cpp 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebCore/workers/service/context/SWContextManager.cpp 2017-11-03 16:37:04 UTC (rev 224403)
@@ -59,14 +59,14 @@
});
}
-ServiceWorkerThreadProxy* SWContextManager::serviceWorkerThreadProxy(uint64_t serviceWorkerIdentifier) const
+ServiceWorkerThreadProxy* SWContextManager::serviceWorkerThreadProxy(ServiceWorkerIdentifier identifier) const
{
- return m_workerMap.get(serviceWorkerIdentifier);
+ return m_workerMap.get(identifier);
}
-void SWContextManager::postMessageToServiceWorkerGlobalScope(uint64_t destinationServiceWorkerIdentifier, Ref<SerializedScriptValue>&& message, const ServiceWorkerClientIdentifier& sourceIdentifier, const String& sourceOrigin)
+void SWContextManager::postMessageToServiceWorkerGlobalScope(ServiceWorkerIdentifier destination, Ref<SerializedScriptValue>&& message, const ServiceWorkerClientIdentifier& sourceIdentifier, const String& sourceOrigin)
{
- auto* serviceWorker = m_workerMap.get(destinationServiceWorkerIdentifier);
+ auto* serviceWorker = m_workerMap.get(destination);
if (!serviceWorker)
return;
Modified: trunk/Source/WebCore/workers/service/context/SWContextManager.h (224402 => 224403)
--- trunk/Source/WebCore/workers/service/context/SWContextManager.h 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebCore/workers/service/context/SWContextManager.h 2017-11-03 16:37:04 UTC (rev 224403)
@@ -28,6 +28,7 @@
#if ENABLE(SERVICE_WORKER)
#include "ExceptionOr.h"
+#include "ServiceWorkerIdentifier.h"
#include "ServiceWorkerThreadProxy.h"
#include <wtf/HashMap.h>
@@ -44,8 +45,8 @@
public:
virtual ~Connection() { }
- virtual void postMessageToServiceWorkerClient(const ServiceWorkerClientIdentifier& destinationIdentifier, Ref<SerializedScriptValue>&& message, uint64_t sourceServiceWorkerIdentifier, const String& sourceOrigin) = 0;
- virtual void serviceWorkerStartedWithMessage(uint64_t serviceWorkerIdentifier, const String& exceptionMessage) = 0;
+ virtual void postMessageToServiceWorkerClient(const ServiceWorkerClientIdentifier& destinationIdentifier, Ref<SerializedScriptValue>&& message, ServiceWorkerIdentifier source, const String& sourceOrigin) = 0;
+ virtual void serviceWorkerStartedWithMessage(ServiceWorkerIdentifier, const String& exceptionMessage) = 0;
};
WEBCORE_EXPORT void setConnection(std::unique_ptr<Connection>&&);
@@ -52,13 +53,13 @@
WEBCORE_EXPORT Connection* connection() const;
WEBCORE_EXPORT void registerServiceWorkerThreadForUpdate(Ref<ServiceWorkerThreadProxy>&&);
- WEBCORE_EXPORT ServiceWorkerThreadProxy* serviceWorkerThreadProxy(uint64_t) const;
- WEBCORE_EXPORT void postMessageToServiceWorkerGlobalScope(uint64_t destinationServiceWorkerIdentifier, Ref<SerializedScriptValue>&& message, const ServiceWorkerClientIdentifier& sourceIdentifier, const String& sourceOrigin);
+ WEBCORE_EXPORT ServiceWorkerThreadProxy* serviceWorkerThreadProxy(ServiceWorkerIdentifier) const;
+ WEBCORE_EXPORT void postMessageToServiceWorkerGlobalScope(ServiceWorkerIdentifier destination, Ref<SerializedScriptValue>&& message, const ServiceWorkerClientIdentifier& sourceIdentifier, const String& sourceOrigin);
private:
SWContextManager() = default;
- HashMap<uint64_t, RefPtr<ServiceWorkerThreadProxy>> m_workerMap;
+ HashMap<ServiceWorkerIdentifier, RefPtr<ServiceWorkerThreadProxy>> m_workerMap;
std::unique_ptr<Connection> m_connection;
};
Modified: trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.cpp (224402 => 224403)
--- trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.cpp 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.cpp 2017-11-03 16:37:04 UTC (rev 224403)
@@ -38,6 +38,7 @@
#include "WorkerDebuggerProxy.h"
#include "WorkerLoaderProxy.h"
#include "WorkerObjectProxy.h"
+#include <inspector/IdentifiersFactory.h>
#include <pal/SessionID.h>
#include <runtime/RuntimeFlags.h>
#include <wtf/NeverDestroyed.h>
@@ -71,7 +72,7 @@
// FIXME: Use valid runtime flags
ServiceWorkerThread::ServiceWorkerThread(uint64_t serverConnectionIdentifier, const ServiceWorkerContextData& data, PAL::SessionID, WorkerLoaderProxy& loaderProxy, WorkerDebuggerProxy& debuggerProxy)
- : WorkerThread(data.scriptURL, data.workerID, ASCIILiteral("WorkerUserAgent"), /* isOnline */ false, data.script, loaderProxy, debuggerProxy, DummyServiceWorkerThreadProxy::shared(), WorkerThreadStartMode::Normal, ContentSecurityPolicyResponseHeaders { }, false, SecurityOrigin::create(data.scriptURL).get(), MonotonicTime::now(), nullptr, nullptr, JSC::RuntimeFlags::createAllEnabled(), SessionID::defaultSessionID())
+ : WorkerThread(data.scriptURL, "serviceworker:" + Inspector::IdentifiersFactory::createIdentifier(), ASCIILiteral("WorkerUserAgent"), /* isOnline */ false, data.script, loaderProxy, debuggerProxy, DummyServiceWorkerThreadProxy::shared(), WorkerThreadStartMode::Normal, ContentSecurityPolicyResponseHeaders { }, false, SecurityOrigin::create(data.scriptURL).get(), MonotonicTime::now(), nullptr, nullptr, JSC::RuntimeFlags::createAllEnabled(), SessionID::defaultSessionID())
, m_serverConnectionIdentifier(serverConnectionIdentifier)
, m_data(data.isolatedCopy())
, m_workerObjectProxy(DummyServiceWorkerThreadProxy::shared())
Modified: trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.h (224402 => 224403)
--- trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.h 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.h 2017-11-03 16:37:04 UTC (rev 224403)
@@ -29,8 +29,8 @@
#include "ServiceWorkerContextData.h"
#include "ServiceWorkerFetch.h"
+#include "ServiceWorkerIdentifier.h"
#include "WorkerThread.h"
-#include <wtf/Identified.h>
namespace WebCore {
@@ -44,7 +44,7 @@
using MessagePortChannelArray = Vector<std::unique_ptr<MessagePortChannel>, 1>;
-class ServiceWorkerThread : public WorkerThread, public ThreadSafeIdentified<ServiceWorkerThread> {
+class ServiceWorkerThread : public WorkerThread {
public:
template<typename... Args> static Ref<ServiceWorkerThread> create(Args&&... args)
{
@@ -60,6 +60,8 @@
uint64_t serverConnectionIdentifier() const { return m_serverConnectionIdentifier; }
const ServiceWorkerContextData& contextData() const { return m_data; }
+ ServiceWorkerIdentifier identifier() const { return m_data.serviceWorkerIdentifier; }
+
protected:
Ref<WorkerGlobalScope> createWorkerGlobalScope(const URL&, const String& identifier, const String& userAgent, bool isOnline, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, Ref<SecurityOrigin>&& topOrigin, MonotonicTime timeOrigin, PAL::SessionID) final;
void runEventLoop() override;
Modified: trunk/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.h (224402 => 224403)
--- trunk/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.h 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.h 2017-11-03 16:37:04 UTC (rev 224403)
@@ -31,6 +31,7 @@
#include "Document.h"
#include "Page.h"
#include "ServiceWorkerDebuggable.h"
+#include "ServiceWorkerIdentifier.h"
#include "ServiceWorkerInspectorProxy.h"
#include "ServiceWorkerThread.h"
#include "WorkerDebuggerProxy.h"
@@ -48,7 +49,7 @@
public:
WEBCORE_EXPORT static Ref<ServiceWorkerThreadProxy> create(PageConfiguration&&, uint64_t serverConnectionIdentifier, const ServiceWorkerContextData&, PAL::SessionID, CacheStorageProvider&);
- uint64_t identifier() const { return m_serviceWorkerThread->identifier(); }
+ ServiceWorkerIdentifier identifier() const { return m_serviceWorkerThread->identifier(); }
ServiceWorkerThread& thread() { return m_serviceWorkerThread.get(); }
ServiceWorkerInspectorProxy& inspectorProxy() { return m_inspectorProxy; }
Modified: trunk/Source/WebCore/workers/service/server/SWClientConnection.cpp (224402 => 224403)
--- trunk/Source/WebCore/workers/service/server/SWClientConnection.cpp 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebCore/workers/service/server/SWClientConnection.cpp 2017-11-03 16:37:04 UTC (rev 224403)
@@ -139,7 +139,7 @@
job->startScriptFetch();
}
-void SWClientConnection::postMessageToServiceWorkerClient(uint64_t destinationScriptExecutionContextIdentifier, Ref<SerializedScriptValue>&& message, uint64_t sourceServiceWorkerIdentifier, const String& sourceOrigin)
+void SWClientConnection::postMessageToServiceWorkerClient(uint64_t destinationScriptExecutionContextIdentifier, Ref<SerializedScriptValue>&& message, ServiceWorkerIdentifier sourceIdentifier, const String& sourceOrigin)
{
// FIXME: destinationScriptExecutionContextIdentifier can only identify a Document at the moment.
auto* destinationDocument = Document::allDocumentsMap().get(destinationScriptExecutionContextIdentifier);
@@ -152,11 +152,11 @@
std::optional<MessageEventSource> source;
auto* activeServiceWorker = destinationDocument->activeServiceWorker();
- if (activeServiceWorker && activeServiceWorker->identifier() == sourceServiceWorkerIdentifier)
+ if (activeServiceWorker && activeServiceWorker->identifier() == sourceIdentifier)
source = MessageEventSource { RefPtr<ServiceWorker> { activeServiceWorker } };
else {
// FIXME: Pass in valid scriptURL.
- source = MessageEventSource { RefPtr<ServiceWorker> { ServiceWorker::create(*destinationDocument, sourceServiceWorkerIdentifier, URL()) } };
+ source = MessageEventSource { RefPtr<ServiceWorker> { ServiceWorker::create(*destinationDocument, sourceIdentifier, URL()) } };
}
// FIXME: We should pass in ports.
@@ -164,7 +164,7 @@
container->dispatchEvent(messageEvent);
}
-void SWClientConnection::updateRegistrationState(const ServiceWorkerRegistrationKey& key, ServiceWorkerRegistrationState state, const String& workerID)
+void SWClientConnection::updateRegistrationState(const ServiceWorkerRegistrationKey& key, ServiceWorkerRegistrationState state, std::optional<ServiceWorkerIdentifier> serviceWorkerIdentifier)
{
auto* registrations = m_registrations.get(key);
if (!registrations)
@@ -171,7 +171,7 @@
return;
for (auto& registration : *registrations)
- registration->updateStateFromServer(state, workerID);
+ registration->updateStateFromServer(state, serviceWorkerIdentifier);
}
} // namespace WebCore
Modified: trunk/Source/WebCore/workers/service/server/SWClientConnection.h (224402 => 224403)
--- trunk/Source/WebCore/workers/service/server/SWClientConnection.h 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebCore/workers/service/server/SWClientConnection.h 2017-11-03 16:37:04 UTC (rev 224403)
@@ -53,7 +53,7 @@
void addServiceWorkerRegistration(ServiceWorkerRegistration&);
void removeServiceWorkerRegistration(ServiceWorkerRegistration&);
- virtual void postMessageToServiceWorkerGlobalScope(uint64_t destinationServiceWorkerIdentifier, Ref<SerializedScriptValue>&&, ScriptExecutionContext& source) = 0;
+ virtual void postMessageToServiceWorkerGlobalScope(ServiceWorkerIdentifier destinationIdentifier, Ref<SerializedScriptValue>&&, ScriptExecutionContext& source) = 0;
virtual uint64_t identifier() const = 0;
virtual bool hasServiceWorkerRegisteredForOrigin(const SecurityOrigin&) const = 0;
@@ -64,8 +64,8 @@
WEBCORE_EXPORT void registrationJobResolvedInServer(uint64_t jobIdentifier, ServiceWorkerRegistrationData&&);
WEBCORE_EXPORT void unregistrationJobResolvedInServer(uint64_t jobIdentifier, bool unregistrationResult);
WEBCORE_EXPORT void startScriptFetchForServer(uint64_t jobIdentifier);
- WEBCORE_EXPORT void postMessageToServiceWorkerClient(uint64_t destinationScriptExecutionContextIdentifier, Ref<SerializedScriptValue>&& message, uint64_t sourceServiceWorkerIdentifier, const String& sourceOrigin);
- WEBCORE_EXPORT void updateRegistrationState(const ServiceWorkerRegistrationKey&, ServiceWorkerRegistrationState, const String& workerID);
+ WEBCORE_EXPORT void postMessageToServiceWorkerClient(uint64_t destinationScriptExecutionContextIdentifier, Ref<SerializedScriptValue>&& message, ServiceWorkerIdentifier source, const String& sourceOrigin);
+ WEBCORE_EXPORT void updateRegistrationState(const ServiceWorkerRegistrationKey&, ServiceWorkerRegistrationState, std::optional<ServiceWorkerIdentifier>);
private:
virtual void scheduleJobInServer(const ServiceWorkerJobData&) = 0;
Modified: trunk/Source/WebCore/workers/service/server/SWServer.cpp (224402 => 224403)
--- trunk/Source/WebCore/workers/service/server/SWServer.cpp 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebCore/workers/service/server/SWServer.cpp 2017-11-03 16:37:04 UTC (rev 224403)
@@ -37,11 +37,16 @@
#include "ServiceWorkerContextData.h"
#include "ServiceWorkerFetchResult.h"
#include "ServiceWorkerJobData.h"
-#include <wtf/UUID.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
+static ServiceWorkerIdentifier generateServiceWorkerIdentifier()
+{
+ static uint64_t identifier = 0;
+ return makeObjectIdentifier<ServiceWorkerIdentifierType>(++identifier);
+}
+
SWServer::Connection::Connection(SWServer& server, uint64_t identifier)
: Identified(identifier)
, m_server(server)
@@ -109,14 +114,14 @@
m_server.removeClientServiceWorkerRegistration(*this, key, clientRegistrationIdentifier);
}
-void SWServer::Connection::scriptContextFailedToStart(const ServiceWorkerRegistrationKey& registrationKey, const String& workerID, const String& message)
+void SWServer::Connection::scriptContextFailedToStart(const ServiceWorkerRegistrationKey& registrationKey, ServiceWorkerIdentifier identifier, const String& message)
{
- m_server.scriptContextFailedToStart(*this, registrationKey, workerID, message);
+ m_server.scriptContextFailedToStart(*this, registrationKey, identifier, message);
}
-void SWServer::Connection::scriptContextStarted(const ServiceWorkerRegistrationKey& registrationKey, uint64_t serviceWorkerIdentifier, const String& workerID)
+void SWServer::Connection::scriptContextStarted(const ServiceWorkerRegistrationKey& registrationKey, ServiceWorkerIdentifier identifier)
{
- m_server.scriptContextStarted(*this, registrationKey, serviceWorkerIdentifier, workerID);
+ m_server.scriptContextStarted(*this, registrationKey, identifier);
}
SWServer::SWServer()
@@ -195,20 +200,20 @@
jobQueue->scriptFetchFinished(connection, result);
}
-void SWServer::scriptContextFailedToStart(Connection& connection, const ServiceWorkerRegistrationKey& registrationKey, const String& workerID, const String& message)
+void SWServer::scriptContextFailedToStart(Connection& connection, const ServiceWorkerRegistrationKey& registrationKey, ServiceWorkerIdentifier identifier, const String& message)
{
ASSERT(m_connections.contains(connection.identifier()));
if (auto* jobQueue = m_jobQueues.get(registrationKey))
- jobQueue->scriptContextFailedToStart(connection, workerID, message);
+ jobQueue->scriptContextFailedToStart(connection, identifier, message);
}
-void SWServer::scriptContextStarted(Connection& connection, const ServiceWorkerRegistrationKey& registrationKey, uint64_t serviceWorkerIdentifier, const String& workerID)
+void SWServer::scriptContextStarted(Connection& connection, const ServiceWorkerRegistrationKey& registrationKey, ServiceWorkerIdentifier identifier)
{
ASSERT(m_connections.contains(connection.identifier()));
if (auto* jobQueue = m_jobQueues.get(registrationKey))
- jobQueue->scriptContextStarted(connection, serviceWorkerIdentifier, workerID);
+ jobQueue->scriptContextStarted(connection, identifier);
}
void SWServer::addClientServiceWorkerRegistration(Connection& connection, const ServiceWorkerRegistrationKey& key, uint64_t registrationIdentifier)
@@ -235,12 +240,12 @@
Ref<SWServerWorker> SWServer::updateWorker(Connection& connection, const ServiceWorkerRegistrationKey& registrationKey, const URL& url, const String& script, WorkerType type)
{
- String workerID = createCanonicalUUIDString();
+ auto serviceWorkerIdentifier = generateServiceWorkerIdentifier();
- auto result = m_workersByID.add(workerID, SWServerWorker::create(registrationKey, url, script, type, workerID));
+ auto result = m_workersByID.add(serviceWorkerIdentifier, SWServerWorker::create(registrationKey, url, script, type, serviceWorkerIdentifier));
ASSERT(result.isNewEntry);
- connection.updateServiceWorkerContext({ registrationKey, workerID, script, url });
+ connection.updateServiceWorkerContext({ registrationKey, serviceWorkerIdentifier, script, url });
return result.iterator->value.get();
}
Modified: trunk/Source/WebCore/workers/service/server/SWServer.h (224402 => 224403)
--- trunk/Source/WebCore/workers/service/server/SWServer.h 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebCore/workers/service/server/SWServer.h 2017-11-03 16:37:04 UTC (rev 224403)
@@ -27,6 +27,7 @@
#if ENABLE(SERVICE_WORKER)
+#include "ServiceWorkerIdentifier.h"
#include "ServiceWorkerJob.h"
#include "ServiceWorkerRegistrationKey.h"
#include <wtf/CrossThreadQueue.h>
@@ -56,11 +57,11 @@
public:
WEBCORE_EXPORT virtual ~Connection();
- WEBCORE_EXPORT void scriptContextFailedToStart(const ServiceWorkerRegistrationKey&, const String& workerID, const String& message);
- WEBCORE_EXPORT void scriptContextStarted(const ServiceWorkerRegistrationKey&, uint64_t serviceWorkerIdentifier, const String& workerID);
+ WEBCORE_EXPORT void scriptContextFailedToStart(const ServiceWorkerRegistrationKey&, ServiceWorkerIdentifier, const String& message);
+ WEBCORE_EXPORT void scriptContextStarted(const ServiceWorkerRegistrationKey&, ServiceWorkerIdentifier);
// Messages to the client WebProcess
- virtual void updateRegistrationStateInClient(const ServiceWorkerRegistrationKey&, ServiceWorkerRegistrationState, const String& serviceWorkerID) = 0;
+ virtual void updateRegistrationStateInClient(const ServiceWorkerRegistrationKey&, ServiceWorkerRegistrationState, std::optional<ServiceWorkerIdentifier>) = 0;
protected:
WEBCORE_EXPORT Connection(SWServer&, uint64_t identifier);
@@ -112,8 +113,8 @@
void handleTaskRepliesOnMainThread();
void scriptFetchFinished(Connection&, const ServiceWorkerFetchResult&);
- void scriptContextFailedToStart(Connection&, const ServiceWorkerRegistrationKey&, const String& workerID, const String& message);
- void scriptContextStarted(Connection&, const ServiceWorkerRegistrationKey&, uint64_t serviceWorkerIdentifier, const String& workerID);
+ void scriptContextFailedToStart(Connection&, const ServiceWorkerRegistrationKey&, ServiceWorkerIdentifier, const String& message);
+ void scriptContextStarted(Connection&, const ServiceWorkerRegistrationKey&, ServiceWorkerIdentifier);
void addClientServiceWorkerRegistration(Connection&, const ServiceWorkerRegistrationKey&, uint64_t registrationIdentifier);
void removeClientServiceWorkerRegistration(Connection&, const ServiceWorkerRegistrationKey&, uint64_t registrationIdentifier);
@@ -122,7 +123,7 @@
HashMap<ServiceWorkerRegistrationKey, std::unique_ptr<SWServerRegistration>> m_registrations;
HashMap<ServiceWorkerRegistrationKey, std::unique_ptr<SWServerJobQueue>> m_jobQueues;
- HashMap<String, Ref<SWServerWorker>> m_workersByID;
+ HashMap<ServiceWorkerIdentifier, Ref<SWServerWorker>> m_workersByID;
RefPtr<Thread> m_taskThread;
Lock m_taskThreadLock;
Modified: trunk/Source/WebCore/workers/service/server/SWServerJobQueue.cpp (224402 => 224403)
--- trunk/Source/WebCore/workers/service/server/SWServerJobQueue.cpp 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebCore/workers/service/server/SWServerJobQueue.cpp 2017-11-03 16:37:04 UTC (rev 224403)
@@ -76,7 +76,7 @@
m_server.updateWorker(connection, m_registrationKey, job.scriptURL, result.script, WorkerType::Classic);
}
-void SWServerJobQueue::scriptContextFailedToStart(SWServer::Connection&, const String& workerID, const String& message)
+void SWServerJobQueue::scriptContextFailedToStart(SWServer::Connection&, ServiceWorkerIdentifier identifier, const String& message)
{
// FIXME: Install has failed. Run the install failed substeps
// Run the Update Worker State algorithm passing registration’s installing worker and redundant as the arguments.
@@ -83,17 +83,15 @@
// Run the Update Registration State algorithm passing registration, "installing" and null as the arguments.
// If newestWorker is null, invoke Clear Registration algorithm passing registration as its argument.
- UNUSED_PARAM(workerID);
+ UNUSED_PARAM(identifier);
UNUSED_PARAM(message);
}
-void SWServerJobQueue::scriptContextStarted(SWServer::Connection&, uint64_t serviceWorkerIdentifier, const String& workerID)
+void SWServerJobQueue::scriptContextStarted(SWServer::Connection&, ServiceWorkerIdentifier identifier)
{
- UNUSED_PARAM(workerID);
-
auto* registration = m_server.getRegistration(m_registrationKey);
ASSERT(registration);
- registration->setActiveServiceWorkerIdentifier(serviceWorkerIdentifier);
+ registration->setActiveServiceWorkerIdentifier(identifier);
m_server.resolveRegistrationJob(firstJob(), registration->data());
finishCurrentJob();
Modified: trunk/Source/WebCore/workers/service/server/SWServerJobQueue.h (224402 => 224403)
--- trunk/Source/WebCore/workers/service/server/SWServerJobQueue.h 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebCore/workers/service/server/SWServerJobQueue.h 2017-11-03 16:37:04 UTC (rev 224403)
@@ -48,8 +48,8 @@
void runNextJob();
void scriptFetchFinished(SWServer::Connection&, const ServiceWorkerFetchResult&);
- void scriptContextFailedToStart(SWServer::Connection&, const String& workerID, const String& message);
- void scriptContextStarted(SWServer::Connection&, uint64_t serviceWorkerIdentifier, const String& workerID);
+ void scriptContextFailedToStart(SWServer::Connection&, ServiceWorkerIdentifier, const String& message);
+ void scriptContextStarted(SWServer::Connection&, ServiceWorkerIdentifier);
private:
void jobTimerFired();
Modified: trunk/Source/WebCore/workers/service/server/SWServerRegistration.cpp (224402 => 224403)
--- trunk/Source/WebCore/workers/service/server/SWServerRegistration.cpp 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebCore/workers/service/server/SWServerRegistration.cpp 2017-11-03 16:37:04 UTC (rev 224403)
@@ -73,13 +73,13 @@
break;
};
- String workerID;
+ std::optional<ServiceWorkerIdentifier> serviceWorkerIdentifier;
if (worker)
- workerID = worker->workerID();
+ serviceWorkerIdentifier = worker->identifier();
for (auto& connectionIdentifierWithClients : m_clientRegistrationsByConnection.keys()) {
if (auto* connection = m_server.getConnection(connectionIdentifierWithClients))
- connection->updateRegistrationStateInClient(m_registrationKey, state, workerID);
+ connection->updateRegistrationStateInClient(m_registrationKey, state, serviceWorkerIdentifier);
}
}
Modified: trunk/Source/WebCore/workers/service/server/SWServerRegistration.h (224402 => 224403)
--- trunk/Source/WebCore/workers/service/server/SWServerRegistration.h 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebCore/workers/service/server/SWServerRegistration.h 2017-11-03 16:37:04 UTC (rev 224403)
@@ -55,7 +55,7 @@
void setLastUpdateTime(double time) { m_lastUpdateTime = time; }
ServiceWorkerUpdateViaCache updateViaCache() const { return m_updateViaCache; }
- void setActiveServiceWorkerIdentifier(uint64_t identifier) { m_activeServiceWorkerIdentifier = identifier; }
+ void setActiveServiceWorkerIdentifier(ServiceWorkerIdentifier identifier) { m_activeServiceWorkerIdentifier = identifier; }
void updateRegistrationState(ServiceWorkerRegistrationState, SWServerWorker*);
@@ -73,7 +73,7 @@
RefPtr<SWServerWorker> m_waitingWorker;
RefPtr<SWServerWorker> m_activeWorker;
- uint64_t m_activeServiceWorkerIdentifier { 0 };
+ std::optional<ServiceWorkerIdentifier> m_activeServiceWorkerIdentifier;
double m_lastUpdateTime { 0 };
Modified: trunk/Source/WebCore/workers/service/server/SWServerWorker.cpp (224402 => 224403)
--- trunk/Source/WebCore/workers/service/server/SWServerWorker.cpp 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebCore/workers/service/server/SWServerWorker.cpp 2017-11-03 16:37:04 UTC (rev 224403)
@@ -30,11 +30,11 @@
namespace WebCore {
-SWServerWorker::SWServerWorker(const ServiceWorkerRegistrationKey& registrationKey, const URL& url, const String& script, WorkerType type, const String& workerID)
+SWServerWorker::SWServerWorker(const ServiceWorkerRegistrationKey& registrationKey, const URL& url, const String& script, WorkerType type, ServiceWorkerIdentifier identifier)
: m_registrationKey(registrationKey)
, m_scriptURL(url)
, m_script(script)
- , m_workerID(workerID)
+ , m_identifier(identifier)
, m_type(type)
{
}
Modified: trunk/Source/WebCore/workers/service/server/SWServerWorker.h (224402 => 224403)
--- trunk/Source/WebCore/workers/service/server/SWServerWorker.h 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebCore/workers/service/server/SWServerWorker.h 2017-11-03 16:37:04 UTC (rev 224403)
@@ -27,6 +27,7 @@
#if ENABLE(SERVICE_WORKER)
+#include "ServiceWorkerIdentifier.h"
#include "ServiceWorkerRegistrationKey.h"
#include "URL.h"
#include <wtf/ThreadSafeRefCounted.h>
@@ -37,9 +38,9 @@
class SWServerWorker : public ThreadSafeRefCounted<SWServerWorker> {
public:
- static Ref<SWServerWorker> create(const ServiceWorkerRegistrationKey& registrationKey, const URL& url, const String& script, WorkerType type, const String& workerID)
+ static Ref<SWServerWorker> create(const ServiceWorkerRegistrationKey& registrationKey, const URL& url, const String& script, WorkerType type, ServiceWorkerIdentifier identifier)
{
- return adoptRef(*new SWServerWorker(registrationKey, url, script, type, workerID));
+ return adoptRef(*new SWServerWorker(registrationKey, url, script, type, identifier));
}
SWServerWorker(const SWServerWorker&) = delete;
@@ -48,15 +49,15 @@
const URL& scriptURL() const { return m_scriptURL; }
const String& script() const { return m_script; }
WorkerType type() const { return m_type; }
- const String& workerID() const { return m_workerID; }
+ ServiceWorkerIdentifier identifier() const { return m_identifier; }
private:
- SWServerWorker(const ServiceWorkerRegistrationKey&, const URL&, const String& script, WorkerType, const String& workerID);
+ SWServerWorker(const ServiceWorkerRegistrationKey&, const URL&, const String& script, WorkerType, ServiceWorkerIdentifier);
ServiceWorkerRegistrationKey m_registrationKey;
URL m_scriptURL;
String m_script;
- String m_workerID;
+ ServiceWorkerIdentifier m_identifier;
WorkerType m_type;
};
Modified: trunk/Source/WebKit/ChangeLog (224402 => 224403)
--- trunk/Source/WebKit/ChangeLog 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebKit/ChangeLog 2017-11-03 16:37:04 UTC (rev 224403)
@@ -1,3 +1,44 @@
+2017-11-03 Chris Dumez <cdu...@apple.com>
+
+ Use a single identifier type to identify Service Workers
+ https://bugs.webkit.org/show_bug.cgi?id=179192
+
+ Reviewed by Brady Eidson.
+
+ Use a single identifier type to identify Service Workers. We had both a String
+ identifier and a uint64_t identifier for each service worker. We now consistently
+ use a ServiceWorkerIdentifier which is a strongly typed identifier backed by a
+ uint64_t.
+
+ * Scripts/webkit/messages.py:
+ (forward_declarations_and_headers):
+ (forward_declarations_and_headers.templates):
+ * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
+ (WebKit::WebSWServerConnection::startFetch):
+ (WebKit::WebSWServerConnection::postMessageToServiceWorkerGlobalScope):
+ (WebKit::WebSWServerConnection::postMessageToServiceWorkerClient):
+ * StorageProcess/ServiceWorker/WebSWServerConnection.h:
+ * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
+ * StorageProcess/StorageProcess.cpp:
+ (WebKit::StorageProcess::serviceWorkerContextFailedToStart):
+ (WebKit::StorageProcess::serviceWorkerContextStarted):
+ (WebKit::StorageProcess::postMessageToServiceWorkerClient):
+ * StorageProcess/StorageProcess.h:
+ * StorageProcess/StorageProcess.messages.in:
+ * WebProcess/Storage/WebSWClientConnection.cpp:
+ (WebKit::WebSWClientConnection::postMessageToServiceWorkerGlobalScope):
+ (WebKit::WebSWClientConnection::postMessageToServiceWorkerClient):
+ * WebProcess/Storage/WebSWClientConnection.h:
+ * WebProcess/Storage/WebSWClientConnection.messages.in:
+ * WebProcess/Storage/WebSWContextManagerConnection.cpp:
+ (WebKit::WebSWContextManagerConnection::updateServiceWorker):
+ (WebKit::WebSWContextManagerConnection::serviceWorkerStartedWithMessage):
+ (WebKit::WebSWContextManagerConnection::startFetch):
+ (WebKit::WebSWContextManagerConnection::postMessageToServiceWorkerGlobalScope):
+ (WebKit::WebSWContextManagerConnection::postMessageToServiceWorkerClient):
+ * WebProcess/Storage/WebSWContextManagerConnection.h:
+ * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
+
2017-11-03 Antti Koivisto <an...@apple.com>
Enable display:contents by default as experimental feature
Modified: trunk/Source/WebKit/Scripts/webkit/messages.py (224402 => 224403)
--- trunk/Source/WebKit/Scripts/webkit/messages.py 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebKit/Scripts/webkit/messages.py 2017-11-03 16:37:04 UTC (rev 224403)
@@ -187,8 +187,8 @@
kind = parameter.kind
type = parameter.type
- if type.find('<') != -1:
- # Don't forward declare class templates.
+ if type.find('<') != -1 or type == "WebCore::ServiceWorkerIdentifier":
+ # Don't forward declare class templates or ServiceWorkerIdentifier.
headers.update(headers_for_type(type))
continue
Modified: trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.cpp (224402 => 224403)
--- trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.cpp 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.cpp 2017-11-03 16:37:04 UTC (rev 224403)
@@ -96,9 +96,9 @@
send(Messages::WebSWClientConnection::StartScriptFetchForServer(jobIdentifier));
}
-void WebSWServerConnection::updateRegistrationStateInClient(const ServiceWorkerRegistrationKey& key, ServiceWorkerRegistrationState state, const String& workerID)
+void WebSWServerConnection::updateRegistrationStateInClient(const ServiceWorkerRegistrationKey& key, ServiceWorkerRegistrationState state, std::optional<ServiceWorkerIdentifier> serviceWorkerIdentifier)
{
- send(Messages::WebSWClientConnection::UpdateRegistrationState(key, state, workerID));
+ send(Messages::WebSWClientConnection::UpdateRegistrationState(key, state, serviceWorkerIdentifier));
}
void WebSWServerConnection::updateServiceWorkerContext(const ServiceWorkerContextData& data)
@@ -109,12 +109,12 @@
m_pendingContextDatas.append(data);
}
-void WebSWServerConnection::startFetch(uint64_t fetchIdentifier, uint64_t serviceWorkerIdentifier, const ResourceRequest& request, const FetchOptions& options)
+void WebSWServerConnection::startFetch(uint64_t fetchIdentifier, std::optional<ServiceWorkerIdentifier> serviceWorkerIdentifier, const ResourceRequest& request, const FetchOptions& options)
{
sendToContextProcess(Messages::WebSWContextManagerConnection::StartFetch(identifier(), fetchIdentifier, serviceWorkerIdentifier, request, options));
}
-void WebSWServerConnection::postMessageToServiceWorkerGlobalScope(uint64_t destinationServiceWorkerIdentifier, const IPC::DataReference& message, uint64_t sourceScriptExecutionContextIdentifier, const String& sourceOrigin)
+void WebSWServerConnection::postMessageToServiceWorkerGlobalScope(ServiceWorkerIdentifier destinationServiceWorkerIdentifier, const IPC::DataReference& message, uint64_t sourceScriptExecutionContextIdentifier, const String& sourceOrigin)
{
ServiceWorkerClientIdentifier sourceIdentifier { identifier(), sourceScriptExecutionContextIdentifier };
sendToContextProcess(Messages::WebSWContextManagerConnection::PostMessageToServiceWorkerGlobalScope { destinationServiceWorkerIdentifier, message, sourceIdentifier, sourceOrigin });
@@ -145,7 +145,7 @@
m_contentConnection->send(Messages::ServiceWorkerClientFetch::DidNotHandle { }, fetchIdentifier);
}
-void WebSWServerConnection::postMessageToServiceWorkerClient(uint64_t destinationScriptExecutionContextIdentifier, const IPC::DataReference& message, uint64_t sourceServiceWorkerIdentifier, const String& sourceOrigin)
+void WebSWServerConnection::postMessageToServiceWorkerClient(uint64_t destinationScriptExecutionContextIdentifier, const IPC::DataReference& message, ServiceWorkerIdentifier sourceServiceWorkerIdentifier, const String& sourceOrigin)
{
send(Messages::WebSWClientConnection::PostMessageToServiceWorkerClient { destinationScriptExecutionContextIdentifier, message, sourceServiceWorkerIdentifier, sourceOrigin });
}
Modified: trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.h (224402 => 224403)
--- trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.h 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.h 2017-11-03 16:37:04 UTC (rev 224403)
@@ -57,7 +57,7 @@
void didFailFetch(uint64_t fetchIdentifier);
void didNotHandleFetch(uint64_t fetchIdentifier);
- void postMessageToServiceWorkerClient(uint64_t destinationScriptExecutionContextIdentifier, const IPC::DataReference& message, uint64_t sourceServiceWorkerIdentifier, const String& sourceOrigin);
+ void postMessageToServiceWorkerClient(uint64_t destinationScriptExecutionContextIdentifier, const IPC::DataReference& message, WebCore::ServiceWorkerIdentifier sourceServiceWorkerIdentifier, const String& sourceOrigin);
private:
// Implement SWServer::Connection (Messages to the client WebProcess)
@@ -65,11 +65,11 @@
void resolveRegistrationJobInClient(uint64_t jobIdentifier, const WebCore::ServiceWorkerRegistrationData&) final;
void resolveUnregistrationJobInClient(uint64_t jobIdentifier, const WebCore::ServiceWorkerRegistrationKey&, bool unregistrationResult) final;
void startScriptFetchInClient(uint64_t jobIdentifier) final;
- void updateRegistrationStateInClient(const WebCore::ServiceWorkerRegistrationKey&, WebCore::ServiceWorkerRegistrationState, const String& serviceWorkerID) final;
+ void updateRegistrationStateInClient(const WebCore::ServiceWorkerRegistrationKey&, WebCore::ServiceWorkerRegistrationState, std::optional<WebCore::ServiceWorkerIdentifier>) final;
- void startFetch(uint64_t fetchIdentifier, uint64_t serviceWorkerIdentifier, const WebCore::ResourceRequest&, const WebCore::FetchOptions&);
+ void startFetch(uint64_t fetchIdentifier, std::optional<WebCore::ServiceWorkerIdentifier>, const WebCore::ResourceRequest&, const WebCore::FetchOptions&);
- void postMessageToServiceWorkerGlobalScope(uint64_t destinationServiceWorkerIdentifier, const IPC::DataReference& message, uint64_t sourceScriptExecutionContextIdentifier, const String& sourceOrigin);
+ void postMessageToServiceWorkerGlobalScope(WebCore::ServiceWorkerIdentifier destinationIdentifier, const IPC::DataReference& message, uint64_t sourceScriptExecutionContextIdentifier, const String& sourceOrigin);
// Messages to the SW context WebProcess
void updateServiceWorkerContext(const WebCore::ServiceWorkerContextData&) final;
Modified: trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.messages.in (224402 => 224403)
--- trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.messages.in 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.messages.in 2017-11-03 16:37:04 UTC (rev 224403)
@@ -29,8 +29,8 @@
AddServiceWorkerRegistrationInServer(struct WebCore::ServiceWorkerRegistrationKey key, uint64_t registrationIdentifier)
RemoveServiceWorkerRegistrationInServer(struct WebCore::ServiceWorkerRegistrationKey key, uint64_t registrationIdentifier)
- StartFetch(uint64_t identifier, uint64_t serviceWorkerIdentifier, WebCore::ResourceRequest request, struct WebCore::FetchOptions options)
- PostMessageToServiceWorkerGlobalScope(uint64_t destinationServiceWorkerIdentifier, IPC::DataReference message, uint64_t sourceScriptExecutionContextIdentifier, String sourceOrigin)
+ StartFetch(uint64_t identifier, std::optional<WebCore::ServiceWorkerIdentifier> serviceWorkerIdentifier, WebCore::ResourceRequest request, struct WebCore::FetchOptions options)
+ PostMessageToServiceWorkerGlobalScope(WebCore::ServiceWorkerIdentifier destinationServiceWorkerIdentifier, IPC::DataReference message, uint64_t sourceScriptExecutionContextIdentifier, String sourceOrigin)
}
#endif // ENABLE(SERVICE_WORKER)
Modified: trunk/Source/WebKit/StorageProcess/StorageProcess.cpp (224402 => 224403)
--- trunk/Source/WebKit/StorageProcess/StorageProcess.cpp 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebKit/StorageProcess/StorageProcess.cpp 2017-11-03 16:37:04 UTC (rev 224403)
@@ -394,16 +394,16 @@
connection->workerContextProcessConnectionCreated();
}
-void StorageProcess::serviceWorkerContextFailedToStart(uint64_t serverConnectionIdentifier, const ServiceWorkerRegistrationKey& registrationKey, const String& workerID, const String& message)
+void StorageProcess::serviceWorkerContextFailedToStart(uint64_t serverConnectionIdentifier, const ServiceWorkerRegistrationKey& registrationKey, ServiceWorkerIdentifier serviceWorkerIdentifier, const String& message)
{
if (auto* connection = m_swServerConnections.get(serverConnectionIdentifier))
- connection->scriptContextFailedToStart(registrationKey, workerID, message);
+ connection->scriptContextFailedToStart(registrationKey, serviceWorkerIdentifier, message);
}
-void StorageProcess::serviceWorkerContextStarted(uint64_t serverConnectionIdentifier, const ServiceWorkerRegistrationKey& registrationKey, uint64_t identifier, const String& workerID)
+void StorageProcess::serviceWorkerContextStarted(uint64_t serverConnectionIdentifier, const ServiceWorkerRegistrationKey& registrationKey, ServiceWorkerIdentifier serviceWorkerIdentifier)
{
if (auto* connection = m_swServerConnections.get(serverConnectionIdentifier))
- connection->scriptContextStarted(registrationKey, identifier, workerID);
+ connection->scriptContextStarted(registrationKey, serviceWorkerIdentifier);
}
void StorageProcess::didFailFetch(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier)
@@ -436,10 +436,10 @@
connection->didFinishFetch(fetchIdentifier);
}
-void StorageProcess::postMessageToServiceWorkerClient(const ServiceWorkerClientIdentifier& destinationIdentifier, const IPC::DataReference& message, uint64_t sourceServiceWorkerIdentifier, const String& sourceOrigin)
+void StorageProcess::postMessageToServiceWorkerClient(const ServiceWorkerClientIdentifier& destinationIdentifier, const IPC::DataReference& message, ServiceWorkerIdentifier sourceIdentifier, const String& sourceOrigin)
{
if (auto* connection = m_swServerConnections.get(destinationIdentifier.serverConnectionIdentifier))
- connection->postMessageToServiceWorkerClient(destinationIdentifier.scriptExecutionContextIdentifier, message, sourceServiceWorkerIdentifier, sourceOrigin);
+ connection->postMessageToServiceWorkerClient(destinationIdentifier.scriptExecutionContextIdentifier, message, sourceIdentifier, sourceOrigin);
}
void StorageProcess::registerSWServerConnection(WebSWServerConnection& connection)
Modified: trunk/Source/WebKit/StorageProcess/StorageProcess.h (224402 => 224403)
--- trunk/Source/WebKit/StorageProcess/StorageProcess.h 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebKit/StorageProcess/StorageProcess.h 2017-11-03 16:37:04 UTC (rev 224403)
@@ -29,6 +29,7 @@
#include "SandboxExtension.h"
#include <WebCore/IDBBackingStore.h>
#include <WebCore/IDBServer.h>
+#include <WebCore/ServiceWorkerIdentifier.h>
#include <WebCore/UniqueIDBDatabase.h>
#include <pal/SessionID.h>
#include <wtf/CrossThreadTask.h>
@@ -118,8 +119,8 @@
#endif
#if ENABLE(SERVICE_WORKER)
void didGetWorkerContextProcessConnection(IPC::Attachment&& encodedConnectionIdentifier);
- void serviceWorkerContextFailedToStart(uint64_t serverConnectionIdentifier, const WebCore::ServiceWorkerRegistrationKey&, const String& workerID, const String& message);
- void serviceWorkerContextStarted(uint64_t serverConnectionIdentifier, const WebCore::ServiceWorkerRegistrationKey&, uint64_t identifier, const String& workerID);
+ void serviceWorkerContextFailedToStart(uint64_t serverConnectionIdentifier, const WebCore::ServiceWorkerRegistrationKey&, WebCore::ServiceWorkerIdentifier, const String& message);
+ void serviceWorkerContextStarted(uint64_t serverConnectionIdentifier, const WebCore::ServiceWorkerRegistrationKey&, WebCore::ServiceWorkerIdentifier);
void didReceiveFetchResponse(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier, const WebCore::ResourceResponse&);
void didReceiveFetchData(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier, const IPC::DataReference&, int64_t encodedDataLength);
@@ -127,7 +128,7 @@
void didFailFetch(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier);
void didNotHandleFetch(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier);
- void postMessageToServiceWorkerClient(const WebCore::ServiceWorkerClientIdentifier& destinationIdentifier, const IPC::DataReference& message, uint64_t sourceServiceWorkerIdentifier, const String& sourceOrigin);
+ void postMessageToServiceWorkerClient(const WebCore::ServiceWorkerClientIdentifier& destinationIdentifier, const IPC::DataReference& message, WebCore::ServiceWorkerIdentifier sourceIdentifier, const String& sourceOrigin);
#endif
#if ENABLE(INDEXED_DATABASE)
Vector<WebCore::SecurityOriginData> indexedDatabaseOrigins(const String& path);
Modified: trunk/Source/WebKit/StorageProcess/StorageProcess.messages.in (224402 => 224403)
--- trunk/Source/WebKit/StorageProcess/StorageProcess.messages.in 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebKit/StorageProcess/StorageProcess.messages.in 2017-11-03 16:37:04 UTC (rev 224403)
@@ -38,8 +38,8 @@
#if ENABLE(SERVICE_WORKER)
DidGetWorkerContextProcessConnection(IPC::Attachment connectionHandle)
- ServiceWorkerContextFailedToStart(uint64_t serverConnectionIdentifier, struct WebCore::ServiceWorkerRegistrationKey registrationKey, String workerID, String message)
- ServiceWorkerContextStarted(uint64_t serverConnectionIdentifier, struct WebCore::ServiceWorkerRegistrationKey registrationKey, uint64_t identifier, String workerID)
+ ServiceWorkerContextFailedToStart(uint64_t serverConnectionIdentifier, struct WebCore::ServiceWorkerRegistrationKey registrationKey, WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier, String message)
+ ServiceWorkerContextStarted(uint64_t serverConnectionIdentifier, struct WebCore::ServiceWorkerRegistrationKey registrationKey, WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier)
DidNotHandleFetch(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier)
DidFailFetch(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier)
@@ -46,6 +46,6 @@
DidReceiveFetchResponse(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier, WebCore::ResourceResponse response)
DidReceiveFetchData(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier, IPC::DataReference data, int64_t encodedDataLength)
DidFinishFetch(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier)
- PostMessageToServiceWorkerClient(struct WebCore::ServiceWorkerClientIdentifier destinationIdentifier, IPC::DataReference message, uint64_t sourceServiceWorkerIdentifier, String sourceOrigin)
+ PostMessageToServiceWorkerClient(struct WebCore::ServiceWorkerClientIdentifier destinationIdentifier, IPC::DataReference message, WebCore::ServiceWorkerIdentifier sourceIdentifier, String sourceOrigin)
#endif
}
Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp (224402 => 224403)
--- trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp 2017-11-03 16:37:04 UTC (rev 224403)
@@ -79,13 +79,13 @@
send(Messages::WebSWServerConnection::RemoveServiceWorkerRegistrationInServer(key, registrationIdentifier));
}
-void WebSWClientConnection::postMessageToServiceWorkerGlobalScope(uint64_t destinationServiceWorkerIdentifier, Ref<SerializedScriptValue>&& scriptValue, ScriptExecutionContext& source)
+void WebSWClientConnection::postMessageToServiceWorkerGlobalScope(ServiceWorkerIdentifier destinationIdentifier, Ref<SerializedScriptValue>&& scriptValue, ScriptExecutionContext& source)
{
// FIXME: Add support for posting messages from workers.
if (!is<Document>(source))
return;
- send(Messages::WebSWServerConnection::PostMessageToServiceWorkerGlobalScope(destinationServiceWorkerIdentifier, IPC::DataReference { scriptValue->data() }, downcast<Document>(source).identifier(), source.origin()));
+ send(Messages::WebSWServerConnection::PostMessageToServiceWorkerGlobalScope(destinationIdentifier, IPC::DataReference { scriptValue->data() }, downcast<Document>(source).identifier(), source.origin()));
}
bool WebSWClientConnection::hasServiceWorkerRegisteredForOrigin(const SecurityOrigin& origin) const
@@ -107,9 +107,9 @@
return ServiceWorkerClientFetch::create(provider, WTFMove(loader), identifier, m_connection.get(), WTFMove(callback));
}
-void WebSWClientConnection::postMessageToServiceWorkerClient(uint64_t destinationScriptExecutionContextIdentifier, const IPC::DataReference& message, uint64_t sourceServiceWorkerIdentifier, const String& sourceOrigin)
+void WebSWClientConnection::postMessageToServiceWorkerClient(uint64_t destinationScriptExecutionContextIdentifier, const IPC::DataReference& message, ServiceWorkerIdentifier sourceIdentifier, const String& sourceOrigin)
{
- SWClientConnection::postMessageToServiceWorkerClient(destinationScriptExecutionContextIdentifier, SerializedScriptValue::adopt(message.vector()), sourceServiceWorkerIdentifier, sourceOrigin);
+ SWClientConnection::postMessageToServiceWorkerClient(destinationScriptExecutionContextIdentifier, SerializedScriptValue::adopt(message.vector()), sourceIdentifier, sourceOrigin);
}
} // namespace WebKit
Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h (224402 => 224403)
--- trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h 2017-11-03 16:37:04 UTC (rev 224403)
@@ -58,7 +58,7 @@
void finishFetchingScriptInServer(const WebCore::ServiceWorkerFetchResult&) final;
void addServiceWorkerRegistrationInServer(const WebCore::ServiceWorkerRegistrationKey&, uint64_t registrationIdentifier) final;
void removeServiceWorkerRegistrationInServer(const WebCore::ServiceWorkerRegistrationKey&, uint64_t registrationIdentifier) final;
- void postMessageToServiceWorkerGlobalScope(uint64_t destinationServiceWorkerIdentifier, Ref<WebCore::SerializedScriptValue>&&, WebCore::ScriptExecutionContext& source) final;
+ void postMessageToServiceWorkerGlobalScope(WebCore::ServiceWorkerIdentifier destinationIdentifier, Ref<WebCore::SerializedScriptValue>&&, WebCore::ScriptExecutionContext& source) final;
void disconnectedFromWebProcess();
void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final;
@@ -66,7 +66,7 @@
bool hasServiceWorkerRegisteredForOrigin(const WebCore::SecurityOrigin&) const final;
Ref<ServiceWorkerClientFetch> startFetch(WebServiceWorkerProvider&, Ref<WebCore::ResourceLoader>&&, uint64_t identifier, ServiceWorkerClientFetch::Callback&&);
- void postMessageToServiceWorkerClient(uint64_t destinationScriptExecutionContextIdentifier, const IPC::DataReference& message, uint64_t sourceServiceWorkerIdentifier, const String& sourceOrigin);
+ void postMessageToServiceWorkerClient(uint64_t destinationScriptExecutionContextIdentifier, const IPC::DataReference& message, WebCore::ServiceWorkerIdentifier sourceIdentifier, const String& sourceOrigin);
private:
void scheduleStorageJob(const WebCore::ServiceWorkerJobData&);
Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.messages.in (224402 => 224403)
--- trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.messages.in 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.messages.in 2017-11-03 16:37:04 UTC (rev 224403)
@@ -28,10 +28,10 @@
RegistrationJobResolvedInServer(uint64_t identifier, struct WebCore::ServiceWorkerRegistrationData registration)
UnregistrationJobResolvedInServer(uint64_t identifier, bool unregistrationResult)
StartScriptFetchForServer(uint64_t jobIdentifier)
- UpdateRegistrationState(struct WebCore::ServiceWorkerRegistrationKey key, enum WebCore::ServiceWorkerRegistrationState state, String workerID)
+ UpdateRegistrationState(struct WebCore::ServiceWorkerRegistrationKey key, enum WebCore::ServiceWorkerRegistrationState state, std::optional<WebCore::ServiceWorkerIdentifier> serviceWorkerIdentifier)
SetSWOriginTableSharedMemory(WebKit::SharedMemory::Handle handle)
- PostMessageToServiceWorkerClient(uint64_t destinationScriptExecutionContextIdentifier, IPC::DataReference message, uint64_t sourceServiceWorkerIdentifier, String sourceOrigin)
+ PostMessageToServiceWorkerClient(uint64_t destinationScriptExecutionContextIdentifier, IPC::DataReference message, WebCore::ServiceWorkerIdentifier sourceServiceWorkerIdentifier, String sourceOrigin)
}
#endif // ENABLE(SERVICE_WORKER)
Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp (224402 => 224403)
--- trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp 2017-11-03 16:37:04 UTC (rev 224403)
@@ -116,10 +116,10 @@
auto serviceWorkerThreadProxy = ServiceWorkerThreadProxy::create(WTFMove(pageConfiguration), serverConnectionIdentifier, data, sessionID, WebProcess::singleton().cacheStorageProvider());
SWContextManager::singleton().registerServiceWorkerThreadForUpdate(WTFMove(serviceWorkerThreadProxy));
- LOG(ServiceWorker, "Context process PID: %i created worker thread %s\n", getpid(), data.workerID.utf8().data());
+ LOG(ServiceWorker, "Context process PID: %i created worker thread\n", getpid());
}
-void WebSWContextManagerConnection::serviceWorkerStartedWithMessage(uint64_t serviceWorkerIdentifier, const String& exceptionMessage)
+void WebSWContextManagerConnection::serviceWorkerStartedWithMessage(ServiceWorkerIdentifier serviceWorkerIdentifier, const String& exceptionMessage)
{
auto* threadProxy = SWContextManager::singleton().serviceWorkerThreadProxy(serviceWorkerIdentifier);
ASSERT(threadProxy);
@@ -127,14 +127,14 @@
auto& data = ""
if (exceptionMessage.isEmpty())
- m_connectionToStorageProcess->send(Messages::StorageProcess::ServiceWorkerContextStarted(threadProxy->thread().serverConnectionIdentifier(), data.registrationKey, serviceWorkerIdentifier, data.workerID), 0);
+ m_connectionToStorageProcess->send(Messages::StorageProcess::ServiceWorkerContextStarted(threadProxy->thread().serverConnectionIdentifier(), data.registrationKey, serviceWorkerIdentifier), 0);
else
- m_connectionToStorageProcess->send(Messages::StorageProcess::ServiceWorkerContextFailedToStart(threadProxy->thread().serverConnectionIdentifier(), data.registrationKey, data.workerID, exceptionMessage), 0);
+ m_connectionToStorageProcess->send(Messages::StorageProcess::ServiceWorkerContextFailedToStart(threadProxy->thread().serverConnectionIdentifier(), data.registrationKey, serviceWorkerIdentifier, exceptionMessage), 0);
}
-void WebSWContextManagerConnection::startFetch(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier, uint64_t serviceWorkerIdentifier, ResourceRequest&& request, FetchOptions&& options)
+void WebSWContextManagerConnection::startFetch(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier, std::optional<ServiceWorkerIdentifier> serviceWorkerIdentifier, ResourceRequest&& request, FetchOptions&& options)
{
- auto* serviceWorkerThreadProxy = SWContextManager::singleton().serviceWorkerThreadProxy(serviceWorkerIdentifier);
+ auto* serviceWorkerThreadProxy = serviceWorkerIdentifier ? SWContextManager::singleton().serviceWorkerThreadProxy(*serviceWorkerIdentifier) : nullptr;
if (!serviceWorkerThreadProxy) {
m_connectionToStorageProcess->send(Messages::StorageProcess::DidNotHandleFetch(serverConnectionIdentifier, fetchIdentifier), 0);
return;
@@ -144,14 +144,14 @@
serviceWorkerThreadProxy->thread().postFetchTask(WTFMove(client), WTFMove(request), WTFMove(options));
}
-void WebSWContextManagerConnection::postMessageToServiceWorkerGlobalScope(uint64_t destinationServiceWorkerIdentifier, const IPC::DataReference& message, const ServiceWorkerClientIdentifier& sourceIdentifier, const String& sourceOrigin)
+void WebSWContextManagerConnection::postMessageToServiceWorkerGlobalScope(ServiceWorkerIdentifier destinationIdentifier, const IPC::DataReference& message, const ServiceWorkerClientIdentifier& sourceIdentifier, const String& sourceOrigin)
{
- SWContextManager::singleton().postMessageToServiceWorkerGlobalScope(destinationServiceWorkerIdentifier, SerializedScriptValue::adopt(message.vector()), sourceIdentifier, sourceOrigin);
+ SWContextManager::singleton().postMessageToServiceWorkerGlobalScope(destinationIdentifier, SerializedScriptValue::adopt(message.vector()), sourceIdentifier, sourceOrigin);
}
-void WebSWContextManagerConnection::postMessageToServiceWorkerClient(const ServiceWorkerClientIdentifier& destinationIdentifier, Ref<SerializedScriptValue>&& message, uint64_t sourceServiceWorkerIdentifier, const String& sourceOrigin)
+void WebSWContextManagerConnection::postMessageToServiceWorkerClient(const ServiceWorkerClientIdentifier& destinationIdentifier, Ref<SerializedScriptValue>&& message, ServiceWorkerIdentifier sourceIdentifier, const String& sourceOrigin)
{
- m_connectionToStorageProcess->send(Messages::StorageProcess::PostMessageToServiceWorkerClient(destinationIdentifier, IPC::DataReference { message->data() }, sourceServiceWorkerIdentifier, sourceOrigin), 0);
+ m_connectionToStorageProcess->send(Messages::StorageProcess::PostMessageToServiceWorkerClient(destinationIdentifier, IPC::DataReference { message->data() }, sourceIdentifier, sourceOrigin), 0);
}
} // namespace WebCore
Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h (224402 => 224403)
--- trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h 2017-11-03 16:37:04 UTC (rev 224403)
@@ -51,13 +51,13 @@
void updatePreferences(const WebPreferencesStore&);
// WebCore::SWContextManager::Connection.
- void postMessageToServiceWorkerClient(const WebCore::ServiceWorkerClientIdentifier& destinationIdentifier, Ref<WebCore::SerializedScriptValue>&& message, uint64_t sourceServiceWorkerIdentifier, const String& sourceOrigin) final;
+ void postMessageToServiceWorkerClient(const WebCore::ServiceWorkerClientIdentifier& destinationIdentifier, Ref<WebCore::SerializedScriptValue>&& message, WebCore::ServiceWorkerIdentifier sourceIdentifier, const String& sourceOrigin) final;
// IPC messages.
- void serviceWorkerStartedWithMessage(uint64_t serviceWorkerIdentifier, const String& exceptionMessage) final;
+ void serviceWorkerStartedWithMessage(WebCore::ServiceWorkerIdentifier, const String& exceptionMessage) final;
void updateServiceWorker(uint64_t serverConnectionIdentifier, const WebCore::ServiceWorkerContextData&);
- void startFetch(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier, uint64_t serviceWorkerIdentifier, WebCore::ResourceRequest&&, WebCore::FetchOptions&&);
- void postMessageToServiceWorkerGlobalScope(uint64_t destinationServiceWorkerIdentifier, const IPC::DataReference& message, const WebCore::ServiceWorkerClientIdentifier& sourceIdentifier, const String& sourceOrigin);
+ void startFetch(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier, std::optional<WebCore::ServiceWorkerIdentifier>, WebCore::ResourceRequest&&, WebCore::FetchOptions&&);
+ void postMessageToServiceWorkerGlobalScope(WebCore::ServiceWorkerIdentifier destinationIdentifier, const IPC::DataReference& message, const WebCore::ServiceWorkerClientIdentifier& sourceIdentifier, const String& sourceOrigin);
Ref<IPC::Connection> m_connectionToStorageProcess;
uint64_t m_pageID { 0 };
Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.messages.in (224402 => 224403)
--- trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.messages.in 2017-11-03 16:35:59 UTC (rev 224402)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.messages.in 2017-11-03 16:37:04 UTC (rev 224403)
@@ -24,8 +24,8 @@
messages -> WebSWContextManagerConnection {
UpdateServiceWorker(uint64_t serverConnectionIdentifier, struct WebCore::ServiceWorkerContextData contextData)
- StartFetch(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier, uint64_t serviceWorkerIdentifier, WebCore::ResourceRequest request, struct WebCore::FetchOptions options)
- PostMessageToServiceWorkerGlobalScope(uint64_t destinationServiceWorkerIdentifier, IPC::DataReference message, struct WebCore::ServiceWorkerClientIdentifier sourceIdentifier, String sourceOrigin)
+ StartFetch(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier, std::optional<WebCore::ServiceWorkerIdentifier> serviceWorkerIdentifier, WebCore::ResourceRequest request, struct WebCore::FetchOptions options)
+ PostMessageToServiceWorkerGlobalScope(WebCore::ServiceWorkerIdentifier destinationIdentifier, IPC::DataReference message, struct WebCore::ServiceWorkerClientIdentifier sourceIdentifier, String sourceOrigin)
}
#endif