Pass a completion handler instead of a WebFramePolicyListenerProxy during policy...
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Sep 2017 01:39:00 +0000 (01:39 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Sep 2017 01:39:00 +0000 (01:39 +0000)
https://bugs.webkit.org/show_bug.cgi?id=177509

Reviewed by Tim Horton.

This makes WebFramePolicyListenerProxy just a wrapper around a WTF::Function which is only needed for the C and glib APIs.
This is a step towards making WebPageProxy::DecidePolicyForResponseSync and WebPageProxy::DecidePolicyForNavigationAction asynchronous.

This patch has no change in behavior.

* CMakeLists.txt:
* 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/C/WKFramePolicyListener.cpp:
(WKFramePolicyListenerUseWithPolicies):
* UIProcess/API/C/WKPage.cpp:
(WKPageSetPagePolicyClient):
(WKPageSetPageNavigationClient):
* UIProcess/API/Cocoa/WKBrowsingContextController.mm:
* UIProcess/API/glib/WebKitPolicyClient.cpp:
* UIProcess/Automation/WebAutomationSession.cpp:
* UIProcess/Cocoa/NavigationState.h:
* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
(WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse):
* UIProcess/Cocoa/WebViewImpl.mm:
* UIProcess/RemoteWebInspectorProxy.cpp:
* UIProcess/WebFormSubmissionListenerProxy.h:
* UIProcess/WebFrameListenerProxy.cpp: Removed.
* UIProcess/WebFrameListenerProxy.h: Removed.
* UIProcess/WebFramePolicyListenerProxy.cpp:
(WebKit::WebFramePolicyListenerProxy::WebFramePolicyListenerProxy):
(WebKit::WebFramePolicyListenerProxy::~WebFramePolicyListenerProxy):
(WebKit::WebFramePolicyListenerProxy::create):
(WebKit::WebFramePolicyListenerProxy::use):
(WebKit::WebFramePolicyListenerProxy::download):
(WebKit::WebFramePolicyListenerProxy::ignore):
* UIProcess/WebFramePolicyListenerProxy.h:
(WebKit::WebFramePolicyListenerProxy::create): Deleted.
(): Deleted.
(WebKit::WebFramePolicyListenerProxy::operator new): Deleted.
* UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::webProcessWillShutDown):
(WebKit::WebFrameProxy::receivedPolicyDecision): Deleted.
(WebKit::WebFrameProxy::setUpPolicyListenerProxy): Deleted.
* UIProcess/WebFrameProxy.h:
* UIProcess/WebInspectorProxy.cpp:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::decidePolicyForNavigationAction):
(WebKit::WebPageProxy::decidePolicyForNewWindowAction):
(WebKit::WebPageProxy::decidePolicyForResponseSync):
(WebKit::WebPageProxy::receivedPolicyDecision): Deleted.
(WebKit::WebPageProxy::decidePolicyForResponse): Deleted.
* UIProcess/WebPageProxy.h:
* UIProcess/mac/ViewGestureControllerMac.mm:
* WebKit.xcodeproj/project.pbxproj:

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

27 files changed:
Source/WebKit/CMakeLists.txt
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/APINavigationClient.h
Source/WebKit/UIProcess/API/APIPolicyClient.h
Source/WebKit/UIProcess/API/C/WKFramePolicyListener.cpp
Source/WebKit/UIProcess/API/C/WKPage.cpp
Source/WebKit/UIProcess/API/Cocoa/WKBrowsingContextController.mm
Source/WebKit/UIProcess/API/glib/WebKitPolicyClient.cpp
Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp
Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp
Source/WebKit/UIProcess/Cocoa/NavigationState.h
Source/WebKit/UIProcess/Cocoa/NavigationState.mm
Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm
Source/WebKit/UIProcess/RemoteWebInspectorProxy.cpp
Source/WebKit/UIProcess/WebFormSubmissionListenerProxy.h
Source/WebKit/UIProcess/WebFrameListenerProxy.cpp [deleted file]
Source/WebKit/UIProcess/WebFrameListenerProxy.h [deleted file]
Source/WebKit/UIProcess/WebFramePolicyListenerProxy.cpp
Source/WebKit/UIProcess/WebFramePolicyListenerProxy.h
Source/WebKit/UIProcess/WebFrameProxy.cpp
Source/WebKit/UIProcess/WebFrameProxy.h
Source/WebKit/UIProcess/WebInspectorProxy.cpp
Source/WebKit/UIProcess/WebPageProxy.cpp
Source/WebKit/UIProcess/WebPageProxy.h
Source/WebKit/UIProcess/ios/ViewGestureControllerIOS.mm
Source/WebKit/UIProcess/mac/ViewGestureControllerMac.mm
Source/WebKit/WebKit.xcodeproj/project.pbxproj

