Serialize WebsitePoliciesData instead of WebsitePolicies
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Dec 2017 02:08:23 +0000 (02:08 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Dec 2017 02:08:23 +0000 (02:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=180847

Reviewed by Joseph Pecoraro.

No change in behavior.  This will allow me to add things to WebsitePolicies that have
a different form when serialized to another process.

Also, remove API::WebsitePolicies because the wrapper isn't necessary.
WebsitePolicies is now the API type that only exists in the UIProcess.

* Shared/WebsitePolicies.cpp: Removed.
* Shared/WebsitePolicies.h:
(WebKit::WebsitePolicies::contentBlockersEnabled const): Deleted.
(WebKit::WebsitePolicies::setContentBlockersEnabled): Deleted.
(WebKit::WebsitePolicies::allowedAutoplayQuirks const): Deleted.
(WebKit::WebsitePolicies::setAllowedAutoplayQuirks): Deleted.
(WebKit::WebsitePolicies::autoplayPolicy const): Deleted.
(WebKit::WebsitePolicies::setAutoplayPolicy): Deleted.
(WebKit::WebsitePolicies::customHeaderFields): Deleted.
(WebKit::WebsitePolicies::takeCustomHeaderFields): Deleted.
(WebKit::WebsitePolicies::setCustomHeaderFields): Deleted.
* Shared/WebsitePoliciesData.cpp: Copied from Source/WebKit/Shared/WebsitePolicies.cpp.
(WebKit::WebsitePoliciesData::fromWebsitePolicies):
(WebKit::WebsitePoliciesData::encode const):
(WebKit::WebsitePoliciesData::decode):
(WebKit::WebsitePoliciesData::applyToDocumentLoader):
(WebKit::WebsitePolicies::WebsitePolicies): Deleted.
(WebKit::WebsitePolicies::encode const): Deleted.
(WebKit::WebsitePolicies::decode): Deleted.
(WebKit::WebsitePolicies::applyToDocumentLoader): Deleted.
* Shared/WebsitePoliciesData.h: Added.
* UIProcess/API/APINavigationClient.h:
(API::NavigationClient::decidePolicyForNavigationAction):
(API::NavigationClient::decidePolicyForNavigationResponse):
* UIProcess/API/APIPolicyClient.h:
(API::PolicyClient::decidePolicyForNavigationAction):
(API::PolicyClient::decidePolicyForNewWindowAction):
(API::PolicyClient::decidePolicyForResponse):
* UIProcess/API/APIWebsitePolicies.cpp: Removed.
* UIProcess/API/APIWebsitePolicies.h: Removed.
* UIProcess/API/C/WKAPICast.h:
* UIProcess/API/C/WKFramePolicyListener.cpp:
(WKFramePolicyListenerUse):
(WKFramePolicyListenerUseWithPolicies):
* UIProcess/API/C/WKPage.cpp:
(WKPageUpdateWebsitePolicies):
(WKPageSetPagePolicyClient):
(WKPageSetPageNavigationClient):
* UIProcess/API/C/WKWebsitePolicies.cpp:
(WKWebsitePoliciesGetTypeID):
(WKWebsitePoliciesCreate):
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _updateWebsitePolicies:]):
* UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
(-[_WKWebsitePolicies dealloc]):
(-[_WKWebsitePolicies init]):
* UIProcess/API/Cocoa/_WKWebsitePoliciesInternal.h:
(WebKit::wrapper):
* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
(WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse):
* UIProcess/WebFrameListenerProxy.cpp:
(WebKit::WebFrameListenerProxy::receivedPolicyDecision):
* UIProcess/WebFrameListenerProxy.h:
* UIProcess/WebFramePolicyListenerProxy.cpp:
(WebKit::WebFramePolicyListenerProxy::use):
(WebKit::WebFramePolicyListenerProxy::download):
(WebKit::WebFramePolicyListenerProxy::ignore):
* UIProcess/WebFramePolicyListenerProxy.h:
* UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::receivedPolicyDecision):
* UIProcess/WebFrameProxy.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::receivedPolicyDecision):
(WebKit::WebPageProxy::decidePolicyForNavigationAction):
(WebKit::WebPageProxy::updateWebsitePolicies):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::applyToDocumentLoader):
(WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
* WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::didReceivePolicyDecision):
* WebProcess/WebPage/WebFrame.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didReceivePolicyDecision):
(WebKit::WebPage::updateWebsitePolicies):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:

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

33 files changed:
Source/WebKit/CMakeLists.txt
Source/WebKit/ChangeLog
Source/WebKit/Shared/WebsitePoliciesData.cpp [moved from Source/WebKit/Shared/WebsitePolicies.cpp with 77% similarity]
Source/WebKit/Shared/WebsitePoliciesData.h [moved from Source/WebKit/UIProcess/API/APIWebsitePolicies.cpp with 68% similarity]
Source/WebKit/UIProcess/API/APINavigationClient.h
Source/WebKit/UIProcess/API/APIPolicyClient.h
Source/WebKit/UIProcess/API/APIWebsitePolicies.h [deleted file]
Source/WebKit/UIProcess/API/C/WKAPICast.h
Source/WebKit/UIProcess/API/C/WKFramePolicyListener.cpp
Source/WebKit/UIProcess/API/C/WKPage.cpp
Source/WebKit/UIProcess/API/C/WKWebsitePolicies.cpp
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.mm
Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePoliciesInternal.h
Source/WebKit/UIProcess/Cocoa/NavigationState.mm
Source/WebKit/UIProcess/WebFrameListenerProxy.cpp
Source/WebKit/UIProcess/WebFrameListenerProxy.h
Source/WebKit/UIProcess/WebFramePolicyListenerProxy.cpp
Source/WebKit/UIProcess/WebFramePolicyListenerProxy.h
Source/WebKit/UIProcess/WebFrameProxy.cpp
Source/WebKit/UIProcess/WebFrameProxy.h
Source/WebKit/UIProcess/WebPageProxy.cpp
Source/WebKit/UIProcess/WebPageProxy.h
Source/WebKit/UIProcess/WebPageProxy.messages.in
Source/WebKit/UIProcess/WebsitePolicies.h [moved from Source/WebKit/Shared/WebsitePolicies.h with 83% similarity]
Source/WebKit/WebKit.xcodeproj/project.pbxproj
Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h
Source/WebKit/WebProcess/WebPage/WebFrame.cpp
Source/WebKit/WebProcess/WebPage/WebFrame.h
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Source/WebKit/WebProcess/WebPage/WebPage.h
Source/WebKit/WebProcess/WebPage/WebPage.messages.in

index 20e11e7..43cab5b 100644 (file)
@@ -216,7 +216,7 @@ set(WebKit_SOURCES
     Shared/WebUserContentControllerDataTypes.cpp
     Shared/WebWheelEvent.cpp
     Shared/WebsiteDataStoreParameters.cpp
-    Shared/WebsitePolicies.cpp
+    Shared/WebsitePoliciesData.cpp
 
     Shared/API/APIArray.cpp
     Shared/API/APIData.cpp
@@ -358,7 +358,6 @@ set(WebKit_SOURCES
     UIProcess/API/APIUserScript.cpp
     UIProcess/API/APIUserStyleSheet.cpp
     UIProcess/API/APIWebsiteDataStore.cpp
-    UIProcess/API/APIWebsitePolicies.cpp
     UIProcess/API/APIWindowFeatures.cpp
 
     UIProcess/API/C/WKApplicationCacheManager.cpp
index 8b6441f..b44d1e8 100644 (file)
@@ -1,3 +1,98 @@
+2017-12-14  Alex Christensen  <achristensen@webkit.org>
+
+        Serialize WebsitePoliciesData instead of WebsitePolicies
+        https://bugs.webkit.org/show_bug.cgi?id=180847
+
+        Reviewed by Joseph Pecoraro.
+
+        No change in behavior.  This will allow me to add things to WebsitePolicies that have 
+        a different form when serialized to another process.
+        
+        Also, remove API::WebsitePolicies because the wrapper isn't necessary.
+        WebsitePolicies is now the API type that only exists in the UIProcess.
+
+        * Shared/WebsitePolicies.cpp: Removed.
+        * Shared/WebsitePolicies.h:
+        (WebKit::WebsitePolicies::contentBlockersEnabled const): Deleted.
+        (WebKit::WebsitePolicies::setContentBlockersEnabled): Deleted.
+        (WebKit::WebsitePolicies::allowedAutoplayQuirks const): Deleted.
+        (WebKit::WebsitePolicies::setAllowedAutoplayQuirks): Deleted.
+        (WebKit::WebsitePolicies::autoplayPolicy const): Deleted.
+        (WebKit::WebsitePolicies::setAutoplayPolicy): Deleted.
+        (WebKit::WebsitePolicies::customHeaderFields): Deleted.
+        (WebKit::WebsitePolicies::takeCustomHeaderFields): Deleted.
+        (WebKit::WebsitePolicies::setCustomHeaderFields): Deleted.
+        * Shared/WebsitePoliciesData.cpp: Copied from Source/WebKit/Shared/WebsitePolicies.cpp.
+        (WebKit::WebsitePoliciesData::fromWebsitePolicies):
+        (WebKit::WebsitePoliciesData::encode const):
+        (WebKit::WebsitePoliciesData::decode):
+        (WebKit::WebsitePoliciesData::applyToDocumentLoader):
+        (WebKit::WebsitePolicies::WebsitePolicies): Deleted.
+        (WebKit::WebsitePolicies::encode const): Deleted.
+        (WebKit::WebsitePolicies::decode): Deleted.
+        (WebKit::WebsitePolicies::applyToDocumentLoader): Deleted.
+        * Shared/WebsitePoliciesData.h: Added.
+        * UIProcess/API/APINavigationClient.h:
+        (API::NavigationClient::decidePolicyForNavigationAction):
+        (API::NavigationClient::decidePolicyForNavigationResponse):
+        * UIProcess/API/APIPolicyClient.h:
+        (API::PolicyClient::decidePolicyForNavigationAction):
+        (API::PolicyClient::decidePolicyForNewWindowAction):
+        (API::PolicyClient::decidePolicyForResponse):
+        * UIProcess/API/APIWebsitePolicies.cpp: Removed.
+        * UIProcess/API/APIWebsitePolicies.h: Removed.
+        * UIProcess/API/C/WKAPICast.h:
+        * UIProcess/API/C/WKFramePolicyListener.cpp:
+        (WKFramePolicyListenerUse):
+        (WKFramePolicyListenerUseWithPolicies):
+        * UIProcess/API/C/WKPage.cpp:
+        (WKPageUpdateWebsitePolicies):
+        (WKPageSetPagePolicyClient):
+        (WKPageSetPageNavigationClient):
+        * UIProcess/API/C/WKWebsitePolicies.cpp:
+        (WKWebsitePoliciesGetTypeID):
+        (WKWebsitePoliciesCreate):
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _updateWebsitePolicies:]):
+        * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
+        (-[_WKWebsitePolicies dealloc]):
+        (-[_WKWebsitePolicies init]):
+        * UIProcess/API/Cocoa/_WKWebsitePoliciesInternal.h:
+        (WebKit::wrapper):
+        * UIProcess/Cocoa/NavigationState.mm:
+        (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
+        (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse):
+        * UIProcess/WebFrameListenerProxy.cpp:
+        (WebKit::WebFrameListenerProxy::receivedPolicyDecision):
+        * UIProcess/WebFrameListenerProxy.h:
+        * UIProcess/WebFramePolicyListenerProxy.cpp:
+        (WebKit::WebFramePolicyListenerProxy::use):
+        (WebKit::WebFramePolicyListenerProxy::download):
+        (WebKit::WebFramePolicyListenerProxy::ignore):
+        * UIProcess/WebFramePolicyListenerProxy.h:
+        * UIProcess/WebFrameProxy.cpp:
+        (WebKit::WebFrameProxy::receivedPolicyDecision):
+        * UIProcess/WebFrameProxy.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::receivedPolicyDecision):
+        (WebKit::WebPageProxy::decidePolicyForNavigationAction):
+        (WebKit::WebPageProxy::updateWebsitePolicies):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+        * WebKit.xcodeproj/project.pbxproj:
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::applyToDocumentLoader):
+        (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
+        * WebProcess/WebPage/WebFrame.cpp:
+        (WebKit::WebFrame::didReceivePolicyDecision):
+        * WebProcess/WebPage/WebFrame.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::didReceivePolicyDecision):
+        (WebKit::WebPage::updateWebsitePolicies):
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in:
+
 2017-12-14  Ryan Haddad  <ryanhaddad@apple.com>
 
         Unreviewed, rolling out r225931.
