Unreviewed, rolling out r230210.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Apr 2018 19:58:09 +0000 (19:58 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Apr 2018 19:58:09 +0000 (19:58 +0000)
https://bugs.webkit.org/show_bug.cgi?id=184277

it is breaking internal bots (Requested by youenn on #webkit).

Reverted changeset:

"Make NetworkProcess get ContentBlocker information from
UIProcess"
https://bugs.webkit.org/show_bug.cgi?id=184205
https://trac.webkit.org/changeset/230210

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@230218 268f45cc-cd09-0410-ab3c-d52691b4dbfc

30 files changed:
Source/WebKit/CMakeLists.txt
Source/WebKit/ChangeLog
Source/WebKit/DerivedSources.make
Source/WebKit/NetworkProcess/NetworkContentRuleListManager.cpp [deleted file]
Source/WebKit/NetworkProcess/NetworkContentRuleListManager.h [deleted file]
Source/WebKit/NetworkProcess/NetworkContentRuleListManager.messages.in [deleted file]
Source/WebKit/NetworkProcess/NetworkLoadChecker.cpp
Source/WebKit/NetworkProcess/NetworkLoadChecker.h
Source/WebKit/NetworkProcess/NetworkProcess.cpp
Source/WebKit/NetworkProcess/NetworkProcess.h
Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.cpp
Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.h
Source/WebKit/NetworkProcess/PingLoad.cpp
Source/WebKit/NetworkProcess/PingLoad.h
Source/WebKit/Scripts/webkit/messages.py
Source/WebKit/Shared/UserContentControllerIdentifier.h [deleted file]
Source/WebKit/Shared/WebPageCreationParameters.cpp
Source/WebKit/Shared/WebPageCreationParameters.h
Source/WebKit/Shared/WebPageGroupData.cpp
Source/WebKit/Shared/WebPageGroupData.h
Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp
Source/WebKit/UIProcess/Network/NetworkProcessProxy.h
Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in
Source/WebKit/UIProcess/UserContent/WebUserContentControllerProxy.cpp
Source/WebKit/UIProcess/UserContent/WebUserContentControllerProxy.h
Source/WebKit/WebKit.xcodeproj/project.pbxproj
Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp
Source/WebKit/WebProcess/UserContent/WebUserContentController.cpp
Source/WebKit/WebProcess/UserContent/WebUserContentController.h
Source/WebKit/WebProcess/WebPage/WebPage.h

index a5b9f1d..60e92b7 100644 (file)
@@ -107,7 +107,6 @@ set(WebKit_SOURCES
 
     NetworkProcess/NetworkCORSPreflightChecker.cpp
     NetworkProcess/NetworkConnectionToWebProcess.cpp
-    NetworkProcess/NetworkContentRuleListManager.cpp
     NetworkProcess/NetworkDataTask.cpp
     NetworkProcess/NetworkDataTaskBlob.cpp
     NetworkProcess/NetworkLoad.cpp
@@ -620,7 +619,6 @@ set(WebKit_MESSAGES_IN_FILES
     NetworkProcess/Cookies/WebCookieManager.messages.in
 
     NetworkProcess/NetworkConnectionToWebProcess.messages.in
-    NetworkProcess/NetworkContentRuleListManager.messages.in
     NetworkProcess/NetworkProcess.messages.in
     NetworkProcess/NetworkResourceLoader.messages.in
     NetworkProcess/NetworkSocketStream.messages.in
index 287c70f..d670ad9 100644 (file)
@@ -1,3 +1,17 @@
+2018-04-03  Commit Queue  <commit-queue@webkit.org>
+
+        Unreviewed, rolling out r230210.
+        https://bugs.webkit.org/show_bug.cgi?id=184277
+
+        it is breaking internal bots (Requested by youenn on #webkit).
+
+        Reverted changeset:
+
+        "Make NetworkProcess get ContentBlocker information from
+        UIProcess"
+        https://bugs.webkit.org/show_bug.cgi?id=184205
+        https://trac.webkit.org/changeset/230210
+
 2018-04-03  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         [Extra zoom mode] Update time picker to use platform view controller
index 4f564d5..2280400 100644 (file)
@@ -115,7 +115,6 @@ MESSAGE_RECEIVERS = \
     NetworkRTCSocket \
     NetworkResourceLoader \
     NetworkSocketStream \
-    NetworkContentRuleListManager \
     PluginControllerProxy \
     PluginProcess \
     PluginProcessConnection \
diff --git a/Source/WebKit/NetworkProcess/NetworkContentRuleListManager.cpp b/Source/WebKit/NetworkProcess/NetworkContentRuleListManager.cpp
deleted file mode 100644 (file)
index 8523e03..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#include "config.h"
-#include "NetworkContentRuleListManager.h"
-
-#if ENABLE(CONTENT_EXTENSIONS)
-
-#include "NetworkProcess.h"
-#include "NetworkProcessProxyMessages.h"
-#include "WebCompiledContentRuleList.h"
-
-using namespace WebCore;
-
-namespace WebKit {
-
-NetworkContentRuleListManager::NetworkContentRuleListManager() = default;
-NetworkContentRuleListManager::~NetworkContentRuleListManager()
-{
-    auto pendingCallbacks = WTFMove(m_pendingCallbacks);
-    if (pendingCallbacks.isEmpty())
-        return;
-
-    WebCore::ContentExtensions::ContentExtensionsBackend backend;
-    for (auto& callbacks : pendingCallbacks.values()) {
-        for (auto& callback : callbacks)
-            callback(backend);
-    }
-}
-
-void NetworkContentRuleListManager::contentExtensionsBackend(UserContentControllerIdentifier identifier, BackendCallback&& callback)
-{
-    auto iterator = m_contentExtensionBackends.find(identifier);
-    if (iterator != m_contentExtensionBackends.end()) {
-        callback(*iterator->value);
-        return;
-    }
-    m_pendingCallbacks.ensure(identifier, [] {
-        return Vector<BackendCallback> { };
-    }).iterator->value.append(WTFMove(callback));
-    NetworkProcess::singleton().parentProcessConnection()->send(Messages::NetworkProcessProxy::ContentExtensionRules { identifier }, 0);
-}
-
-void NetworkContentRuleListManager::addContentRuleLists(UserContentControllerIdentifier identifier, const Vector<std::pair<String, WebCompiledContentRuleListData>>& contentRuleLists)
-{
-    auto& backend = *m_contentExtensionBackends.ensure(identifier, [] {
-        return std::make_unique<WebCore::ContentExtensions::ContentExtensionsBackend>();
-    }).iterator->value;
-
-    for (const auto& contentRuleList : contentRuleLists) {
-        WebCompiledContentRuleListData contentRuleListData = contentRuleList.second;
-        auto compiledContentRuleList = WebCompiledContentRuleList::create(WTFMove(contentRuleListData));
-        backend.addContentExtension(contentRuleList.first, WTFMove(compiledContentRuleList));
-    }
-
-    auto pendingCallbacks = m_pendingCallbacks.take(identifier);
-    for (auto& callback : pendingCallbacks)
-        callback(backend);
-
-}
-
-void NetworkContentRuleListManager::removeContentRuleList(UserContentControllerIdentifier identifier, const String& name)
-{
-    auto iterator = m_contentExtensionBackends.find(identifier);
-    if (iterator == m_contentExtensionBackends.end())
-        return;
-
-    iterator->value->removeContentExtension(name);
-}
-
-void NetworkContentRuleListManager::removeAllContentRuleLists(UserContentControllerIdentifier identifier)
-{
-    auto iterator = m_contentExtensionBackends.find(identifier);
-    if (iterator == m_contentExtensionBackends.end())
-        return;
-
-    iterator->value->removeAllContentExtensions();
-}
-
-void NetworkContentRuleListManager::remove(UserContentControllerIdentifier identifier)
-{
-    m_contentExtensionBackends.remove(identifier);
-}
-
-} // namespace WebKit
-
-#endif // ENABLE(CONTENT_EXTENSIONS)
diff --git a/Source/WebKit/NetworkProcess/NetworkContentRuleListManager.h b/Source/WebKit/NetworkProcess/NetworkContentRuleListManager.h
deleted file mode 100644 (file)
index 0f76ce2..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2018 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(CONTENT_EXTENSIONS)
-
-#include "UserContentControllerIdentifier.h"
-#include "WebCompiledContentRuleListData.h"
-#include <WebCore/ContentExtensionsBackend.h>
-#include <WebCore/UserContentProvider.h>
-
-namespace IPC {
-class Connection;
-class Decoder;
-}
-
-namespace WebKit {
-
-class NetworkContentRuleListManager {
-public:
-    NetworkContentRuleListManager();
-    ~NetworkContentRuleListManager();
-
-    void didReceiveMessage(IPC::Connection&, IPC::Decoder&);
-
-    using BackendCallback = CompletionHandler<void(WebCore::ContentExtensions::ContentExtensionsBackend&)>;
-    void contentExtensionsBackend(UserContentControllerIdentifier, BackendCallback&&);
-
-private:
-    void addContentRuleLists(UserContentControllerIdentifier, const Vector<std::pair<String, WebCompiledContentRuleListData>>&);
-    void removeContentRuleList(UserContentControllerIdentifier, const String& name);
-    void removeAllContentRuleLists(UserContentControllerIdentifier);
-    void remove(UserContentControllerIdentifier);
-
-    HashMap<UserContentControllerIdentifier, std::unique_ptr<WebCore::ContentExtensions::ContentExtensionsBackend>> m_contentExtensionBackends;
-    HashMap<UserContentControllerIdentifier, Vector<BackendCallback>> m_pendingCallbacks;
-};
-
-} // namespace WebKit
-
-#endif // ENABLE(CONTENT_EXTENSIONS)
diff --git a/Source/WebKit/NetworkProcess/NetworkContentRuleListManager.messages.in b/Source/WebKit/NetworkProcess/NetworkContentRuleListManager.messages.in
deleted file mode 100644 (file)
index ae01641..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright (C) 2018 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.
-
-#if ENABLE(CONTENT_EXTENSIONS)
-
-messages -> NetworkContentRuleListManager {
-    Remove(WebKit::UserContentControllerIdentifier identifier)
-    AddContentRuleLists(WebKit::UserContentControllerIdentifier identifier, Vector<std::pair<String, WebKit::WebCompiledContentRuleListData>> contentFilters)
-    RemoveContentRuleList(WebKit::UserContentControllerIdentifier identifier, String name)
-    RemoveAllContentRuleLists(WebKit::UserContentControllerIdentifier identifier)
-}
-
-#endif
index e4e713f..a145e81 100644 (file)
@@ -28,9 +28,7 @@
 
 #include "Logging.h"
 #include "NetworkCORSPreflightChecker.h"
-#include "NetworkProcess.h"
 #include "WebCompiledContentRuleList.h"
-#include "WebUserContentController.h"
 #include <WebCore/ContentSecurityPolicy.h>
 #include <WebCore/CrossOriginAccessControl.h>
 #include <WebCore/CrossOriginPreflightResultCache.h>
@@ -97,20 +95,12 @@ NetworkLoadChecker::RequestOrError NetworkLoadChecker::returnError(String&& erro
 void NetworkLoadChecker::checkRequest(ResourceRequest&& request, ValidationHandler&& handler)
 {
 #if ENABLE(CONTENT_EXTENSIONS)
-    processContentExtensionRulesForLoad(WTFMove(request), [this, handler = WTFMove(handler)](auto&& request, auto status) mutable {
-        if (status.blockedLoad) {
-            handler(this->returnError(ASCIILiteral("Blocked by content extension")));
-            return;
-        }
-        this->continueCheckingRequest(WTFMove(request), WTFMove(handler));
-    });
-#else
-    continueCheckingRequest(WTFMove(request), WTFMove(handler));
+    if (processContentExtensionRulesForLoad(request).blockedLoad) {
+        handler(returnError(ASCIILiteral("Blocked by content extension")));
+        return;
+    }
 #endif
-}
 
-void NetworkLoadChecker::continueCheckingRequest(ResourceRequest&& request, ValidationHandler&& handler)
-{
     if (auto* contentSecurityPolicy = this->contentSecurityPolicy()) {
         if (isRedirected()) {
             URL url = request.url();
@@ -239,18 +229,21 @@ ContentSecurityPolicy* NetworkLoadChecker::contentSecurityPolicy() const
 }
 
 #if ENABLE(CONTENT_EXTENSIONS)
-void NetworkLoadChecker::processContentExtensionRulesForLoad(ResourceRequest&& request, CompletionHandler<void(WebCore::ResourceRequest&&, const ContentExtensions::BlockedStatus&)>&& callback)
+ContentExtensions::ContentExtensionsBackend& NetworkLoadChecker::contentExtensionsBackend()
 {
-    if (!m_userContentControllerIdentifier) {
-        ContentExtensions::BlockedStatus status;
-        callback(WTFMove(request), status);
-        return;
+    if (!m_contentExtensionsBackend) {
+        m_contentExtensionsBackend = std::make_unique<ContentExtensions::ContentExtensionsBackend>();
+        for (auto& pair : m_contentRuleLists)
+            m_contentExtensionsBackend->addContentExtension(pair.first, WebCompiledContentRuleList::create(WTFMove(pair.second)));
     }
-    NetworkProcess::singleton().networkContentRuleListManager().contentExtensionsBackend(*m_userContentControllerIdentifier, [protectedThis = makeRef(*this), this, request = WTFMove(request), callback = WTFMove(callback)](auto& backend) mutable {
-        auto status = backend.processContentExtensionRulesForPingLoad(request.url(), m_mainDocumentURL);
-        applyBlockedStatusToRequest(status, nullptr, request);
-        callback(WTFMove(request), status);
-    });
+    return *m_contentExtensionsBackend;
+}
+
+ContentExtensions::BlockedStatus NetworkLoadChecker::processContentExtensionRulesForLoad(ResourceRequest& request)
+{
+    auto status = contentExtensionsBackend().processContentExtensionRulesForPingLoad(request.url(), m_mainDocumentURL);
+    applyBlockedStatusToRequest(status, nullptr, request);
+    return status;
 }
 #endif // ENABLE(CONTENT_EXTENSIONS)
 
index 032d5f4..ecfb5eb 100644 (file)
@@ -25,8 +25,8 @@
 
 #pragma once
 
-#include "NetworkContentRuleListManager.h"
 #include "NetworkResourceLoadParameters.h"
+#include <WebCore/ContentExtensionsBackend.h>
 #include <WebCore/ResourceError.h>
 #include <WebCore/ResourceResponse.h>
 #include <wtf/CompletionHandler.h>
@@ -40,12 +40,9 @@ namespace WebKit {
 
 class NetworkCORSPreflightChecker;
 
-class NetworkLoadChecker : public RefCounted<NetworkLoadChecker> {
+class NetworkLoadChecker {
 public:
-    static Ref<NetworkLoadChecker> create(WebCore::FetchOptions::Mode mode, bool shouldFollowRedirects, WebCore::StoredCredentialsPolicy storedCredentialsPolicy, PAL::SessionID sessionID, WebCore::HTTPHeaderMap&& originalHeaders, WebCore::URL&& url, RefPtr<WebCore::SecurityOrigin>&& sourceOrigin)
-    {
-        return adoptRef(*new NetworkLoadChecker { mode, shouldFollowRedirects, storedCredentialsPolicy, sessionID, WTFMove(originalHeaders), WTFMove(url), WTFMove(sourceOrigin) });
-    }
+    NetworkLoadChecker(WebCore::FetchOptions::Mode, bool shouldFollowRedirects, WebCore::StoredCredentialsPolicy, PAL::SessionID, WebCore::HTTPHeaderMap&&, WebCore::URL&&, RefPtr<WebCore::SecurityOrigin>&&);
     ~NetworkLoadChecker();
 
     using RequestOrError = Expected<WebCore::ResourceRequest, WebCore::ResourceError>;
@@ -55,10 +52,10 @@ public:
 
     void setCSPResponseHeaders(WebCore::ContentSecurityPolicyResponseHeaders&& headers) { m_cspResponseHeaders = WTFMove(headers); }
 #if ENABLE(CONTENT_EXTENSIONS)
-    void setContentExtensionController(WebCore::URL&& mainDocumentURL, std::optional<UserContentControllerIdentifier> identifier)
+    void setContentExtensionRuleLists(WebCore::URL&& mainDocumentURL, Vector<std::pair<String, WebCompiledContentRuleListData>>&& contentRuleLists)
     {
         m_mainDocumentURL = WTFMove(mainDocumentURL);
-        m_userContentControllerIdentifier = identifier;
+        m_contentRuleLists = WTFMove(contentRuleLists);
     }
 #endif
 
@@ -66,16 +63,12 @@ public:
     WebCore::StoredCredentialsPolicy storedCredentialsPolicy() const { return m_storedCredentialsPolicy; }
 
 private:
-    NetworkLoadChecker(WebCore::FetchOptions::Mode, bool shouldFollowRedirects, WebCore::StoredCredentialsPolicy, PAL::SessionID, WebCore::HTTPHeaderMap&&, WebCore::URL&&, RefPtr<WebCore::SecurityOrigin>&&);
-
     WebCore::ContentSecurityPolicy* contentSecurityPolicy() const;
     bool isChecking() const { return !!m_corsPreflightChecker; }
     bool isRedirected() const { return m_redirectCount; }
 
     void checkRequest(WebCore::ResourceRequest&&, ValidationHandler&&);
 
-    void continueCheckingRequest(WebCore::ResourceRequest&&, ValidationHandler&&);
-
     bool doesNotNeedCORSCheck(const WebCore::URL&) const;
     void checkCORSRequest(WebCore::ResourceRequest&&, ValidationHandler&&);
     void checkCORSRedirectedRequest(WebCore::ResourceRequest&&, ValidationHandler&&);
@@ -84,7 +77,8 @@ private:
     RequestOrError returnError(String&& error);
 
 #if ENABLE(CONTENT_EXTENSIONS)
-    void processContentExtensionRulesForLoad(WebCore::ResourceRequest&&, CompletionHandler<void(WebCore::ResourceRequest&&, const WebCore::ContentExtensions::BlockedStatus&)>&&);
+    WebCore::ContentExtensions::ContentExtensionsBackend& contentExtensionsBackend();
+    WebCore::ContentExtensions::BlockedStatus processContentExtensionRulesForLoad(WebCore::ResourceRequest&);
 #endif
 
     WebCore::FetchOptions::Mode m_mode;
@@ -98,13 +92,16 @@ private:
     std::optional<WebCore::ContentSecurityPolicyResponseHeaders> m_cspResponseHeaders;
 #if ENABLE(CONTENT_EXTENSIONS)
     WebCore::URL m_mainDocumentURL;
-    std::optional<UserContentControllerIdentifier> m_userContentControllerIdentifier;
+    Vector<std::pair<String, WebCompiledContentRuleListData>> m_contentRuleLists;
 #endif
 
     std::unique_ptr<NetworkCORSPreflightChecker> m_corsPreflightChecker;
     bool m_isSameOriginRequest { true };
     bool m_isSimpleRequest { true };
     mutable std::unique_ptr<WebCore::ContentSecurityPolicy> m_contentSecurityPolicy;
+#if ENABLE(CONTENT_EXTENSIONS)
+    std::unique_ptr<WebCore::ContentExtensions::ContentExtensionsBackend> m_contentExtensionsBackend;
+#endif
     size_t m_redirectCount { 0 };
     WebCore::URL m_previousURL;
 };
index 7977da1..1c5588e 100644 (file)
@@ -39,7 +39,6 @@
 #include "Logging.h"
 #include "NetworkBlobRegistry.h"
 #include "NetworkConnectionToWebProcess.h"
-#include "NetworkContentRuleListManagerMessages.h"
 #include "NetworkProcessCreationParameters.h"
 #include "NetworkProcessPlatformStrategies.h"
 #include "NetworkProcessProxyMessages.h"
@@ -172,13 +171,6 @@ void NetworkProcess::didReceiveMessage(IPC::Connection& connection, IPC::Decoder
         return;
     }
 
-#if ENABLE(CONTENT_EXTENSIONS)
-    if (decoder.messageReceiverName() == Messages::NetworkContentRuleListManager::messageReceiverName()) {
-        m_NetworkContentRuleListManager.didReceiveMessage(connection, decoder);
-        return;
-    }
-#endif
-
     didReceiveNetworkProcessMessage(connection, decoder);
 }
 
index ce412b4..d8cea69 100644 (file)
@@ -29,7 +29,6 @@
 #include "ChildProcess.h"
 #include "DownloadManager.h"
 #include "MessageReceiverMap.h"
-#include "NetworkContentRuleListManager.h"
 #include <WebCore/DiagnosticLoggingClient.h>
 #include <memory>
 #include <pal/SessionID.h>
@@ -158,10 +157,6 @@ public:
     void setSessionIsControlledByAutomation(PAL::SessionID, bool);
     bool sessionIsControlledByAutomation(PAL::SessionID) const;
 
-#if ENABLE(CONTENT_EXTENSIONS)
-    NetworkContentRuleListManager& networkContentRuleListManager() { return m_NetworkContentRuleListManager; }
-#endif
-
 private:
     NetworkProcess();
     ~NetworkProcess();
@@ -296,10 +291,6 @@ private:
 #if PLATFORM(IOS)
     WebSQLiteDatabaseTracker m_webSQLiteDatabaseTracker;
 #endif
-
-#if ENABLE(CONTENT_EXTENSIONS)
-    NetworkContentRuleListManager m_NetworkContentRuleListManager;
-#endif
 };
 
 } // namespace WebKit
index 44077d3..0172c3b 100644 (file)
@@ -93,7 +93,7 @@ void NetworkResourceLoadParameters::encode(IPC::Encoder& encoder) const
 
 #if ENABLE(CONTENT_EXTENSIONS)
     encoder << mainDocumentURL;
-    encoder << userContentControllerIdentifier;
+    encoder << contentRuleLists;
 #endif
 }
 
@@ -184,11 +184,11 @@ bool NetworkResourceLoadParameters::decode(IPC::Decoder& decoder, NetworkResourc
     if (!decoder.decode(result.mainDocumentURL))
         return false;
 
-    std::optional<std::optional<UserContentControllerIdentifier>> userContentControllerIdentifier;
-    decoder >> userContentControllerIdentifier;
-    if (!userContentControllerIdentifier)
+    std::optional<Vector<std::pair<String, WebCompiledContentRuleListData>>> contentRuleLists;
+    decoder >> contentRuleLists;
+    if (!contentRuleLists)
         return false;
-    result.userContentControllerIdentifier = *userContentControllerIdentifier;
+    result.contentRuleLists = WTFMove(*contentRuleLists);
 #endif
 
     return true;
index 2cc33ac..77de855 100644 (file)
@@ -27,7 +27,7 @@
 
 #include "NetworkLoadParameters.h"
 #include "SandboxExtension.h"
-#include "UserContentControllerIdentifier.h"
+#include "WebCompiledContentRuleListData.h"
 #include <WebCore/ContentSecurityPolicyResponseHeaders.h>
 #include <WebCore/FetchOptions.h>
 #include <WebCore/ResourceLoaderOptions.h>
@@ -61,7 +61,7 @@ public:
 
 #if ENABLE(CONTENT_EXTENSIONS)
     WebCore::URL mainDocumentURL;
-    std::optional<UserContentControllerIdentifier> userContentControllerIdentifier;
+    Vector<std::pair<String, WebCompiledContentRuleListData>> contentRuleLists;
 #endif
 };
 
index 25f963a..bc48943 100644 (file)
@@ -42,13 +42,13 @@ PingLoad::PingLoad(NetworkResourceLoadParameters&& parameters, HTTPHeaderMap&& o
     : m_parameters(WTFMove(parameters))
     , m_completionHandler(WTFMove(completionHandler))
     , m_timeoutTimer(*this, &PingLoad::timeoutTimerFired)
-    , m_networkLoadChecker(NetworkLoadChecker::create(m_parameters.mode, m_parameters.shouldFollowRedirects, m_parameters.storedCredentialsPolicy, m_parameters.sessionID, WTFMove(originalRequestHeaders), URL { m_parameters.request.url() }, m_parameters.sourceOrigin.copyRef()))
+    , m_networkLoadChecker(makeUniqueRef<NetworkLoadChecker>(m_parameters.mode, m_parameters.shouldFollowRedirects, m_parameters.storedCredentialsPolicy, m_parameters.sessionID, WTFMove(originalRequestHeaders), URL { m_parameters.request.url() }, m_parameters.sourceOrigin.copyRef()))
 {
 
     if (m_parameters.cspResponseHeaders)
         m_networkLoadChecker->setCSPResponseHeaders(WTFMove(m_parameters.cspResponseHeaders.value()));
 #if ENABLE(CONTENT_EXTENSIONS)
-    m_networkLoadChecker->setContentExtensionController(WTFMove(m_parameters.mainDocumentURL), m_parameters.userContentControllerIdentifier);
+    m_networkLoadChecker->setContentExtensionRuleLists(WTFMove(m_parameters.mainDocumentURL), WTFMove(m_parameters.contentRuleLists));
 #endif
 
     // If the server never responds, this object will hang around forever.
index a1ef6e7..74a6985 100644 (file)
@@ -70,7 +70,7 @@ private:
     WTF::CompletionHandler<void(const WebCore::ResourceError&, const WebCore::ResourceResponse&)> m_completionHandler;
     RefPtr<NetworkDataTask> m_task;
     WebCore::Timer m_timeoutTimer;
-    Ref<NetworkLoadChecker> m_networkLoadChecker;
+    UniqueRef<NetworkLoadChecker> m_networkLoadChecker;
     std::optional<WebCore::ResourceRequest> m_lastRedirectionRequest;
 };
 
index b7a4c96..27f05c7 100644 (file)
@@ -185,7 +185,6 @@ def forward_declarations_and_headers(receiver):
             types_by_namespace['IPC'].update([('class', 'Connection')])
 
     no_forward_declaration_types = frozenset([
-        'String',
         'WebCore::DocumentIdentifier',
         'WebCore::ServiceWorkerIdentifier',
         'WebCore::ServiceWorkerJobIdentifier',
@@ -193,7 +192,7 @@ def forward_declarations_and_headers(receiver):
         'WebCore::ServiceWorkerOrClientIdentifier',
         'WebCore::ServiceWorkerRegistrationIdentifier',
         'WebCore::SWServerConnectionIdentifier',
-        'WebKit::UserContentControllerIdentifier',
+        'String',
     ])
 
     for parameter in receiver.iterparameters():
diff --git a/Source/WebKit/Shared/UserContentControllerIdentifier.h b/Source/WebKit/Shared/UserContentControllerIdentifier.h
deleted file mode 100644 (file)
index eb3fb43..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2018 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/ObjectIdentifier.h>
-
-namespace WebKit {
-
-enum UserContentControllerIdentifierType { };
-using UserContentControllerIdentifier = ObjectIdentifier<UserContentControllerIdentifierType>;
-
-}
index 867159b..7089da8 100644 (file)
@@ -179,13 +179,8 @@ std::optional<WebPageCreationParameters> WebPageCreationParameters::decode(IPC::
         return std::nullopt;
     if (!decoder.decode(parameters.highestUsedBackForwardItemID))
         return std::nullopt;
-
-    std::optional<UserContentControllerIdentifier> userContentControllerIdentifier;
-    decoder >> userContentControllerIdentifier;
-    if (!userContentControllerIdentifier)
+    if (!decoder.decode(parameters.userContentControllerID))
         return std::nullopt;
-    parameters.userContentControllerID = *userContentControllerIdentifier;
-
     if (!decoder.decode(parameters.visitedLinkTableID))
         return std::nullopt;
     if (!decoder.decode(parameters.websiteDataStoreID))
index baebaf4..6bd1961 100644 (file)
@@ -98,7 +98,7 @@ struct WebPageCreationParameters {
     PAL::SessionID sessionID;
     uint64_t highestUsedBackForwardItemID;
 
-    UserContentControllerIdentifier userContentControllerID;
+    uint64_t userContentControllerID;
     uint64_t visitedLinkTableID;
     uint64_t websiteDataStoreID;
     bool canRunBeforeUnloadConfirmPanel;
index abda7d5..275007a 100644 (file)
@@ -53,11 +53,10 @@ std::optional<WebPageGroupData> WebPageGroupData::decode(IPC::Decoder& decoder)
     bool visibleToHistoryClient;
     if (!decoder.decode(visibleToHistoryClient))
         return std::nullopt;
-    std::optional<UserContentControllerIdentifier> userContentControllerIdentifier;
-    decoder >> userContentControllerIdentifier;
-    if (!userContentControllerIdentifier)
+    uint64_t userContentControllerIdentifier;
+    if (!decoder.decode(userContentControllerIdentifier))
         return std::nullopt;
-    return { { id, pageGroupID, visibleToInjectedBundle, visibleToHistoryClient, *userContentControllerIdentifier } };
+    return { { id, pageGroupID, visibleToInjectedBundle, visibleToHistoryClient, userContentControllerIdentifier } };
 }
 
 } // namespace WebKit
index 930d8ee..2c61e59 100644 (file)
@@ -25,7 +25,6 @@
 
 #pragma once
 
-#include "UserContentControllerIdentifier.h"
 #include <wtf/text/WTFString.h>
 
 namespace IPC {
@@ -44,7 +43,7 @@ struct WebPageGroupData {
     bool visibleToInjectedBundle;
     bool visibleToHistoryClient;
 
-    UserContentControllerIdentifier userContentControllerIdentifier;
+    uint64_t userContentControllerIdentifier;
 };
 
 } // namespace WebKit
index 5c69422..613893e 100644 (file)
 #include "config.h"
 #include "NetworkProcessProxy.h"
 
-#include "APIContentRuleList.h"
 #include "AuthenticationChallengeProxy.h"
 #include "DownloadProxyMessages.h"
 #if ENABLE(LEGACY_CUSTOM_PROTOCOL_MANAGER)
 #include "LegacyCustomProtocolManagerProxyMessages.h"
 #endif
 #include "Logging.h"
-#include "NetworkContentRuleListManagerMessages.h"
 #include "NetworkProcessCreationParameters.h"
 #include "NetworkProcessMessages.h"
 #include "SandboxExtension.h"
 #include "StorageProcessMessages.h"
-#include "WebCompiledContentRuleList.h"
 #include "WebPageProxy.h"
 #include "WebProcessMessages.h"
 #include "WebProcessPool.h"
-#include "WebUserContentControllerProxy.h"
 #include "WebsiteData.h"
 #include <wtf/CompletionHandler.h>
 
@@ -89,10 +85,6 @@ NetworkProcessProxy::~NetworkProcessProxy()
     ASSERT(m_pendingFetchWebsiteDataCallbacks.isEmpty());
     ASSERT(m_pendingDeleteWebsiteDataCallbacks.isEmpty());
     ASSERT(m_pendingDeleteWebsiteDataForOriginsCallbacks.isEmpty());
-#if ENABLE(CONTENT_EXTENSIONS)
-    for (auto* proxy : m_webUserContentControllerProxies)
-        proxy->removeNetworkProcess(*this);
-#endif
 }
 
 void NetworkProcessProxy::getLaunchOptions(ProcessLauncher::LaunchOptions& launchOptions)
@@ -548,28 +540,4 @@ void NetworkProcessProxy::setIsHoldingLockedFiles(bool isHoldingLockedFiles)
     }
 }
 
-
-#if ENABLE(CONTENT_EXTENSIONS)
-void NetworkProcessProxy::contentExtensionRules(UserContentControllerIdentifier identifier)
-{
-    if (auto* webUserContentControllerProxy = WebUserContentControllerProxy::get(identifier)) {
-        m_webUserContentControllerProxies.add(webUserContentControllerProxy);
-        webUserContentControllerProxy->addNetworkProcess(*this);
-
-        auto rules = WTF::map(webUserContentControllerProxy->contentExtensionRules(), [](auto&& keyValue) -> std::pair<String, WebCompiledContentRuleListData> {
-            return std::make_pair(keyValue.value->name(), keyValue.value->compiledRuleList().data());
-        });
-        send(Messages::NetworkContentRuleListManager::AddContentRuleLists { identifier, rules }, 0);
-        return;
-    }
-    send(Messages::NetworkContentRuleListManager::AddContentRuleLists { identifier, { } }, 0);
-}
-
-void NetworkProcessProxy::didDestroyWebUserContentControllerProxy(WebUserContentControllerProxy& proxy)
-{
-    send(Messages::NetworkContentRuleListManager::Remove { proxy.identifier() }, 0);
-    m_webUserContentControllerProxies.remove(&proxy);
-}
-#endif
-
 } // namespace WebKit
index c9dc792..fffb414 100644 (file)
@@ -33,7 +33,6 @@
 #include "ProcessLauncher.h"
 #include "ProcessThrottler.h"
 #include "ProcessThrottlerClient.h"
-#include "UserContentControllerIdentifier.h"
 #include "WebProcessProxyMessages.h"
 #include <memory>
 #include <wtf/Deque.h>
@@ -60,7 +59,6 @@ class WebProcessPool;
 enum class WebsiteDataFetchOption;
 enum class WebsiteDataType;
 struct NetworkProcessCreationParameters;
-class WebUserContentControllerProxy;
 struct WebsiteData;
 
 class NetworkProcessProxy : public ChildProcessProxy, private ProcessThrottlerClient {
@@ -96,10 +94,6 @@ public:
     ProcessThrottler& throttler() { return m_throttler; }
     WebProcessPool& processPool() { return m_processPool; }
 
-#if ENABLE(CONTENT_EXTENSIONS)
-    void didDestroyWebUserContentControllerProxy(WebUserContentControllerProxy&);
-#endif
-
 private:
     NetworkProcessProxy(WebProcessPool&);
 
@@ -145,10 +139,6 @@ private:
     void allStorageAccessEntriesResult(Vector<String>&& domains, uint64_t contextId);
 #endif
 
-#if ENABLE(CONTENT_EXTENSIONS)
-    void contentExtensionRules(UserContentControllerIdentifier);
-#endif
-
     // ProcessLauncher::Client
     void didFinishLaunching(ProcessLauncher*, IPC::Connection::Identifier) override;
 
@@ -171,10 +161,6 @@ private:
     HashMap<uint64_t, CompletionHandler<void(bool success)>> m_writeBlobToFilePathCallbackMap;
     HashMap<uint64_t, WTF::CompletionHandler<void(bool wasGranted)>> m_storageAccessResponseCallbackMap;
     HashMap<uint64_t, CompletionHandler<void(Vector<String>&& domains)>> m_allStorageAccessEntriesCallbackMap;
-
-#if ENABLE(CONTENT_EXTENSIONS)
-    HashSet<WebUserContentControllerProxy*> m_webUserContentControllerProxies;
-#endif
 };
 
 } // namespace WebKit
index 184c2fd..6126ea5 100644 (file)
@@ -47,8 +47,4 @@ messages -> NetworkProcessProxy LegacyReceiver {
 #if HAVE(CFNETWORK_STORAGE_PARTITIONING)
     StorageAccessRequestResult(bool wasGranted, uint64_t contextId)
     AllStorageAccessEntriesResult(Vector<String> domains, uint64_t contextId)
-
-#if ENABLE(CONTENT_EXTENSIONS)
-    ContentExtensionRules(WebKit::UserContentControllerIdentifier identifier)
-#endif
 }
index 42fb8ea..4233c8e 100644 (file)
@@ -31,8 +31,6 @@
 #include "APIUserScript.h"
 #include "APIUserStyleSheet.h"
 #include "DataReference.h"
-#include "NetworkContentRuleListManagerMessages.h"
-#include "NetworkProcessProxy.h"
 #include "WebPageCreationParameters.h"
 #include "WebProcessProxy.h"
 #include "WebScriptMessageHandler.h"
 
 namespace WebKit {
 
-static HashMap<UserContentControllerIdentifier, WebUserContentControllerProxy*>& webUserContentControllerProxies()
-{
-    static NeverDestroyed<HashMap<UserContentControllerIdentifier, WebUserContentControllerProxy*>> proxies;
-    return proxies;
-}
-
-
-WebUserContentControllerProxy* WebUserContentControllerProxy::get(UserContentControllerIdentifier identifier)
-{
-    return webUserContentControllerProxies().get(identifier);
-}
-    
 WebUserContentControllerProxy::WebUserContentControllerProxy()
-    : m_identifier(generateObjectIdentifier<UserContentControllerIdentifierType>())
-    , m_userScripts(API::Array::create())
+    : m_userScripts(API::Array::create())
     , m_userStyleSheets(API::Array::create())
 {
-    webUserContentControllerProxies().add(m_identifier, this);
 }
 
 WebUserContentControllerProxy::~WebUserContentControllerProxy()
 {
-    webUserContentControllerProxies().remove(m_identifier);
-    for (auto* process : m_processes) {
-        process->removeMessageReceiver(Messages::WebUserContentControllerProxy::messageReceiverName(), identifier().toUInt64());
+    for (WebProcessProxy* process : m_processes) {
+        process->removeMessageReceiver(Messages::WebUserContentControllerProxy::messageReceiverName(), identifier());
         process->didDestroyWebUserContentControllerProxy(*this);
     }
-#if ENABLE(CONTENT_EXTENSIONS)
-    for (auto* process : m_networkProcesses)
-        process->didDestroyWebUserContentControllerProxy(*this);
-#endif
 }
 
 void WebUserContentControllerProxy::addProcess(WebProcessProxy& webProcessProxy, WebPageCreationParameters& parameters)
@@ -86,7 +65,7 @@ void WebUserContentControllerProxy::addProcess(WebProcessProxy& webProcessProxy,
     if (!m_processes.add(&webProcessProxy).isNewEntry)
         return;
 
-    webProcessProxy.addMessageReceiver(Messages::WebUserContentControllerProxy::messageReceiverName(), identifier().toUInt64(), *this);
+    webProcessProxy.addMessageReceiver(Messages::WebUserContentControllerProxy::messageReceiverName(), identifier(), *this);
 
     ASSERT(parameters.userContentWorlds.isEmpty());
     for (const auto& world : m_userContentWorlds)
@@ -116,7 +95,7 @@ void WebUserContentControllerProxy::removeProcess(WebProcessProxy& webProcessPro
     ASSERT(m_processes.contains(&webProcessProxy));
 
     m_processes.remove(&webProcessProxy);
-    webProcessProxy.removeMessageReceiver(Messages::WebUserContentControllerProxy::messageReceiverName(), identifier().toUInt64());
+    webProcessProxy.removeMessageReceiver(Messages::WebUserContentControllerProxy::messageReceiverName(), identifier());
 }
 
 void WebUserContentControllerProxy::addUserContentWorldUse(API::UserContentWorld& world)
@@ -127,7 +106,7 @@ void WebUserContentControllerProxy::addUserContentWorldUse(API::UserContentWorld
     auto addResult = m_userContentWorlds.add(&world);
     if (addResult.isNewEntry) {
         for (WebProcessProxy* process : m_processes)
-            process->send(Messages::WebUserContentController::AddUserContentWorlds({ std::make_pair(world.identifier(), world.name()) }), identifier().toUInt64());
+            process->send(Messages::WebUserContentController::AddUserContentWorlds({ std::make_pair(world.identifier(), world.name()) }), identifier());
     }
 }
 
@@ -151,7 +130,7 @@ void WebUserContentControllerProxy::removeUserContentWorldUses(API::UserContentW
 {
     if (shouldSendRemoveUserContentWorldsMessage(world, numberOfUsesToRemove)) {
         for (WebProcessProxy* process : m_processes)
-            process->send(Messages::WebUserContentController::RemoveUserContentWorlds({ world.identifier() }), identifier().toUInt64());
+            process->send(Messages::WebUserContentController::RemoveUserContentWorlds({ world.identifier() }), identifier());
     }
 }
 
@@ -164,7 +143,7 @@ void WebUserContentControllerProxy::removeUserContentWorldUses(HashCountedSet<Re
     }
 
     for (WebProcessProxy* process : m_processes)
-        process->send(Messages::WebUserContentController::RemoveUserContentWorlds(worldsToRemove), identifier().toUInt64());
+        process->send(Messages::WebUserContentController::RemoveUserContentWorlds(worldsToRemove), identifier());
 }
 
 void WebUserContentControllerProxy::addUserScript(API::UserScript& userScript)
@@ -176,7 +155,7 @@ void WebUserContentControllerProxy::addUserScript(API::UserScript& userScript)
     m_userScripts->elements().append(&userScript);
 
     for (WebProcessProxy* process : m_processes)
-        process->send(Messages::WebUserContentController::AddUserScripts({ { userScript.identifier(), world->identifier(), userScript.userScript() } }), identifier().toUInt64());
+        process->send(Messages::WebUserContentController::AddUserScripts({ { userScript.identifier(), world->identifier(), userScript.userScript() } }), identifier());
 }
 
 void WebUserContentControllerProxy::removeUserScript(API::UserScript& userScript)
@@ -184,7 +163,7 @@ void WebUserContentControllerProxy::removeUserScript(API::UserScript& userScript
     Ref<API::UserContentWorld> world = userScript.userContentWorld();
 
     for (WebProcessProxy* process : m_processes)
-        process->send(Messages::WebUserContentController::RemoveUserScript(world->identifier(), userScript.identifier()), identifier().toUInt64());
+        process->send(Messages::WebUserContentController::RemoveUserScript(world->identifier(), userScript.identifier()), identifier());
 
     m_userScripts->elements().removeAll(&userScript);
 
@@ -194,7 +173,7 @@ void WebUserContentControllerProxy::removeUserScript(API::UserScript& userScript
 void WebUserContentControllerProxy::removeAllUserScripts(API::UserContentWorld& world)
 {
     for (WebProcessProxy* process : m_processes)
-        process->send(Messages::WebUserContentController::RemoveAllUserScripts({ world.identifier() }), identifier().toUInt64());
+        process->send(Messages::WebUserContentController::RemoveAllUserScripts({ world.identifier() }), identifier());
 
     unsigned userScriptsRemoved = m_userScripts->removeAllOfTypeMatching<API::UserScript>([&](const auto& userScript) {
         return &userScript->userContentWorld() == &world;
@@ -215,7 +194,7 @@ void WebUserContentControllerProxy::removeAllUserScripts()
         worldIdentifiers.uncheckedAppend(worldCountPair.key->identifier());
 
     for (WebProcessProxy* process : m_processes)
-        process->send(Messages::WebUserContentController::RemoveAllUserScripts(worldIdentifiers), identifier().toUInt64());
+        process->send(Messages::WebUserContentController::RemoveAllUserScripts(worldIdentifiers), identifier());
 
     m_userScripts->elements().clear();
 
@@ -231,7 +210,7 @@ void WebUserContentControllerProxy::addUserStyleSheet(API::UserStyleSheet& userS
     m_userStyleSheets->elements().append(&userStyleSheet);
 
     for (WebProcessProxy* process : m_processes)
-        process->send(Messages::WebUserContentController::AddUserStyleSheets({ { userStyleSheet.identifier(), world->identifier(), userStyleSheet.userStyleSheet() } }), identifier().toUInt64());
+        process->send(Messages::WebUserContentController::AddUserStyleSheets({ { userStyleSheet.identifier(), world->identifier(), userStyleSheet.userStyleSheet() } }), identifier());
 }
 
 void WebUserContentControllerProxy::removeUserStyleSheet(API::UserStyleSheet& userStyleSheet)
@@ -239,7 +218,7 @@ void WebUserContentControllerProxy::removeUserStyleSheet(API::UserStyleSheet& us
     Ref<API::UserContentWorld> world = userStyleSheet.userContentWorld();
 
     for (WebProcessProxy* process : m_processes)
-        process->send(Messages::WebUserContentController::RemoveUserStyleSheet(world->identifier(), userStyleSheet.identifier()), identifier().toUInt64());
+        process->send(Messages::WebUserContentController::RemoveUserStyleSheet(world->identifier(), userStyleSheet.identifier()), identifier());
 
     m_userStyleSheets->elements().removeAll(&userStyleSheet);
 
@@ -249,7 +228,7 @@ void WebUserContentControllerProxy::removeUserStyleSheet(API::UserStyleSheet& us
 void WebUserContentControllerProxy::removeAllUserStyleSheets(API::UserContentWorld& world)
 {
     for (WebProcessProxy* process : m_processes)
-        process->send(Messages::WebUserContentController::RemoveAllUserStyleSheets({ world.identifier() }), identifier().toUInt64());
+        process->send(Messages::WebUserContentController::RemoveAllUserStyleSheets({ world.identifier() }), identifier());
 
     unsigned userStyleSheetsRemoved = m_userStyleSheets->removeAllOfTypeMatching<API::UserStyleSheet>([&](const auto& userStyleSheet) {
         return &userStyleSheet->userContentWorld() == &world;
@@ -270,7 +249,7 @@ void WebUserContentControllerProxy::removeAllUserStyleSheets()
         worldIdentifiers.uncheckedAppend(worldCountPair.key->identifier());
 
     for (WebProcessProxy* process : m_processes)
-        process->send(Messages::WebUserContentController::RemoveAllUserStyleSheets(worldIdentifiers), identifier().toUInt64());
+        process->send(Messages::WebUserContentController::RemoveAllUserStyleSheets(worldIdentifiers), identifier());
 
     m_userStyleSheets->elements().clear();
 
@@ -291,7 +270,7 @@ bool WebUserContentControllerProxy::addUserScriptMessageHandler(WebScriptMessage
     m_scriptMessageHandlers.add(handler.identifier(), &handler);
 
     for (WebProcessProxy* process : m_processes)
-        process->send(Messages::WebUserContentController::AddUserScriptMessageHandlers({ { handler.identifier(), world->identifier(), handler.name() } }), identifier().toUInt64());
+        process->send(Messages::WebUserContentController::AddUserScriptMessageHandlers({ { handler.identifier(), world->identifier(), handler.name() } }), identifier());
     
     return true;
 }
@@ -301,7 +280,7 @@ void WebUserContentControllerProxy::removeUserMessageHandlerForName(const String
     for (auto it = m_scriptMessageHandlers.begin(), end = m_scriptMessageHandlers.end(); it != end; ++it) {
         if (it->value->name() == name && &it->value->userContentWorld() == &world) {
             for (WebProcessProxy* process : m_processes)
-                process->send(Messages::WebUserContentController::RemoveUserScriptMessageHandler(world.identifier(), it->value->identifier()), identifier().toUInt64());
+                process->send(Messages::WebUserContentController::RemoveUserScriptMessageHandler(world.identifier(), it->value->identifier()), identifier());
 
             m_scriptMessageHandlers.remove(it);
 
@@ -314,7 +293,7 @@ void WebUserContentControllerProxy::removeUserMessageHandlerForName(const String
 void WebUserContentControllerProxy::removeAllUserMessageHandlers(API::UserContentWorld& world)
 {
     for (WebProcessProxy* process : m_processes)
-        process->send(Messages::WebUserContentController::RemoveAllUserScriptMessageHandlers({ world.identifier() }), identifier().toUInt64());
+        process->send(Messages::WebUserContentController::RemoveAllUserScriptMessageHandlers({ world.identifier() }), identifier());
 
     unsigned numberRemoved = 0;
     m_scriptMessageHandlers.removeIf([&](auto& entry) {
@@ -351,33 +330,24 @@ void WebUserContentControllerProxy::addContentRuleList(API::ContentRuleList& con
 
     auto pair = std::make_pair(contentRuleList.name(), contentRuleList.compiledRuleList().data());
 
-    for (auto* process : m_processes)
-        process->send(Messages::WebUserContentController::AddContentRuleLists({ pair }), identifier().toUInt64());
-
-    for (auto* process : m_networkProcesses)
-        process->send(Messages::NetworkContentRuleListManager::AddContentRuleLists { identifier(), { pair } }, 0);
+    for (WebProcessProxy* process : m_processes)
+        process->send(Messages::WebUserContentController::AddContentRuleLists({ pair }), identifier());
 }
 
 void WebUserContentControllerProxy::removeContentRuleList(const String& name)
 {
     m_contentRuleLists.remove(name);
 
-    for (auto* process : m_processes)
-        process->send(Messages::WebUserContentController::RemoveContentRuleList(name), identifier().toUInt64());
-
-    for (auto* process : m_networkProcesses)
-        process->send(Messages::NetworkContentRuleListManager::RemoveContentRuleList { identifier(), name }, 0);
+    for (WebProcessProxy* process : m_processes)
+        process->send(Messages::WebUserContentController::RemoveContentRuleList(name), identifier());
 }
 
 void WebUserContentControllerProxy::removeAllContentRuleLists()
 {
     m_contentRuleLists.clear();
 
-    for (auto* process : m_processes)
-        process->send(Messages::WebUserContentController::RemoveAllContentRuleLists(), identifier().toUInt64());
-
-    for (auto* process : m_networkProcesses)
-        process->send(Messages::NetworkContentRuleListManager::RemoveAllContentRuleLists { identifier() }, 0);
+    for (WebProcessProxy* process : m_processes)
+        process->send(Messages::WebUserContentController::RemoveAllContentRuleLists(), identifier());
 }
 #endif
 
index ab3f260..230f623 100644 (file)
 
 #include "APIObject.h"
 #include "MessageReceiver.h"
-#include "UserContentControllerIdentifier.h"
 #include <wtf/Forward.h>
 #include <wtf/HashCountedSet.h>
 #include <wtf/HashMap.h>
 #include <wtf/HashSet.h>
+#include <wtf/Identified.h>
 #include <wtf/Ref.h>
 #include <wtf/RefCounted.h>
 #include <wtf/text/StringHash.h>
@@ -54,23 +54,20 @@ struct SecurityOriginData;
 
 namespace WebKit {
 
-class NetworkProcessProxy;
 class WebProcessProxy;
 class WebScriptMessageHandler;
 struct FrameInfoData;
 struct WebPageCreationParameters;
 
-class WebUserContentControllerProxy : public API::ObjectImpl<API::Object::Type::UserContentController>, private IPC::MessageReceiver {
+class WebUserContentControllerProxy : public API::ObjectImpl<API::Object::Type::UserContentController>, private IPC::MessageReceiver, public Identified<WebUserContentControllerProxy> {
 public:
     static Ref<WebUserContentControllerProxy> create()
     { 
         return adoptRef(*new WebUserContentControllerProxy);
-    }
-    WebUserContentControllerProxy();
+    } 
+    explicit WebUserContentControllerProxy();
     ~WebUserContentControllerProxy();
 
-    static WebUserContentControllerProxy* get(UserContentControllerIdentifier);
-
     void addProcess(WebProcessProxy&, WebPageCreationParameters&);
     void removeProcess(WebProcessProxy&);
 
@@ -94,17 +91,11 @@ public:
     void removeAllUserMessageHandlers(API::UserContentWorld&);
 
 #if ENABLE(CONTENT_EXTENSIONS)
-    void addNetworkProcess(NetworkProcessProxy& proxy) { m_networkProcesses.remove(&proxy); }
-    void removeNetworkProcess(NetworkProcessProxy& proxy) { m_networkProcesses.add(&proxy); }
-
     void addContentRuleList(API::ContentRuleList&);
     void removeContentRuleList(const String&);
     void removeAllContentRuleLists();
-    const HashMap<String, RefPtr<API::ContentRuleList>>& contentExtensionRules() { return m_contentRuleLists; }
 #endif
 
-    UserContentControllerIdentifier identifier() const { return m_identifier; }
-
 private:
     // IPC::MessageReceiver.
     void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
@@ -116,15 +107,13 @@ private:
     void removeUserContentWorldUses(HashCountedSet<RefPtr<API::UserContentWorld>>&);
     bool shouldSendRemoveUserContentWorldsMessage(API::UserContentWorld&, unsigned numberOfUsesToRemove);
 
-    UserContentControllerIdentifier m_identifier;
-    HashSet<WebProcessProxy*> m_processes;
+    HashSet<WebProcessProxy*> m_processes;    
     Ref<API::Array> m_userScripts;
     Ref<API::Array> m_userStyleSheets;
     HashMap<uint64_t, RefPtr<WebScriptMessageHandler>> m_scriptMessageHandlers;
     HashCountedSet<RefPtr<API::UserContentWorld>> m_userContentWorlds;
 
 #if ENABLE(CONTENT_EXTENSIONS)
-    HashSet<NetworkProcessProxy*> m_networkProcesses;
     HashMap<String, RefPtr<API::ContentRuleList>> m_contentRuleLists;
 #endif
 };
index ff99c50..ea2016b 100644 (file)
                41FAF5F51E3C0649001AE678 /* WebRTCResolver.h in Headers */ = {isa = PBXBuildFile; fileRef = 41FAF5F41E3C0641001AE678 /* WebRTCResolver.h */; };
                41FAF5F81E3C1021001AE678 /* LibWebRTCResolver.h in Headers */ = {isa = PBXBuildFile; fileRef = 41FAF5F61E3C0B47001AE678 /* LibWebRTCResolver.h */; };
                41FAF5F91E3C1025001AE678 /* LibWebRTCResolver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41FAF5F71E3C0B47001AE678 /* LibWebRTCResolver.cpp */; };
-               41FBE826206DF7FA000F0741 /* NetworkContentRuleListManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41FBE824206DA79C000F0741 /* NetworkContentRuleListManager.cpp */; };
                4450AEC01DC3FAE5009943F2 /* SharedMemoryCocoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4450AEBF1DC3FAE5009943F2 /* SharedMemoryCocoa.cpp */; };
                460F488F1F996F7100CF4B87 /* WebSWContextManagerConnectionMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 460F488D1F996F6C00CF4B87 /* WebSWContextManagerConnectionMessageReceiver.cpp */; };
                460F48901F996F7100CF4B87 /* WebSWContextManagerConnectionMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 460F488E1F996F6C00CF4B87 /* WebSWContextManagerConnectionMessages.h */; };
                52D5A1B01C57495A00DE34A3 /* VideoFullscreenManagerProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 52D5A1AA1C57494E00DE34A3 /* VideoFullscreenManagerProxy.h */; };
                52D5A1B11C57496200DE34A3 /* VideoFullscreenManagerProxy.mm in Sources */ = {isa = PBXBuildFile; fileRef = 52D5A1AC1C57494E00DE34A3 /* VideoFullscreenManagerProxy.mm */; };
                52D5A1B71C574A0200DE34A3 /* VideoFullscreenManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = 52D5A1B41C5749F200DE34A3 /* VideoFullscreenManager.mm */; };
-               52F060E11654318500F3281B /* NetworkContentRuleListManagerMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 52F060DD1654317500F3281B /* NetworkContentRuleListManagerMessageReceiver.cpp */; };
                5302583B1DCBBD2200DA89C2 /* NetworkCaptureResource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5302582E1DCBBD1D00DA89C2 /* NetworkCaptureResource.cpp */; };
                5302583C1DCBBD2200DA89C2 /* NetworkCaptureResource.h in Headers */ = {isa = PBXBuildFile; fileRef = 5302582F1DCBBD1D00DA89C2 /* NetworkCaptureResource.h */; };
                5302583D1DCBBD2200DA89C2 /* NetworkCaptureEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 530258301DCBBD1D00DA89C2 /* NetworkCaptureEvent.cpp */; };
                41FAF5F41E3C0641001AE678 /* WebRTCResolver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebRTCResolver.h; path = Network/webrtc/WebRTCResolver.h; sourceTree = "<group>"; };
                41FAF5F61E3C0B47001AE678 /* LibWebRTCResolver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LibWebRTCResolver.h; path = Network/webrtc/LibWebRTCResolver.h; sourceTree = "<group>"; };
                41FAF5F71E3C0B47001AE678 /* LibWebRTCResolver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LibWebRTCResolver.cpp; path = Network/webrtc/LibWebRTCResolver.cpp; sourceTree = "<group>"; };
-               41FBE821206D87F6000F0741 /* UserContentControllerIdentifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserContentControllerIdentifier.h; sourceTree = "<group>"; };
-               41FBE822206DA79C000F0741 /* NetworkContentRuleListManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkContentRuleListManager.h; path = NetworkProcess/NetworkContentRuleListManager.h; sourceTree = "<group>"; };
-               41FBE823206DA79C000F0741 /* NetworkContentRuleListManager.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = NetworkContentRuleListManager.messages.in; path = NetworkProcess/NetworkContentRuleListManager.messages.in; sourceTree = "<group>"; };
-               41FBE824206DA79C000F0741 /* NetworkContentRuleListManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NetworkContentRuleListManager.cpp; path = NetworkProcess/NetworkContentRuleListManager.cpp; sourceTree = "<group>"; };
                4450AEBF1DC3FAE5009943F2 /* SharedMemoryCocoa.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SharedMemoryCocoa.cpp; sourceTree = "<group>"; };
                460F488D1F996F6C00CF4B87 /* WebSWContextManagerConnectionMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebSWContextManagerConnectionMessageReceiver.cpp; sourceTree = "<group>"; };
                460F488E1F996F6C00CF4B87 /* WebSWContextManagerConnectionMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSWContextManagerConnectionMessages.h; sourceTree = "<group>"; };
                52D5A1B21C5749F200DE34A3 /* VideoFullscreenManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoFullscreenManager.h; sourceTree = "<group>"; };
                52D5A1B31C5749F200DE34A3 /* VideoFullscreenManager.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = VideoFullscreenManager.messages.in; sourceTree = "<group>"; };
                52D5A1B41C5749F200DE34A3 /* VideoFullscreenManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = VideoFullscreenManager.mm; sourceTree = "<group>"; };
-               52F060DD1654317500F3281B /* NetworkContentRuleListManagerMessageReceiver.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkContentRuleListManagerMessageReceiver.cpp; sourceTree = "<group>"; };
                5302582E1DCBBD1D00DA89C2 /* NetworkCaptureResource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NetworkCaptureResource.cpp; path = NetworkProcess/capture/NetworkCaptureResource.cpp; sourceTree = "<group>"; };
                5302582F1DCBBD1D00DA89C2 /* NetworkCaptureResource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkCaptureResource.h; path = NetworkProcess/capture/NetworkCaptureResource.h; sourceTree = "<group>"; };
                530258301DCBBD1D00DA89C2 /* NetworkCaptureEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NetworkCaptureEvent.cpp; path = NetworkProcess/capture/NetworkCaptureEvent.cpp; sourceTree = "<group>"; };
                                1A64245C12DE29A100CAAE2C /* UpdateInfo.h */,
                                5C19A51E1FD0B14600EEA323 /* URLSchemeTaskParameters.cpp */,
                                5C19A51F1FD0B14700EEA323 /* URLSchemeTaskParameters.h */,
-                               41FBE821206D87F6000F0741 /* UserContentControllerIdentifier.h */,
                                1AC1336518565B5700F3EC05 /* UserData.cpp */,
                                1AC1336618565B5700F3EC05 /* UserData.h */,
                                2684054A18B866FF0022C38B /* VisibleContentRectUpdateInfo.cpp */,
                                513A16491630A9BF005D7D22 /* NetworkConnectionToWebProcess.cpp */,
                                513A164A1630A9BF005D7D22 /* NetworkConnectionToWebProcess.h */,
                                513A164B1630A9BF005D7D22 /* NetworkConnectionToWebProcess.messages.in */,
-                               41FBE824206DA79C000F0741 /* NetworkContentRuleListManager.cpp */,
-                               41FBE822206DA79C000F0741 /* NetworkContentRuleListManager.h */,
-                               41FBE823206DA79C000F0741 /* NetworkContentRuleListManager.messages.in */,
                                46DF06391F3905E5001980BB /* NetworkCORSPreflightChecker.cpp */,
                                46DF063A1F3905E5001980BB /* NetworkCORSPreflightChecker.h */,
                                532159511DBAE6FC0054AA3C /* NetworkDataTask.cpp */,
                                2984F57B164B915F004BC0C6 /* LegacyCustomProtocolManagerProxyMessages.h */,
                                51DD9F2616367DA2001578E9 /* NetworkConnectionToWebProcessMessageReceiver.cpp */,
                                51DD9F2716367DA2001578E9 /* NetworkConnectionToWebProcessMessages.h */,
-                               52F060DD1654317500F3281B /* NetworkContentRuleListManagerMessageReceiver.cpp */,
                                517CF0E1163A486C00C2950E /* NetworkProcessConnectionMessageReceiver.cpp */,
                                517CF0E2163A486C00C2950E /* NetworkProcessConnectionMessages.h */,
                                51ACC9341628064800342550 /* NetworkProcessMessageReceiver.cpp */,
                                5302583B1DCBBD2200DA89C2 /* NetworkCaptureResource.cpp in Sources */,
                                513A164C1630A9BF005D7D22 /* NetworkConnectionToWebProcess.cpp in Sources */,
                                51DD9F2816367DA2001578E9 /* NetworkConnectionToWebProcessMessageReceiver.cpp in Sources */,
-                               41FBE826206DF7FA000F0741 /* NetworkContentRuleListManager.cpp in Sources */,
-                               52F060E11654318500F3281B /* NetworkContentRuleListManagerMessageReceiver.cpp in Sources */,
                                46DF063B1F3905F8001980BB /* NetworkCORSPreflightChecker.cpp in Sources */,
                                532159541DBAE71D0054AA3C /* NetworkDataTask.cpp in Sources */,
                                53BA47D01DC2EF5E004DF4AD /* NetworkDataTaskBlob.cpp in Sources */,
index d7f8bf8..b14a580 100644 (file)
@@ -456,9 +456,6 @@ void WebLoaderStrategy::startPingLoad(Frame& frame, ResourceRequest& request, co
         return;
     }
 
-    WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(frame.loader().client());
-    WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : nullptr;
-
     NetworkResourceLoadParameters loadParameters;
     loadParameters.identifier = generateLoadIdentifier();
     loadParameters.request = request;
@@ -475,11 +472,13 @@ void WebLoaderStrategy::startPingLoad(Frame& frame, ResourceRequest& request, co
 
 #if ENABLE(CONTENT_EXTENSIONS)
     loadParameters.mainDocumentURL = document->topDocument().url();
-    // FIXME: Instead of passing userContentControllerIdentifier, we should just pass webPageId to NetworkProcess.
-    if (auto* page = frame.page()) {
-        WebPage* webPage = webFrame ? webFrame->page() : nullptr;
-        if (webPage)
-            loadParameters.userContentControllerIdentifier = webPage->userContentControllerIdentifier();
+
+    if (auto* documentLoader = frame.loader().documentLoader()) {
+        if (auto* page = frame.page()) {
+            page->userContentProvider().forEachContentExtension([&loadParameters](const String& identifier, ContentExtensions::ContentExtension& contentExtension) {
+                loadParameters.contentRuleLists.append(std::make_pair(identifier, static_cast<const WebCompiledContentRuleList&>(contentExtension.compiledExtension()).data()));
+            }, *documentLoader);
+        }
     }
 #endif
 
index b9e5858..2235a8d 100644 (file)
@@ -50,9 +50,9 @@ using namespace WebCore;
 
 namespace WebKit {
 
-static HashMap<UserContentControllerIdentifier, WebUserContentController*>& userContentControllers()
+static HashMap<uint64_t, WebUserContentController*>& userContentControllers()
 {
-    static NeverDestroyed<HashMap<UserContentControllerIdentifier, WebUserContentController*>> userContentControllers;
+    static NeverDestroyed<HashMap<uint64_t, WebUserContentController*>> userContentControllers;
 
     return userContentControllers;
 }
@@ -66,7 +66,7 @@ static WorldMap& worldMap()
     return map;
 }
 
-Ref<WebUserContentController> WebUserContentController::getOrCreate(UserContentControllerIdentifier identifier)
+Ref<WebUserContentController> WebUserContentController::getOrCreate(uint64_t identifier)
 {
     auto& userContentControllerPtr = userContentControllers().add(identifier, nullptr).iterator->value;
     if (userContentControllerPtr)
@@ -78,17 +78,17 @@ Ref<WebUserContentController> WebUserContentController::getOrCreate(UserContentC
     return userContentController.releaseNonNull();
 }
 
-WebUserContentController::WebUserContentController(UserContentControllerIdentifier identifier)
+WebUserContentController::WebUserContentController(uint64_t identifier)
     : m_identifier(identifier)
 {
-    WebProcess::singleton().addMessageReceiver(Messages::WebUserContentController::messageReceiverName(), m_identifier.toUInt64(), *this);
+    WebProcess::singleton().addMessageReceiver(Messages::WebUserContentController::messageReceiverName(), m_identifier, *this);
 }
 
 WebUserContentController::~WebUserContentController()
 {
     ASSERT(userContentControllers().contains(m_identifier));
 
-    WebProcess::singleton().removeMessageReceiver(Messages::WebUserContentController::messageReceiverName(), m_identifier.toUInt64());
+    WebProcess::singleton().removeMessageReceiver(Messages::WebUserContentController::messageReceiverName(), m_identifier);
 
     userContentControllers().remove(m_identifier);
 }
@@ -242,7 +242,7 @@ private:
         if (!webPage)
             return;
 
-        WebProcess::singleton().parentProcessConnection()->send(Messages::WebUserContentControllerProxy::DidPostMessage(webPage->pageID(), webFrame->info(), m_identifier, IPC::DataReference(value->data())), m_controller->identifier().toUInt64());
+        WebProcess::singleton().parentProcessConnection()->send(Messages::WebUserContentControllerProxy::DidPostMessage(webPage->pageID(), webFrame->info(), m_identifier, IPC::DataReference(value->data())), m_controller->identifier());
     }
 
     RefPtr<WebUserContentController> m_controller;
index f58d21e..9b72d96 100644 (file)
@@ -26,7 +26,6 @@
 #pragma once
 
 #include "MessageReceiver.h"
-#include "UserContentControllerIdentifier.h"
 #include "WebScriptMessageHandler.h"
 #include "WebUserContentControllerDataTypes.h"
 #include <WebCore/UserContentProvider.h>
@@ -50,10 +49,10 @@ class WebUserMessageHandlerDescriptorProxy;
 
 class WebUserContentController final : public WebCore::UserContentProvider, private IPC::MessageReceiver {
 public:
-    static Ref<WebUserContentController> getOrCreate(UserContentControllerIdentifier);
+    static Ref<WebUserContentController> getOrCreate(uint64_t identifier);
     virtual ~WebUserContentController();
 
-    UserContentControllerIdentifier identifier() { return m_identifier; }
+    uint64_t identifier() { return m_identifier; } 
 
     void addUserScript(InjectedBundleScriptWorld&, WebCore::UserScript&&);
     void removeUserScriptWithURL(InjectedBundleScriptWorld&, const WebCore::URL&);
@@ -72,7 +71,7 @@ public:
 #endif
 
 private:
-    explicit WebUserContentController(UserContentControllerIdentifier);
+    explicit WebUserContentController(uint64_t identifier);
 
     // WebCore::UserContentProvider
     void forEachUserScript(Function<void(WebCore::DOMWrapperWorld&, const WebCore::UserScript&)>&&) const final;
@@ -112,7 +111,7 @@ private:
     void removeUserScriptMessageHandlerInternal(InjectedBundleScriptWorld&, uint64_t userScriptMessageHandlerIdentifier);
 #endif
 
-    UserContentControllerIdentifier m_identifier;
+    uint64_t m_identifier;
 
     typedef HashMap<RefPtr<InjectedBundleScriptWorld>, Vector<std::pair<uint64_t, WebCore::UserScript>>> WorldToUserScriptMap;
     WorldToUserScriptMap m_userScripts;
@@ -127,6 +126,7 @@ private:
 #if ENABLE(CONTENT_EXTENSIONS)
     WebCore::ContentExtensions::ContentExtensionsBackend m_contentExtensionBackend;
 #endif
+
 };
 
 } // namespace WebKit
index b27474b..8442cd7 100644 (file)
@@ -46,7 +46,6 @@
 #include "SharedMemory.h"
 #include "UserData.h"
 #include "WebURLSchemeHandler.h"
-#include "WebUserContentController.h"
 #include <WebCore/ActivityState.h>
 #include <WebCore/DictionaryPopupInfo.h>
 #include <WebCore/FrameLoaderTypes.h>
@@ -1070,8 +1069,6 @@ public:
     void openGLDisplayMaskChanged(uint32_t displayMask);
 #endif
 
-    UserContentControllerIdentifier userContentControllerIdentifier() const { return m_userContentController->identifier(); }
-
 private:
     WebPage(uint64_t pageID, WebPageCreationParameters&&);