index 0e36b13..02c32be 100644 (file)
@@ -313,7 +313,6 @@ set(WebKit_SOURCES
     UIProcess/WebEditCommandProxy.cpp
     UIProcess/WebFormClient.cpp
     UIProcess/WebFormSubmissionListenerProxy.cpp
-    UIProcess/WebFrameListenerProxy.cpp
     UIProcess/WebFramePolicyListenerProxy.cpp
     UIProcess/WebFrameProxy.cpp
     UIProcess/WebFullScreenManagerProxy.cpp
index e796e04..31cbba1 100644 (file)
@@ -1,3 +1,67 @@
+2017-09-26  Alex Christensen  <achristensen@webkit.org>
+
+        Pass a completion handler instead of a WebFramePolicyListenerProxy during policy decisions
+        https://bugs.webkit.org/show_bug.cgi?id=177509
+
+        Reviewed by Tim Horton.
+
+        This makes WebFramePolicyListenerProxy just a wrapper around a WTF::Function which is only needed for the C and glib APIs.
+        This is a step towards making WebPageProxy::DecidePolicyForResponseSync and WebPageProxy::DecidePolicyForNavigationAction asynchronous.
+
+        This patch has no change in behavior.
+
+        * CMakeLists.txt:
+        * 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/C/WKFramePolicyListener.cpp:
+        (WKFramePolicyListenerUseWithPolicies):
+        * UIProcess/API/C/WKPage.cpp:
+        (WKPageSetPagePolicyClient):
+        (WKPageSetPageNavigationClient):
+        * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
+        * UIProcess/API/glib/WebKitPolicyClient.cpp:
+        * UIProcess/Automation/WebAutomationSession.cpp:
+        * UIProcess/Cocoa/NavigationState.h:
+        * UIProcess/Cocoa/NavigationState.mm:
+        (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
+        (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse):
+        * UIProcess/Cocoa/WebViewImpl.mm:
+        * UIProcess/RemoteWebInspectorProxy.cpp:
+        * UIProcess/WebFormSubmissionListenerProxy.h:
+        * UIProcess/WebFrameListenerProxy.cpp: Removed.
+        * UIProcess/WebFrameListenerProxy.h: Removed.
+        * UIProcess/WebFramePolicyListenerProxy.cpp:
+        (WebKit::WebFramePolicyListenerProxy::WebFramePolicyListenerProxy):
+        (WebKit::WebFramePolicyListenerProxy::~WebFramePolicyListenerProxy):
+        (WebKit::WebFramePolicyListenerProxy::create):
+        (WebKit::WebFramePolicyListenerProxy::use):
+        (WebKit::WebFramePolicyListenerProxy::download):
+        (WebKit::WebFramePolicyListenerProxy::ignore):
+        * UIProcess/WebFramePolicyListenerProxy.h:
+        (WebKit::WebFramePolicyListenerProxy::create): Deleted.
+        (): Deleted.
+        (WebKit::WebFramePolicyListenerProxy::operator new): Deleted.
+        * UIProcess/WebFrameProxy.cpp:
+        (WebKit::WebFrameProxy::webProcessWillShutDown):
+        (WebKit::WebFrameProxy::receivedPolicyDecision): Deleted.
+        (WebKit::WebFrameProxy::setUpPolicyListenerProxy): Deleted.
+        * UIProcess/WebFrameProxy.h:
+        * UIProcess/WebInspectorProxy.cpp:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::decidePolicyForNavigationAction):
+        (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
+        (WebKit::WebPageProxy::decidePolicyForResponseSync):
+        (WebKit::WebPageProxy::receivedPolicyDecision): Deleted.
+        (WebKit::WebPageProxy::decidePolicyForResponse): Deleted.
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/mac/ViewGestureControllerMac.mm:
+        * WebKit.xcodeproj/project.pbxproj:
+
 2017-09-26  Brian Burg  <bburg@apple.com>
 
         Web Automation: overflow:hidden elements with no children are mistakenly reported as not visible
index 61dc71d..a381c9d 100644 (file)
 #pragma once
 
 #include "APIData.h"
+#include "DownloadID.h"
 #include "PluginModuleInfo.h"
 #include "ProcessTerminationReason.h"
 #include "SameDocumentNavigationType.h"
 #include "WebEvent.h"
-#include "WebFramePolicyListenerProxy.h"
 #include "WebsitePolicies.h"
 #include <WebCore/FrameLoaderTypes.h>
 #include <WebCore/LayoutMilestones.h>
@@ -40,14 +40,15 @@ namespace WebCore {
 class ResourceError;
 class ResourceRequest;
 class ResourceResponse;
+class URL;
 struct SecurityOriginData;
 }
 
 namespace WebKit {
 class AuthenticationChallengeProxy;
+class DownloadID;
 class QuickLookDocumentData;
 class WebBackForwardListItem;
-class WebFramePolicyListenerProxy;
 class WebFrameProxy;
 class WebPageProxy;
 class WebProtectionSpace;
@@ -96,14 +97,14 @@ public:
     virtual void didFinishLoadForQuickLookDocumentInMainFrame(const WebKit::QuickLookDocumentData&) { }
 #endif
 
-    virtual void decidePolicyForNavigationAction(WebKit::WebPageProxy&, Ref<NavigationAction>&&, Ref<WebKit::WebFramePolicyListenerProxy>&& listener, Object*)
+    virtual void decidePolicyForNavigationAction(WebKit::WebPageProxy&, Ref<NavigationAction>&&, Function<void(WebCore::PolicyAction, std::optional<WebKit::WebsitePolicies>&&)>&& completionHandler, Object*)
     {
-        listener->use({ });
+        completionHandler(WebCore::PolicyAction::Use, std::nullopt);
     }
 
-    virtual void decidePolicyForNavigationResponse(WebKit::WebPageProxy&, NavigationResponse&, Ref<WebKit::WebFramePolicyListenerProxy>&& listener, Object*)
+    virtual void decidePolicyForNavigationResponse(WebKit::WebPageProxy&, NavigationResponse&, Function<void(WebCore::PolicyAction, std::optional<WebKit::WebsitePolicies>&&)>&& completionHandler, Object*)
     {
-        listener->use({ });
+        completionHandler(WebCore::PolicyAction::Use, std::nullopt);
     }
     
 #if ENABLE(NETSCAPE_PLUGIN_API)
index a12e797..77b4894 100644 (file)
@@ -26,7 +26,6 @@
 #pragma once
 
 #include "WebEvent.h"
-#include "WebFramePolicyListenerProxy.h"
 #include "WebsitePolicies.h"
 #include <WebCore/FrameLoaderTypes.h>
 #include <wtf/Forward.h>
@@ -38,10 +37,10 @@ class ResourceResponse;
 }
 
 namespace WebKit {
+class DownloadID;
 struct NavigationActionData;
 class WebPageProxy;
 class WebFrameProxy;
-class WebFramePolicyListenerProxy;
 }
 
 namespace API {
@@ -51,17 +50,17 @@ class PolicyClient {
 public:
     virtual ~PolicyClient() { }
 
-    virtual void decidePolicyForNavigationAction(WebKit::WebPageProxy&, WebKit::WebFrameProxy*, const WebKit::NavigationActionData&, WebKit::WebFrameProxy*, const WebCore::ResourceRequest&, const WebCore::ResourceRequest&, Ref<WebKit::WebFramePolicyListenerProxy>&& listener, API::Object*)
+    virtual void decidePolicyForNavigationAction(WebKit::WebPageProxy&, WebKit::WebFrameProxy*, const WebKit::NavigationActionData&, WebKit::WebFrameProxy*, const WebCore::ResourceRequest&, const WebCore::ResourceRequest&, Function<void(WebCore::PolicyAction, std::optional<WebKit::WebsitePolicies>&&)>&& completionHandler, API::Object*)
     {
-        listener->use({ });
+        completionHandler(WebCore::PolicyAction::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*)
+    virtual void decidePolicyForNewWindowAction(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, const WebKit::NavigationActionData&, const WebCore::ResourceRequest&, const WTF::String&, Function<void(WebCore::PolicyAction, std::optional<WebKit::WebsitePolicies>&&)>&& completionHandler, API::Object*)
     {
-        listener->use({ });
+        completionHandler(WebCore::PolicyAction::Use, std::nullopt);
     }
-    virtual void decidePolicyForResponse(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&, bool, Ref<WebKit::WebFramePolicyListenerProxy>&& listener, API::Object*)
+    virtual void decidePolicyForResponse(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&, bool, Function<void(WebCore::PolicyAction, std::optional<WebKit::WebsitePolicies>&&)>&& completionHandler, API::Object*)
     {
-        listener->use({ });
+        completionHandler(WebCore::PolicyAction::Use, std::nullopt);
     }
     virtual void unableToImplementPolicy(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, const WebCore::ResourceError&, API::Object*) { }
 };
index b654beb..b4eddff 100644 (file)
@@ -44,9 +44,10 @@ void WKFramePolicyListenerUse(WKFramePolicyListenerRef policyListenerRef)
     toImpl(policyListenerRef)->use({ });
 }
 
-void WKFramePolicyListenerUseWithPolicies(WKFramePolicyListenerRef policyListenerRef, WKWebsitePoliciesRef websitePolicies)
+void WKFramePolicyListenerUseWithPolicies(WKFramePolicyListenerRef policyListenerRef, WKWebsitePoliciesRef websitePoliciesRef)
 {
-    toImpl(policyListenerRef)->use(toImpl(websitePolicies)->websitePolicies());
+    auto websitePolicies = toImpl(websitePoliciesRef)->websitePolicies();
+    toImpl(policyListenerRef)->use(WTFMove(websitePolicies));
 }
 
 void WKFramePolicyListenerDownload(WKFramePolicyListenerRef policyListenerRef)
index 1088612..fd6637f 100644 (file)
@@ -38,6 +38,7 @@
 #include "APIGeometry.h"
 #include "APIHitTestResult.h"
 #include "APILoaderClient.h"
+#include "APINavigation.h"
 #include "APINavigationAction.h"
 #include "APINavigationClient.h"
 #include "APINavigationResponse.h"
@@ -62,6 +63,7 @@
 #include "WKPluginInformation.h"
 #include "WebBackForwardList.h"
 #include "WebFormClient.h"
+#include "WebFramePolicyListenerProxy.h"
 #include "WebImage.h"
 #include "WebInspectorProxy.h"
 #include "WebOpenPanelResultListenerProxy.h"
@@ -1348,13 +1350,14 @@ void WKPageSetPagePolicyClient(WKPageRef pageRef, const WKPagePolicyClientBase*
         }
 
     private:
-        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
+        void decidePolicyForNavigationAction(WebPageProxy& page, WebFrameProxy* frame, const NavigationActionData& navigationActionData, WebFrameProxy* originatingFrame, const WebCore::ResourceRequest& originalResourceRequest, const WebCore::ResourceRequest& resourceRequest, Function<void(WebCore::PolicyAction, std::optional<WebKit::WebsitePolicies>&&)>&& completionHandler, API::Object* userData) override
         {
             if (!m_client.decidePolicyForNavigationAction_deprecatedForUseWithV0 && !m_client.decidePolicyForNavigationAction_deprecatedForUseWithV1 && !m_client.decidePolicyForNavigationAction) {
-                listener->use({ });
+                completionHandler(WebCore::PolicyAction::Use, std::nullopt);
                 return;
             }
 
+            auto listener = WebFramePolicyListenerProxy::create(WTFMove(completionHandler));
             Ref<API::URLRequest> originalRequest = API::URLRequest::create(originalResourceRequest);
             Ref<API::URLRequest> request = API::URLRequest::create(resourceRequest);
 
@@ -1366,25 +1369,27 @@ void WKPageSetPagePolicyClient(WKPageRef pageRef, const WKPagePolicyClientBase*
                 m_client.decidePolicyForNavigationAction(toAPI(&page), toAPI(frame), toAPI(navigationActionData.navigationType), toAPI(navigationActionData.modifiers), toAPI(navigationActionData.mouseButton), toAPI(originatingFrame), toAPI(originalRequest.ptr()), toAPI(request.ptr()), toAPI(listener.ptr()), toAPI(userData), m_client.base.clientInfo);
         }
 
-        void decidePolicyForNewWindowAction(WebPageProxy& page, WebFrameProxy& frame, const NavigationActionData& navigationActionData, const ResourceRequest& resourceRequest, const String& frameName, Ref<WebFramePolicyListenerProxy>&& listener, API::Object* userData) override
+        void decidePolicyForNewWindowAction(WebPageProxy& page, WebFrameProxy& frame, const NavigationActionData& navigationActionData, const ResourceRequest& resourceRequest, const String& frameName, Function<void(WebCore::PolicyAction, std::optional<WebKit::WebsitePolicies>&&)>&& completionHandler, API::Object* userData) override
         {
             if (!m_client.decidePolicyForNewWindowAction) {
-                listener->use({ });
+                completionHandler(WebCore::PolicyAction::Use, std::nullopt);
                 return;
             }
 
+            auto listener = WebFramePolicyListenerProxy::create(WTFMove(completionHandler));
             Ref<API::URLRequest> request = API::URLRequest::create(resourceRequest);
 
             m_client.decidePolicyForNewWindowAction(toAPI(&page), toAPI(&frame), toAPI(navigationActionData.navigationType), toAPI(navigationActionData.modifiers), toAPI(navigationActionData.mouseButton), toAPI(request.ptr()), toAPI(frameName.impl()), toAPI(listener.ptr()), toAPI(userData), m_client.base.clientInfo);
         }
 
-        void decidePolicyForResponse(WebPageProxy& page, WebFrameProxy& frame, const ResourceResponse& resourceResponse, const ResourceRequest& resourceRequest, bool canShowMIMEType, Ref<WebFramePolicyListenerProxy>&& listener, API::Object* userData) override
+        void decidePolicyForResponse(WebPageProxy& page, WebFrameProxy& frame, const ResourceResponse& resourceResponse, const ResourceRequest& resourceRequest, bool canShowMIMEType, Function<void(WebCore::PolicyAction, std::optional<WebKit::WebsitePolicies>&&)>&& completionHandler, API::Object* userData) override
         {
             if (!m_client.decidePolicyForResponse_deprecatedForUseWithV0 && !m_client.decidePolicyForResponse) {
-                listener->use({ });
+                completionHandler(WebCore::PolicyAction::Use, std::nullopt);
                 return;
             }
 
+            auto listener = WebFramePolicyListenerProxy::create(WTFMove(completionHandler));
             Ref<API::URLResponse> response = API::URLResponse::create(resourceResponse);
             Ref<API::URLRequest> request = API::URLRequest::create(resourceRequest);
 
@@ -2140,21 +2145,23 @@ void WKPageSetPageNavigationClient(WKPageRef pageRef, const WKPageNavigationClie
         }
 
     private:
-        void decidePolicyForNavigationAction(WebPageProxy& page, Ref<API::NavigationAction>&& navigationAction, Ref<WebKit::WebFramePolicyListenerProxy>&& listener, API::Object* userData) final
+        void decidePolicyForNavigationAction(WebPageProxy& page, Ref<API::NavigationAction>&& navigationAction, Function<void(WebCore::PolicyAction, std::optional<WebKit::WebsitePolicies>&&)>&& completionHandler, API::Object* userData) final
         {
             if (!m_client.decidePolicyForNavigationAction) {
-                listener->use({ });
+                completionHandler(WebCore::PolicyAction::Use, std::nullopt);
                 return;
             }
+            auto listener = WebFramePolicyListenerProxy::create(WTFMove(completionHandler));
             m_client.decidePolicyForNavigationAction(toAPI(&page), toAPI(navigationAction.ptr()), toAPI(listener.ptr()), toAPI(userData), m_client.base.clientInfo);
         }
 
-        void decidePolicyForNavigationResponse(WebPageProxy& page, API::NavigationResponse& navigationResponse, Ref<WebKit::WebFramePolicyListenerProxy>&& listener, API::Object* userData) override
+        void decidePolicyForNavigationResponse(WebPageProxy& page, API::NavigationResponse& navigationResponse, Function<void(WebCore::PolicyAction, std::optional<WebKit::WebsitePolicies>&&)>&& completionHandler, API::Object* userData) override
         {
             if (!m_client.decidePolicyForNavigationResponse) {
-                listener->use({ });
+                completionHandler(WebCore::PolicyAction::Use, std::nullopt);
                 return;
             }
+            auto listener = WebFramePolicyListenerProxy::create(WTFMove(completionHandler));
             m_client.decidePolicyForNavigationResponse(toAPI(&page), toAPI(&navigationResponse), toAPI(listener.ptr()), toAPI(userData), m_client.base.clientInfo);
         }
 
index b7e5e69..106fac3 100644 (file)
@@ -29,6 +29,7 @@
 #if WK_API_ENABLED
 
 #import "APIData.h"
+#import "APINavigation.h"
 #import "ObjCObjectGraph.h"
 #import "PageLoadStateObserver.h"
 #import "RemoteObjectRegistry.h"
index 78c0d5e..38986a4 100644 (file)
@@ -38,20 +38,23 @@ public:
     }
 
 private:
-    void decidePolicyForNavigationAction(WebPageProxy&, WebFrameProxy*, const NavigationActionData& navigationActionData, WebFrameProxy* /*originatingFrame*/, const WebCore::ResourceRequest& /*originalRequest*/, const WebCore::ResourceRequest& request, Ref<WebFramePolicyListenerProxy>&& listener, API::Object* /*userData*/) override
+    void decidePolicyForNavigationAction(WebPageProxy&, WebFrameProxy*, const NavigationActionData& navigationActionData, WebFrameProxy* /*originatingFrame*/, const WebCore::ResourceRequest& /*originalRequest*/, const WebCore::ResourceRequest& request, Function<void(WebCore::PolicyAction, std::optional<WebKit::WebsitePolicies>&&)>&& completionHandler, API::Object* /*userData*/) override
     {
+        auto listener = WebFramePolicyListenerProxy::create(WTFMove(completionHandler));
         GRefPtr<WebKitPolicyDecision> decision = adoptGRef(webkitNavigationPolicyDecisionCreate(navigationActionData, request, listener.ptr()));
         webkitWebViewMakePolicyDecision(m_webView, WEBKIT_POLICY_DECISION_TYPE_NAVIGATION_ACTION, decision.get());
     }
 
-    void decidePolicyForNewWindowAction(WebPageProxy&, WebFrameProxy&, const NavigationActionData& navigationActionData, const WebCore::ResourceRequest& request, const String& frameName, Ref<WebFramePolicyListenerProxy>&& listener, API::Object* /*userData*/) override
+    void decidePolicyForNewWindowAction(WebPageProxy&, WebFrameProxy&, const NavigationActionData& navigationActionData, const WebCore::ResourceRequest& request, const String& frameName, Function<void(WebCore::PolicyAction, std::optional<WebKit::WebsitePolicies>&&)>&& completionHandler, API::Object* /*userData*/) override
     {
+        auto listener = WebFramePolicyListenerProxy::create(WTFMove(completionHandler));
         GRefPtr<WebKitPolicyDecision> decision = adoptGRef(webkitNewWindowPolicyDecisionCreate(navigationActionData, request, frameName, listener.ptr()));
         webkitWebViewMakePolicyDecision(m_webView, WEBKIT_POLICY_DECISION_TYPE_NEW_WINDOW_ACTION, decision.get());
     }
 
-    void decidePolicyForResponse(WebPageProxy&, WebFrameProxy&, const WebCore::ResourceResponse& response, const WebCore::ResourceRequest& request, bool canShowMIMEType, Ref<WebFramePolicyListenerProxy>&& listener, API::Object* /*userData*/) override
+    void decidePolicyForResponse(WebPageProxy&, WebFrameProxy&, const WebCore::ResourceResponse& response, const WebCore::ResourceRequest& request, bool canShowMIMEType, Function<void(WebCore::PolicyAction, std::optional<WebKit::WebsitePolicies>&&)>&& completionHandler, API::Object* /*userData*/) override
     {
+        auto listener = WebFramePolicyListenerProxy::create(WTFMove(completionHandler));
         GRefPtr<WebKitPolicyDecision> decision = adoptGRef(webkitResponsePolicyDecisionCreate(request, response, canShowMIMEType, listener.ptr()));
         webkitWebViewMakePolicyDecision(m_webView, WEBKIT_POLICY_DECISION_TYPE_RESPONSE, decision.get());
     }
index 0c17983..bf6acfe 100644 (file)
@@ -23,6 +23,7 @@
 #include "WebKitWebView.h"
 
 #include "APIData.h"
+#include "APINavigation.h"
 #include "APISerializedScriptValue.h"
 #include "ImageOptions.h"
 #include "WebCertificateInfo.h"
index 8494d88..3c7674e 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "APIArray.h"
 #include "APIAutomationSessionClient.h"
+#include "APINavigation.h"
 #include "APIOpenPanelParameters.h"
 #include "AutomationProtocolObjects.h"
 #include "WebAutomationSessionMacros.h"
index 807860b..0d1ef87 100644 (file)
@@ -121,8 +121,8 @@ private:
         void resolveWebGLLoadPolicy(WebPageProxy&, const WebCore::URL&, WTF::Function<void(WebCore::WebGLLoadPolicy)>&& completionHandler) const final;
 #endif
 
-        void decidePolicyForNavigationAction(WebPageProxy&, Ref<API::NavigationAction>&&, Ref<WebFramePolicyListenerProxy>&&, API::Object* userData) override;
-        void decidePolicyForNavigationResponse(WebPageProxy&, API::NavigationResponse&, Ref<WebFramePolicyListenerProxy>&&, API::Object* userData) override;
+        void decidePolicyForNavigationAction(WebPageProxy&, Ref<API::NavigationAction>&&, Function<void(WebCore::PolicyAction, std::optional<WebsitePolicies>&&)>&&, API::Object* userData) override;
+        void decidePolicyForNavigationResponse(WebPageProxy&, API::NavigationResponse&, Function<void(WebCore::PolicyAction, std::optional<WebsitePolicies>&&)>&&, API::Object* userData) override;
 
         NavigationState& m_navigationState;
     };
index a91afb4..32a32c1 100644 (file)
@@ -360,32 +360,31 @@ static void tryAppLink(RefPtr<API::NavigationAction>&& navigationAction, const S
 #endif
 }
 
-void NavigationState::NavigationClient::decidePolicyForNavigationAction(WebPageProxy& webPageProxy, Ref<API::NavigationAction>&& navigationAction, Ref<WebFramePolicyListenerProxy>&& listener, API::Object* userData)
+void NavigationState::NavigationClient::decidePolicyForNavigationAction(WebPageProxy& webPageProxy, Ref<API::NavigationAction>&& navigationAction, Function<void(WebCore::PolicyAction, std::optional<WebsitePolicies>&&)>&& completionHandler, API::Object* userData)
 {
     String mainFrameURLString = webPageProxy.mainFrame()->url();
 
     if (!m_navigationState.m_navigationDelegateMethods.webViewDecidePolicyForNavigationActionDecisionHandler
         && !m_navigationState.m_navigationDelegateMethods.webViewDecidePolicyForNavigationActionDecisionHandlerWebsitePolicies) {
         Ref<API::NavigationAction> localNavigationAction = navigationAction.copyRef();
-        RefPtr<WebFramePolicyListenerProxy> localListener = WTFMove(listener);
 
-        tryAppLink(WTFMove(localNavigationAction), mainFrameURLString, [webPage = RefPtr<WebPageProxy>(&webPageProxy), localListener, localNavigationAction = navigationAction.copyRef()] (bool followedLinkToApp) {
+        tryAppLink(WTFMove(localNavigationAction), mainFrameURLString, [webPage = RefPtr<WebPageProxy>(&webPageProxy), completionHandler = WTFMove(completionHandler), localNavigationAction = navigationAction.copyRef()] (bool followedLinkToApp) {
             if (followedLinkToApp) {
-                localListener->ignore();
+                completionHandler(PolicyAction::Ignore, std::nullopt);
                 return;
             }
 
             if (!localNavigationAction->targetFrame()) {
-                localListener->use({ });
+                completionHandler(PolicyAction::Use, std::nullopt);
                 return;
             }
 
             RetainPtr<NSURLRequest> nsURLRequest = adoptNS(wrapper(API::URLRequest::create(localNavigationAction->request()).leakRef()));
             if ([NSURLConnection canHandleRequest:nsURLRequest.get()] || webPage->urlSchemeHandlerForScheme([nsURLRequest URL].scheme)) {
                 if (localNavigationAction->shouldPerformDownload())
-                    localListener->download();
+                    completionHandler(PolicyAction::Download, std::nullopt);
                 else
-                    localListener->use({ });
+                    completionHandler(PolicyAction::Use, std::nullopt);
                 return;
             }
 
@@ -395,7 +394,7 @@ void NavigationState::NavigationClient::decidePolicyForNavigationAction(WebPageP
             if (![[nsURLRequest URL] isFileURL])
                 [[NSWorkspace sharedWorkspace] openURL:[nsURLRequest URL]];
 #endif
-            localListener->ignore();
+            completionHandler(PolicyAction::Ignore, std::nullopt);
         });
 
         return;
@@ -407,43 +406,43 @@ void NavigationState::NavigationClient::decidePolicyForNavigationAction(WebPageP
 
     bool delegateHasWebsitePolicies = m_navigationState.m_navigationDelegateMethods.webViewDecidePolicyForNavigationActionDecisionHandlerWebsitePolicies;
     
-    RefPtr<CompletionHandlerCallChecker> checker = CompletionHandlerCallChecker::create(navigationDelegate.get(), delegateHasWebsitePolicies ? @selector(_webView:decidePolicyForNavigationAction:decisionHandler:) : @selector(webView:decidePolicyForNavigationAction:decisionHandler:));
+    auto checker = CompletionHandlerCallChecker::create(navigationDelegate.get(), delegateHasWebsitePolicies ? @selector(_webView:decidePolicyForNavigationAction:decisionHandler:) : @selector(webView:decidePolicyForNavigationAction:decisionHandler:));
     
-    auto decisionHandlerWithPolicies = [localListener = RefPtr<WebFramePolicyListenerProxy>(WTFMove(listener)), localNavigationAction = navigationAction.copyRef(), checker = WTFMove(checker), mainFrameURLString](WKNavigationActionPolicy actionPolicy, _WKWebsitePolicies *websitePolicies) mutable {
+    auto decisionHandlerWithPolicies = [completionHandler = WTFMove(completionHandler), localNavigationAction = navigationAction.copyRef(), checker = WTFMove(checker), mainFrameURLString](WKNavigationActionPolicy actionPolicy, _WKWebsitePolicies *websitePolicies) mutable {
         if (checker->completionHandlerHasBeenCalled())
             return;
         checker->didCallCompletionHandler();
 
-        WebsitePolicies policies;
+        std::optional<WebsitePolicies> policies;
         if (websitePolicies)
             policies = websitePolicies->_websitePolicies->websitePolicies();
 
         switch (actionPolicy) {
         case WKNavigationActionPolicyAllow:
-            tryAppLink(WTFMove(localNavigationAction), mainFrameURLString, [localListener = WTFMove(localListener), policies = WTFMove(policies)](bool followedLinkToApp) mutable {
+            tryAppLink(WTFMove(localNavigationAction), mainFrameURLString, [completionHandler = WTFMove(completionHandler), policies = WTFMove(policies)](bool followedLinkToApp) mutable {
                 if (followedLinkToApp) {
-                    localListener->ignore();
+                    completionHandler(PolicyAction::Ignore, std::nullopt);
                     return;
                 }
 
-                localListener->use(policies);
+                completionHandler(PolicyAction::Use, WTFMove(policies));
             });
         
             break;
 
         case WKNavigationActionPolicyCancel:
-            localListener->ignore();
+            completionHandler(PolicyAction::Ignore, std::nullopt);
             break;
 
 // FIXME: Once we have a new enough compiler everywhere we don't need to ignore -Wswitch.
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wswitch"
         case _WKNavigationActionPolicyDownload:
-            localListener->download();
+            completionHandler(PolicyAction::Download, std::nullopt);
             break;
         case _WKNavigationActionPolicyAllowWithoutTryingAppLink:
 #pragma clang diagnostic pop
-            localListener->use(policies);
+            completionHandler(PolicyAction::Use, WTFMove(policies));
             break;
         }
     };
@@ -458,7 +457,7 @@ void NavigationState::NavigationClient::decidePolicyForNavigationAction(WebPageP
     }
 }
 
-void NavigationState::NavigationClient::decidePolicyForNavigationResponse(WebPageProxy&, API::NavigationResponse& navigationResponse, Ref<WebFramePolicyListenerProxy>&& listener, API::Object* userData)
+void NavigationState::NavigationClient::decidePolicyForNavigationResponse(WebPageProxy&, API::NavigationResponse& navigationResponse, Function<void(WebCore::PolicyAction, std::optional<WebsitePolicies>&&)>&& completionHandler, API::Object* userData)
 {
     if (!m_navigationState.m_navigationDelegateMethods.webViewDecidePolicyForNavigationResponseDecisionHandler) {
         NSURL *url = navigationResponse.response().nsURLResponse().URL;
@@ -467,16 +466,16 @@ void NavigationState::NavigationClient::decidePolicyForNavigationResponse(WebPag
             BOOL exists = [[NSFileManager defaultManager] fileExistsAtPath:url.path isDirectory:&isDirectory];
 
             if (exists && !isDirectory && navigationResponse.canShowMIMEType())
-                listener->use({ });
+                completionHandler(PolicyAction::Use, std::nullopt);
             else
-                listener->ignore();
+                completionHandler(PolicyAction::Ignore, std::nullopt);
             return;
         }
 
         if (navigationResponse.canShowMIMEType())
-            listener->use({ });
+            completionHandler(PolicyAction::Use, std::nullopt);
         else
-            listener->ignore();
+            completionHandler(PolicyAction::Ignore, std::nullopt);
         return;
     }
 
@@ -484,20 +483,19 @@ void NavigationState::NavigationClient::decidePolicyForNavigationResponse(WebPag
     if (!navigationDelegate)
         return;
 
-    RefPtr<WebFramePolicyListenerProxy> localListener = WTFMove(listener);
-    RefPtr<CompletionHandlerCallChecker> checker = CompletionHandlerCallChecker::create(navigationDelegate.get(), @selector(webView:decidePolicyForNavigationResponse:decisionHandler:));
-    [navigationDelegate webView:m_navigationState.m_webView decidePolicyForNavigationResponse:wrapper(navigationResponse) decisionHandler:[localListener, checker](WKNavigationResponsePolicy responsePolicy) {
+    auto checker = CompletionHandlerCallChecker::create(navigationDelegate.get(), @selector(webView:decidePolicyForNavigationResponse:decisionHandler:));
+    [navigationDelegate webView:m_navigationState.m_webView decidePolicyForNavigationResponse:wrapper(navigationResponse) decisionHandler:BlockPtr<void(WKNavigationResponsePolicy)>::fromCallable([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)](WKNavigationResponsePolicy responsePolicy) {
         if (checker->completionHandlerHasBeenCalled())
             return;
         checker->didCallCompletionHandler();
 
         switch (responsePolicy) {
         case WKNavigationResponsePolicyAllow:
-            localListener->use({ });
+            completionHandler(PolicyAction::Use, std::nullopt);
             break;
 
         case WKNavigationResponsePolicyCancel:
-            localListener->ignore();
+            completionHandler(PolicyAction::Ignore, std::nullopt);
             break;
 
 // FIXME: Once we have a new enough compiler everywhere we don't need to ignore -Wswitch.
@@ -505,10 +503,10 @@ void NavigationState::NavigationClient::decidePolicyForNavigationResponse(WebPag
 #pragma clang diagnostic ignored "-Wswitch"
         case _WKNavigationResponsePolicyBecomeDownload:
 #pragma clang diagnostic pop
-            localListener->download();
+            completionHandler(PolicyAction::Download, std::nullopt);
             break;
         }
-    }];
+    }).get()];
 }
 
 void NavigationState::NavigationClient::didStartProvisionalNavigation(WebPageProxy& page, API::Navigation* navigation, API::Object*)
index 93846a8..05df1c7 100644 (file)
@@ -29,6 +29,7 @@
 #if PLATFORM(MAC)
 
 #import "APILegacyContextHistoryClient.h"
+#import "APINavigation.h"
 #import "AttributedString.h"
 #import "ColorSpaceData.h"
 #import "FullscreenClient.h"
index 8e83895..b5c461b 100644 (file)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "RemoteWebInspectorProxy.h"
 
+#include "APINavigation.h"
 #include "RemoteWebInspectorProxyMessages.h"
 #include "RemoteWebInspectorUIMessages.h"
 #include "WebInspectorProxy.h"
index 2a7fa4b..c54ff34 100644 (file)
@@ -25,7 +25,8 @@
 
 #pragma once
 
-#include "WebFrameListenerProxy.h"
+#include "APIObject.h"
+#include <wtf/Function.h>
 
 namespace WebKit {
 
diff --git a/Source/WebKit/UIProcess/WebFrameListenerProxy.cpp b/Source/WebKit/UIProcess/WebFrameListenerProxy.cpp
deleted file mode 100644 (file)
index 5add279..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2010 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 "WebFrameListenerProxy.h"
-
-#include "WebFrameProxy.h"
-
-namespace WebKit {
-
-WebFrameListenerProxy::WebFrameListenerProxy(WebFrameProxy* frame, uint64_t listenerID)
-    : m_frame(frame)
-    , m_listenerID(listenerID)
-{
-}
-
-WebFrameListenerProxy::~WebFrameListenerProxy()
-{
-}
-
-void WebFrameListenerProxy::invalidate()
-{
-    m_frame = nullptr;
-}
-
-void WebFrameListenerProxy::receivedPolicyDecision(WebCore::PolicyAction action, const WebsitePolicies& websitePolicies)
-{
-    if (!m_frame)
-        return;
-
-    m_frame->receivedPolicyDecision(action, m_listenerID, m_navigation.get(), websitePolicies);
-    m_frame = nullptr;
-}
-
-} // namespace WebKit
diff --git a/Source/WebKit/UIProcess/WebFrameListenerProxy.h b/Source/WebKit/UIProcess/WebFrameListenerProxy.h
deleted file mode 100644 (file)
index c3dfa05..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2010 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 "APINavigation.h"
-#include "APIObject.h"
-#include <WebCore/FrameLoaderTypes.h>
-#include <wtf/Ref.h>
-#include <wtf/RefPtr.h>
-
-namespace WebKit {
-
-class WebFrameProxy;
-struct WebsitePolicies;
-
-class WebFrameListenerProxy : public API::Object {
-public:
-    virtual ~WebFrameListenerProxy();
-
-    void invalidate();
-    uint64_t listenerID() const { return m_listenerID; }
-
-    void setNavigation(Ref<API::Navigation>&& navigation) { m_navigation = WTFMove(navigation); }
-
-protected:
-    WebFrameListenerProxy(WebFrameProxy*, uint64_t listenerID);
-
-    void receivedPolicyDecision(WebCore::PolicyAction, const WebsitePolicies&);
-
-private:
-    RefPtr<WebFrameProxy> m_frame;
-    uint64_t m_listenerID;
-    RefPtr<API::Navigation> m_navigation;
-};
-
-} // namespace WebKit
index 4a74901..15b7005 100644 (file)
 #include "config.h"
 #include "WebFramePolicyListenerProxy.h"
 
-#include "WebFrameProxy.h"
 #include "WebsitePolicies.h"
+#include <WebCore/FrameLoaderTypes.h>
+#include <wtf/Function.h>
 
 namespace WebKit {
 
-WebFramePolicyListenerProxy::WebFramePolicyListenerProxy(WebFrameProxy* frame, uint64_t listenerID)
-    : WebFrameListenerProxy(frame, listenerID)
+Ref<WebFramePolicyListenerProxy> WebFramePolicyListenerProxy::create(Function<void(WebCore::PolicyAction, std::optional<WebsitePolicies>&&)>&& completionHandler)
 {
+    return adoptRef(*new WebFramePolicyListenerProxy(WTFMove(completionHandler)));
 }
 
-void WebFramePolicyListenerProxy::use(const WebsitePolicies& websitePolicies)
+WebFramePolicyListenerProxy::WebFramePolicyListenerProxy(Function<void(WebCore::PolicyAction, std::optional<WebsitePolicies>&&)>&& completionHandler)
+    : m_completionHandler(WTFMove(completionHandler))
 {
-    receivedPolicyDecision(WebCore::PolicyAction::Use, websitePolicies);
+}
+
+void WebFramePolicyListenerProxy::use(std::optional<WebsitePolicies>&& websitePolicies)
+{
+    if (auto completionHandler = std::exchange(m_completionHandler, nullptr))
+        completionHandler(WebCore::PolicyAction::Use, WTFMove(websitePolicies));
 }
 
 void WebFramePolicyListenerProxy::download()
 {
-    receivedPolicyDecision(WebCore::PolicyAction::Download, { });
+    if (auto completionHandler = std::exchange(m_completionHandler, nullptr))
+        completionHandler(WebCore::PolicyAction::Download, std::nullopt);
 }
 
 void WebFramePolicyListenerProxy::ignore()
 {
-    receivedPolicyDecision(WebCore::PolicyAction::Ignore, { });
+    if (auto completionHandler = std::exchange(m_completionHandler, nullptr))
+        completionHandler(WebCore::PolicyAction::Ignore, std::nullopt);
 }
 
 } // namespace WebKit
index 379efd2..2a04346 100644 (file)
 
 #pragma once
 
-#include "WebFrameListenerProxy.h"
+#include "APIObject.h"
+#include <wtf/Function.h>
+#include <wtf/Optional.h>
 
-#if PLATFORM(COCOA)
-#include "WKFoundation.h"
-#endif
-
-#define DELEGATE_REF_COUNTING_TO_COCOA (PLATFORM(COCOA) && WK_API_ENABLED)
+namespace WebCore {
+enum class PolicyAction;
+}
 
 namespace WebKit {
 
-class WebFramePolicyListenerProxy : public WebFrameListenerProxy {
-public:
-    static const Type APIType = Type::FramePolicyListener;
+struct WebsitePolicies;
 
-    static Ref<WebFramePolicyListenerProxy> create(WebFrameProxy* frame, uint64_t listenerID)
-    {
-        return adoptRef(*new WebFramePolicyListenerProxy(frame, listenerID));
-    }
+class WebFramePolicyListenerProxy : public API::ObjectImpl<API::Object::Type::FramePolicyListener> {
+public:
+    static Ref<WebFramePolicyListenerProxy> create(Function<void(WebCore::PolicyAction, std::optional<WebsitePolicies>&&)>&&);
 
-    void use(const WebsitePolicies&);
+    void use(std::optional<WebsitePolicies>&&);
     void download();
     void ignore();
 
 private:
-    WebFramePolicyListenerProxy(WebFrameProxy*, uint64_t listenerID);
+    WebFramePolicyListenerProxy(Function<void(WebCore::PolicyAction, std::optional<WebsitePolicies>&&)>&&);
 
-    Type type() const override { return APIType; }
-
-#if DELEGATE_REF_COUNTING_TO_COCOA
-    void* operator new(size_t size) { return newObject(size, APIType); }
-#endif
+    Function<void(WebCore::PolicyAction, std::optional<WebsitePolicies>&&)> m_completionHandler;
 };
 
 } // namespace WebKit
-
-#undef DELEGATE_REF_COUNTING_TO_COCOA
index 855d5d1..b556f81 100644 (file)
@@ -26,8 +26,8 @@
 #include "config.h"
 #include "WebFrameProxy.h"
 
+#include "APINavigation.h"
 #include "WebCertificateInfo.h"
-#include "WebFramePolicyListenerProxy.h"
 #include "WebPageMessages.h"
 #include "WebPageProxy.h"
 #include "WebPasteboardProxy.h"
@@ -60,11 +60,6 @@ WebFrameProxy::~WebFrameProxy()
 void WebFrameProxy::webProcessWillShutDown()
 {
     m_page = nullptr;
-
-    if (m_activeListener) {
-        m_activeListener->invalidate();
-        m_activeListener = nullptr;
-    }
 }
 
 bool WebFrameProxy::isMainFrame() const
@@ -175,24 +170,6 @@ void WebFrameProxy::didChangeTitle(const String& title)
     m_title = title;
 }
 
-void WebFrameProxy::receivedPolicyDecision(PolicyAction action, uint64_t listenerID, API::Navigation* navigation, const WebsitePolicies& websitePolicies)
-{
-    if (!m_page)
-        return;
-
-    ASSERT(m_activeListener);
-    ASSERT(m_activeListener->listenerID() == listenerID);
-    m_page->receivedPolicyDecision(action, *this, listenerID, navigation, websitePolicies);
-}
-
-WebFramePolicyListenerProxy& WebFrameProxy::setUpPolicyListenerProxy(uint64_t listenerID)
-{
-    if (m_activeListener)
-        m_activeListener->invalidate();
-    m_activeListener = WebFramePolicyListenerProxy::create(this, listenerID);
-    return *static_cast<WebFramePolicyListenerProxy*>(m_activeListener.get());
-}
-
 void WebFrameProxy::getWebArchive(Function<void (API::Data*, CallbackBase::Error)>&& callbackFunction)
 {
     if (!m_page) {
index b834197..99e3ccc 100644 (file)
@@ -28,7 +28,6 @@
 #include "APIObject.h"
 #include "FrameLoadState.h"
 #include "GenericCallback.h"
-#include "WebFrameListenerProxy.h"
 #include <WebCore/FrameLoaderTypes.h>
 #include <wtf/Forward.h>
 #include <wtf/Function.h>
@@ -49,7 +48,6 @@ class Decoder;
 
 namespace WebKit {
 class WebCertificateInfo;
-class WebFramePolicyListenerProxy;
 class WebPageProxy;
 struct WebsitePolicies;
 
@@ -113,10 +111,6 @@ public:
     void didSameDocumentNavigation(const WebCore::URL&); // eg. anchor navigation, session state change.
     void didChangeTitle(const String&);
 
-    // Policy operations.
-    void receivedPolicyDecision(WebCore::PolicyAction, uint64_t listenerID, API::Navigation*, const WebsitePolicies&);
-    WebFramePolicyListenerProxy& setUpPolicyListenerProxy(uint64_t listenerID);
-
 #if ENABLE(CONTENT_FILTERING)
     void contentFilterDidBlockLoad(WebCore::ContentFilterUnblockHandler contentFilterUnblockHandler) { m_contentFilterUnblockHandler = WTFMove(contentFilterUnblockHandler); }
     bool didHandleContentFilterUnblockNavigation(const WebCore::ResourceRequest&);
@@ -138,7 +132,6 @@ private:
     bool m_isFrameSet;
     bool m_containsPluginDocument { false };
     RefPtr<WebCertificateInfo> m_certificateInfo;
-    RefPtr<WebFrameListenerProxy> m_activeListener;
     uint64_t m_frameID;
 #if ENABLE(CONTENT_FILTERING)
     WebCore::ContentFilterUnblockHandler m_contentFilterUnblockHandler;
index 5f11d8d..aa28ad1 100644 (file)
@@ -27,6 +27,7 @@
 #include "config.h"
 #include "WebInspectorProxy.h"
 
+#include "APINavigation.h"
 #include "APINavigationAction.h"
 #include "APIProcessPoolConfiguration.h"
 #include "WKArray.h"
index a5628da..c121dbe 100644 (file)
@@ -50,6 +50,7 @@
 #include "APISecurityOrigin.h"
 #include "APIUIClient.h"
 #include "APIURLRequest.h"
+#include "APIWebsitePolicies.h"
 #include "AuthenticationChallengeProxy.h"
 #include "AuthenticationDecisionListener.h"
 #include "DataReference.h"
@@ -88,7 +89,6 @@
 #include "WebEditCommandProxy.h"
 #include "WebEvent.h"
 #include "WebEventConversion.h"
-#include "WebFramePolicyListenerProxy.h"
 #include "WebFullScreenManagerProxy.h"
 #include "WebFullScreenManagerProxyMessages.h"
 #include "WebImage.h"
@@ -2257,56 +2257,6 @@ void WebPageProxy::centerSelectionInVisibleArea()
     m_process->send(Messages::WebPage::CenterSelectionInVisibleArea(), m_pageID);
 }
 
-void WebPageProxy::receivedPolicyDecision(PolicyAction action, WebFrameProxy& frame, uint64_t listenerID, API::Navigation* navigation, const WebsitePolicies& websitePolicies)
-{
-    if (!isValid())
-        return;
-
-    auto transaction = m_pageLoadState.transaction();
-
-    if (action == PolicyAction::Ignore)
-        m_pageLoadState.clearPendingAPIRequestURL(transaction);
-
-#if ENABLE(DOWNLOAD_ATTRIBUTE)
-    if (m_syncNavigationActionHasDownloadAttribute && action == PolicyAction::Use)
-        action = PolicyAction::Download;
-#endif
-
-    DownloadID downloadID = { };
-    if (action == PolicyAction::Download) {
-        // Create a download proxy.
-        auto* download = m_process->processPool().createDownloadProxy(m_decidePolicyForResponseRequest, this);
-        if (navigation) {
-            download->setWasUserInitiated(navigation->wasUserInitiated());
-            download->setRedirectChain(navigation->takeRedirectChain());
-        }
-
-        downloadID = download->downloadID();
-        handleDownloadRequest(download);
-        m_decidePolicyForResponseRequest = { };
-    }
-
-    // If we received a policy decision while in decidePolicyForResponse the decision will
-    // be sent back to the web process by decidePolicyForResponse.
-    if (m_responsePolicyReply) {
-        m_responsePolicyReply->send(action, downloadID);
-        ASSERT(!m_newNavigationID);
-        m_responsePolicyReply = nullptr;
-        return;
-    }
-
-    // If we received a policy decision while in decidePolicyForNavigationAction the decision will 
-    // be sent back to the web process by decidePolicyForNavigationAction. 
-    if (m_navigationActionPolicyReply) {
-        m_navigationActionPolicyReply->send(m_newNavigationID, action, downloadID, websitePolicies);
-        m_newNavigationID = 0;
-        m_navigationActionPolicyReply = nullptr;
-        return;
-    }
-    
-    m_process->send(Messages::WebPage::DidReceivePolicyDecision(frame.frameID(), listenerID, action, navigation ? navigation->navigationID() : 0, downloadID), m_pageID);
-}
-
 void WebPageProxy::setUserAgent(const String& userAgent)
 {
     if (m_userAgent == userAgent)
@@ -3656,6 +3606,21 @@ void WebPageProxy::frameDidBecomeFrameSet(uint64_t frameID, bool value)
         m_frameSetLargestFrame = value ? m_mainFrame : 0;
 }
 
+DownloadID WebPageProxy::makeDownloadProxy(ResourceRequest&& request, uint64_t navigationID)
+{
+    auto* download = m_process->processPool().createDownloadProxy(request, this);
+
+    RefPtr<API::Navigation> navigation;
+    if (navigationID)
+        navigation = &m_navigationState->navigation(navigationID);
+    else
+        navigation = m_navigationState->createLoadRequestNavigation(WTFMove(request));
+    download->setWasUserInitiated(navigation->wasUserInitiated());
+    download->setRedirectChain(navigation->takeRedirectChain());
+    handleDownloadRequest(download);
+    return download->downloadID();
+}
+
 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, Ref<Messages::WebPageProxy::DecidePolicyForNavigationAction::DelayedReply>&& reply)
 {
     PageClientProtector protector(m_pageClient);
@@ -3671,31 +3636,52 @@ void WebPageProxy::decidePolicyForNavigationAction(uint64_t frameID, const Secur
     MESSAGE_CHECK_URL(request.url());
     MESSAGE_CHECK_URL(originalRequest.url());
     
-    m_newNavigationID = 0;
-    Ref<WebFramePolicyListenerProxy> listener = frame->setUpPolicyListenerProxy(listenerID);
+#if ENABLE(DOWNLOAD_ATTRIBUTE)
+    bool forceDownload = !navigationActionData.downloadAttribute.isNull();
+#else
+    bool forceDownload = false;
+#endif
+
+    uint64_t newNavigationID = 0;
+    RefPtr<API::Navigation> navigation;
     if (!navigationID) {
-        auto navigation = m_navigationState->createLoadRequestNavigation(ResourceRequest(request));
-        m_newNavigationID = navigation->navigationID();
-        navigation->setWasUserInitiated(!!navigationActionData.userGestureTokenIdentifier);
-        listener->setNavigation(WTFMove(navigation));
-    } else {
-        auto& navigation = m_navigationState->navigation(navigationID);
-        navigation.setWasUserInitiated(!!navigationActionData.userGestureTokenIdentifier);
-        listener->setNavigation(navigation);
-    }
+        navigation = m_navigationState->createLoadRequestNavigation(ResourceRequest(request));
+        newNavigationID = navigation->navigationID();
+        navigationID = newNavigationID;
+    } else
+        navigation = &m_navigationState->navigation(navigationID);
+    ASSERT(navigation);
+    navigation->setWasUserInitiated(!!navigationActionData.userGestureTokenIdentifier);
 
-#if ENABLE(CONTENT_FILTERING)
-    if (frame->didHandleContentFilterUnblockNavigation(request)) {
-        reply->send(m_newNavigationID, PolicyAction::Ignore, { }, { });
-        m_newNavigationID = 0;
-        return;
-    }
-#endif
+    auto completionHandler = [this, protectedThis = makeRef(*this), reply = WTFMove(reply), request = request, navigationID, newNavigationID, forceDownload](WebCore::PolicyAction policyAction, std::optional<WebsitePolicies>&& optional) mutable {
 
-#if ENABLE(DOWNLOAD_ATTRIBUTE)
-    m_syncNavigationActionHasDownloadAttribute = !navigationActionData.downloadAttribute.isNull();
+        if (policyAction == PolicyAction::Use && forceDownload)
+            policyAction = PolicyAction::Download;
+
+        WebsitePolicies websitePolicies; // FIXME: Just send the optional instead
+        if (optional)
+            websitePolicies = WTFMove(*optional);
+
+        DownloadID downloadID;
+        switch (policyAction) {
+        case PolicyAction::Ignore: {
+            auto transaction = m_pageLoadState.transaction();
+            m_pageLoadState.clearPendingAPIRequestURL(transaction);
+            break;
+        }
+        case PolicyAction::Download:
+            downloadID = makeDownloadProxy(WTFMove(request), navigationID);
+            break;
+        case PolicyAction::Use:
+            break;
+        }
+        reply->send(newNavigationID, policyAction, downloadID, websitePolicies);
+    };
+
+#if ENABLE(CONTENT_FILTERING)
+    if (frame->didHandleContentFilterUnblockNavigation(request))
+        return completionHandler(PolicyAction::Ignore, std::nullopt);
 #endif
-    m_navigationActionPolicyReply = WTFMove(reply);
 
     WebFrameProxy* originatingFrame = m_process->webFrame(originatingFrameInfoData.frameID);
 
@@ -3712,9 +3698,9 @@ void WebPageProxy::decidePolicyForNavigationAction(uint64_t frameID, const Secur
 
         auto navigationAction = API::NavigationAction::create(WTFMove(navigationActionData), sourceFrameInfo.get(), destinationFrameInfo.ptr(), WTFMove(request), originalRequest.url(), shouldOpenAppLinks, WTFMove(userInitiatedActivity));
 
-        m_navigationClient->decidePolicyForNavigationAction(*this, WTFMove(navigationAction), WTFMove(listener), m_process->transformHandlesToObjects(userData.object()).get());
+        m_navigationClient->decidePolicyForNavigationAction(*this, WTFMove(navigationAction), WTFMove(completionHandler), m_process->transformHandlesToObjects(userData.object()).get());
     } else
-        m_policyClient->decidePolicyForNavigationAction(*this, frame, WTFMove(navigationActionData), originatingFrame, originalRequest, WTFMove(request), WTFMove(listener), m_process->transformHandlesToObjects(userData.object()).get());
+        m_policyClient->decidePolicyForNavigationAction(*this, frame, WTFMove(navigationActionData), originatingFrame, originalRequest, WTFMove(request), WTFMove(completionHandler), m_process->transformHandlesToObjects(userData.object()).get());
 
     m_shouldSuppressAppLinksInNextNavigationPolicyDecision = false;
 }
@@ -3727,24 +3713,32 @@ void WebPageProxy::decidePolicyForNewWindowAction(uint64_t frameID, const Securi
     MESSAGE_CHECK(frame);
     MESSAGE_CHECK_URL(request.url());
 
-    Ref<WebFramePolicyListenerProxy> listener = frame->setUpPolicyListenerProxy(listenerID);
-
     if (m_navigationClient) {
         RefPtr<API::FrameInfo> sourceFrameInfo;
         if (frame)
             sourceFrameInfo = API::FrameInfo::create(*frame, frameSecurityOrigin.securityOrigin());
+        
+        auto completionHandler = [this, protectedThis = makeRef(*this), listenerID, frameID](WebCore::PolicyAction policyAction, std::optional<WebsitePolicies>&& optional) {
+            ASSERT_UNUSED(optional, !optional);
+            m_process->send(Messages::WebPage::DidReceivePolicyDecision(frameID, listenerID, policyAction, 0, DownloadID()), m_pageID);
+        };
 
         auto userInitiatedActivity = m_process->userInitiatedActivity(navigationActionData.userGestureTokenIdentifier);
         bool shouldOpenAppLinks = !hostsAreEqual(URL(ParsedURLString, m_mainFrame->url()), request.url());
         auto navigationAction = API::NavigationAction::create(WTFMove(navigationActionData), sourceFrameInfo.get(), nullptr, WTFMove(request), request.url(), shouldOpenAppLinks, WTFMove(userInitiatedActivity));
 
-        m_navigationClient->decidePolicyForNavigationAction(*this, navigationAction.get(), WTFMove(listener), m_process->transformHandlesToObjects(userData.object()).get());
+        m_navigationClient->decidePolicyForNavigationAction(*this, navigationAction.get(), WTFMove(completionHandler), m_process->transformHandlesToObjects(userData.object()).get());
 
-    } else
-        m_policyClient->decidePolicyForNewWindowAction(*this, *frame, navigationActionData, request, frameName, WTFMove(listener), m_process->transformHandlesToObjects(userData.object()).get());
+    } else {
+        auto completionHandler = [this, protectedThis = makeRef(*this), frameID, listenerID](WebCore::PolicyAction policyAction, std::optional<WebsitePolicies>&& optional) {
+            ASSERT_UNUSED(optional, !optional);
+            m_process->send(Messages::WebPage::DidReceivePolicyDecision(frameID, listenerID, policyAction, 0, DownloadID()), m_pageID);
+        };
+        m_policyClient->decidePolicyForNewWindowAction(*this, *frame, navigationActionData, request, frameName, WTFMove(completionHandler), m_process->transformHandlesToObjects(userData.object()).get());
+    }
 }
 
-void WebPageProxy::decidePolicyForResponse(uint64_t frameID, const SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, const ResourceResponse& response, const ResourceRequest& request, bool canShowMIMEType, uint64_t listenerID, const UserData& userData)
+void WebPageProxy::decidePolicyForResponseSync(uint64_t frameID, const SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, const ResourceResponse& response, const ResourceRequest& request, bool canShowMIMEType, uint64_t listenerID, const UserData& userData, Ref<Messages::WebPageProxy::DecidePolicyForResponseSync::DelayedReply>&& reply)
 {
     PageClientProtector protector(m_pageClient);
 
@@ -3753,25 +3747,29 @@ void WebPageProxy::decidePolicyForResponse(uint64_t frameID, const SecurityOrigi
     MESSAGE_CHECK_URL(request.url());
     MESSAGE_CHECK_URL(response.url());
 
-    Ref<WebFramePolicyListenerProxy> listener = frame->setUpPolicyListenerProxy(listenerID);
-    if (navigationID)
-        listener->setNavigation(m_navigationState->navigation(navigationID));
+    auto completionHandler = [this, protectedThis = makeRef(*this), reply = WTFMove(reply), request = request, navigationID](WebCore::PolicyAction policyAction, std::optional<WebsitePolicies>&& optional) mutable {
+        ASSERT_UNUSED(optional, !optional);
+        DownloadID downloadID;
+        switch (policyAction) {
+        case PolicyAction::Ignore: {
+            auto transaction = m_pageLoadState.transaction();
+            m_pageLoadState.clearPendingAPIRequestURL(transaction);
+            break;
+        }
+        case PolicyAction::Download:
+            downloadID = makeDownloadProxy(WTFMove(request), navigationID);
+            break;
+        case PolicyAction::Use:
+            break;
+        }
+        reply->send(policyAction, downloadID);
+    };
 
     if (m_navigationClient) {
         auto navigationResponse = API::NavigationResponse::create(API::FrameInfo::create(*frame, frameSecurityOrigin.securityOrigin()).get(), request, response, canShowMIMEType);
-        m_navigationClient->decidePolicyForNavigationResponse(*this, navigationResponse.get(), WTFMove(listener), m_process->transformHandlesToObjects(userData.object()).get());
+        m_navigationClient->decidePolicyForNavigationResponse(*this, navigationResponse.get(), WTFMove(completionHandler), m_process->transformHandlesToObjects(userData.object()).get());
     } else
-        m_policyClient->decidePolicyForResponse(*this, *frame, response, request, canShowMIMEType, WTFMove(listener), m_process->transformHandlesToObjects(userData.object()).get());
-}
-
-void WebPageProxy::decidePolicyForResponseSync(uint64_t frameID, const SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, const ResourceResponse& response, const ResourceRequest& request, bool canShowMIMEType, uint64_t listenerID, const UserData& userData, Ref<Messages::WebPageProxy::DecidePolicyForResponseSync::DelayedReply>&& reply)
-{
-    PageClientProtector protector(m_pageClient);
-
-    m_decidePolicyForResponseRequest = request;
-    m_responsePolicyReply = WTFMove(reply);
-
-    decidePolicyForResponse(frameID, frameSecurityOrigin, navigationID, response, request, canShowMIMEType, listenerID, userData);
+        m_policyClient->decidePolicyForResponse(*this, *frame, response, request, canShowMIMEType, WTFMove(completionHandler), m_process->transformHandlesToObjects(userData.object()).get());
 }
 
 void WebPageProxy::unableToImplementPolicy(uint64_t frameID, const ResourceError& error, const UserData& userData)
index 18932cb..078bc4e 100644 (file)
@@ -824,8 +824,6 @@ public:
     void performDictionaryLookupOfCurrentSelection();
 #endif
 
-    void receivedPolicyDecision(WebCore::PolicyAction, WebFrameProxy&, uint64_t listenerID, API::Navigation* navigationID, const WebsitePolicies&);
-
     void backForwardRemovedItem(uint64_t itemID);
 
 #if ENABLE(DRAG_SUPPORT)    
@@ -1265,6 +1263,7 @@ private:
     void didFailLoadForFrame(uint64_t frameID, uint64_t navigationID, const WebCore::ResourceError&, const UserData&);
     void didSameDocumentNavigationForFrame(uint64_t frameID, uint64_t navigationID, uint32_t sameDocumentNavigationType, WebCore::URL&&, const UserData&);
     void didChangeMainDocument(uint64_t frameID);
+    DownloadID makeDownloadProxy(WebCore::ResourceRequest&&, uint64_t navigationID);
 
     void didReceiveTitleForFrame(uint64_t frameID, const String&, const UserData&);
     void didFirstLayoutForFrame(uint64_t frameID, const UserData&);
@@ -1285,7 +1284,6 @@ private:
 
     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&, Ref<Messages::WebPageProxy::DecidePolicyForNavigationAction::DelayedReply>&&);
     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&, Ref<Messages::WebPageProxy::DecidePolicyForResponseSync::DelayedReply>&&);
     void unableToImplementPolicy(uint64_t frameID, const WebCore::ResourceError&, const UserData&);
 
@@ -1798,11 +1796,6 @@ private:
     bool m_isInPrintingMode { false };
     bool m_isPerformingDOMPrintOperation { false };
 
-    RefPtr<Messages::WebPageProxy::DecidePolicyForNavigationAction::DelayedReply> m_navigationActionPolicyReply;
-    uint64_t m_newNavigationID { 0 };
-    RefPtr<Messages::WebPageProxy::DecidePolicyForResponseSync::DelayedReply> m_responsePolicyReply;
-    WebCore::ResourceRequest m_decidePolicyForResponseRequest;
-
     bool m_shouldSuppressAppLinksInNextNavigationPolicyDecision { false };
 
     Deque<NativeWebKeyboardEvent> m_keyEventQueue;
@@ -2001,10 +1994,6 @@ private:
     bool m_isPointerLocked { false };
 #endif
 
-#if ENABLE(DOWNLOAD_ATTRIBUTE)
-    bool m_syncNavigationActionHasDownloadAttribute { false };
-#endif
-
     bool m_isUsingHighPerformanceWebGL { false };
 
     WeakPtrFactory<WebPageProxy> m_weakPtrFactory;
index a08f21d..37cea85 100644 (file)
@@ -28,6 +28,7 @@
 
 #if PLATFORM(IOS)
 
+#import "APINavigation.h"
 #import "DrawingAreaProxy.h"
 #import "UIKitSPI.h"
 #import "ViewGestureControllerMessages.h"
index 54ad762..10c5cd0 100644 (file)
@@ -28,6 +28,7 @@
 
 #if PLATFORM(MAC)
 
+#import "APINavigation.h"
 #import "DrawingAreaProxy.h"
 #import "FrameLoadState.h"
 #import "Logging.h"
index 6807e93..62a4b72 100644 (file)
                BCE469561214E6CB000B98EB /* WebFormSubmissionListenerProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE469521214E6CB000B98EB /* WebFormSubmissionListenerProxy.h */; };
                BCE469591214EDF4000B98EB /* WKFormSubmissionListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE469571214EDF4000B98EB /* WKFormSubmissionListener.cpp */; };
                BCE4695A1214EDF4000B98EB /* WKFormSubmissionListener.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE469581214EDF4000B98EB /* WKFormSubmissionListener.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               BCE469771214F27B000B98EB /* WebFrameListenerProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE469761214F27B000B98EB /* WebFrameListenerProxy.h */; };
-               BCE469791214F2B4000B98EB /* WebFrameListenerProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE469781214F2B4000B98EB /* WebFrameListenerProxy.cpp */; };
                BCE81D8C1319F7EF00241910 /* FontInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE81D8A1319F7EF00241910 /* FontInfo.cpp */; };
                BCE81D8D1319F7EF00241910 /* FontInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE81D8B1319F7EF00241910 /* FontInfo.h */; };
                BCEE7AD012817988009827DA /* WebProcessProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEE7ACC12817988009827DA /* WebProcessProxyMessageReceiver.cpp */; };
                BCE469521214E6CB000B98EB /* WebFormSubmissionListenerProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebFormSubmissionListenerProxy.h; sourceTree = "<group>"; };
                BCE469571214EDF4000B98EB /* WKFormSubmissionListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKFormSubmissionListener.cpp; sourceTree = "<group>"; };
                BCE469581214EDF4000B98EB /* WKFormSubmissionListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKFormSubmissionListener.h; sourceTree = "<group>"; };
-               BCE469761214F27B000B98EB /* WebFrameListenerProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebFrameListenerProxy.h; sourceTree = "<group>"; };
-               BCE469781214F2B4000B98EB /* WebFrameListenerProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebFrameListenerProxy.cpp; sourceTree = "<group>"; };
                BCE81D8A1319F7EF00241910 /* FontInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontInfo.cpp; sourceTree = "<group>"; };
                BCE81D8B1319F7EF00241910 /* FontInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontInfo.h; sourceTree = "<group>"; };
                BCE9C0CF1485965D00E33D61 /* WebConnectionToUIProcess.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebConnectionToUIProcess.cpp; sourceTree = "<group>"; };
                                BCE469501214E6CB000B98EB /* WebFormClient.h */,
                                BCE469511214E6CB000B98EB /* WebFormSubmissionListenerProxy.cpp */,
                                BCE469521214E6CB000B98EB /* WebFormSubmissionListenerProxy.h */,
-                               BCE469781214F2B4000B98EB /* WebFrameListenerProxy.cpp */,
-                               BCE469761214F27B000B98EB /* WebFrameListenerProxy.h */,
                                BCB9F69F1123A84B00A137E0 /* WebFramePolicyListenerProxy.cpp */,
                                BCB9F69E1123A84B00A137E0 /* WebFramePolicyListenerProxy.h */,
                                BC111B0A112F5E4F00337BAB /* WebFrameProxy.cpp */,
                                BCE469541214E6CB000B98EB /* WebFormClient.h in Headers */,
                                BCE469561214E6CB000B98EB /* WebFormSubmissionListenerProxy.h in Headers */,
                                BC032D8D10F437A00058C15A /* WebFrame.h in Headers */,
-                               BCE469771214F27B000B98EB /* WebFrameListenerProxy.h in Headers */,
                                BC032D7F10F4378D0058C15A /* WebFrameLoaderClient.h in Headers */,
                                9391F2CB121B67AD00EBF7E8 /* WebFrameNetworkingContext.h in Headers */,
                                BCB9F6A01123A84B00A137E0 /* WebFramePolicyListenerProxy.h in Headers */,
                                BCE469531214E6CB000B98EB /* WebFormClient.cpp in Sources */,
                                BCE469551214E6CB000B98EB /* WebFormSubmissionListenerProxy.cpp in Sources */,
                                BC111ADD112F5B9300337BAB /* WebFrame.cpp in Sources */,
-                               BCE469791214F2B4000B98EB /* WebFrameListenerProxy.cpp in Sources */,
                                BC111A5F112F4FBB00337BAB /* WebFrameLoaderClient.cpp in Sources */,
                                2D28F3E71885CCC1004B9EAE /* WebFrameLoaderClientIOS.mm in Sources */,
                                9391F2CA121B679A00EBF7E8 /* WebFrameNetworkingContext.mm in Sources */,