similarity index 77%
rename from Source/WebKit/Shared/WebsitePolicies.cpp
rename to Source/WebKit/Shared/WebsitePoliciesData.cpp
index da2e55b..f007115 100644 (file)
  */
 
 #include "config.h"
-#include "WebsitePolicies.h"
+#include "WebsitePoliciesData.h"
 
 #include "ArgumentCoders.h"
 #include <WebCore/DocumentLoader.h>
 
 namespace WebKit {
 
-WebsitePolicies::WebsitePolicies(bool contentBlockersEnabled, OptionSet<WebsiteAutoplayQuirk> allowedAutoplayQuirks, WebsiteAutoplayPolicy autoplayPolicy, Vector<WebCore::HTTPHeaderField>&& customHeaderFields)
-    : m_contentBlockersEnabled(contentBlockersEnabled)
-    , m_allowedAutoplayQuirks(allowedAutoplayQuirks)
-    , m_autoplayPolicy(autoplayPolicy)
-    , m_customHeaderFields(WTFMove(customHeaderFields))
+WebsitePoliciesData WebsitePoliciesData::fromWebsitePolicies(const WebsitePolicies& policies)
 {
+    return { policies.contentBlockersEnabled(), policies.allowedAutoplayQuirks(), policies.autoplayPolicy(), policies.customHeaderFields() };
 }
 
-void WebsitePolicies::encode(IPC::Encoder& encoder) const
+void WebsitePoliciesData::encode(IPC::Encoder& encoder) const
 {
-    encoder << m_contentBlockersEnabled;
-    encoder << m_autoplayPolicy;
-    encoder << m_allowedAutoplayQuirks;
-    encoder << m_customHeaderFields;
+    encoder << contentBlockersEnabled;
+    encoder << autoplayPolicy;
+    encoder << allowedAutoplayQuirks;
+    encoder << customHeaderFields;
 }
 
-std::optional<WebsitePolicies> WebsitePolicies::decode(IPC::Decoder& decoder)
+std::optional<WebsitePoliciesData> WebsitePoliciesData::decode(IPC::Decoder& decoder)
 {
     std::optional<bool> contentBlockersEnabled;
     decoder >> contentBlockersEnabled;
@@ -77,16 +74,16 @@ std::optional<WebsitePolicies> WebsitePolicies::decode(IPC::Decoder& decoder)
     } };
 }
 
