Diff
Modified: trunk/Source/WebKit/ChangeLog (224676 => 224677)
--- trunk/Source/WebKit/ChangeLog 2017-11-10 11:26:54 UTC (rev 224676)
+++ trunk/Source/WebKit/ChangeLog 2017-11-10 13:03:51 UTC (rev 224677)
@@ -1,3 +1,74 @@
+2017-11-10 Carlos Garcia Campos <cgar...@igalia.com>
+
+ [GTK][WPE] Switch to use API::NavigationClient
+ https://bugs.webkit.org/show_bug.cgi?id=178720
+
+ Reviewed by Alex Christensen.
+
+ Replace WebKitLoaderClient and WebKitPolicyClient with WebKitNavigationClient that implements
+ API::NavigationClient.
+
+ * PlatformGTK.cmake:
+ * PlatformWPE.cmake:
+ * UIProcess/API/APINavigationAction.h: Add new constructor that receives a target frame name instead of a target
+ frame info.
+ * UIProcess/API/APINavigationClient.h:
+ (API::NavigationClient::didDisplayInsecureContent): Added.
+ (API::NavigationClient::didRunInsecureContent): Added.
+ (API::NavigationClient::decidePolicyForNavigationResponse): Change NavigationResponse parameter to be a
+ Ref<NavigationResponse>&& instead of a NavigationResponse&.
+ * UIProcess/API/C/WKPage.cpp:
+ (WKPageSetPageNavigationClient): Update NavigationResponse parameter.
+ * UIProcess/API/glib/WebKitBackForwardList.cpp:
+ (webkitBackForwardListChanged):
+ * UIProcess/API/glib/WebKitBackForwardListPrivate.h:
+ * UIProcess/API/glib/WebKitNavigationAction.cpp:
+ (webkitNavigationActionCreate): Wrap the given API::NavigationAction.
+ (webkit_navigation_action_get_navigation_type): Use the wrapped API::NavigationAction.
+ (webkit_navigation_action_get_mouse_button): Ditto.
+ (webkit_navigation_action_get_modifiers): Ditto.
+ (webkit_navigation_action_get_request): Ditto.
+ (webkit_navigation_action_is_user_gesture): Ditto.
+ (webkit_navigation_action_is_redirect): Ditto.
+ * UIProcess/API/glib/WebKitNavigationActionPrivate.h:
+ (_WebKitNavigationAction::_WebKitNavigationAction):
+ * UIProcess/API/glib/WebKitNavigationClient.cpp: Renamed from Source/WebKit/UIProcess/API/glib/WebKitLoaderClient.cpp.
+ (NavigationClient::NavigationClient):
+ (attachNavigationClientToView):
+ * UIProcess/API/glib/WebKitNavigationClient.h: Renamed from Source/WebKit/UIProcess/API/glib/WebKitLoaderClient.h.
+ * UIProcess/API/glib/WebKitNavigationPolicyDecision.cpp:
+ (webkit_navigation_policy_decision_get_frame_name): Add FIXME.
+ (webkitNavigationPolicyDecisionCreate): Get the target frame name from the API::NavigationAction.
+ * UIProcess/API/glib/WebKitNavigationPolicyDecisionPrivate.h:
+ * UIProcess/API/glib/WebKitPolicyClient.cpp: Removed.
+ * UIProcess/API/glib/WebKitPolicyClient.h: Removed.
+ * UIProcess/API/glib/WebKitPolicyDecision.cpp:
+ (webkitPolicyDecisionSetListener): Remove the madePolicyDecision boolean member, we can null-check the listener instead.
+ (webkit_policy_decision_use): Ensure listener is nullptr after being invoked to prevent the decision from being made
+ more than once.
+ (webkit_policy_decision_ignore): Ditto.
+ (webkit_policy_decision_download): Ditto.
+ * UIProcess/API/glib/WebKitPolicyDecisionPrivate.h:
+ * UIProcess/API/glib/WebKitResponsePolicyDecision.cpp:
+ (webkit_response_policy_decision_get_request): Use the wrapped API::NavigationResponse.
+ (webkit_response_policy_decision_get_response): Ditto.
+ (webkit_response_policy_decision_is_mime_type_supported): Ditto.
+ (webkitResponsePolicyDecisionCreate): Wrap the given API::NavigationResponse.
+ * UIProcess/API/glib/WebKitResponsePolicyDecisionPrivate.h:
+ * UIProcess/API/glib/WebKitUIClient.cpp:
+ (UIClient::createNewPage): Create the WebKitNavigationAction from a new API::NavigationAction.
+ * UIProcess/API/glib/WebKitWebView.cpp:
+ (webkitWebViewConstructed): Attach navigation client.
+ * UIProcess/Cocoa/NavigationState.h: Update API::NavigationResponse parameter of decidePolicyForNavigationResponse.
+ * UIProcess/Cocoa/NavigationState.mm:
+ (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse):
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::didDisplayInsecureContentForFrame): Notify the navigation client if it's used.
+ (WebKit::WebPageProxy::didRunInsecureContentForFrame): Ditto.
+ (WebKit::WebPageProxy::decidePolicyForNewWindowAction): Use the new API::NavigationAction constructor to pass
+ the target frame name, instead of a null target frame info.
+ (WebKit::WebPageProxy::decidePolicyForResponse): Move the API::NavigationResponse.
+
2017-11-09 Chris Dumez <cdu...@apple.com>
Unreviewed, rolling out r224661.
Modified: trunk/Source/WebKit/PlatformGTK.cmake (224676 => 224677)
--- trunk/Source/WebKit/PlatformGTK.cmake 2017-11-10 11:26:54 UTC (rev 224676)
+++ trunk/Source/WebKit/PlatformGTK.cmake 2017-11-10 13:03:51 UTC (rev 224677)
@@ -147,9 +147,9 @@
UIProcess/API/glib/WebKitInjectedBundleClient.cpp
UIProcess/API/glib/WebKitInstallMissingMediaPluginsPermissionRequest.cpp
UIProcess/API/glib/WebKitJavascriptResult.cpp
- UIProcess/API/glib/WebKitLoaderClient.cpp
UIProcess/API/glib/WebKitMimeInfo.cpp
UIProcess/API/glib/WebKitNavigationAction.cpp
+ UIProcess/API/glib/WebKitNavigationClient.cpp
UIProcess/API/glib/WebKitNavigationPolicyDecision.cpp
UIProcess/API/glib/WebKitNetworkProxySettings.cpp
UIProcess/API/glib/WebKitNotification.cpp
@@ -157,7 +157,6 @@
UIProcess/API/glib/WebKitNotificationProvider.cpp
UIProcess/API/glib/WebKitPermissionRequest.cpp
UIProcess/API/glib/WebKitPlugin.cpp
- UIProcess/API/glib/WebKitPolicyClient.cpp
UIProcess/API/glib/WebKitPolicyDecision.cpp
UIProcess/API/glib/WebKitPrivate.cpp
UIProcess/API/glib/WebKitResponsePolicyDecision.cpp
Modified: trunk/Source/WebKit/PlatformWPE.cmake (224676 => 224677)
--- trunk/Source/WebKit/PlatformWPE.cmake 2017-11-10 11:26:54 UTC (rev 224676)
+++ trunk/Source/WebKit/PlatformWPE.cmake 2017-11-10 13:03:51 UTC (rev 224677)
@@ -168,9 +168,9 @@
UIProcess/API/glib/WebKitInjectedBundleClient.cpp
UIProcess/API/glib/WebKitInstallMissingMediaPluginsPermissionRequest.cpp
UIProcess/API/glib/WebKitJavascriptResult.cpp
- UIProcess/API/glib/WebKitLoaderClient.cpp
UIProcess/API/glib/WebKitMimeInfo.cpp
UIProcess/API/glib/WebKitNavigationAction.cpp
+ UIProcess/API/glib/WebKitNavigationClient.cpp
UIProcess/API/glib/WebKitNavigationPolicyDecision.cpp
UIProcess/API/glib/WebKitNetworkProxySettings.cpp
UIProcess/API/glib/WebKitNotification.cpp
@@ -178,7 +178,6 @@
UIProcess/API/glib/WebKitNotificationProvider.cpp
UIProcess/API/glib/WebKitPermissionRequest.cpp
UIProcess/API/glib/WebKitPlugin.cpp
- UIProcess/API/glib/WebKitPolicyClient.cpp
UIProcess/API/glib/WebKitPolicyDecision.cpp
UIProcess/API/glib/WebKitPrivate.cpp
UIProcess/API/glib/WebKitResponsePolicyDecision.cpp
Modified: trunk/Source/WebKit/UIProcess/API/APINavigationAction.h (224676 => 224677)
--- trunk/Source/WebKit/UIProcess/API/APINavigationAction.h 2017-11-10 11:26:54 UTC (rev 224676)
+++ trunk/Source/WebKit/UIProcess/API/APINavigationAction.h 2017-11-10 13:03:51 UTC (rev 224677)
@@ -36,16 +36,17 @@
class NavigationAction final : public ObjectImpl<Object::Type::NavigationAction> {
public:
- static Ref<NavigationAction> create(WebKit::NavigationActionData&& navigationActionData, API::FrameInfo* sourceFrame, API::FrameInfo* targetFrame, WebCore::ResourceRequest&& request, const WebCore::URL& originalURL, bool shouldOpenAppLinks, RefPtr<UserInitiatedAction>&& userInitiatedAction)
+ static Ref<NavigationAction> create(WebKit::NavigationActionData&& navigationActionData, API::FrameInfo* sourceFrame, API::FrameInfo* targetFrame, std::optional<WTF::String> targetFrameName, WebCore::ResourceRequest&& request, const WebCore::URL& originalURL, bool shouldOpenAppLinks, RefPtr<UserInitiatedAction>&& userInitiatedAction)
{
- return adoptRef(*new NavigationAction(WTFMove(navigationActionData), sourceFrame, targetFrame, WTFMove(request), originalURL, shouldOpenAppLinks, WTFMove(userInitiatedAction)));
+ return adoptRef(*new NavigationAction(WTFMove(navigationActionData), sourceFrame, targetFrame, targetFrameName, WTFMove(request), originalURL, shouldOpenAppLinks, WTFMove(userInitiatedAction)));
}
FrameInfo* sourceFrame() const { return m_sourceFrame.get(); }
FrameInfo* targetFrame() const { return m_targetFrame.get(); }
+ std::optional<WTF::String> targetFrameName() const { return m_targetFrameName; }
const WebCore::ResourceRequest& request() const { return m_request; }
- const WebCore::URL& originalURL() const { return m_originalURL; }
+ const WebCore::URL& originalURL() const { return !m_originalURL.isNull() ? m_originalURL : m_request.url(); }
WebCore::NavigationType navigationType() const { return m_navigationActionData.navigationType; }
WebKit::WebEvent::Modifiers modifiers() const { return m_navigationActionData.modifiers; }
@@ -62,9 +63,10 @@
UserInitiatedAction* userInitiatedAction() const { return m_userInitiatedAction.get(); }
private:
- NavigationAction(WebKit::NavigationActionData&& navigationActionData, API::FrameInfo* sourceFrame, API::FrameInfo* targetFrame, WebCore::ResourceRequest&& request, const WebCore::URL& originalURL, bool shouldOpenAppLinks, RefPtr<UserInitiatedAction>&& userInitiatedAction)
+NavigationAction(WebKit::NavigationActionData&& navigationActionData, API::FrameInfo* sourceFrame, API::FrameInfo* targetFrame, std::optional<WTF::String> targetFrameName, WebCore::ResourceRequest&& request, const WebCore::URL& originalURL, bool shouldOpenAppLinks, RefPtr<UserInitiatedAction>&& userInitiatedAction)
: m_sourceFrame(sourceFrame)
, m_targetFrame(targetFrame)
+ , m_targetFrameName(targetFrameName)
, m_request(WTFMove(request))
, m_originalURL(originalURL)
, m_shouldOpenAppLinks(shouldOpenAppLinks)
@@ -75,6 +77,7 @@
RefPtr<FrameInfo> m_sourceFrame;
RefPtr<FrameInfo> m_targetFrame;
+ std::optional<WTF::String> m_targetFrameName;
WebCore::ResourceRequest m_request;
WebCore::URL m_originalURL;
Modified: trunk/Source/WebKit/UIProcess/API/APINavigationClient.h (224676 => 224677)
--- trunk/Source/WebKit/UIProcess/API/APINavigationClient.h 2017-11-10 11:26:54 UTC (rev 224676)
+++ trunk/Source/WebKit/UIProcess/API/APINavigationClient.h 2017-11-10 13:03:51 UTC (rev 224677)
@@ -79,6 +79,9 @@
virtual void didFailNavigationWithError(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, Navigation*, const WebCore::ResourceError&, Object*) { }
virtual void didSameDocumentNavigation(WebKit::WebPageProxy&, Navigation*, WebKit::SameDocumentNavigationType, Object*) { }
+ virtual void didDisplayInsecureContent(WebKit::WebPageProxy&, API::Object*) { }
+ virtual void didRunInsecureContent(WebKit::WebPageProxy&, API::Object*) { }
+
virtual void renderingProgressDidChange(WebKit::WebPageProxy&, WebCore::LayoutMilestones) { }
virtual bool canAuthenticateAgainstProtectionSpace(WebKit::WebPageProxy&, WebKit::WebProtectionSpace*) { return false; }
@@ -101,7 +104,7 @@
listener->use({ });
}
- virtual void decidePolicyForNavigationResponse(WebKit::WebPageProxy&, NavigationResponse&, Ref<WebKit::WebFramePolicyListenerProxy>&& listener, Object*)
+ virtual void decidePolicyForNavigationResponse(WebKit::WebPageProxy&, Ref<NavigationResponse>&&, Ref<WebKit::WebFramePolicyListenerProxy>&& listener, Object*)
{
listener->use({ });
}
Modified: trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp (224676 => 224677)
--- trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp 2017-11-10 11:26:54 UTC (rev 224676)
+++ trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp 2017-11-10 13:03:51 UTC (rev 224677)
@@ -1573,7 +1573,7 @@
auto userInitiatedActivity = page.process().userInitiatedActivity(navigationActionData.userGestureTokenIdentifier);
bool shouldOpenAppLinks = !hostsAreEqual(sourceFrameInfo->request().url(), resourceRequest.url());
- auto apiNavigationAction = API::NavigationAction::create(WTFMove(navigationActionData), sourceFrameInfo.ptr(), nullptr, WTFMove(resourceRequest), WebCore::URL(), shouldOpenAppLinks, WTFMove(userInitiatedActivity));
+ auto apiNavigationAction = API::NavigationAction::create(WTFMove(navigationActionData), sourceFrameInfo.ptr(), nullptr, std::nullopt, WTFMove(resourceRequest), WebCore::URL(), shouldOpenAppLinks, WTFMove(userInitiatedActivity));
auto apiWindowFeatures = API::WindowFeatures::create(windowFeatures);
@@ -2149,13 +2149,13 @@
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, Ref<API::NavigationResponse>&& navigationResponse, Ref<WebKit::WebFramePolicyListenerProxy>&& listener, API::Object* userData) override
{
if (!m_client.decidePolicyForNavigationResponse) {
listener->use({ });
return;
}
- m_client.decidePolicyForNavigationResponse(toAPI(&page), toAPI(&navigationResponse), toAPI(listener.ptr()), toAPI(userData), m_client.base.clientInfo);
+ m_client.decidePolicyForNavigationResponse(toAPI(&page), toAPI(navigationResponse.ptr()), toAPI(listener.ptr()), toAPI(userData), m_client.base.clientInfo);
}
void didStartProvisionalNavigation(WebPageProxy& page, API::Navigation* navigation, API::Object* userData) override
Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitBackForwardList.cpp (224676 => 224677)
--- trunk/Source/WebKit/UIProcess/API/glib/WebKitBackForwardList.cpp 2017-11-10 11:26:54 UTC (rev 224676)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitBackForwardList.cpp 2017-11-10 13:03:51 UTC (rev 224677)
@@ -128,7 +128,7 @@
return list;
}
-void webkitBackForwardListChanged(WebKitBackForwardList* backForwardList, WebBackForwardListItem* webAddedItem, Vector<Ref<WebBackForwardListItem>>&& webRemovedItems)
+void webkitBackForwardListChanged(WebKitBackForwardList* backForwardList, WebBackForwardListItem* webAddedItem, const Vector<Ref<WebBackForwardListItem>>& webRemovedItems)
{
WebKitBackForwardListItem* addedItem = webkitBackForwardListGetOrCreateItem(backForwardList, webAddedItem);
GList* removedItems = nullptr;
Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitBackForwardListPrivate.h (224676 => 224677)
--- trunk/Source/WebKit/UIProcess/API/glib/WebKitBackForwardListPrivate.h 2017-11-10 11:26:54 UTC (rev 224676)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitBackForwardListPrivate.h 2017-11-10 13:03:51 UTC (rev 224677)
@@ -31,4 +31,4 @@
WebKitBackForwardList* webkitBackForwardListCreate(WebKit::WebBackForwardList*);
WebKitBackForwardListItem* webkitBackForwardListItemGetOrCreate(WebKit::WebBackForwardListItem*);
WebKit::WebBackForwardListItem* webkitBackForwardListItemGetItem(WebKitBackForwardListItem*);
-void webkitBackForwardListChanged(WebKitBackForwardList*, WebKit::WebBackForwardListItem* webAddedItem, Vector<Ref<WebKit::WebBackForwardListItem>>&&);
+void webkitBackForwardListChanged(WebKitBackForwardList*, WebKit::WebBackForwardListItem* webAddedItem, const Vector<Ref<WebKit::WebBackForwardListItem>>&);
Deleted: trunk/Source/WebKit/UIProcess/API/glib/WebKitLoaderClient.cpp (224676 => 224677)
--- trunk/Source/WebKit/UIProcess/API/glib/WebKitLoaderClient.cpp 2017-11-10 11:26:54 UTC (rev 224676)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitLoaderClient.cpp 2017-11-10 13:03:51 UTC (rev 224677)
@@ -1,125 +0,0 @@
-/*
- * Copyright (C) 2011 Igalia S.L.
- * Portions Copyright (c) 2011 Motorola Mobility, Inc. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "WebKitLoaderClient.h"
-
-#include "APILoaderClient.h"
-#include "WebKitBackForwardListPrivate.h"
-#include "WebKitPrivate.h"
-#include "WebKitURIResponsePrivate.h"
-#include "WebKitWebViewPrivate.h"
-#include <wtf/glib/GUniquePtr.h>
-#include <wtf/text/CString.h>
-
-using namespace WebKit;
-using namespace WebCore;
-
-class LoaderClient : public API::LoaderClient {
-public:
- explicit LoaderClient(WebKitWebView* webView)
- : m_webView(webView)
- {
- }
-
-private:
- void didStartProvisionalLoadForFrame(WebPageProxy&, WebFrameProxy& frame, API::Navigation*, API::Object* /* userData */) override
- {
- if (!frame.isMainFrame())
- return;
- webkitWebViewLoadChanged(m_webView, WEBKIT_LOAD_STARTED);
- }
-
- void didReceiveServerRedirectForProvisionalLoadForFrame(WebPageProxy&, WebFrameProxy& frame, API::Navigation*, API::Object* /* userData */) override
- {
- if (!frame.isMainFrame())
- return;
- webkitWebViewLoadChanged(m_webView, WEBKIT_LOAD_REDIRECTED);
- }
-
- void didFailProvisionalLoadWithErrorForFrame(WebPageProxy&, WebFrameProxy& frame, API::Navigation*, const ResourceError& resourceError, API::Object* /* userData */) override
- {
- if (!frame.isMainFrame())
- return;
- GUniquePtr<GError> error(g_error_new_literal(g_quark_from_string(resourceError.domain().utf8().data()),
- toWebKitError(resourceError.errorCode()), resourceError.localizedDescription().utf8().data()));
- if (resourceError.tlsErrors()) {
- webkitWebViewLoadFailedWithTLSErrors(m_webView, resourceError.failingURL().string().utf8().data(), error.get(),
- static_cast<GTlsCertificateFlags>(resourceError.tlsErrors()), resourceError.certificate());
- } else
- webkitWebViewLoadFailed(m_webView, WEBKIT_LOAD_STARTED, resourceError.failingURL().string().utf8().data(), error.get());
- }
-
- void didCommitLoadForFrame(WebPageProxy&, WebFrameProxy& frame, API::Navigation*, API::Object* /* userData */) override
- {
- if (!frame.isMainFrame())
- return;
- webkitWebViewLoadChanged(m_webView, WEBKIT_LOAD_COMMITTED);
- }
-
- void didFinishLoadForFrame(WebPageProxy&, WebFrameProxy& frame, API::Navigation*, API::Object* /* userData */) override
- {
- if (!frame.isMainFrame())
- return;
- webkitWebViewLoadChanged(m_webView, WEBKIT_LOAD_FINISHED);
- }
-
- void didFailLoadWithErrorForFrame(WebPageProxy&, WebFrameProxy& frame, API::Navigation*, const ResourceError& resourceError, API::Object* /* userData */) override
- {
- if (!frame.isMainFrame())
- return;
- GUniquePtr<GError> error(g_error_new_literal(g_quark_from_string(resourceError.domain().utf8().data()),
- toWebKitError(resourceError.errorCode()), resourceError.localizedDescription().utf8().data()));
- webkitWebViewLoadFailed(m_webView, WEBKIT_LOAD_COMMITTED, resourceError.failingURL().string().utf8().data(), error.get());
- }
-
- void didDisplayInsecureContentForFrame(WebPageProxy&, WebFrameProxy&, API::Object* /* userData */) override
- {
- webkitWebViewInsecureContentDetected(m_webView, WEBKIT_INSECURE_CONTENT_DISPLAYED);
- }
-
- void didRunInsecureContentForFrame(WebPageProxy&, WebFrameProxy&, API::Object* /* userData */) override
- {
- webkitWebViewInsecureContentDetected(m_webView, WEBKIT_INSECURE_CONTENT_RUN);
- }
-
- void didChangeBackForwardList(WebPageProxy&, WebBackForwardListItem* addedItem, Vector<Ref<WebBackForwardListItem>>&& removedItems) override
- {
- webkitBackForwardListChanged(webkit_web_view_get_back_forward_list(m_webView), addedItem, WTFMove(removedItems));
- }
-
- void didReceiveAuthenticationChallengeInFrame(WebPageProxy&, WebFrameProxy&, AuthenticationChallengeProxy& authenticationChallenge) override
- {
- webkitWebViewHandleAuthenticationChallenge(m_webView, &authenticationChallenge);
- }
-
- void processDidCrash(WebPageProxy&) override
- {
- webkitWebViewWebProcessCrashed(m_webView);
- }
-
- WebKitWebView* m_webView;
-};
-
-void attachLoaderClientToView(WebKitWebView* webView)
-{
- webkitWebViewGetPage(webView).setLoaderClient(std::make_unique<LoaderClient>(webView));
-}
-
Deleted: trunk/Source/WebKit/UIProcess/API/glib/WebKitLoaderClient.h (224676 => 224677)
--- trunk/Source/WebKit/UIProcess/API/glib/WebKitLoaderClient.h 2017-11-10 11:26:54 UTC (rev 224676)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitLoaderClient.h 2017-11-10 13:03:51 UTC (rev 224677)
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2011 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef WebKitLoaderClient_h
-#define WebKitLoaderClient_h
-
-#include "WebKitWebView.h"
-
-void attachLoaderClientToView(WebKitWebView*);
-
-#endif
Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitNavigationAction.cpp (224676 => 224677)
--- trunk/Source/WebKit/UIProcess/API/glib/WebKitNavigationAction.cpp 2017-11-10 11:26:54 UTC (rev 224676)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitNavigationAction.cpp 2017-11-10 13:03:51 UTC (rev 224677)
@@ -21,16 +21,17 @@
#include "WebKitNavigationAction.h"
#include "WebKitNavigationActionPrivate.h"
-#include <wtf/glib/GRefPtr.h>
+#include "WebKitPrivate.h"
+#include "WebKitURIRequestPrivate.h"
using namespace WebKit;
G_DEFINE_BOXED_TYPE(WebKitNavigationAction, webkit_navigation_action, webkit_navigation_action_copy, webkit_navigation_action_free)
-WebKitNavigationAction* webkitNavigationActionCreate(WebKitURIRequest* request, const NavigationActionData& navigationActionData)
+WebKitNavigationAction* webkitNavigationActionCreate(Ref<API::NavigationAction>&& action)
{
WebKitNavigationAction* navigation = static_cast<WebKitNavigationAction*>(fastZeroedMalloc(sizeof(WebKitNavigationAction)));
- new (navigation) WebKitNavigationAction(request, navigationActionData);
+ new (navigation) WebKitNavigationAction(WTFMove(action));
return navigation;
}
@@ -82,7 +83,7 @@
WebKitNavigationType webkit_navigation_action_get_navigation_type(WebKitNavigationAction* navigation)
{
g_return_val_if_fail(navigation, WEBKIT_NAVIGATION_TYPE_OTHER);
- return navigation->type;
+ return toWebKitNavigationType(navigation->action->navigationType());
}
/**
@@ -99,7 +100,7 @@
unsigned webkit_navigation_action_get_mouse_button(WebKitNavigationAction* navigation)
{
g_return_val_if_fail(navigation, 0);
- return navigation->mouseButton;
+ return toWebKitMouseButton(navigation->action->mouseButton());
}
/**
@@ -116,7 +117,7 @@
unsigned webkit_navigation_action_get_modifiers(WebKitNavigationAction* navigation)
{
g_return_val_if_fail(navigation, 0);
- return navigation->modifiers;
+ return toPlatformModifiers(navigation->action->modifiers());
}
/**
@@ -132,6 +133,8 @@
WebKitURIRequest* webkit_navigation_action_get_request(WebKitNavigationAction* navigation)
{
g_return_val_if_fail(navigation, nullptr);
+ if (!navigation->request)
+ navigation->request = adoptGRef(webkitURIRequestCreateForResourceRequest(navigation->action->request()));
return navigation->request.get();
}
@@ -148,7 +151,7 @@
gboolean webkit_navigation_action_is_user_gesture(WebKitNavigationAction* navigation)
{
g_return_val_if_fail(navigation, FALSE);
- return navigation->isUserGesture;
+ return navigation->action->isProcessingUserGesture();
}
/**
@@ -164,5 +167,5 @@
gboolean webkit_navigation_action_is_redirect(WebKitNavigationAction* navigation)
{
g_return_val_if_fail(navigation, FALSE);
- return navigation->isRedirect;
+ return navigation->action->isRedirect();
}
Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitNavigationActionPrivate.h (224676 => 224677)
--- trunk/Source/WebKit/UIProcess/API/glib/WebKitNavigationActionPrivate.h 2017-11-10 11:26:54 UTC (rev 224676)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitNavigationActionPrivate.h 2017-11-10 13:03:51 UTC (rev 224677)
@@ -19,37 +19,23 @@
#pragma once
-#include "NavigationActionData.h"
+#include "APINavigationAction.h"
#include "WebKitNavigationAction.h"
-#include "WebKitPrivate.h"
#include <wtf/glib/GRefPtr.h>
struct _WebKitNavigationAction {
- _WebKitNavigationAction(WebKitURIRequest* uriRequest, const WebKit::NavigationActionData& navigationActionData)
- : type(toWebKitNavigationType(navigationActionData.navigationType))
- , mouseButton(toWebKitMouseButton(navigationActionData.mouseButton))
- , modifiers(toPlatformModifiers(navigationActionData.modifiers))
- , isUserGesture(navigationActionData.userGestureTokenIdentifier)
- , isRedirect(navigationActionData.isRedirect)
- , request(uriRequest)
+ _WebKitNavigationAction(Ref<API::NavigationAction>&& action)
+ : action(WTFMove(action))
{
}
_WebKitNavigationAction(WebKitNavigationAction* navigation)
- : type(navigation->type)
- , mouseButton(navigation->mouseButton)
- , modifiers(navigation->modifiers)
- , isUserGesture(navigation->isUserGesture)
- , request(navigation->request)
+ : action(navigation->action)
{
}
- WebKitNavigationType type;
- unsigned mouseButton;
- unsigned modifiers;
- bool isUserGesture : 1;
- bool isRedirect : 1;
+ RefPtr<API::NavigationAction> action;
GRefPtr<WebKitURIRequest> request;
};
-WebKitNavigationAction* webkitNavigationActionCreate(WebKitURIRequest*, const WebKit::NavigationActionData&);
+WebKitNavigationAction* webkitNavigationActionCreate(Ref<API::NavigationAction>&&);
Copied: trunk/Source/WebKit/UIProcess/API/glib/WebKitNavigationClient.cpp (from rev 224671, trunk/Source/WebKit/UIProcess/API/glib/WebKitLoaderClient.cpp) (0 => 224677)
--- trunk/Source/WebKit/UIProcess/API/glib/WebKitNavigationClient.cpp (rev 0)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitNavigationClient.cpp 2017-11-10 13:03:51 UTC (rev 224677)
@@ -0,0 +1,135 @@
+/*
+ * Copyright (C) 2017 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "WebKitNavigationClient.h"
+
+#include "APINavigationAction.h"
+#include "APINavigationClient.h"
+#include "WebKitBackForwardListPrivate.h"
+#include "WebKitNavigationPolicyDecisionPrivate.h"
+#include "WebKitPrivate.h"
+#include "WebKitResponsePolicyDecisionPrivate.h"
+#include "WebKitURIResponsePrivate.h"
+#include "WebKitWebViewPrivate.h"
+#include <wtf/glib/GUniquePtr.h>
+#include <wtf/text/CString.h>
+
+using namespace WebKit;
+using namespace WebCore;
+
+class NavigationClient : public API::NavigationClient {
+public:
+ explicit NavigationClient(WebKitWebView* webView)
+ : m_webView(webView)
+ {
+ }
+
+private:
+ void didStartProvisionalNavigation(WebPageProxy&, API::Navigation*, API::Object* /* userData */) override
+ {
+ webkitWebViewLoadChanged(m_webView, WEBKIT_LOAD_STARTED);
+ }
+
+ void didReceiveServerRedirectForProvisionalNavigation(WebPageProxy&, API::Navigation*, API::Object* /* userData */) override
+ {
+ webkitWebViewLoadChanged(m_webView, WEBKIT_LOAD_REDIRECTED);
+ }
+
+ void didFailProvisionalNavigationWithError(WebPageProxy&, WebFrameProxy& frame, API::Navigation*, const ResourceError& resourceError, API::Object* /* userData */) override
+ {
+ if (!frame.isMainFrame())
+ return;
+ GUniquePtr<GError> error(g_error_new_literal(g_quark_from_string(resourceError.domain().utf8().data()),
+ toWebKitError(resourceError.errorCode()), resourceError.localizedDescription().utf8().data()));
+ if (resourceError.tlsErrors()) {
+ webkitWebViewLoadFailedWithTLSErrors(m_webView, resourceError.failingURL().string().utf8().data(), error.get(),
+ static_cast<GTlsCertificateFlags>(resourceError.tlsErrors()), resourceError.certificate());
+ } else
+ webkitWebViewLoadFailed(m_webView, WEBKIT_LOAD_STARTED, resourceError.failingURL().string().utf8().data(), error.get());
+ }
+
+ void didCommitNavigation(WebPageProxy&, API::Navigation*, API::Object* /* userData */) override
+ {
+ webkitWebViewLoadChanged(m_webView, WEBKIT_LOAD_COMMITTED);
+ }
+
+ void didFinishNavigation(WebPageProxy&, API::Navigation*, API::Object* /* userData */) override
+ {
+ webkitWebViewLoadChanged(m_webView, WEBKIT_LOAD_FINISHED);
+ }
+
+ void didFailNavigationWithError(WebPageProxy&, WebFrameProxy& frame, API::Navigation*, const ResourceError& resourceError, API::Object* /* userData */) override
+ {
+ if (!frame.isMainFrame())
+ return;
+ GUniquePtr<GError> error(g_error_new_literal(g_quark_from_string(resourceError.domain().utf8().data()),
+ toWebKitError(resourceError.errorCode()), resourceError.localizedDescription().utf8().data()));
+ webkitWebViewLoadFailed(m_webView, WEBKIT_LOAD_COMMITTED, resourceError.failingURL().string().utf8().data(), error.get());
+ }
+
+ void didDisplayInsecureContent(WebPageProxy&, API::Object* /* userData */) override
+ {
+ webkitWebViewInsecureContentDetected(m_webView, WEBKIT_INSECURE_CONTENT_DISPLAYED);
+ }
+
+ void didRunInsecureContent(WebPageProxy&, API::Object* /* userData */) override
+ {
+ webkitWebViewInsecureContentDetected(m_webView, WEBKIT_INSECURE_CONTENT_RUN);
+ }
+
+ bool didChangeBackForwardList(WebPageProxy&, WebBackForwardListItem* addedItem, const Vector<Ref<WebBackForwardListItem>>& removedItems) override
+ {
+ webkitBackForwardListChanged(webkit_web_view_get_back_forward_list(m_webView), addedItem, removedItems);
+ return true;
+ }
+
+ void didReceiveAuthenticationChallenge(WebPageProxy&, AuthenticationChallengeProxy& authenticationChallenge) override
+ {
+ webkitWebViewHandleAuthenticationChallenge(m_webView, &authenticationChallenge);
+ }
+
+ void processDidTerminate(WebPageProxy&, ProcessTerminationReason reason) override
+ {
+ if (reason == ProcessTerminationReason::RequestedByClient)
+ return;
+ webkitWebViewWebProcessCrashed(m_webView);
+ }
+
+ void decidePolicyForNavigationAction(WebPageProxy&, Ref<API::NavigationAction>&& navigationAction, Ref<WebFramePolicyListenerProxy>&& listener, API::Object* /* userData */) override
+ {
+ WebKitPolicyDecisionType decisionType = navigationAction->targetFrame() ? WEBKIT_POLICY_DECISION_TYPE_NAVIGATION_ACTION : WEBKIT_POLICY_DECISION_TYPE_NEW_WINDOW_ACTION;
+ GRefPtr<WebKitPolicyDecision> decision = adoptGRef(webkitNavigationPolicyDecisionCreate(WTFMove(navigationAction), WTFMove(listener)));
+ webkitWebViewMakePolicyDecision(m_webView, decisionType, decision.get());
+ }
+
+ void decidePolicyForNavigationResponse(WebPageProxy&, Ref<API::NavigationResponse>&& navigationResponse, Ref<WebFramePolicyListenerProxy>&& listener, API::Object* /* userData */) override
+ {
+ GRefPtr<WebKitPolicyDecision> decision = adoptGRef(webkitResponsePolicyDecisionCreate(WTFMove(navigationResponse), WTFMove(listener)));
+ webkitWebViewMakePolicyDecision(m_webView, WEBKIT_POLICY_DECISION_TYPE_RESPONSE, decision.get());
+ }
+
+ WebKitWebView* m_webView;
+};
+
+void attachNavigationClientToView(WebKitWebView* webView)
+{
+ webkitWebViewGetPage(webView).setNavigationClient(std::make_unique<NavigationClient>(webView));
+}
+
Copied: trunk/Source/WebKit/UIProcess/API/glib/WebKitNavigationClient.h (from rev 224671, trunk/Source/WebKit/UIProcess/API/glib/WebKitLoaderClient.h) (0 => 224677)
--- trunk/Source/WebKit/UIProcess/API/glib/WebKitNavigationClient.h (rev 0)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitNavigationClient.h 2017-11-10 13:03:51 UTC (rev 224677)
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2017 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#pragma once
+
+#include "WebKitWebView.h"
+
+void attachNavigationClientToView(WebKitWebView*);
Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitNavigationPolicyDecision.cpp (224676 => 224677)
--- trunk/Source/WebKit/UIProcess/API/glib/WebKitNavigationPolicyDecision.cpp 2017-11-10 11:26:54 UTC (rev 224676)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitNavigationPolicyDecision.cpp 2017-11-10 13:03:51 UTC (rev 224677)
@@ -295,23 +295,20 @@
*/
const char* webkit_navigation_policy_decision_get_frame_name(WebKitNavigationPolicyDecision* decision)
{
- g_return_val_if_fail(WEBKIT_IS_NAVIGATION_POLICY_DECISION(decision), 0);
+ g_return_val_if_fail(WEBKIT_IS_NAVIGATION_POLICY_DECISION(decision), nullptr);
+ // FIXME: frame name should also be moved to WebKitNavigationAction and this method deprecated.
return decision->priv->frameName.data();
}
-WebKitPolicyDecision* webkitNavigationPolicyDecisionCreate(const NavigationActionData& navigationActionData, const ResourceRequest& request, WebFramePolicyListenerProxy* listener)
+WebKitPolicyDecision* webkitNavigationPolicyDecisionCreate(Ref<API::NavigationAction>&& navigationAction, Ref<WebFramePolicyListenerProxy>&& listener)
{
WebKitNavigationPolicyDecision* navigationDecision = WEBKIT_NAVIGATION_POLICY_DECISION(g_object_new(WEBKIT_TYPE_NAVIGATION_POLICY_DECISION, nullptr));
- GRefPtr<WebKitURIRequest> uriRequest = adoptGRef(webkitURIRequestCreateForResourceRequest(request));
- navigationDecision->priv->navigationAction = webkitNavigationActionCreate(uriRequest.get(), navigationActionData);
+ // FIXME: frame name should also be moved to WebKitNavigationAction.
+ auto targetFrameName = navigationAction->targetFrameName();
+ navigationDecision->priv->navigationAction = webkitNavigationActionCreate(WTFMove(navigationAction));
+ if (targetFrameName)
+ navigationDecision->priv->frameName = targetFrameName->utf8();
WebKitPolicyDecision* decision = WEBKIT_POLICY_DECISION(navigationDecision);
- webkitPolicyDecisionSetListener(decision, listener);
+ webkitPolicyDecisionSetListener(decision, WTFMove(listener));
return decision;
}
-
-WebKitPolicyDecision* webkitNewWindowPolicyDecisionCreate(const NavigationActionData& navigationActionData, const ResourceRequest& request, const String& frameName, WebFramePolicyListenerProxy* listener)
-{
- WebKitPolicyDecision* decision = webkitNavigationPolicyDecisionCreate(navigationActionData, request, listener);
- WEBKIT_NAVIGATION_POLICY_DECISION(decision)->priv->frameName = frameName.utf8().data();
- return decision;
-}
Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitNavigationPolicyDecisionPrivate.h (224676 => 224677)
--- trunk/Source/WebKit/UIProcess/API/glib/WebKitNavigationPolicyDecisionPrivate.h 2017-11-10 11:26:54 UTC (rev 224676)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitNavigationPolicyDecisionPrivate.h 2017-11-10 13:03:51 UTC (rev 224677)
@@ -19,10 +19,8 @@
#pragma once
-#include "NavigationActionData.h"
+#include "APINavigationAction.h"
#include "WebFramePolicyListenerProxy.h"
#include "WebKitNavigationPolicyDecision.h"
-#include <WebCore/ResourceRequest.h>
-WebKitPolicyDecision* webkitNavigationPolicyDecisionCreate(const WebKit::NavigationActionData&, const WebCore::ResourceRequest&, WebKit::WebFramePolicyListenerProxy*);
-WebKitPolicyDecision* webkitNewWindowPolicyDecisionCreate(const WebKit::NavigationActionData&, const WebCore::ResourceRequest&, const String& frameName, WebKit::WebFramePolicyListenerProxy*);
+WebKitPolicyDecision* webkitNavigationPolicyDecisionCreate(Ref<API::NavigationAction>&&, Ref<WebKit::WebFramePolicyListenerProxy>&&);
Deleted: trunk/Source/WebKit/UIProcess/API/glib/WebKitPolicyClient.cpp (224676 => 224677)
--- trunk/Source/WebKit/UIProcess/API/glib/WebKitPolicyClient.cpp 2017-11-10 11:26:54 UTC (rev 224676)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitPolicyClient.cpp 2017-11-10 13:03:51 UTC (rev 224677)
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2012 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "WebKitPolicyClient.h"
-
-#include "APIPolicyClient.h"
-#include "WebKitNavigationPolicyDecisionPrivate.h"
-#include "WebKitResponsePolicyDecisionPrivate.h"
-#include "WebKitWebViewPrivate.h"
-#include "WebsitePolicies.h"
-#include <wtf/glib/GRefPtr.h>
-#include <wtf/text/CString.h>
-
-using namespace WebKit;
-
-class PolicyClient: public API::PolicyClient {
-public:
- explicit PolicyClient(WebKitWebView* webView)
- : m_webView(webView)
- {
- }
-
-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
- {
- 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
- {
- 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
- {
- GRefPtr<WebKitPolicyDecision> decision = adoptGRef(webkitResponsePolicyDecisionCreate(request, response, canShowMIMEType, listener.ptr()));
- webkitWebViewMakePolicyDecision(m_webView, WEBKIT_POLICY_DECISION_TYPE_RESPONSE, decision.get());
- }
-
- WebKitWebView* m_webView;
-};
-
-void attachPolicyClientToView(WebKitWebView* webView)
-{
- webkitWebViewGetPage(webView).setPolicyClient(std::make_unique<PolicyClient>(webView));
-}
Deleted: trunk/Source/WebKit/UIProcess/API/glib/WebKitPolicyClient.h (224676 => 224677)
--- trunk/Source/WebKit/UIProcess/API/glib/WebKitPolicyClient.h 2017-11-10 11:26:54 UTC (rev 224676)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitPolicyClient.h 2017-11-10 13:03:51 UTC (rev 224677)
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2012 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef WebKitPolicyClient_h
-#define WebKitPolicyClient_h
-
-#include "WebKitWebView.h"
-
-void attachPolicyClientToView(WebKitWebView*);
-
-#endif // WebKitPolicyClient_h
Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitPolicyDecision.cpp (224676 => 224677)
--- trunk/Source/WebKit/UIProcess/API/glib/WebKitPolicyDecision.cpp 2017-11-10 11:26:54 UTC (rev 224676)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitPolicyDecision.cpp 2017-11-10 13:03:51 UTC (rev 224677)
@@ -46,7 +46,6 @@
struct _WebKitPolicyDecisionPrivate {
RefPtr<WebFramePolicyListenerProxy> listener;
- bool madePolicyDecision;
};
WEBKIT_DEFINE_ABSTRACT_TYPE(WebKitPolicyDecision, webkit_policy_decision, G_TYPE_OBJECT)
@@ -57,9 +56,9 @@
G_OBJECT_CLASS(webkit_policy_decision_parent_class)->dispose(object);
}
-void webkitPolicyDecisionSetListener(WebKitPolicyDecision* decision, WebFramePolicyListenerProxy* listener)
+void webkitPolicyDecisionSetListener(WebKitPolicyDecision* decision, Ref<WebFramePolicyListenerProxy>&& listener)
{
- decision->priv->listener = listener;
+ decision->priv->listener = WTFMove(listener);
}
static void webkit_policy_decision_class_init(WebKitPolicyDecisionClass* decisionClass)
@@ -78,11 +77,11 @@
{
g_return_if_fail(WEBKIT_IS_POLICY_DECISION(decision));
- if (decision->priv->madePolicyDecision)
+ if (!decision->priv->listener)
return;
- decision->priv->listener->use({ });
- decision->priv->madePolicyDecision = true;
+ auto listener = std::exchange(decision->priv->listener, nullptr);
+ listener->use({ });
}
/**
@@ -96,11 +95,11 @@
{
g_return_if_fail(WEBKIT_IS_POLICY_DECISION(decision));
- if (decision->priv->madePolicyDecision)
+ if (!decision->priv->listener)
return;
- decision->priv->listener->ignore();
- decision->priv->madePolicyDecision = true;
+ auto listener = std::exchange(decision->priv->listener, nullptr);
+ listener->ignore();
}
/**
@@ -113,9 +112,9 @@
{
g_return_if_fail(WEBKIT_IS_POLICY_DECISION(decision));
- if (decision->priv->madePolicyDecision)
+ if (!decision->priv->listener)
return;
- decision->priv->listener->download();
- decision->priv->madePolicyDecision = true;
+ auto listener = std::exchange(decision->priv->listener, nullptr);
+ listener->download();
}
Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitPolicyDecisionPrivate.h (224676 => 224677)
--- trunk/Source/WebKit/UIProcess/API/glib/WebKitPolicyDecisionPrivate.h 2017-11-10 11:26:54 UTC (rev 224676)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitPolicyDecisionPrivate.h 2017-11-10 13:03:51 UTC (rev 224677)
@@ -22,4 +22,4 @@
#include "WebFramePolicyListenerProxy.h"
#include "WebKitPolicyDecision.h"
-void webkitPolicyDecisionSetListener(WebKitPolicyDecision*, WebKit::WebFramePolicyListenerProxy*);
+void webkitPolicyDecisionSetListener(WebKitPolicyDecision*, Ref<WebKit::WebFramePolicyListenerProxy>&&);
Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitResponsePolicyDecision.cpp (224676 => 224677)
--- trunk/Source/WebKit/UIProcess/API/glib/WebKitResponsePolicyDecision.cpp 2017-11-10 11:26:54 UTC (rev 224676)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitResponsePolicyDecision.cpp 2017-11-10 13:03:51 UTC (rev 224677)
@@ -21,6 +21,7 @@
#include "WebKitResponsePolicyDecision.h"
#include "WebKitPolicyDecisionPrivate.h"
+#include "WebKitResponsePolicyDecisionPrivate.h"
#include "WebKitURIRequestPrivate.h"
#include "WebKitURIResponsePrivate.h"
#include <glib/gi18n-lib.h>
@@ -45,9 +46,9 @@
*/
struct _WebKitResponsePolicyDecisionPrivate {
+ RefPtr<API::NavigationResponse> navigationResponse;
GRefPtr<WebKitURIRequest> request;
GRefPtr<WebKitURIResponse> response;
- bool canShowMIMEType;
};
WEBKIT_DEFINE_TYPE(WebKitResponsePolicyDecision, webkit_response_policy_decision, WEBKIT_TYPE_POLICY_DECISION)
@@ -119,7 +120,9 @@
*/
WebKitURIRequest* webkit_response_policy_decision_get_request(WebKitResponsePolicyDecision* decision)
{
- g_return_val_if_fail(WEBKIT_IS_RESPONSE_POLICY_DECISION(decision), 0);
+ g_return_val_if_fail(WEBKIT_IS_RESPONSE_POLICY_DECISION(decision), nullptr);
+ if (!decision->priv->request)
+ decision->priv->request = adoptGRef(webkitURIRequestCreateForResourceRequest(decision->priv->navigationResponse->request()));
return decision->priv->request.get();
}
@@ -133,7 +136,9 @@
*/
WebKitURIResponse* webkit_response_policy_decision_get_response(WebKitResponsePolicyDecision* decision)
{
- g_return_val_if_fail(WEBKIT_IS_RESPONSE_POLICY_DECISION(decision), 0);
+ g_return_val_if_fail(WEBKIT_IS_RESPONSE_POLICY_DECISION(decision), nullptr);
+ if (!decision->priv->response)
+ decision->priv->response = adoptGRef(webkitURIResponseCreateForResourceResponse(decision->priv->navigationResponse->response()));
return decision->priv->response.get();
}
@@ -151,16 +156,14 @@
gboolean webkit_response_policy_decision_is_mime_type_supported(WebKitResponsePolicyDecision* decision)
{
g_return_val_if_fail(WEBKIT_IS_RESPONSE_POLICY_DECISION(decision), FALSE);
- return decision->priv->canShowMIMEType;
+ return decision->priv->navigationResponse->canShowMIMEType();
}
-WebKitPolicyDecision* webkitResponsePolicyDecisionCreate(const ResourceRequest& request, const ResourceResponse& response, bool canShowMIMEType, WebFramePolicyListenerProxy* listener)
+WebKitPolicyDecision* webkitResponsePolicyDecisionCreate(Ref<API::NavigationResponse>&& response, Ref<WebKit::WebFramePolicyListenerProxy>&& listener)
{
WebKitResponsePolicyDecision* responseDecision = WEBKIT_RESPONSE_POLICY_DECISION(g_object_new(WEBKIT_TYPE_RESPONSE_POLICY_DECISION, nullptr));
- responseDecision->priv->request = adoptGRef(webkitURIRequestCreateForResourceRequest(request));
- responseDecision->priv->response = adoptGRef(webkitURIResponseCreateForResourceResponse(response));
- responseDecision->priv->canShowMIMEType = canShowMIMEType;
+ responseDecision->priv->navigationResponse = WTFMove(response);
WebKitPolicyDecision* decision = WEBKIT_POLICY_DECISION(responseDecision);
- webkitPolicyDecisionSetListener(decision, listener);
+ webkitPolicyDecisionSetListener(decision, WTFMove(listener));
return decision;
}
Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitResponsePolicyDecisionPrivate.h (224676 => 224677)
--- trunk/Source/WebKit/UIProcess/API/glib/WebKitResponsePolicyDecisionPrivate.h 2017-11-10 11:26:54 UTC (rev 224676)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitResponsePolicyDecisionPrivate.h 2017-11-10 13:03:51 UTC (rev 224677)
@@ -19,6 +19,8 @@
#pragma once
+#include "APINavigationResponse.h"
+#include "WebFramePolicyListenerProxy.h"
#include "WebKitResponsePolicyDecision.h"
-WebKitPolicyDecision* webkitResponsePolicyDecisionCreate(const WebCore::ResourceRequest&, const WebCore::ResourceResponse&, bool canShowMIMEType, WebKit::WebFramePolicyListenerProxy*);
+WebKitPolicyDecision* webkitResponsePolicyDecisionCreate(Ref<API::NavigationResponse>&&, Ref<WebKit::WebFramePolicyListenerProxy>&&);
Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitUIClient.cpp (224676 => 224677)
--- trunk/Source/WebKit/UIProcess/API/glib/WebKitUIClient.cpp 2017-11-10 11:26:54 UTC (rev 224676)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitUIClient.cpp 2017-11-10 13:03:51 UTC (rev 224677)
@@ -30,6 +30,7 @@
#include "WebKitWebViewPrivate.h"
#include "WebKitWindowPropertiesPrivate.h"
#include "WebPageProxy.h"
+#include "WebProcessProxy.h"
#include <wtf/glib/GRefPtr.h>
#if PLATFORM(GTK)
@@ -46,10 +47,10 @@
}
private:
- void createNewPage(WebPageProxy&, Ref<API::FrameInfo>&&, WebCore::ResourceRequest&& resourceRequest, WebCore::WindowFeatures&& windowFeatures, NavigationActionData&& navigationActionData, WTF::Function<void(RefPtr<WebPageProxy>&&)>&& completionHandler)
+ void createNewPage(WebPageProxy& page, Ref<API::FrameInfo>&& frameInfo, WebCore::ResourceRequest&& resourceRequest, WebCore::WindowFeatures&& windowFeatures, NavigationActionData&& navigationActionData, WTF::Function<void(RefPtr<WebPageProxy>&&)>&& completionHandler)
{
- GRefPtr<WebKitURIRequest> request = adoptGRef(webkitURIRequestCreateForResourceRequest(resourceRequest));
- WebKitNavigationAction navigationAction(request.get(), navigationActionData);
+ auto userInitiatedActivity = page.process().userInitiatedActivity(navigationActionData.userGestureTokenIdentifier);
+ WebKitNavigationAction navigationAction(API::NavigationAction::create(WTFMove(navigationActionData), frameInfo.ptr(), nullptr, std::nullopt, WTFMove(resourceRequest), { }, false, WTFMove(userInitiatedActivity)));
completionHandler(webkitWebViewCreateNewPage(m_webView, windowFeatures, &navigationAction));
}
Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp (224676 => 224677)
--- trunk/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp 2017-11-10 11:26:54 UTC (rev 224676)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp 2017-11-10 13:03:51 UTC (rev 224677)
@@ -45,9 +45,8 @@
#include "WebKitIconLoadingClient.h"
#include "WebKitInstallMissingMediaPluginsPermissionRequestPrivate.h"
#include "WebKitJavascriptResultPrivate.h"
-#include "WebKitLoaderClient.h"
+#include "WebKitNavigationClient.h"
#include "WebKitNotificationPrivate.h"
-#include "WebKitPolicyClient.h"
#include "WebKitPrivate.h"
#include "WebKitResponsePolicyDecision.h"
#include "WebKitScriptDialogPrivate.h"
@@ -648,9 +647,8 @@
// The related view is only valid during the construction.
priv->relatedView = nullptr;
- attachLoaderClientToView(webView);
+ attachNavigationClientToView(webView);
attachUIClientToView(webView);
- attachPolicyClientToView(webView);
attachContextMenuClientToView(webView);
attachFormClientToView(webView);
Modified: trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.h (224676 => 224677)
--- trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.h 2017-11-10 11:26:54 UTC (rev 224676)
+++ trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.h 2017-11-10 13:03:51 UTC (rev 224677)
@@ -126,7 +126,7 @@
void contentRuleListNotification(WebPageProxy&, WebCore::URL&&, Vector<String>&&, Vector<String>&&) final;
void decidePolicyForNavigationAction(WebPageProxy&, Ref<API::NavigationAction>&&, Ref<WebFramePolicyListenerProxy>&&, API::Object* userData) override;
- void decidePolicyForNavigationResponse(WebPageProxy&, API::NavigationResponse&, Ref<WebFramePolicyListenerProxy>&&, API::Object* userData) override;
+ void decidePolicyForNavigationResponse(WebPageProxy&, Ref<API::NavigationResponse>&&, Ref<WebFramePolicyListenerProxy>&&, API::Object* userData) override;
NavigationState& m_navigationState;
};
Modified: trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm (224676 => 224677)
--- trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm 2017-11-10 11:26:54 UTC (rev 224676)
+++ trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm 2017-11-10 13:03:51 UTC (rev 224677)
@@ -535,15 +535,15 @@
[(id <WKNavigationDelegatePrivate>)navigationDelegate _webView:m_navigationState.m_webView URL:url contentRuleListIdentifiers:identifiers.get() notifications:nsNotifications.get()];
}
-void NavigationState::NavigationClient::decidePolicyForNavigationResponse(WebPageProxy&, API::NavigationResponse& navigationResponse, Ref<WebFramePolicyListenerProxy>&& listener, API::Object* userData)
+void NavigationState::NavigationClient::decidePolicyForNavigationResponse(WebPageProxy&, Ref<API::NavigationResponse>&& navigationResponse, Ref<WebFramePolicyListenerProxy>&& listener, API::Object* userData)
{
if (!m_navigationState.m_navigationDelegateMethods.webViewDecidePolicyForNavigationResponseDecisionHandler) {
- NSURL *url = ""
+ NSURL *url = ""
if ([url isFileURL]) {
BOOL isDirectory = NO;
BOOL exists = [[NSFileManager defaultManager] fileExistsAtPath:url.path isDirectory:&isDirectory];
- if (exists && !isDirectory && navigationResponse.canShowMIMEType())
+ if (exists && !isDirectory && navigationResponse->canShowMIMEType())
listener->use({ });
else
listener->ignore();
@@ -550,7 +550,7 @@
return;
}
- if (navigationResponse.canShowMIMEType())
+ if (navigationResponse->canShowMIMEType())
listener->use({ });
else
listener->ignore();
Modified: trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm (224676 => 224677)
--- trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm 2017-11-10 11:26:54 UTC (rev 224676)
+++ trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm 2017-11-10 13:03:51 UTC (rev 224677)
@@ -211,7 +211,7 @@
auto userInitiatedActivity = page.process().userInitiatedActivity(navigationActionData.userGestureTokenIdentifier);
bool shouldOpenAppLinks = !hostsAreEqual(sourceFrameInfo->request().url(), request.url());
- auto apiNavigationAction = API::NavigationAction::create(WTFMove(navigationActionData), sourceFrameInfo.ptr(), nullptr, WTFMove(request), WebCore::URL(), shouldOpenAppLinks, WTFMove(userInitiatedActivity));
+ auto apiNavigationAction = API::NavigationAction::create(WTFMove(navigationActionData), sourceFrameInfo.ptr(), nullptr, std::nullopt, WTFMove(request), WebCore::URL(), shouldOpenAppLinks, WTFMove(userInitiatedActivity));
auto apiWindowFeatures = API::WindowFeatures::create(windowFeatures);
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (224676 => 224677)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2017-11-10 11:26:54 UTC (rev 224676)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2017-11-10 13:03:51 UTC (rev 224677)
@@ -3624,9 +3624,12 @@
auto transaction = m_pageLoadState.transaction();
m_pageLoadState.didDisplayOrRunInsecureContent(transaction);
+ m_pageLoadState.commitChanges();
- m_pageLoadState.commitChanges();
- m_loaderClient->didDisplayInsecureContentForFrame(*this, *frame, m_process->transformHandlesToObjects(userData.object()).get());
+ if (m_navigationClient)
+ m_navigationClient->didDisplayInsecureContent(*this, m_process->transformHandlesToObjects(userData.object()).get());
+ else
+ m_loaderClient->didDisplayInsecureContentForFrame(*this, *frame, m_process->transformHandlesToObjects(userData.object()).get());
}
void WebPageProxy::didRunInsecureContentForFrame(uint64_t frameID, const UserData& userData)
@@ -3638,9 +3641,12 @@
auto transaction = m_pageLoadState.transaction();
m_pageLoadState.didDisplayOrRunInsecureContent(transaction);
+ m_pageLoadState.commitChanges();
- m_pageLoadState.commitChanges();
- m_loaderClient->didRunInsecureContentForFrame(*this, *frame, m_process->transformHandlesToObjects(userData.object()).get());
+ if (m_navigationClient)
+ m_navigationClient->didRunInsecureContent(*this, m_process->transformHandlesToObjects(userData.object()).get());
+ else
+ m_loaderClient->didRunInsecureContentForFrame(*this, *frame, m_process->transformHandlesToObjects(userData.object()).get());
}
void WebPageProxy::didDetectXSSForFrame(uint64_t frameID, const UserData& userData)
@@ -3725,7 +3731,7 @@
auto userInitiatedActivity = m_process->userInitiatedActivity(navigationActionData.userGestureTokenIdentifier);
bool shouldOpenAppLinks = !m_shouldSuppressAppLinksInNextNavigationPolicyDecision && destinationFrameInfo->isMainFrame() && !hostsAreEqual(URL(ParsedURLString, m_mainFrame->url()), request.url()) && navigationActionData.navigationType != WebCore::NavigationType::BackForward;
- auto navigationAction = API::NavigationAction::create(WTFMove(navigationActionData), sourceFrameInfo.get(), destinationFrameInfo.ptr(), WTFMove(request), originalRequest.url(), shouldOpenAppLinks, WTFMove(userInitiatedActivity));
+ auto navigationAction = API::NavigationAction::create(WTFMove(navigationActionData), sourceFrameInfo.get(), destinationFrameInfo.ptr(), std::nullopt, WTFMove(request), originalRequest.url(), shouldOpenAppLinks, WTFMove(userInitiatedActivity));
m_navigationClient->decidePolicyForNavigationAction(*this, WTFMove(navigationAction), WTFMove(listener), m_process->transformHandlesToObjects(userData.object()).get());
} else
@@ -3760,7 +3766,7 @@
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));
+ auto navigationAction = API::NavigationAction::create(WTFMove(navigationActionData), sourceFrameInfo.get(), nullptr, frameName, WTFMove(request), { }, shouldOpenAppLinks, WTFMove(userInitiatedActivity));
m_navigationClient->decidePolicyForNavigationAction(*this, navigationAction.get(), WTFMove(listener), m_process->transformHandlesToObjects(userData.object()).get());
@@ -3783,7 +3789,7 @@
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, WTFMove(navigationResponse), WTFMove(listener), m_process->transformHandlesToObjects(userData.object()).get());
} else
m_policyClient->decidePolicyForResponse(*this, *frame, response, request, canShowMIMEType, WTFMove(listener), m_process->transformHandlesToObjects(userData.object()).get());
}