-void WebsitePolicies::applyToDocumentLoader(WebsitePolicies&& websitePolicies, WebCore::DocumentLoader& documentLoader)
+void WebsitePoliciesData::applyToDocumentLoader(WebsitePoliciesData&& websitePolicies, WebCore::DocumentLoader& documentLoader)
 {
-    documentLoader.setCustomHeaderFields(websitePolicies.takeCustomHeaderFields());
+    documentLoader.setCustomHeaderFields(WTFMove(websitePolicies.customHeaderFields));
     
     // Only setUserContentExtensionsEnabled if it hasn't already been disabled by reloading without content blockers.
     if (documentLoader.userContentExtensionsEnabled())
-        documentLoader.setUserContentExtensionsEnabled(websitePolicies.contentBlockersEnabled());
+        documentLoader.setUserContentExtensionsEnabled(websitePolicies.contentBlockersEnabled);
 
     OptionSet<WebCore::AutoplayQuirk> quirks;
-    auto allowedQuirks = websitePolicies.allowedAutoplayQuirks();
+    const auto& allowedQuirks = websitePolicies.allowedAutoplayQuirks;
     
     if (allowedQuirks.contains(WebsiteAutoplayQuirk::InheritedUserGestures))
         quirks |= WebCore::AutoplayQuirk::InheritedUserGestures;
@@ -99,7 +96,7 @@ void WebsitePolicies::applyToDocumentLoader(WebsitePolicies&& websitePolicies, W
 
     documentLoader.setAllowedAutoplayQuirks(quirks);
 
-    switch (websitePolicies.autoplayPolicy()) {
+    switch (websitePolicies.autoplayPolicy) {
     case WebsiteAutoplayPolicy::Default:
         documentLoader.setAutoplayPolicy(WebCore::AutoplayPolicy::Default);
         break;
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "config.h"
-#include "APIWebsitePolicies.h"
+#pragma once
 
-namespace API {
+#include "WebsitePolicies.h"
 
-Ref<WebsitePolicies> WebsitePolicies::create()
-{
-    return adoptRef(*new WebsitePolicies());
-}
+namespace WebKit {
 
-WebsitePolicies::WebsitePolicies()
-{
-}
+struct WebsitePoliciesData {
+    static WebsitePoliciesData fromWebsitePolicies(const WebsitePolicies&);
+    static void applyToDocumentLoader(WebsitePoliciesData&&, WebCore::DocumentLoader&);
 
-WebsitePolicies::~WebsitePolicies()
-{
-}
+    bool contentBlockersEnabled { true };
+    OptionSet<WebsiteAutoplayQuirk> allowedAutoplayQuirks;
+    WebsiteAutoplayPolicy autoplayPolicy { WebsiteAutoplayPolicy::Default };
+    Vector<WebCore::HTTPHeaderField> customHeaderFields;
+    
+    void encode(IPC::Encoder&) const;
+    static std::optional<WebsitePoliciesData> decode(IPC::Decoder&);
+};
 
-}
+} // namespace WebKit
index be05c43..b624fec 100644 (file)
@@ -31,7 +31,7 @@
 #include "SameDocumentNavigationType.h"
 #include "WebEvent.h"
 #include "WebFramePolicyListenerProxy.h"
-#include "WebsitePolicies.h"
+#include "WebsitePoliciesData.h"
 #include <WebCore/FrameLoaderTypes.h>
 #include <WebCore/LayoutMilestones.h>
 #include <wtf/Forward.h>
@@ -101,12 +101,12 @@ public:
 
     virtual void decidePolicyForNavigationAction(WebKit::WebPageProxy&, Ref<NavigationAction>&&, Ref<WebKit::WebFramePolicyListenerProxy>&& listener, Object*)
     {
-        listener->use({ });
+        listener->use(std::nullopt);
     }
 
     virtual void decidePolicyForNavigationResponse(WebKit::WebPageProxy&, Ref<NavigationResponse>&&, Ref<WebKit::WebFramePolicyListenerProxy>&& listener, Object*)
     {
-        listener->use({ });
+        listener->use(std::nullopt);
     }
     
     virtual void contentRuleListNotification(WebKit::WebPageProxy&, WebCore::URL&&, Vector<WTF::String>&&, Vector<WTF::String>&&) { };
index a12e797..cc038d7 100644 (file)
@@ -27,7 +27,6 @@
 
 #include "WebEvent.h"
 #include "WebFramePolicyListenerProxy.h"
-#include "WebsitePolicies.h"
 #include <WebCore/FrameLoaderTypes.h>
 #include <wtf/Forward.h>
 
@@ -53,15 +52,15 @@ public:
 
     virtual void decidePolicyForNavigationAction(WebKit::WebPageProxy&, WebKit::WebFrameProxy*, const WebKit::NavigationActionData&, WebKit::WebFrameProxy*, const WebCore::ResourceRequest&, const WebCore::ResourceRequest&, Ref<WebKit::WebFramePolicyListenerProxy>&& listener, API::Object*)
     {
-        listener->use({ });
+        listener->use(std::nullopt);
     }
     virtual void decidePolicyForNewWindowAction(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, const WebKit::NavigationActionData&, const WebCore::ResourceRequest&, const WTF::String&, Ref<WebKit::WebFramePolicyListenerProxy>&& listener, API::Object*)
     {
-        listener->use({ });
+        listener->use(std::nullopt);
     }
     virtual void decidePolicyForResponse(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&, bool, Ref<WebKit::WebFramePolicyListenerProxy>&& listener, API::Object*)
     {
-        listener->use({ });
+        listener->use(std::nullopt);
     }
     virtual void unableToImplementPolicy(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, const WebCore::ResourceError&, API::Object*) { }
 };
diff --git a/Source/WebKit/UIProcess/API/APIWebsitePolicies.h b/Source/WebKit/UIProcess/API/APIWebsitePolicies.h
deleted file mode 100644 (file)
index 69a43be..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2016 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 "APIObject.h"
-#include "WebsitePolicies.h"
-#include <wtf/OptionSet.h>
-
-namespace API {
-
-class WebsitePolicies final : public ObjectImpl<Object::Type::WebsitePolicies> {
-public:
-    static Ref<WebsitePolicies> create();
-    explicit WebsitePolicies();
-    virtual ~WebsitePolicies();
-
-    bool contentBlockersEnabled() const { return m_websitePolicies.contentBlockersEnabled(); }
-    void setContentBlockersEnabled(bool enabled) { m_websitePolicies.setContentBlockersEnabled(enabled); }
-
-    OptionSet<WebKit::WebsiteAutoplayQuirk> allowedAutoplayQuirks() const { return m_websitePolicies.allowedAutoplayQuirks(); }
-    void setAllowedAutoplayQuirks(OptionSet<WebKit::WebsiteAutoplayQuirk> allowedQuirks) { m_websitePolicies.setAllowedAutoplayQuirks(allowedQuirks); }
-
-    WebKit::WebsiteAutoplayPolicy autoplayPolicy() const { return m_websitePolicies.autoplayPolicy(); }
-    void setAutoplayPolicy(WebKit::WebsiteAutoplayPolicy policy) { m_websitePolicies.setAutoplayPolicy(policy); }
-
-    void setCustomHeaderFields(Vector<WebCore::HTTPHeaderField>&& customHeaderFields) { m_websitePolicies.setCustomHeaderFields(WTFMove(customHeaderFields)); };
-    const Vector<WebCore::HTTPHeaderField> customHeaderFields() { return m_websitePolicies.customHeaderFields(); }
-
-    const WebKit::WebsitePolicies& websitePolicies() { return m_websitePolicies; }
-    
-private:
-    WebKit::WebsitePolicies m_websitePolicies;
-};
-
-}
index c8854ba..19cac5f 100644 (file)
@@ -68,7 +68,6 @@ class ProcessPoolConfiguration;
 class SessionState;
 class UserScript;
 class WebsiteDataStore;
-class WebsitePolicies;
 class WindowFeatures;
 }
 
@@ -166,7 +165,7 @@ WK_ADD_API_MAPPING(WKUserMediaPermissionRequestRef, UserMediaPermissionRequestPr
 WK_ADD_API_MAPPING(WKUserScriptRef, API::UserScript)
 WK_ADD_API_MAPPING(WKViewportAttributesRef, WebViewportAttributes)
 WK_ADD_API_MAPPING(WKWebsiteDataStoreRef, API::WebsiteDataStore)
-WK_ADD_API_MAPPING(WKWebsitePoliciesRef, API::WebsitePolicies)
+WK_ADD_API_MAPPING(WKWebsitePoliciesRef, WebsitePolicies)
 WK_ADD_API_MAPPING(WKWindowFeaturesRef, API::WindowFeatures)
 
 /* Enum conversions */
index b654beb..37c8d4f 100644 (file)
 #include "config.h"
 #include "WKFramePolicyListener.h"
 
-#include "APIWebsitePolicies.h"
 #include "WKAPICast.h"
 #include "WebFramePolicyListenerProxy.h"
 #include "WebFrameProxy.h"
-#include "WebsitePolicies.h"
+#include "WebsitePoliciesData.h"
 
 using namespace WebKit;
 
@@ -41,12 +40,12 @@ WKTypeID WKFramePolicyListenerGetTypeID()
 
 void WKFramePolicyListenerUse(WKFramePolicyListenerRef policyListenerRef)
 {
-    toImpl(policyListenerRef)->use({ });
+    toImpl(policyListenerRef)->use(std::nullopt);
 }
 
 void WKFramePolicyListenerUseWithPolicies(WKFramePolicyListenerRef policyListenerRef, WKWebsitePoliciesRef websitePolicies)
 {
-    toImpl(policyListenerRef)->use(toImpl(websitePolicies)->websitePolicies());
+    toImpl(policyListenerRef)->use(WebsitePoliciesData::fromWebsitePolicies(*toImpl(websitePolicies)));
 }
 
 void WKFramePolicyListenerDownload(WKFramePolicyListenerRef policyListenerRef)
index 32e4f4a..7c121b1 100644 (file)
@@ -46,7 +46,6 @@
 #include "APIPolicyClient.h"
 #include "APISessionState.h"
 #include "APIUIClient.h"
-#include "APIWebsitePolicies.h"
 #include "APIWindowFeatures.h"
 #include "AuthenticationChallengeProxy.h"
 #include "LegacySessionStateCoding.h"
@@ -71,6 +70,7 @@
 #include "WebProcessPool.h"
 #include "WebProcessProxy.h"
 #include "WebProtectionSpace.h"
+#include "WebsitePolicies.h"
 #include <WebCore/Page.h>
 #include <WebCore/SecurityOriginData.h>
 #include <WebCore/SerializedCryptoKeyWrap.h>
@@ -325,7 +325,7 @@ bool WKPageWillHandleHorizontalScrollEvents(WKPageRef pageRef)
 
 void WKPageUpdateWebsitePolicies(WKPageRef pageRef, WKWebsitePoliciesRef websitePoliciesRef)
 {
-    toImpl(pageRef)->updateWebsitePolicies(toImpl(websitePoliciesRef)->websitePolicies());
+    toImpl(pageRef)->updateWebsitePolicies(WebsitePoliciesData::fromWebsitePolicies(*toImpl(websitePoliciesRef)));
 }
 
 WKStringRef WKPageCopyTitle(WKPageRef pageRef)
@@ -1351,7 +1351,7 @@ void WKPageSetPagePolicyClient(WKPageRef pageRef, const WKPagePolicyClientBase*
         void decidePolicyForNavigationAction(WebPageProxy& page, WebFrameProxy* frame, const NavigationActionData& navigationActionData, WebFrameProxy* originatingFrame, const WebCore::ResourceRequest& originalResourceRequest, const WebCore::ResourceRequest& resourceRequest, Ref<WebFramePolicyListenerProxy>&& listener, API::Object* userData) override
         {
             if (!m_client.decidePolicyForNavigationAction_deprecatedForUseWithV0 && !m_client.decidePolicyForNavigationAction_deprecatedForUseWithV1 && !m_client.decidePolicyForNavigationAction) {
-                listener->use({ });
+                listener->use(std::nullopt);
                 return;
             }
 
@@ -1369,7 +1369,7 @@ void WKPageSetPagePolicyClient(WKPageRef pageRef, const WKPagePolicyClientBase*
         void decidePolicyForNewWindowAction(WebPageProxy& page, WebFrameProxy& frame, const NavigationActionData& navigationActionData, const ResourceRequest& resourceRequest, const String& frameName, Ref<WebFramePolicyListenerProxy>&& listener, API::Object* userData) override
         {
             if (!m_client.decidePolicyForNewWindowAction) {
-                listener->use({ });
+                listener->use(std::nullopt);
                 return;
             }
 
@@ -1381,7 +1381,7 @@ void WKPageSetPagePolicyClient(WKPageRef pageRef, const WKPagePolicyClientBase*
         void decidePolicyForResponse(WebPageProxy& page, WebFrameProxy& frame, const ResourceResponse& resourceResponse, const ResourceRequest& resourceRequest, bool canShowMIMEType, Ref<WebFramePolicyListenerProxy>&& listener, API::Object* userData) override
         {
             if (!m_client.decidePolicyForResponse_deprecatedForUseWithV0 && !m_client.decidePolicyForResponse) {
-                listener->use({ });
+                listener->use(std::nullopt);
                 return;
             }
 
@@ -2143,7 +2143,7 @@ void WKPageSetPageNavigationClient(WKPageRef pageRef, const WKPageNavigationClie
         void decidePolicyForNavigationAction(WebPageProxy& page, Ref<API::NavigationAction>&& navigationAction, Ref<WebKit::WebFramePolicyListenerProxy>&& listener, API::Object* userData) final
         {
             if (!m_client.decidePolicyForNavigationAction) {
-                listener->use({ });
+                listener->use(std::nullopt);
                 return;
             }
             m_client.decidePolicyForNavigationAction(toAPI(&page), toAPI(navigationAction.ptr()), toAPI(listener.ptr()), toAPI(userData), m_client.base.clientInfo);
@@ -2152,7 +2152,7 @@ void WKPageSetPageNavigationClient(WKPageRef pageRef, const WKPageNavigationClie
         void decidePolicyForNavigationResponse(WebPageProxy& page, Ref<API::NavigationResponse>&& navigationResponse, Ref<WebKit::WebFramePolicyListenerProxy>&& listener, API::Object* userData) override
         {
             if (!m_client.decidePolicyForNavigationResponse) {
-                listener->use({ });
+                listener->use(std::nullopt);
                 return;
             }
             m_client.decidePolicyForNavigationResponse(toAPI(&page), toAPI(navigationResponse.ptr()), toAPI(listener.ptr()), toAPI(userData), m_client.base.clientInfo);
index 2742934..1361a73 100644 (file)
@@ -27,7 +27,6 @@
 #include "WKWebsitePolicies.h"
 
 #include "APIDictionary.h"
-#include "APIWebsitePolicies.h"
 #include "WKAPICast.h"
 #include "WKArray.h"
 #include "WKDictionary.h"
@@ -38,12 +37,12 @@ using namespace WebKit;
 
 WKTypeID WKWebsitePoliciesGetTypeID()
 {
-    return toAPI(API::WebsitePolicies::APIType);
+    return toAPI(WebsitePolicies::APIType);
 }
 
 WKWebsitePoliciesRef WKWebsitePoliciesCreate()
 {
-    return toAPI(&API::WebsitePolicies::create().leakRef());
+    return toAPI(&WebsitePolicies::create().leakRef());
 }
 
 void WKWebsitePoliciesSetContentBlockersEnabled(WKWebsitePoliciesRef websitePolicies, bool enabled)
index c3e51cd..1c8317e 100644 (file)
@@ -4233,7 +4233,7 @@ static int32_t activeOrientation(WKWebView *webView)
 
 - (void)_updateWebsitePolicies:(_WKWebsitePolicies *)websitePolicies
 {
-    _page->updateWebsitePolicies(websitePolicies->_websitePolicies->websitePolicies());
+    _page->updateWebsitePolicies(WebKit::WebsitePoliciesData::fromWebsitePolicies(*websitePolicies->_websitePolicies));
 }
 
 - (BOOL)_allowsRemoteInspection
index d7aa25a..fcdcd1d 100644 (file)
@@ -32,7 +32,7 @@
 
 - (void)dealloc
 {
-    _websitePolicies->API::WebsitePolicies::~WebsitePolicies();
+    _websitePolicies->WebKit::WebsitePolicies::~WebsitePolicies();
     
     [super dealloc];
 }
@@ -42,7 +42,7 @@
     if (!(self = [super init]))
         return nil;
     
-    API::Object::constructInWrapper<API::WebsitePolicies>(self);
+    API::Object::constructInWrapper<WebKit::WebsitePolicies>(self);
     
     return self;
 }
index 2fb0c47..d295487 100644 (file)
 
 #if WK_API_ENABLED
 
-#import "APIWebsitePolicies.h"
 #import "WKObject.h"
+#import "WebsitePolicies.h"
 
 namespace WebKit {
 
-inline _WKWebsitePolicies *wrapper(API::WebsitePolicies& websitePolicies)
+inline _WKWebsitePolicies *wrapper(WebsitePolicies& websitePolicies)
 {
     ASSERT([websitePolicies.wrapper() isKindOfClass:[_WKWebsitePolicies class]]);
     return (_WKWebsitePolicies *)websitePolicies.wrapper();
@@ -42,7 +42,7 @@ inline _WKWebsitePolicies *wrapper(API::WebsitePolicies& websitePolicies)
 
 @interface _WKWebsitePolicies () <WKObject> {
 @package
-    API::ObjectStorage<API::WebsitePolicies> _websitePolicies;
+    API::ObjectStorage<WebKit::WebsitePolicies> _websitePolicies;
 }
 @end
 
index 56ee380..30e576d 100644 (file)
@@ -427,7 +427,7 @@ void NavigationState::NavigationClient::decidePolicyForNavigationAction(WebPageP
             }
 
             if (!navigationAction->targetFrame()) {
-                listener->use({ });
+                listener->use(std::nullopt);
                 return;
             }
 
@@ -436,7 +436,7 @@ void NavigationState::NavigationClient::decidePolicyForNavigationAction(WebPageP
                 if (navigationAction->shouldPerformDownload())
                     listener->download();
                 else
-                    listener->use({ });
+                    listener->use(std::nullopt);
                 return;
             }
 
@@ -465,19 +465,19 @@ void NavigationState::NavigationClient::decidePolicyForNavigationAction(WebPageP
             return;
         checker->didCallCompletionHandler();
 
-        std::optional<WebsitePolicies> policies;
+        std::optional<WebsitePoliciesData> data;
         if (websitePolicies)
-            policies = websitePolicies->_websitePolicies->websitePolicies();
+            data = WebsitePoliciesData::fromWebsitePolicies(*websitePolicies->_websitePolicies);
 
         switch (actionPolicy) {
         case WKNavigationActionPolicyAllow:
-            tryAppLink(WTFMove(navigationAction), mainFrameURLString, [localListener = WTFMove(localListener), policies = WTFMove(policies)](bool followedLinkToApp) mutable {
+            tryAppLink(WTFMove(navigationAction), mainFrameURLString, [localListener = WTFMove(localListener), data = WTFMove(data)](bool followedLinkToApp) mutable {
                 if (followedLinkToApp) {
                     localListener->ignore();
                     return;
                 }
 
-                localListener->use(WTFMove(policies));
+                localListener->use(WTFMove(data));
             });
         
             break;
@@ -494,7 +494,7 @@ void NavigationState::NavigationClient::decidePolicyForNavigationAction(WebPageP
             break;
         case _WKNavigationActionPolicyAllowWithoutTryingAppLink:
 #pragma clang diagnostic pop
-            localListener->use(WTFMove(policies));
+            localListener->use(WTFMove(data));
             break;
         }
     };
@@ -544,14 +544,14 @@ void NavigationState::NavigationClient::decidePolicyForNavigationResponse(WebPag
             BOOL exists = [[NSFileManager defaultManager] fileExistsAtPath:url.path isDirectory:&isDirectory];
 
             if (exists && !isDirectory && navigationResponse->canShowMIMEType())
-                listener->use({ });
+                listener->use(std::nullopt);
             else
                 listener->ignore();
             return;
         }
 
         if (navigationResponse->canShowMIMEType())
-            listener->use({ });
+            listener->use(std::nullopt);
         else
             listener->ignore();
         return;
@@ -570,7 +570,7 @@ void NavigationState::NavigationClient::decidePolicyForNavigationResponse(WebPag
 
         switch (responsePolicy) {
         case WKNavigationResponsePolicyAllow:
-            localListener->use({ });
+            localListener->use(std::nullopt);
             break;
 
         case WKNavigationResponsePolicyCancel:
index 6331121..696afda 100644 (file)
@@ -27,7 +27,7 @@
 #include "WebFrameListenerProxy.h"
 
 #include "WebFrameProxy.h"
-#include "WebsitePolicies.h"
+#include "WebsitePoliciesData.h"
 
 namespace WebKit {
 
@@ -46,12 +46,12 @@ void WebFrameListenerProxy::invalidate()
     m_frame = nullptr;
 }
 
-void WebFrameListenerProxy::receivedPolicyDecision(WebCore::PolicyAction action, std::optional<WebsitePolicies>&& websitePolicies)
+void WebFrameListenerProxy::receivedPolicyDecision(WebCore::PolicyAction action, std::optional<WebsitePoliciesData>&& data)
 {
     if (!m_frame)
         return;
 
-    m_frame->receivedPolicyDecision(action, m_listenerID, m_navigation.get(), WTFMove(websitePolicies));
+    m_frame->receivedPolicyDecision(action, m_listenerID, m_navigation.get(), WTFMove(data));
     m_frame = nullptr;
 }
 
index 57ca349..f8ad8f2 100644 (file)
@@ -34,7 +34,7 @@
 namespace WebKit {
 
 class WebFrameProxy;
-class WebsitePolicies;
+struct WebsitePoliciesData;
 
 class WebFrameListenerProxy : public API::Object {
 public:
@@ -48,7 +48,7 @@ public:
 protected:
     WebFrameListenerProxy(WebFrameProxy*, uint64_t listenerID);
 
-    void receivedPolicyDecision(WebCore::PolicyAction, std::optional<WebsitePolicies>&&);
+    void receivedPolicyDecision(WebCore::PolicyAction, std::optional<WebsitePoliciesData>&&);
 
 private:
     RefPtr<WebFrameProxy> m_frame;
index 95f9eea..a8242f3 100644 (file)
@@ -27,7 +27,7 @@
 #include "WebFramePolicyListenerProxy.h"
 
 #include "WebFrameProxy.h"
-#include "WebsitePolicies.h"
+#include "WebsitePoliciesData.h"
 
 namespace WebKit {
 
@@ -36,19 +36,19 @@ WebFramePolicyListenerProxy::WebFramePolicyListenerProxy(WebFrameProxy* frame, u
 {
 }
 
-void WebFramePolicyListenerProxy::use(std::optional<WebsitePolicies>&& websitePolicies)
+void WebFramePolicyListenerProxy::use(std::optional<WebsitePoliciesData>&& data)
 {
-    receivedPolicyDecision(WebCore::PolicyAction::Use, WTFMove(websitePolicies));
+    receivedPolicyDecision(WebCore::PolicyAction::Use, WTFMove(data));
 }
 
 void WebFramePolicyListenerProxy::download()
 {
-    receivedPolicyDecision(WebCore::PolicyAction::Download, { });
+    receivedPolicyDecision(WebCore::PolicyAction::Download, std::nullopt);
 }
 
 void WebFramePolicyListenerProxy::ignore()
 {
-    receivedPolicyDecision(WebCore::PolicyAction::Ignore, { });
+    receivedPolicyDecision(WebCore::PolicyAction::Ignore, std::nullopt);
 }
 
 } // namespace WebKit
index ed5af9e..03c83f2 100644 (file)
@@ -44,7 +44,7 @@ public:
         return adoptRef(*new WebFramePolicyListenerProxy(frame, listenerID));
     }
 
-    void use(std::optional<WebsitePolicies>&&);
+    void use(std::optional<WebsitePoliciesData>&&);
     void download();
     void ignore();
 
index 3330a51..342501b 100644 (file)
@@ -32,6 +32,7 @@
 #include "WebPageProxy.h"
 #include "WebPasteboardProxy.h"
 #include "WebProcessPool.h"
+#include "WebsitePoliciesData.h"
 #include <WebCore/Image.h>
 #include <WebCore/MIMETypeRegistry.h>
 #include <stdio.h>
@@ -175,14 +176,14 @@ void WebFrameProxy::didChangeTitle(const String& title)
     m_title = title;
 }
 
-void WebFrameProxy::receivedPolicyDecision(PolicyAction action, uint64_t listenerID, API::Navigation* navigation, std::optional<WebsitePolicies>&& websitePolicies)
+void WebFrameProxy::receivedPolicyDecision(PolicyAction action, uint64_t listenerID, API::Navigation* navigation, std::optional<WebsitePoliciesData>&& data)
 {
     if (!m_page)
         return;
 
     ASSERT(m_activeListener);
     ASSERT(m_activeListener->listenerID() == listenerID);
-    m_page->receivedPolicyDecision(action, *this, listenerID, navigation, WTFMove(websitePolicies));
+    m_page->receivedPolicyDecision(action, *this, listenerID, navigation, WTFMove(data));
 }
 
 WebFramePolicyListenerProxy& WebFrameProxy::setUpPolicyListenerProxy(uint64_t listenerID)
index 175bf21..dd218ac 100644 (file)
@@ -51,7 +51,7 @@ namespace WebKit {
 class WebCertificateInfo;
 class WebFramePolicyListenerProxy;
 class WebPageProxy;
-class WebsitePolicies;
+struct WebsitePoliciesData;
 
 typedef GenericCallback<API::Data*> DataCallback;
 
@@ -114,7 +114,7 @@ public:
     void didChangeTitle(const String&);
 
     // Policy operations.
-    void receivedPolicyDecision(WebCore::PolicyAction, uint64_t listenerID, API::Navigation*, std::optional<WebsitePolicies>&&);
+    void receivedPolicyDecision(WebCore::PolicyAction, uint64_t listenerID, API::Navigation*, std::optional<WebsitePoliciesData>&&);
     WebFramePolicyListenerProxy& setUpPolicyListenerProxy(uint64_t listenerID);
 
 #if ENABLE(CONTENT_FILTERING)
index 41ccd83..cb4d4b0 100644 (file)
@@ -2275,7 +2275,7 @@ void WebPageProxy::centerSelectionInVisibleArea()
     m_process->send(Messages::WebPage::CenterSelectionInVisibleArea(), m_pageID);
 }
 
-void WebPageProxy::receivedPolicyDecision(PolicyAction action, WebFrameProxy& frame, uint64_t listenerID, API::Navigation* navigation, std::optional<WebsitePolicies>&& websitePolicies)
+void WebPageProxy::receivedPolicyDecision(PolicyAction action, WebFrameProxy& frame, uint64_t listenerID, API::Navigation* navigation, std::optional<WebsitePoliciesData>&& websitePolicies)
 {
     if (!isValid())
         return;
@@ -2317,7 +2317,7 @@ void WebPageProxy::receivedPolicyDecision(PolicyAction action, WebFrameProxy& fr
         m_syncNavigationActionPolicyActionIsValid = true;
         m_syncNavigationActionPolicyAction = action;
         m_syncNavigationActionPolicyDownloadID = downloadID;
-        m_syncNavigationActionPolicyWebsitePolicies = websitePolicies;
+        m_syncNavigationActionPolicyWebsitePolicies = WTFMove(websitePolicies);
         return;
     }
     
@@ -3685,7 +3685,7 @@ void WebPageProxy::frameDidBecomeFrameSet(uint64_t frameID, bool value)
         m_frameSetLargestFrame = value ? m_mainFrame : 0;
 }
 
-void WebPageProxy::decidePolicyForNavigationAction(uint64_t frameID, const SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, NavigationActionData&& navigationActionData, const FrameInfoData& originatingFrameInfoData, uint64_t originatingPageID, const WebCore::ResourceRequest& originalRequest, ResourceRequest&& request, uint64_t listenerID, const UserData& userData, bool& receivedPolicyAction, uint64_t& newNavigationID, WebCore::PolicyAction& policyAction, DownloadID& downloadID, std::optional<WebsitePolicies>& websitePolicies)
+void WebPageProxy::decidePolicyForNavigationAction(uint64_t frameID, const SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, NavigationActionData&& navigationActionData, const FrameInfoData& originatingFrameInfoData, uint64_t originatingPageID, const WebCore::ResourceRequest& originalRequest, ResourceRequest&& request, uint64_t listenerID, const UserData& userData, bool& receivedPolicyAction, uint64_t& newNavigationID, WebCore::PolicyAction& policyAction, DownloadID& downloadID, std::optional<WebsitePoliciesData>& websitePolicies)
 {
     PageClientProtector protector(m_pageClient);
 
@@ -3754,7 +3754,7 @@ void WebPageProxy::decidePolicyForNavigationAction(uint64_t frameID, const Secur
     if (m_syncNavigationActionPolicyActionIsValid) {
         policyAction = m_syncNavigationActionPolicyAction;
         downloadID = m_syncNavigationActionPolicyDownloadID;
-        websitePolicies = m_syncNavigationActionPolicyWebsitePolicies;
+        websitePolicies = WTFMove(m_syncNavigationActionPolicyWebsitePolicies);
     }
 }
 
@@ -6151,7 +6151,7 @@ bool WebPageProxy::willHandleHorizontalScrollEvents() const
     return !m_canShortCircuitHorizontalWheelEvents;
 }
 
-void WebPageProxy::updateWebsitePolicies(const WebsitePolicies& websitePolicies)
+void WebPageProxy::updateWebsitePolicies(WebsitePoliciesData&& websitePolicies)
 {
     m_process->send(Messages::WebPage::UpdateWebsitePolicies(websitePolicies), m_pageID);
 }
index 47fdaf3..d242427 100644 (file)
@@ -62,7 +62,7 @@
 #include "WebPageProxyMessages.h"
 #include "WebPopupMenuProxy.h"
 #include "WebProcessLifetimeTracker.h"
-#include "WebsitePolicies.h"
+#include "WebsitePoliciesData.h"
 #include <WebCore/ActivityState.h>
 #include <WebCore/AutoplayEvent.h>
 #include <WebCore/Color.h>
@@ -433,7 +433,7 @@ public:
 
     bool willHandleHorizontalScrollEvents() const;
 
-    void updateWebsitePolicies(const WebsitePolicies&);
+    void updateWebsitePolicies(WebsitePoliciesData&&);
 
     bool canShowMIMEType(const String& mimeType);
 
@@ -843,7 +843,7 @@ public:
     void performDictionaryLookupOfCurrentSelection();
 #endif
 
-    void receivedPolicyDecision(WebCore::PolicyAction, WebFrameProxy&, uint64_t listenerID, API::Navigation* navigationID, std::optional<WebsitePolicies>&&);
+    void receivedPolicyDecision(WebCore::PolicyAction, WebFrameProxy&, uint64_t listenerID, API::Navigation* navigationID, std::optional<WebsitePoliciesData>&&);
 
     void backForwardRemovedItem(uint64_t itemID);
 
@@ -1326,7 +1326,7 @@ private:
 
     void didDestroyNavigation(uint64_t navigationID);
 
-    void decidePolicyForNavigationAction(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, NavigationActionData&&, const FrameInfoData&, uint64_t originatingPageID, const WebCore::ResourceRequest& originalRequest, WebCore::ResourceRequest&&, uint64_t listenerID, const UserData&, bool& receivedPolicyAction, uint64_t& newNavigationID, WebCore::PolicyAction&, DownloadID&, std::optional<WebsitePolicies>&);
+    void decidePolicyForNavigationAction(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, NavigationActionData&&, const FrameInfoData&, uint64_t originatingPageID, const WebCore::ResourceRequest& originalRequest, WebCore::ResourceRequest&&, uint64_t listenerID, const UserData&, bool& receivedPolicyAction, uint64_t& newNavigationID, WebCore::PolicyAction&, DownloadID&, std::optional<WebsitePoliciesData>&);
     void decidePolicyForNewWindowAction(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, NavigationActionData&&, WebCore::ResourceRequest&&, const String& frameName, uint64_t listenerID, const UserData&);
     void decidePolicyForResponse(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&, bool canShowMIMEType, uint64_t listenerID, const UserData&);
     void decidePolicyForResponseSync(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&, bool canShowMIMEType, uint64_t listenerID, const UserData&, bool& receivedPolicyAction, WebCore::PolicyAction&, DownloadID&);
@@ -1867,7 +1867,7 @@ private:
     bool m_syncNavigationActionPolicyActionIsValid { false };
     WebCore::PolicyAction m_syncNavigationActionPolicyAction { WebCore::PolicyAction::Use };
     DownloadID m_syncNavigationActionPolicyDownloadID { 0 };
-    std::optional<WebsitePolicies> m_syncNavigationActionPolicyWebsitePolicies;
+    std::optional<WebsitePoliciesData> m_syncNavigationActionPolicyWebsitePolicies;
 
     bool m_shouldSuppressAppLinksInNextNavigationPolicyDecision { false };
 
index 56f2afd..331ba19 100644 (file)
@@ -99,7 +99,7 @@ messages -> WebPageProxy {
 
     # Policy messages
     DecidePolicyForResponseSync(uint64_t frameID, struct WebCore::SecurityOriginData frameSecurityOrigin, uint64_t navigationID, WebCore::ResourceResponse response, WebCore::ResourceRequest request, bool canShowMIMEType, uint64_t listenerID, WebKit::UserData userData) -> (bool receivedPolicyAction, enum WebCore::PolicyAction policyAction, WebKit::DownloadID downloadID)
-    DecidePolicyForNavigationAction(uint64_t frameID, struct WebCore::SecurityOriginData frameSecurityOrigin, uint64_t navigationID, struct WebKit::NavigationActionData navigationActionData, struct WebKit::FrameInfoData originatingFrameInfoData, uint64_t originatingPageID, WebCore::ResourceRequest originalRequest, WebCore::ResourceRequest request, uint64_t listenerID, WebKit::UserData userData) -> (bool receivedPolicyAction, uint64_t newNavigationID, enum WebCore::PolicyAction policyAction, WebKit::DownloadID downloadID, std::optional<WebKit::WebsitePolicies> websitePolicies)
+    DecidePolicyForNavigationAction(uint64_t frameID, struct WebCore::SecurityOriginData frameSecurityOrigin, uint64_t navigationID, struct WebKit::NavigationActionData navigationActionData, struct WebKit::FrameInfoData originatingFrameInfoData, uint64_t originatingPageID, WebCore::ResourceRequest originalRequest, WebCore::ResourceRequest request, uint64_t listenerID, WebKit::UserData userData) -> (bool receivedPolicyAction, uint64_t newNavigationID, enum WebCore::PolicyAction policyAction, WebKit::DownloadID downloadID, std::optional<WebKit::WebsitePoliciesData> websitePolicies)
     DecidePolicyForNewWindowAction(uint64_t frameID, struct WebCore::SecurityOriginData frameSecurityOrigin, struct WebKit::NavigationActionData navigationActionData, WebCore::ResourceRequest request, String frameName, uint64_t listenerID, WebKit::UserData userData)
     UnableToImplementPolicy(uint64_t frameID, WebCore::ResourceError error, WebKit::UserData userData)
 
similarity index 83%
rename from Source/WebKit/Shared/WebsitePolicies.h
rename to Source/WebKit/UIProcess/WebsitePolicies.h
index f4e2cc3..d700fe0 100644 (file)
@@ -25,6 +25,7 @@
 
 #pragma once
 
+#include "APIObject.h"
 #include <WebCore/HTTPHeaderField.h>
 #include <wtf/EnumTraits.h>
 #include <wtf/OptionSet.h>
@@ -55,8 +56,9 @@ enum class WebsiteAutoplayQuirk {
     ArbitraryUserGestures = 1 << 2,
 };
 
-class WebsitePolicies {
+class WebsitePolicies final : public API::ObjectImpl<API::Object::Type::WebsitePolicies> {
 public:
+    static Ref<WebsitePolicies> create() { return adoptRef(*new WebsitePolicies); }
     WebsitePolicies() = default;
 
     bool contentBlockersEnabled() const { return m_contentBlockersEnabled; }
@@ -68,17 +70,17 @@ public:
     WebsiteAutoplayPolicy autoplayPolicy() const { return m_autoplayPolicy; }
     void setAutoplayPolicy(WebsiteAutoplayPolicy policy) { m_autoplayPolicy = policy; }
     
-    const Vector<WebCore::HTTPHeaderField>& customHeaderFields() { return m_customHeaderFields; }
+    const Vector<WebCore::HTTPHeaderField>& customHeaderFields() const { return m_customHeaderFields; }
     Vector<WebCore::HTTPHeaderField>&& takeCustomHeaderFields() { return WTFMove(m_customHeaderFields); }
     void setCustomHeaderFields(Vector<WebCore::HTTPHeaderField>&& fields) { m_customHeaderFields = WTFMove(fields); }
-    
-    static void applyToDocumentLoader(WebsitePolicies&&, WebCore::DocumentLoader&);
-    
-    void encode(IPC::Encoder&) const;
-    static std::optional<WebsitePolicies> decode(IPC::Decoder&);
 
 private:
-    WebsitePolicies(bool, OptionSet<WebsiteAutoplayQuirk>, WebsiteAutoplayPolicy, Vector<WebCore::HTTPHeaderField>&&);
+    WebsitePolicies(bool contentBlockersEnabled, OptionSet<WebsiteAutoplayQuirk> allowedAutoplayQuirks, WebsiteAutoplayPolicy autoplayPolicy, Vector<WebCore::HTTPHeaderField>&& customHeaderFields)
+        : m_contentBlockersEnabled(contentBlockersEnabled)
+        , m_allowedAutoplayQuirks(allowedAutoplayQuirks)
+        , m_autoplayPolicy(autoplayPolicy)
+        , m_customHeaderFields(WTFMove(customHeaderFields))
+    { }
 
     bool m_contentBlockersEnabled { true };
     OptionSet<WebsiteAutoplayQuirk> m_allowedAutoplayQuirks;
index 5aa22aa..6758bc1 100644 (file)
                5C0B17791E7C882100E9123C /* WebSocketStreamMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C0B17761E7C879C00E9123C /* WebSocketStreamMessageReceiver.cpp */; };
                5C0B177C1E7C885400E9123C /* WebSocketStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C0B177A1E7C884F00E9123C /* WebSocketStream.cpp */; };
                5C0B17811E7C8C2600E9123C /* NetworkSocketStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C0B177D1E7C886700E9123C /* NetworkSocketStream.cpp */; };
+               5C13024C1FE35154000D9B31 /* WebsitePolicies.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C13024B1FE35142000D9B31 /* WebsitePolicies.h */; };
                5C1426EC1C23F80900D41183 /* NetworkProcessCreationParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1426E21C23F80500D41183 /* NetworkProcessCreationParameters.cpp */; };
                5C1426ED1C23F80900D41183 /* NetworkProcessCreationParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1426E31C23F80500D41183 /* NetworkProcessCreationParameters.h */; };
                5C1426EE1C23F80900D41183 /* NetworkProcessSupplement.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1426E41C23F80500D41183 /* NetworkProcessSupplement.h */; };
                5C20CB9D1BB0DCFA00895BB1 /* NetworkSessionCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C20CB9B1BB0DCD200895BB1 /* NetworkSessionCocoa.mm */; };
                5C20CBA01BB1ECD800895BB1 /* NetworkSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C20CB9E1BB0DD1800895BB1 /* NetworkSession.h */; };
                5C298DA01C3DF02100470AFE /* PendingDownload.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C298D9E1C3DEF2900470AFE /* PendingDownload.h */; };
-               5C3AEA8F1FE1F21F002318D3 /* WebsitePolicies.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C3AEA8E1FE1F1DF002318D3 /* WebsitePolicies.cpp */; };
+               5C3AEA8F1FE1F21F002318D3 /* WebsitePoliciesData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C3AEA8E1FE1F1DF002318D3 /* WebsitePoliciesData.cpp */; };
                5C62FDF91EFC271C00CE072E /* WKURLSchemeTaskPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C62FDF81EFC263C00CE072E /* WKURLSchemeTaskPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
                5C6CE6D11F59BC7A0007C6CB /* PageClientImplCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C6CE6D01F59BC460007C6CB /* PageClientImplCocoa.mm */; };
                5C7706741D1138380012700F /* WebSocketProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C7706731D111D8B0012700F /* WebSocketProvider.cpp */; };
                5CB2378B1DF0DE5300117AA3 /* _WKWebsitePolicies.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CB2378A1DF0DD4300117AA3 /* _WKWebsitePolicies.mm */; };
                5CB2378C1DF0DE6E00117AA3 /* _WKWebsitePolicies.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CB237891DF0DD4300117AA3 /* _WKWebsitePolicies.h */; settings = {ATTRIBUTES = (Private, ); }; };
                5CB2378E1DF0E0D300117AA3 /* _WKWebsitePoliciesInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CB2378D1DF0E0C200117AA3 /* _WKWebsitePoliciesInternal.h */; };
-               5CB237911DF0E2E600117AA3 /* APIWebsitePolicies.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CB237901DF0E1DD00117AA3 /* APIWebsitePolicies.cpp */; };
-               5CB237921DF0E2EE00117AA3 /* APIWebsitePolicies.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CB2378F1DF0E1B800117AA3 /* APIWebsitePolicies.h */; };
                5CBC9B8D1C65279C00A8FDCF /* NetworkDataTaskCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CBC9B8B1C65257300A8FDCF /* NetworkDataTaskCocoa.mm */; };
                5CBC9B8E1C652CA000A8FDCF /* NetworkDataTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CBC9B891C6524A500A8FDCF /* NetworkDataTask.h */; };
                5CD286511E7235990094FDC8 /* WKContentRuleListStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CD2864D1E722F440094FDC8 /* WKContentRuleListStore.h */; settings = {ATTRIBUTES = (Public, ); }; };
                5C0B177E1E7C886700E9123C /* NetworkSocketStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkSocketStream.h; path = NetworkProcess/NetworkSocketStream.h; sourceTree = "<group>"; };
                5C0B177F1E7C886700E9123C /* NetworkSocketStream.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = NetworkSocketStream.messages.in; path = NetworkProcess/NetworkSocketStream.messages.in; sourceTree = "<group>"; };
                5C0B17801E7C888000E9123C /* WebSocketStream.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = WebSocketStream.messages.in; path = Network/WebSocketStream.messages.in; sourceTree = "<group>"; };
+               5C13024A1FE341A7000D9B31 /* WebsitePoliciesData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebsitePoliciesData.h; sourceTree = "<group>"; };
+               5C13024B1FE35142000D9B31 /* WebsitePolicies.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebsitePolicies.h; sourceTree = "<group>"; };
                5C1426E21C23F80500D41183 /* NetworkProcessCreationParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NetworkProcessCreationParameters.cpp; path = NetworkProcess/NetworkProcessCreationParameters.cpp; sourceTree = "<group>"; };
                5C1426E31C23F80500D41183 /* NetworkProcessCreationParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkProcessCreationParameters.h; path = NetworkProcess/NetworkProcessCreationParameters.h; sourceTree = "<group>"; };
                5C1426E41C23F80500D41183 /* NetworkProcessSupplement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkProcessSupplement.h; path = NetworkProcess/NetworkProcessSupplement.h; sourceTree = "<group>"; };
                5C20CB9B1BB0DCD200895BB1 /* NetworkSessionCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = NetworkSessionCocoa.mm; path = NetworkProcess/cocoa/NetworkSessionCocoa.mm; sourceTree = "<group>"; };
                5C20CB9E1BB0DD1800895BB1 /* NetworkSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkSession.h; path = NetworkProcess/NetworkSession.h; sourceTree = "<group>"; };
                5C298D9E1C3DEF2900470AFE /* PendingDownload.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PendingDownload.h; path = NetworkProcess/Downloads/PendingDownload.h; sourceTree = "<group>"; };
-               5C3AEA8E1FE1F1DF002318D3 /* WebsitePolicies.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebsitePolicies.cpp; sourceTree = "<group>"; };
+               5C3AEA8E1FE1F1DF002318D3 /* WebsitePoliciesData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebsitePoliciesData.cpp; sourceTree = "<group>"; };
                5C62FDF81EFC263C00CE072E /* WKURLSchemeTaskPrivate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WKURLSchemeTaskPrivate.h; sourceTree = "<group>"; };
                5C6CE6D01F59BC460007C6CB /* PageClientImplCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PageClientImplCocoa.mm; sourceTree = "<group>"; };
                5C6CE6D31F59EA350007C6CB /* PageClientImplCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageClientImplCocoa.h; sourceTree = "<group>"; };
                5C7C88DC1D0F41A0009D2F6D /* WebSocketProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebSocketProvider.h; path = Network/WebSocketProvider.h; sourceTree = "<group>"; };
                5C84CF901F96AC4E00B6705A /* NetworkSessionCreationParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkSessionCreationParameters.h; path = NetworkProcess/NetworkSessionCreationParameters.h; sourceTree = "<group>"; };
                5C85C7861C3F23C50061A4FA /* PendingDownload.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PendingDownload.cpp; path = NetworkProcess/Downloads/PendingDownload.cpp; sourceTree = "<group>"; };
-               5C9E567F1DF7930900C9EE33 /* WebsitePolicies.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebsitePolicies.h; sourceTree = "<group>"; };
                5C9E56801DF7F05500C9EE33 /* WKWebsitePolicies.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKWebsitePolicies.cpp; sourceTree = "<group>"; };
                5C9E56811DF7F05500C9EE33 /* WKWebsitePolicies.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebsitePolicies.h; sourceTree = "<group>"; };
                5CB237891DF0DD4300117AA3 /* _WKWebsitePolicies.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKWebsitePolicies.h; sourceTree = "<group>"; };
                5CB2378A1DF0DD4300117AA3 /* _WKWebsitePolicies.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKWebsitePolicies.mm; sourceTree = "<group>"; };
                5CB2378D1DF0E0C200117AA3 /* _WKWebsitePoliciesInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKWebsitePoliciesInternal.h; sourceTree = "<group>"; };
-               5CB2378F1DF0E1B800117AA3 /* APIWebsitePolicies.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIWebsitePolicies.h; sourceTree = "<group>"; };
-               5CB237901DF0E1DD00117AA3 /* APIWebsitePolicies.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIWebsitePolicies.cpp; sourceTree = "<group>"; };
                5CBC9B891C6524A500A8FDCF /* NetworkDataTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkDataTask.h; path = NetworkProcess/NetworkDataTask.h; sourceTree = "<group>"; };
                5CBC9B8B1C65257300A8FDCF /* NetworkDataTaskCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = NetworkDataTaskCocoa.mm; path = NetworkProcess/cocoa/NetworkDataTaskCocoa.mm; sourceTree = "<group>"; };
                5CD286491E722F440094FDC8 /* _WKUserContentFilterPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKUserContentFilterPrivate.h; sourceTree = "<group>"; };
                                3760881D150413E900FC82C7 /* WebRenderObject.h */,
                                511F7D3F1EB1BCEE00E47B83 /* WebsiteDataStoreParameters.cpp */,
                                511F7D401EB1BCEE00E47B83 /* WebsiteDataStoreParameters.h */,
-                               5C3AEA8E1FE1F1DF002318D3 /* WebsitePolicies.cpp */,
-                               5C9E567F1DF7930900C9EE33 /* WebsitePolicies.h */,
+                               5C3AEA8E1FE1F1DF002318D3 /* WebsitePoliciesData.cpp */,
+                               5C13024A1FE341A7000D9B31 /* WebsitePoliciesData.h */,
                                8360349D1ACB34D600626549 /* WebSQLiteDatabaseTracker.cpp */,
                                8360349E1ACB34D600626549 /* WebSQLiteDatabaseTracker.h */,
                                C0337DD7127A51B6008FF4F4 /* WebTouchEvent.cpp */,
                                7A9CD8C21C779AD600D9F6C7 /* WebResourceLoadStatisticsStore.messages.in */,
                                6B821DDB1EEF05DD00D7AF4A /* WebResourceLoadStatisticsTelemetry.cpp */,
                                6B821DDA1EEF05DD00D7AF4A /* WebResourceLoadStatisticsTelemetry.h */,
+                               5C13024B1FE35142000D9B31 /* WebsitePolicies.h */,
                                51D124241E6D3CC3002B2820 /* WebURLSchemeHandler.cpp */,
                                51D124251E6D3CC3002B2820 /* WebURLSchemeHandler.h */,
                                51E8B68D1E712873001B7132 /* WebURLSchemeTask.cpp */,
                                1AE286821C7F93860069AC4F /* APIWebsiteDataRecord.h */,
                                1A3635A71A3144A300ED6197 /* APIWebsiteDataStore.cpp */,
                                1A3635A81A3144A300ED6197 /* APIWebsiteDataStore.h */,
-                               5CB237901DF0E1DD00117AA3 /* APIWebsitePolicies.cpp */,
-                               5CB2378F1DF0E1B800117AA3 /* APIWebsitePolicies.h */,
                                1A6563E21B7A8C50009CF787 /* APIWindowFeatures.cpp */,
                                1A6563E31B7A8C50009CF787 /* APIWindowFeatures.h */,
                        );
                                C5E1AFEF16B21029006CC1F2 /* APIWebArchiveResource.h in Headers */,
                                1AE286841C7F93860069AC4F /* APIWebsiteDataRecord.h in Headers */,
                                1A3635AA1A3144A300ED6197 /* APIWebsiteDataStore.h in Headers */,
-                               5CB237921DF0E2EE00117AA3 /* APIWebsitePolicies.h in Headers */,
                                1A6563E51B7A8C50009CF787 /* APIWindowFeatures.h in Headers */,
                                1AD4C1931B39F33200ABC28E /* ApplicationStateTracker.h in Headers */,
                                1AEFD27911D16C81008219D3 /* ArgumentCoder.h in Headers */,
                                1A4832D11A9BDC2F008B4DFE /* WebsiteDataRecord.h in Headers */,
                                1A53C2AA1A325730004E8C70 /* WebsiteDataStore.h in Headers */,
                                511F7D411EB1BCF500E47B83 /* WebsiteDataStoreParameters.h in Headers */,
+                               5C13024C1FE35154000D9B31 /* WebsitePolicies.h in Headers */,
                                836034A01ACB34D600626549 /* WebSQLiteDatabaseTracker.h in Headers */,
                                1A52C0F81A38CDC70016160A /* WebStorageNamespaceProvider.h in Headers */,
                                517A53051F4793C600DCDC0A /* WebSWClientConnection.h in Headers */,
                                1AE286831C7F93860069AC4F /* APIWebsiteDataRecord.cpp in Sources */,
                                1A3635A91A3144A300ED6197 /* APIWebsiteDataStore.cpp in Sources */,
                                1A3635AD1A3145E500ED6197 /* APIWebsiteDataStoreCocoa.mm in Sources */,
-                               5CB237911DF0E2E600117AA3 /* APIWebsitePolicies.cpp in Sources */,
                                1A6563E41B7A8C50009CF787 /* APIWindowFeatures.cpp in Sources */,
                                1AD4C1921B39F33200ABC28E /* ApplicationStateTracker.mm in Sources */,
                                1A3D610513A7F03A00F95D4E /* ArgumentCoders.cpp in Sources */,
                                1A53C2A91A32572B004E8C70 /* WebsiteDataStore.cpp in Sources */,
                                1A4832C31A965A3C008B4DFE /* WebsiteDataStoreCocoa.mm in Sources */,
                                511F7D421EB1BCF800E47B83 /* WebsiteDataStoreParameters.cpp in Sources */,
-                               5C3AEA8F1FE1F21F002318D3 /* WebsitePolicies.cpp in Sources */,
+                               5C3AEA8F1FE1F21F002318D3 /* WebsitePoliciesData.cpp in Sources */,
                                5C7706741D1138380012700F /* WebSocketProvider.cpp in Sources */,
                                5C0B177C1E7C885400E9123C /* WebSocketStream.cpp in Sources */,
                                5C0B17791E7C882100E9123C /* WebSocketStreamMessageReceiver.cpp in Sources */,
index e9704a2..5f84995 100644 (file)
@@ -54,7 +54,7 @@
 #include "WebPageProxyMessages.h"
 #include "WebProcess.h"
 #include "WebProcessPoolMessages.h"
-#include "WebsitePolicies.h"
+#include "WebsitePoliciesData.h"
 #include <JavaScriptCore/APICast.h>
 #include <JavaScriptCore/JSObject.h>
 #include <WebCore/CachedFrame.h>
@@ -776,7 +776,7 @@ void WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction(const Navigati
     webPage->send(Messages::WebPageProxy::DecidePolicyForNewWindowAction(m_frame->frameID(), SecurityOriginData::fromFrame(coreFrame), navigationActionData, request, frameName, listenerID, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
 }
 
-void WebFrameLoaderClient::applyToDocumentLoader(WebsitePolicies&& websitePolicies)
+void WebFrameLoaderClient::applyToDocumentLoader(WebsitePoliciesData&& websitePolicies)
 {
     if (!m_frame)
         return;
@@ -791,7 +791,7 @@ void WebFrameLoaderClient::applyToDocumentLoader(WebsitePolicies&& websitePolici
     if (!documentLoader)
         return;
 
-    WebsitePolicies::applyToDocumentLoader(WTFMove(websitePolicies), *documentLoader);
+    WebsitePoliciesData::applyToDocumentLoader(WTFMove(websitePolicies), *documentLoader);
 }
 
 void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(const NavigationAction& navigationAction, const ResourceRequest& request, bool didReceiveRedirectResponse, FormState* formState, FramePolicyFunction&& function)
@@ -862,7 +862,7 @@ void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(const Navigat
 
     // Notify the UIProcess.
     Ref<WebFrame> protect(*m_frame);
-    std::optional<WebsitePolicies> websitePolicies;
+    std::optional<WebsitePoliciesData> websitePolicies;
     if (!webPage->sendSync(Messages::WebPageProxy::DecidePolicyForNavigationAction(m_frame->frameID(), SecurityOriginData::fromFrame(coreFrame), documentLoader->navigationID(), navigationActionData, originatingFrameInfoData, originatingFrame && originatingFrame->page() ? originatingFrame->page()->pageID() : 0, navigationAction.resourceRequest(), request, listenerID, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())), Messages::WebPageProxy::DecidePolicyForNavigationAction::Reply(receivedPolicyAction, newNavigationID, policyAction, downloadID, websitePolicies))) {
         m_frame->didReceivePolicyDecision(listenerID, PolicyAction::Ignore, 0, { }, { });
         return;
index afbf30d..0ced8bd 100644 (file)
@@ -35,7 +35,7 @@ namespace WebKit {
 
 class PluginView;
 class WebFrame;
-class WebsitePolicies;
+struct WebsitePoliciesData;
     
 class WebFrameLoaderClient final : public WebCore::FrameLoaderClient {
 public:
@@ -49,7 +49,7 @@ public:
 
     void setUseIconLoadingClient(bool useIconLoadingClient) { m_useIconLoadingClient = useIconLoadingClient; }
 
-    void applyToDocumentLoader(WebsitePolicies&&);
+    void applyToDocumentLoader(WebsitePoliciesData&&);
 
     std::optional<uint64_t> pageID() const final;
     std::optional<uint64_t> frameID() const final;
index 2ba3246..ae5546a 100644 (file)
@@ -45,6 +45,7 @@
 #include "WebPage.h"
 #include "WebPageProxyMessages.h"
 #include "WebProcess.h"
+#include "WebsitePoliciesData.h"
 #include <JavaScriptCore/APICast.h>
 #include <JavaScriptCore/JSContextRef.h>
 #include <JavaScriptCore/JSLock.h>
@@ -251,7 +252,7 @@ void WebFrame::invalidatePolicyListener()
     m_willSubmitFormCompletionHandlers.clear();
 }
 
-void WebFrame::didReceivePolicyDecision(uint64_t listenerID, PolicyAction action, uint64_t navigationID, DownloadID downloadID, std::optional<WebsitePolicies>&& websitePolicies)
+void WebFrame::didReceivePolicyDecision(uint64_t listenerID, PolicyAction action, uint64_t navigationID, DownloadID downloadID, std::optional<WebsitePoliciesData>&& websitePolicies)
 {
     if (!m_coreFrame)
         return;
index e955d97..9fef7f1 100644 (file)
@@ -63,8 +63,8 @@ class InjectedBundleNodeHandle;
 class InjectedBundleRangeHandle;
 class InjectedBundleScriptWorld;
 class WebPage;
-class WebsitePolicies;
 struct FrameInfoData;
+struct WebsitePoliciesData;
 
 class WebFrame : public API::ObjectImpl<API::Object::Type::BundleFrame> {
 public:
@@ -86,7 +86,7 @@ public:
     enum class ForNavigationAction { No, Yes };
     uint64_t setUpPolicyListener(WebCore::FramePolicyFunction&&, ForNavigationAction);
     void invalidatePolicyListener();
-    void didReceivePolicyDecision(uint64_t listenerID, WebCore::PolicyAction, uint64_t navigationID, DownloadID, std::optional<WebsitePolicies>&&);
+    void didReceivePolicyDecision(uint64_t listenerID, WebCore::PolicyAction, uint64_t navigationID, DownloadID, std::optional<WebsitePoliciesData>&&);
 
     uint64_t setUpWillSubmitFormListener(WTF::Function<void(void)>&&);
     void continueWillSubmitForm(uint64_t);
index efa197b..eef4420 100644 (file)
@@ -30,7 +30,6 @@
 
 #include "APIArray.h"
 #include "APIGeometry.h"
-#include "APIWebsitePolicies.h"
 #include "AssistedNodeInformation.h"
 #include "DataReference.h"
 #include "DragControllerAction.h"
 #include "WebUserMediaClient.h"
 #include "WebValidationMessageClient.h"
 #include "WebsiteDataStoreParameters.h"
+#include "WebsitePolicies.h"
 #include <JavaScriptCore/APICast.h>
 #include <WebCore/ApplicationCacheStorage.h>
 #include <WebCore/ArchiveResource.h>
@@ -2746,7 +2746,7 @@ void WebPage::setSessionID(PAL::SessionID sessionID)
     m_page->setSessionID(sessionID);
 }
 
-void WebPage::didReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, PolicyAction policyAction, uint64_t navigationID, const DownloadID& downloadID, std::optional<WebsitePolicies>&& websitePolicies)
+void WebPage::didReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, PolicyAction policyAction, uint64_t navigationID, const DownloadID& downloadID, std::optional<WebsitePoliciesData>&& websitePolicies)
 {
     WebFrame* frame = WebProcess::singleton().webFrame(frameID);
     if (!frame)
@@ -5438,7 +5438,7 @@ void WebPage::flushPendingEditorStateUpdate()
     sendEditorStateUpdate();
 }
 
-void WebPage::updateWebsitePolicies(WebsitePolicies&& websitePolicies)
+void WebPage::updateWebsitePolicies(WebsitePoliciesData&& websitePolicies)
 {
     if (!m_page)
         return;
@@ -5447,7 +5447,7 @@ void WebPage::updateWebsitePolicies(WebsitePolicies&& websitePolicies)
     if (!documentLoader)
         return;
 
-    WebsitePolicies::applyToDocumentLoader(WTFMove(websitePolicies), *documentLoader);
+    WebsitePoliciesData::applyToDocumentLoader(WTFMove(websitePolicies), *documentLoader);
     
 #if ENABLE(VIDEO)
     m_page->updateMediaElementRateChangeRestrictions();
index 999f307..2a67207 100644 (file)
@@ -210,7 +210,6 @@ class WebUserContentController;
 class VideoFullscreenManager;
 class WebWheelEvent;
 class WebTouchEvent;
-class WebsitePolicies;
 class RemoteLayerTreeTransaction;
 
 struct AssistedNodeInformation;
@@ -224,6 +223,7 @@ struct PrintInfo;
 struct WebPageCreationParameters;
 struct WebPreferencesStore;
 struct WebSelectionData;
+struct WebsitePoliciesData;
 
 enum class DragControllerAction;
 enum FindOptions : uint16_t;
@@ -1189,7 +1189,7 @@ private:
     void updatePreferences(const WebPreferencesStore&);
     void updatePreferencesGenerated(const WebPreferencesStore&);
 
-    void didReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, WebCore::PolicyAction, uint64_t navigationID, const DownloadID&, std::optional<WebsitePolicies>&&);
+    void didReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, WebCore::PolicyAction, uint64_t navigationID, const DownloadID&, std::optional<WebsitePoliciesData>&&);
     void continueWillSubmitForm(uint64_t frameID, uint64_t listenerID);
     void setUserAgent(const String&);
     void setCustomTextEncodingName(const String&);
@@ -1298,7 +1298,7 @@ private:
 
     void reportUsedFeatures();
 
-    void updateWebsitePolicies(WebsitePolicies&&);
+    void updateWebsitePolicies(WebsitePoliciesData&&);
 
 #if PLATFORM(MAC)
     void performImmediateActionHitTestAtLocation(WebCore::FloatPoint);
index fc4a597..6573f80 100644 (file)
@@ -150,8 +150,8 @@ messages -> WebPage LegacyReceiver {
 
     DidRemoveBackForwardItem(uint64_t backForwardItemID)
 
-    UpdateWebsitePolicies(WebKit::WebsitePolicies websitePolicies)
-    DidReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, enum WebCore::PolicyAction policyAction, uint64_t navigationID, WebKit::DownloadID downloadID, std::optional<WebKit::WebsitePolicies> websitePolicies)
+    UpdateWebsitePolicies(struct WebKit::WebsitePoliciesData websitePolicies)
+    DidReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, enum WebCore::PolicyAction policyAction, uint64_t navigationID, WebKit::DownloadID downloadID, std::optional<WebKit::WebsitePoliciesData> websitePolicies)
     ContinueWillSubmitForm(uint64_t frameID, uint64_t listenerID)
 
     ClearSelection()