Diff
Modified: releases/WebKitGTK/webkit-2.18/Source/WebCore/ChangeLog (223403 => 223404)
--- releases/WebKitGTK/webkit-2.18/Source/WebCore/ChangeLog 2017-10-16 13:28:18 UTC (rev 223403)
+++ releases/WebKitGTK/webkit-2.18/Source/WebCore/ChangeLog 2017-10-16 13:34:17 UTC (rev 223404)
@@ -1,3 +1,26 @@
+2017-09-25 Alex Christensen <achristen...@webkit.org>
+
+ Separate form submission from PolicyChecker infrastructure
+ https://bugs.webkit.org/show_bug.cgi?id=177396
+
+ Reviewed by Geoffrey Garen.
+
+ We used PolicyChecker for WillSubmitForm even though we just need a completion handler
+ with no parameters. That is what lambdas and WTF::Functions are for.
+
+ No change in behavior.
+
+ * loader/EmptyClients.cpp:
+ (WebCore::EmptyFrameLoaderClient::dispatchWillSubmitForm):
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
+ (WebCore::FrameLoader::continueLoadAfterWillSubmitForm): Deleted.
+ * loader/FrameLoader.h:
+ * loader/FrameLoaderClient.h:
+ * loader/PolicyChecker.cpp:
+ (WebCore::PolicyChecker::continueLoadAfterWillSubmitForm): Deleted.
+ * loader/PolicyChecker.h:
+
2017-09-25 Manuel Rego Casasnovas <r...@igalia.com>
[css-grid] Small refactoring adding RenderGrid::contentAlignment()
Modified: releases/WebKitGTK/webkit-2.18/Source/WebCore/loader/EmptyClients.cpp (223403 => 223404)
--- releases/WebKitGTK/webkit-2.18/Source/WebCore/loader/EmptyClients.cpp 2017-10-16 13:28:18 UTC (rev 223403)
+++ releases/WebKitGTK/webkit-2.18/Source/WebCore/loader/EmptyClients.cpp 2017-10-16 13:34:17 UTC (rev 223404)
@@ -345,7 +345,7 @@
void dispatchUnableToImplementPolicy(const ResourceError&) final { }
void dispatchWillSendSubmitEvent(Ref<FormState>&&) final;
- void dispatchWillSubmitForm(FormState&, FramePolicyFunction&&) final;
+ void dispatchWillSubmitForm(FormState&, WTF::Function<void(void)>&&) final;
void revertToProvisionalState(DocumentLoader*) final { }
void setMainDocumentError(DocumentLoader*, const ResourceError&) final { }
@@ -612,7 +612,7 @@
{
}
-void EmptyFrameLoaderClient::dispatchWillSubmitForm(FormState&, FramePolicyFunction&&)
+void EmptyFrameLoaderClient::dispatchWillSubmitForm(FormState&, WTF::Function<void(void)>&&)
{
}
Modified: releases/WebKitGTK/webkit-2.18/Source/WebCore/loader/FrameLoader.cpp (223403 => 223404)
--- releases/WebKitGTK/webkit-2.18/Source/WebCore/loader/FrameLoader.cpp 2017-10-16 13:28:18 UTC (rev 223403)
+++ releases/WebKitGTK/webkit-2.18/Source/WebCore/loader/FrameLoader.cpp 2017-10-16 13:34:17 UTC (rev 223404)
@@ -2386,30 +2386,6 @@
ASSERT_NOT_REACHED();
}
-void FrameLoader::continueLoadAfterWillSubmitForm()
-{
- if (!m_provisionalDocumentLoader)
- return;
-
- prepareForLoadStart();
-
- // The load might be cancelled inside of prepareForLoadStart(), nulling out the m_provisionalDocumentLoader,
- // so we need to null check it again.
- if (!m_provisionalDocumentLoader) {
- RELEASE_LOG_IF_ALLOWED("continueLoadAfterWillSubmitForm: Frame load canceled (frame = %p, main = %d)", &m_frame, m_frame.isMainFrame());
- return;
- }
-
- DocumentLoader* activeDocLoader = activeDocumentLoader();
- if (activeDocLoader && activeDocLoader->isLoadingMainResource()) {
- RELEASE_LOG_IF_ALLOWED("continueLoadAfterWillSubmitForm: Main frame already being loaded (frame = %p, main = %d)", &m_frame, m_frame.isMainFrame());
- return;
- }
-
- m_loadingFromCachedPage = false;
- m_provisionalDocumentLoader->startLoadingMainResource();
-}
-
void FrameLoader::setOriginalURLForDownloadRequest(ResourceRequest& request)
{
// FIXME: Rename firstPartyForCookies back to mainDocumentURL. It was a mistake to think that it was only used for cookies.
@@ -3181,14 +3157,35 @@
diagnosticLoggingClient.logDiagnosticMessageWithResult(DiagnosticLoggingKeys::pageCacheKey(), DiagnosticLoggingKeys::retrievalKey(), DiagnosticLoggingResultFail, ShouldSample::Yes);
}
+ WTF::Function<void(void)> completionHandler = [this] {
+ if (!m_provisionalDocumentLoader)
+ return;
+
+ prepareForLoadStart();
+
+ // The load might be cancelled inside of prepareForLoadStart(), nulling out the m_provisionalDocumentLoader,
+ // so we need to null check it again.
+ if (!m_provisionalDocumentLoader) {
+ RELEASE_LOG_IF_ALLOWED("dispatchWillSubmitForm completionHandler: Frame load canceled (frame = %p, main = %d)", &m_frame, m_frame.isMainFrame());
+ return;
+ }
+
+ DocumentLoader* activeDocLoader = activeDocumentLoader();
+ if (activeDocLoader && activeDocLoader->isLoadingMainResource()) {
+ RELEASE_LOG_IF_ALLOWED("dispatchWillSubmitForm completionHandler: Main frame already being loaded (frame = %p, main = %d)", &m_frame, m_frame.isMainFrame());
+ return;
+ }
+
+ m_loadingFromCachedPage = false;
+ m_provisionalDocumentLoader->startLoadingMainResource();
+ };
+
if (!formState) {
- continueLoadAfterWillSubmitForm();
+ completionHandler();
return;
}
- m_client.dispatchWillSubmitForm(*formState, [this] (PolicyAction action) {
- policyChecker().continueLoadAfterWillSubmitForm(action);
- });
+ m_client.dispatchWillSubmitForm(*formState, WTFMove(completionHandler));
}
void FrameLoader::continueLoadAfterNewWindowPolicy(const ResourceRequest& request,
Modified: releases/WebKitGTK/webkit-2.18/Source/WebCore/loader/FrameLoader.h (223403 => 223404)
--- releases/WebKitGTK/webkit-2.18/Source/WebCore/loader/FrameLoader.h 2017-10-16 13:28:18 UTC (rev 223403)
+++ releases/WebKitGTK/webkit-2.18/Source/WebCore/loader/FrameLoader.h 2017-10-16 13:34:17 UTC (rev 223404)
@@ -267,11 +267,6 @@
void clientRedirectCancelledOrFinished(bool cancelWithLoadInProgress);
void performClientRedirect(FrameLoadRequest&&);
- // FIXME: This is public because this asynchronous callback from the FrameLoaderClient
- // uses the policy machinery (and therefore is called via the PolicyChecker). Once we
- // introduce a proper callback type for this function, we should make it private again.
- void continueLoadAfterWillSubmitForm();
-
WEBCORE_EXPORT void setOriginalURLForDownloadRequest(ResourceRequest&);
bool quickRedirectComing() const { return m_quickRedirectComing; }
Modified: releases/WebKitGTK/webkit-2.18/Source/WebCore/loader/FrameLoaderClient.h (223403 => 223404)
--- releases/WebKitGTK/webkit-2.18/Source/WebCore/loader/FrameLoaderClient.h 2017-10-16 13:28:18 UTC (rev 223403)
+++ releases/WebKitGTK/webkit-2.18/Source/WebCore/loader/FrameLoaderClient.h 2017-10-16 13:34:17 UTC (rev 223404)
@@ -185,7 +185,7 @@
virtual void dispatchUnableToImplementPolicy(const ResourceError&) = 0;
virtual void dispatchWillSendSubmitEvent(Ref<FormState>&&) = 0;
- virtual void dispatchWillSubmitForm(FormState&, FramePolicyFunction&&) = 0;
+ virtual void dispatchWillSubmitForm(FormState&, WTF::Function<void(void)>&&) = 0;
virtual void revertToProvisionalState(DocumentLoader*) = 0;
virtual void setMainDocumentError(DocumentLoader*, const ResourceError&) = 0;
Modified: releases/WebKitGTK/webkit-2.18/Source/WebCore/loader/PolicyChecker.cpp (223403 => 223404)
--- releases/WebKitGTK/webkit-2.18/Source/WebCore/loader/PolicyChecker.cpp 2017-10-16 13:28:18 UTC (rev 223403)
+++ releases/WebKitGTK/webkit-2.18/Source/WebCore/loader/PolicyChecker.cpp 2017-10-16 13:34:17 UTC (rev 223404)
@@ -189,13 +189,6 @@
handleUnimplementablePolicy(m_frame.loader().client().cannotShowMIMETypeError(response));
}
-void PolicyChecker::continueLoadAfterWillSubmitForm(PolicyAction)
-{
- // See header file for an explaination of why this function
- // isn't like the others.
- m_frame.loader().continueLoadAfterWillSubmitForm();
-}
-
void PolicyChecker::continueAfterNavigationPolicy(PolicyAction policy)
{
PolicyCallback callback = WTFMove(m_callback);
Modified: releases/WebKitGTK/webkit-2.18/Source/WebCore/loader/PolicyChecker.h (223403 => 223404)
--- releases/WebKitGTK/webkit-2.18/Source/WebCore/loader/PolicyChecker.h 2017-10-16 13:28:18 UTC (rev 223403)
+++ releases/WebKitGTK/webkit-2.18/Source/WebCore/loader/PolicyChecker.h 2017-10-16 13:34:17 UTC (rev 223404)
@@ -71,13 +71,6 @@
bool delegateIsDecidingNavigationPolicy() const { return m_delegateIsDecidingNavigationPolicy; }
bool delegateIsHandlingUnimplementablePolicy() const { return m_delegateIsHandlingUnimplementablePolicy; }
- // FIXME: This function is a cheat. Basically, this is just an asynchronouc callback
- // from the FrameLoaderClient, but this callback uses the policy types and so has to
- // live on this object. In the long term, we should create a type for non-policy
- // callbacks from the FrameLoaderClient and remove this vestige. I just don't have
- // the heart to hack on all the platforms to make that happen right now.
- void continueLoadAfterWillSubmitForm(PolicyAction);
-
#if ENABLE(CONTENT_FILTERING)
void setContentFilterUnblockHandler(ContentFilterUnblockHandler unblockHandler) { m_contentFilterUnblockHandler = WTFMove(unblockHandler); }
#endif
Modified: releases/WebKitGTK/webkit-2.18/Source/WebKit/ChangeLog (223403 => 223404)
--- releases/WebKitGTK/webkit-2.18/Source/WebKit/ChangeLog 2017-10-16 13:28:18 UTC (rev 223403)
+++ releases/WebKitGTK/webkit-2.18/Source/WebKit/ChangeLog 2017-10-16 13:34:17 UTC (rev 223404)
@@ -1,3 +1,43 @@
+2017-09-25 Alex Christensen <achristen...@webkit.org>
+
+ Separate form submission from PolicyChecker infrastructure
+ https://bugs.webkit.org/show_bug.cgi?id=177396
+
+ Reviewed by Geoffrey Garen.
+
+ * UIProcess/API/APIFormClient.h:
+ (API::FormClient::willSubmitForm):
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView _setInputDelegate:]):
+ * UIProcess/WebFormClient.cpp:
+ (WebKit::WebFormClient::willSubmitForm):
+ * UIProcess/WebFormClient.h:
+ * UIProcess/WebFormSubmissionListenerProxy.cpp:
+ (WebKit::WebFormSubmissionListenerProxy::continueSubmission):
+ (WebKit::WebFormSubmissionListenerProxy::WebFormSubmissionListenerProxy): Deleted.
+ * UIProcess/WebFormSubmissionListenerProxy.h:
+ (WebKit::WebFormSubmissionListenerProxy::create):
+ (WebKit::WebFormSubmissionListenerProxy::WebFormSubmissionListenerProxy):
+ (): Deleted.
+ (WebKit::WebFormSubmissionListenerProxy::operator new): Deleted.
+ * UIProcess/WebFrameProxy.cpp:
+ (WebKit::WebFrameProxy::setUpFormSubmissionListenerProxy): Deleted.
+ * UIProcess/WebFrameProxy.h:
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::willSubmitForm):
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction):
+ (WebKit::WebFrameLoaderClient::dispatchWillSubmitForm):
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
+ * WebProcess/WebPage/WebFrame.cpp:
+ (WebKit::WebFrame::setUpWillSubmitFormListener):
+ (WebKit::WebFrame::continueWillSubmitForm):
+ * WebProcess/WebPage/WebFrame.h:
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::continueWillSubmitForm):
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/WebPage.messages.in:
+
2017-09-24 Michael Catanzaro <mcatanz...@igalia.com>
[GTK] Unreviewed, move webkit_hit_test_result_context_is_scrollbar in documentation
Modified: releases/WebKitGTK/webkit-2.18/Source/WebKit/UIProcess/API/APIFormClient.h (223403 => 223404)
--- releases/WebKitGTK/webkit-2.18/Source/WebKit/UIProcess/API/APIFormClient.h 2017-10-16 13:28:18 UTC (rev 223403)
+++ releases/WebKitGTK/webkit-2.18/Source/WebKit/UIProcess/API/APIFormClient.h 2017-10-16 13:34:17 UTC (rev 223404)
@@ -23,11 +23,10 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef APIFormClient_h
-#define APIFormClient_h
+#pragma once
-#include "WebFormSubmissionListenerProxy.h"
#include <wtf/Forward.h>
+#include <wtf/Function.h>
#include <wtf/Vector.h>
namespace WebKit {
@@ -42,12 +41,10 @@
public:
virtual ~FormClient() { }
- virtual void willSubmitForm(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, WebKit::WebFrameProxy&, const Vector<std::pair<WTF::String, WTF::String>>&, API::Object*, Ref<WebKit::WebFormSubmissionListenerProxy>&& listener)
+ virtual void willSubmitForm(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, WebKit::WebFrameProxy&, const Vector<std::pair<WTF::String, WTF::String>>&, API::Object*, WTF::Function<void(void)>&& completionHandler)
{
- listener->continueSubmission();
+ completionHandler();
}
};
} // namespace API
-
-#endif // APIFormClient_h
Modified: releases/WebKitGTK/webkit-2.18/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (223403 => 223404)
--- releases/WebKitGTK/webkit-2.18/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2017-10-16 13:28:18 UTC (rev 223403)
+++ releases/WebKitGTK/webkit-2.18/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2017-10-16 13:34:17 UTC (rev 223404)
@@ -71,7 +71,6 @@
#import "WKWebsiteDataStoreInternal.h"
#import "WebBackForwardList.h"
#import "WebCertificateInfo.h"
-#import "WebFormSubmissionListenerProxy.h"
#import "WebFullScreenManagerProxy.h"
#import "WebKitSystemInterface.h"
#import "WebPageGroup.h"
@@ -4358,12 +4357,12 @@
virtual ~FormClient() { }
- void willSubmitForm(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, WebKit::WebFrameProxy& sourceFrame, const Vector<std::pair<WTF::String, WTF::String>>& textFieldValues, API::Object* userData, Ref<WebKit::WebFormSubmissionListenerProxy>&& listener) override
+ void willSubmitForm(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, WebKit::WebFrameProxy& sourceFrame, const Vector<std::pair<WTF::String, WTF::String>>& textFieldValues, API::Object* userData, WTF::Function<void(void)>&& completionHandler) override
{
if (userData && userData->type() != API::Object::Type::Data) {
ASSERT(!userData || userData->type() == API::Object::Type::Data);
m_webView->_page->process().connection()->markCurrentlyDispatchedMessageAsInvalid();
- listener->continueSubmission();
+ completionHandler();
return;
}
@@ -4370,7 +4369,7 @@
auto inputDelegate = m_webView->_inputDelegate.get();
if (![inputDelegate respondsToSelector:@selector(_webView:willSubmitFormValues:userObject:submissionHandler:)]) {
- listener->continueSubmission();
+ completionHandler();
return;
}
@@ -4390,14 +4389,13 @@
}
}
- RefPtr<WebKit::WebFormSubmissionListenerProxy> localListener = WTFMove(listener);
- RefPtr<WebKit::CompletionHandlerCallChecker> checker = WebKit::CompletionHandlerCallChecker::create(inputDelegate.get(), @selector(_webView:willSubmitFormValues:userObject:submissionHandler:));
- [inputDelegate _webView:m_webView willSubmitFormValues:valueMap.get() userObject:userObject submissionHandler:[localListener, checker] {
+ auto checker = WebKit::CompletionHandlerCallChecker::create(inputDelegate.get(), @selector(_webView:willSubmitFormValues:userObject:submissionHandler:));
+ [inputDelegate _webView:m_webView willSubmitFormValues:valueMap.get() userObject:userObject submissionHandler:BlockPtr<void(void)>::fromCallable([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)] {
if (checker->completionHandlerHasBeenCalled())
return;
checker->didCallCompletionHandler();
- localListener->continueSubmission();
- }];
+ completionHandler();
+ }).get()];
}
private:
Modified: releases/WebKitGTK/webkit-2.18/Source/WebKit/UIProcess/API/glib/WebKitFormClient.cpp (223403 => 223404)
--- releases/WebKitGTK/webkit-2.18/Source/WebKit/UIProcess/API/glib/WebKitFormClient.cpp 2017-10-16 13:28:18 UTC (rev 223403)
+++ releases/WebKitGTK/webkit-2.18/Source/WebKit/UIProcess/API/glib/WebKitFormClient.cpp 2017-10-16 13:34:17 UTC (rev 223404)
@@ -37,9 +37,9 @@
}
private:
- void willSubmitForm(WebPageProxy&, WebFrameProxy&, WebFrameProxy&, const Vector<std::pair<String, String>>& values, API::Object*, Ref<WebFormSubmissionListenerProxy>&& listener) override
+ void willSubmitForm(WebPageProxy&, WebFrameProxy&, WebFrameProxy&, const Vector<std::pair<String, String>>& values, API::Object*, WTF::Function<void(void)>&& completionHandler) override
{
- GRefPtr<WebKitFormSubmissionRequest> request = adoptGRef(webkitFormSubmissionRequestCreate(values, WTFMove(listener)));
+ GRefPtr<WebKitFormSubmissionRequest> request = adoptGRef(webkitFormSubmissionRequestCreate(values, WebFormSubmissionListenerProxy::create(WTFMove(completionHandler))));
webkitWebViewSubmitFormRequest(m_webView, request.get());
}
Modified: releases/WebKitGTK/webkit-2.18/Source/WebKit/UIProcess/WebFormClient.cpp (223403 => 223404)
--- releases/WebKitGTK/webkit-2.18/Source/WebKit/UIProcess/WebFormClient.cpp 2017-10-16 13:28:18 UTC (rev 223403)
+++ releases/WebKitGTK/webkit-2.18/Source/WebKit/UIProcess/WebFormClient.cpp 2017-10-16 13:34:17 UTC (rev 223404)
@@ -39,10 +39,10 @@
initialize(wkClient);
}
-void WebFormClient::willSubmitForm(WebPageProxy& page, WebFrameProxy& frame, WebFrameProxy& sourceFrame, const Vector<std::pair<String, String>>& textFieldValues, API::Object* userData, Ref<WebFormSubmissionListenerProxy>&& listener)
+void WebFormClient::willSubmitForm(WebPageProxy& page, WebFrameProxy& frame, WebFrameProxy& sourceFrame, const Vector<std::pair<String, String>>& textFieldValues, API::Object* userData, WTF::Function<void(void)>&& completionHandler)
{
if (!m_client.willSubmitForm) {
- listener->continueSubmission();
+ completionHandler();
return;
}
@@ -49,8 +49,9 @@
API::Dictionary::MapType map;
for (size_t i = 0; i < textFieldValues.size(); ++i)
map.set(textFieldValues[i].first, API::String::create(textFieldValues[i].second));
- Ref<API::Dictionary> textFieldsMap = API::Dictionary::create(WTFMove(map));
- m_client.willSubmitForm(toAPI(&page), toAPI(&frame), toAPI(&sourceFrame), toAPI(textFieldsMap.ptr()), toAPI(userData), toAPI(&listener.get()), m_client.base.clientInfo);
+ auto textFieldsMap = API::Dictionary::create(WTFMove(map));
+ auto listener = WebFormSubmissionListenerProxy::create(WTFMove(completionHandler));
+ m_client.willSubmitForm(toAPI(&page), toAPI(&frame), toAPI(&sourceFrame), toAPI(textFieldsMap.ptr()), toAPI(userData), toAPI(listener.ptr()), m_client.base.clientInfo);
}
} // namespace WebKit
Modified: releases/WebKitGTK/webkit-2.18/Source/WebKit/UIProcess/WebFormClient.h (223403 => 223404)
--- releases/WebKitGTK/webkit-2.18/Source/WebKit/UIProcess/WebFormClient.h 2017-10-16 13:28:18 UTC (rev 223403)
+++ releases/WebKitGTK/webkit-2.18/Source/WebKit/UIProcess/WebFormClient.h 2017-10-16 13:34:17 UTC (rev 223404)
@@ -23,8 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WebFormClient_h
-#define WebFormClient_h
+#pragma once
#include "APIClient.h"
#include "APIFormClient.h"
@@ -42,9 +41,7 @@
public:
explicit WebFormClient(const WKPageFormClientBase*);
- void willSubmitForm(WebPageProxy&, WebFrameProxy&, WebFrameProxy&, const Vector<std::pair<String, String>>& textFieldValues, API::Object* userData, Ref<WebFormSubmissionListenerProxy>&&) override;
+ void willSubmitForm(WebPageProxy&, WebFrameProxy&, WebFrameProxy&, const Vector<std::pair<String, String>>& textFieldValues, API::Object* userData, WTF::Function<void(void)>&&) override;
};
} // namespace WebKit
-
-#endif // WebFormClient_h
Modified: releases/WebKitGTK/webkit-2.18/Source/WebKit/UIProcess/WebFormSubmissionListenerProxy.cpp (223403 => 223404)
--- releases/WebKitGTK/webkit-2.18/Source/WebKit/UIProcess/WebFormSubmissionListenerProxy.cpp 2017-10-16 13:28:18 UTC (rev 223403)
+++ releases/WebKitGTK/webkit-2.18/Source/WebKit/UIProcess/WebFormSubmissionListenerProxy.cpp 2017-10-16 13:34:17 UTC (rev 223404)
@@ -30,14 +30,10 @@
namespace WebKit {
-WebFormSubmissionListenerProxy::WebFormSubmissionListenerProxy(WebFrameProxy* frame, uint64_t listenerID)
- : WebFrameListenerProxy(frame, listenerID)
-{
-}
-
void WebFormSubmissionListenerProxy::continueSubmission()
{
- receivedPolicyDecision(WebCore::PolicyUse, { });
+ if (auto completionHandler = std::exchange(m_completionHandler, nullptr))
+ completionHandler();
}
} // namespace WebKit
Modified: releases/WebKitGTK/webkit-2.18/Source/WebKit/UIProcess/WebFormSubmissionListenerProxy.h (223403 => 223404)
--- releases/WebKitGTK/webkit-2.18/Source/WebKit/UIProcess/WebFormSubmissionListenerProxy.h 2017-10-16 13:28:18 UTC (rev 223403)
+++ releases/WebKitGTK/webkit-2.18/Source/WebKit/UIProcess/WebFormSubmissionListenerProxy.h 2017-10-16 13:34:17 UTC (rev 223404)
@@ -23,44 +23,28 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WebFormSubmissionListenerProxy_h
-#define WebFormSubmissionListenerProxy_h
+#pragma once
#include "WebFrameListenerProxy.h"
-#if PLATFORM(COCOA)
-#include "WKFoundation.h"
-#endif
-
-#define DELEGATE_REF_COUNTING_TO_COCOA (PLATFORM(COCOA) && WK_API_ENABLED)
-
namespace WebKit {
class WebFrameProxy;
-class WebFormSubmissionListenerProxy : public WebFrameListenerProxy {
+class WebFormSubmissionListenerProxy : public API::ObjectImpl<API::Object::Type::FormSubmissionListener> {
public:
- static const Type APIType = Type::FormSubmissionListener;
-
- static Ref<WebFormSubmissionListenerProxy> create(WebFrameProxy* frame, uint64_t listenerID)
+ static Ref<WebFormSubmissionListenerProxy> create(WTF::Function<void(void)>&& completionHandler)
{
- return adoptRef(*new WebFormSubmissionListenerProxy(frame, listenerID));
+ return adoptRef(*new WebFormSubmissionListenerProxy(WTFMove(completionHandler)));
}
void continueSubmission();
private:
- WebFormSubmissionListenerProxy(WebFrameProxy*, uint64_t listenerID);
-
- Type type() const override { return APIType; }
-
-#if DELEGATE_REF_COUNTING_TO_COCOA
- void* operator new(size_t size) { return newObject(size, APIType); }
-#endif
+ WebFormSubmissionListenerProxy(WTF::Function<void(void)>&& completionHandler)
+ : m_completionHandler(WTFMove(completionHandler))
+ { }
+ WTF::Function<void(void)> m_completionHandler;
};
} // namespace WebKit
-
-#undef DELEGATE_REF_COUNTING_TO_COCOA
-
-#endif // WebFramePolicyListenerProxy_h
Modified: releases/WebKitGTK/webkit-2.18/Source/WebKit/UIProcess/WebFrameProxy.cpp (223403 => 223404)
--- releases/WebKitGTK/webkit-2.18/Source/WebKit/UIProcess/WebFrameProxy.cpp 2017-10-16 13:28:18 UTC (rev 223403)
+++ releases/WebKitGTK/webkit-2.18/Source/WebKit/UIProcess/WebFrameProxy.cpp 2017-10-16 13:34:17 UTC (rev 223404)
@@ -27,7 +27,6 @@
#include "WebFrameProxy.h"
#include "WebCertificateInfo.h"
-#include "WebFormSubmissionListenerProxy.h"
#include "WebFramePolicyListenerProxy.h"
#include "WebPageMessages.h"
#include "WebPageProxy.h"
@@ -194,14 +193,6 @@
return *static_cast<WebFramePolicyListenerProxy*>(m_activeListener.get());
}
-WebFormSubmissionListenerProxy& WebFrameProxy::setUpFormSubmissionListenerProxy(uint64_t listenerID)
-{
- if (m_activeListener)
- m_activeListener->invalidate();
- m_activeListener = WebFormSubmissionListenerProxy::create(this, listenerID);
- return *static_cast<WebFormSubmissionListenerProxy*>(m_activeListener.get());
-}
-
void WebFrameProxy::getWebArchive(Function<void (API::Data*, CallbackBase::Error)>&& callbackFunction)
{
if (!m_page) {
Modified: releases/WebKitGTK/webkit-2.18/Source/WebKit/UIProcess/WebFrameProxy.h (223403 => 223404)
--- releases/WebKitGTK/webkit-2.18/Source/WebKit/UIProcess/WebFrameProxy.h 2017-10-16 13:28:18 UTC (rev 223403)
+++ releases/WebKitGTK/webkit-2.18/Source/WebKit/UIProcess/WebFrameProxy.h 2017-10-16 13:34:17 UTC (rev 223404)
@@ -49,7 +49,6 @@
namespace WebKit {
class WebCertificateInfo;
-class WebFormSubmissionListenerProxy;
class WebFramePolicyListenerProxy;
class WebPageProxy;
struct WebsitePolicies;
@@ -117,7 +116,6 @@
// Policy operations.
void receivedPolicyDecision(WebCore::PolicyAction, uint64_t listenerID, API::Navigation*, const WebsitePolicies&);
WebFramePolicyListenerProxy& setUpPolicyListenerProxy(uint64_t listenerID);
- WebFormSubmissionListenerProxy& setUpFormSubmissionListenerProxy(uint64_t listenerID);
#if ENABLE(CONTENT_FILTERING)
void contentFilterDidBlockLoad(WebCore::ContentFilterUnblockHandler contentFilterUnblockHandler) { m_contentFilterUnblockHandler = WTFMove(contentFilterUnblockHandler); }
Modified: releases/WebKitGTK/webkit-2.18/Source/WebKit/UIProcess/WebPageProxy.cpp (223403 => 223404)
--- releases/WebKitGTK/webkit-2.18/Source/WebKit/UIProcess/WebPageProxy.cpp 2017-10-16 13:28:18 UTC (rev 223403)
+++ releases/WebKitGTK/webkit-2.18/Source/WebKit/UIProcess/WebPageProxy.cpp 2017-10-16 13:34:17 UTC (rev 223404)
@@ -88,7 +88,6 @@
#include "WebEditCommandProxy.h"
#include "WebEvent.h"
#include "WebEventConversion.h"
-#include "WebFormSubmissionListenerProxy.h"
#include "WebFramePolicyListenerProxy.h"
#include "WebFullScreenManagerProxy.h"
#include "WebFullScreenManagerProxyMessages.h"
@@ -3761,8 +3760,9 @@
WebFrameProxy* sourceFrame = m_process->webFrame(sourceFrameID);
MESSAGE_CHECK(sourceFrame);
- Ref<WebFormSubmissionListenerProxy> listener = frame->setUpFormSubmissionListenerProxy(listenerID);
- m_formClient->willSubmitForm(*this, *frame, *sourceFrame, textFieldValues, m_process->transformHandlesToObjects(userData.object()).get(), listener.get());
+ m_formClient->willSubmitForm(*this, *frame, *sourceFrame, textFieldValues, m_process->transformHandlesToObjects(userData.object()).get(), [this, protectedThis = makeRef(*this), frameID, listenerID]() {
+ m_process->send(Messages::WebPage::ContinueWillSubmitForm(frameID, listenerID), m_pageID);
+ });
}
void WebPageProxy::didNavigateWithNavigationData(const WebNavigationDataStore& store, uint64_t frameID)
Modified: releases/WebKitGTK/webkit-2.18/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (223403 => 223404)
--- releases/WebKitGTK/webkit-2.18/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2017-10-16 13:28:18 UTC (rev 223403)
+++ releases/WebKitGTK/webkit-2.18/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2017-10-16 13:34:17 UTC (rev 223404)
@@ -739,7 +739,6 @@
return;
}
-
uint64_t listenerID = m_frame->setUpPolicyListener(WTFMove(function));
NavigationActionData navigationActionData;
@@ -896,7 +895,7 @@
webPage->injectedBundleFormClient().willSendSubmitEvent(webPage, &form, m_frame, sourceFrame, formState->textFieldValues());
}
-void WebFrameLoaderClient::dispatchWillSubmitForm(FormState& formState, FramePolicyFunction&& function)
+void WebFrameLoaderClient::dispatchWillSubmitForm(FormState& formState, WTF::Function<void(void)>&& function)
{
WebPage* webPage = m_frame->page();
if (!webPage)
@@ -912,7 +911,7 @@
RefPtr<API::Object> userData;
webPage->injectedBundleFormClient().willSubmitForm(webPage, &form, m_frame, sourceFrame, values, userData);
- uint64_t listenerID = m_frame->setUpPolicyListener(WTFMove(function));
+ uint64_t listenerID = m_frame->setUpWillSubmitFormListener(WTFMove(function));
webPage->send(Messages::WebPageProxy::WillSubmitForm(m_frame->frameID(), sourceFrame->frameID(), values, listenerID, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
}
Modified: releases/WebKitGTK/webkit-2.18/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h (223403 => 223404)
--- releases/WebKitGTK/webkit-2.18/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h 2017-10-16 13:28:18 UTC (rev 223403)
+++ releases/WebKitGTK/webkit-2.18/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h 2017-10-16 13:34:17 UTC (rev 223404)
@@ -119,7 +119,7 @@
void dispatchUnableToImplementPolicy(const WebCore::ResourceError&) final;
void dispatchWillSendSubmitEvent(Ref<WebCore::FormState>&&) final;
- void dispatchWillSubmitForm(WebCore::FormState&, WebCore::FramePolicyFunction&&) final;
+ void dispatchWillSubmitForm(WebCore::FormState&, WTF::Function<void(void)>&&) final;
void revertToProvisionalState(WebCore::DocumentLoader*) final;
void setMainDocumentError(WebCore::DocumentLoader*, const WebCore::ResourceError&) final;
Modified: releases/WebKitGTK/webkit-2.18/Source/WebKit/WebProcess/WebPage/WebFrame.cpp (223403 => 223404)
--- releases/WebKitGTK/webkit-2.18/Source/WebKit/WebProcess/WebPage/WebFrame.cpp 2017-10-16 13:28:18 UTC (rev 223403)
+++ releases/WebKitGTK/webkit-2.18/Source/WebKit/WebProcess/WebPage/WebFrame.cpp 2017-10-16 13:34:17 UTC (rev 223404)
@@ -220,6 +220,19 @@
return m_policyListenerID;
}
+uint64_t WebFrame::setUpWillSubmitFormListener(WTF::Function<void(void)>&& completionHandler)
+{
+ uint64_t identifier = generateListenerID();
+ m_willSubmitFormCompletionHandlers.set(identifier, WTFMove(completionHandler));
+ return identifier;
+}
+
+void WebFrame::continueWillSubmitForm(uint64_t listenerID)
+{
+ if (auto completionHandler = m_willSubmitFormCompletionHandlers.take(listenerID))
+ completionHandler();
+}
+
void WebFrame::invalidatePolicyListener()
{
if (!m_policyListenerID)
Modified: releases/WebKitGTK/webkit-2.18/Source/WebKit/WebProcess/WebPage/WebFrame.h (223403 => 223404)
--- releases/WebKitGTK/webkit-2.18/Source/WebKit/WebProcess/WebPage/WebFrame.h 2017-10-16 13:28:18 UTC (rev 223403)
+++ releases/WebKitGTK/webkit-2.18/Source/WebKit/WebProcess/WebPage/WebFrame.h 2017-10-16 13:34:17 UTC (rev 223404)
@@ -83,6 +83,9 @@
void invalidatePolicyListener();
void didReceivePolicyDecision(uint64_t listenerID, WebCore::PolicyAction, uint64_t navigationID, DownloadID);
+ uint64_t setUpWillSubmitFormListener(WTF::Function<void(void)>&&);
+ void continueWillSubmitForm(uint64_t);
+
void startDownload(const WebCore::ResourceRequest&, const String& suggestedName = { });
void convertMainResourceLoadToDownload(WebCore::DocumentLoader*, WebCore::SessionID, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&);
@@ -171,6 +174,7 @@
uint64_t m_policyListenerID { 0 };
WebCore::FramePolicyFunction m_policyFunction;
+ HashMap<uint64_t, WTF::Function<void(void)>> m_willSubmitFormCompletionHandlers;
DownloadID m_policyDownloadID { 0 };
std::unique_ptr<WebFrameLoaderClient> m_frameLoaderClient;
Modified: releases/WebKitGTK/webkit-2.18/Source/WebKit/WebProcess/WebPage/WebPage.cpp (223403 => 223404)
--- releases/WebKitGTK/webkit-2.18/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2017-10-16 13:28:18 UTC (rev 223403)
+++ releases/WebKitGTK/webkit-2.18/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2017-10-16 13:34:17 UTC (rev 223404)
@@ -2724,6 +2724,14 @@
frame->didReceivePolicyDecision(listenerID, static_cast<PolicyAction>(policyAction), navigationID, downloadID);
}
+void WebPage::continueWillSubmitForm(uint64_t frameID, uint64_t listenerID)
+{
+ WebFrame* frame = WebProcess::singleton().webFrame(frameID);
+ if (!frame)
+ return;
+ frame->continueWillSubmitForm(listenerID);
+}
+
void WebPage::didStartPageTransition()
{
m_drawingArea->setLayerTreeStateIsFrozen(true);
Modified: releases/WebKitGTK/webkit-2.18/Source/WebKit/WebProcess/WebPage/WebPage.h (223403 => 223404)
--- releases/WebKitGTK/webkit-2.18/Source/WebKit/WebProcess/WebPage/WebPage.h 2017-10-16 13:28:18 UTC (rev 223403)
+++ releases/WebKitGTK/webkit-2.18/Source/WebKit/WebProcess/WebPage/WebPage.h 2017-10-16 13:34:17 UTC (rev 223404)
@@ -1128,6 +1128,7 @@
void updatePreferences(const WebPreferencesStore&);
void didReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction, uint64_t navigationID, const DownloadID&);
+ void continueWillSubmitForm(uint64_t frameID, uint64_t listenerID);
void setUserAgent(const String&);
void setCustomTextEncodingName(const String&);
void suspendActiveDOMObjectsAndAnimations();
Modified: releases/WebKitGTK/webkit-2.18/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (223403 => 223404)
--- releases/WebKitGTK/webkit-2.18/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2017-10-16 13:28:18 UTC (rev 223403)
+++ releases/WebKitGTK/webkit-2.18/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2017-10-16 13:34:17 UTC (rev 223404)
@@ -151,6 +151,7 @@
UpdateWebsitePolicies(struct WebKit::WebsitePolicies websitePolicies)
DidReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction, uint64_t navigationID, WebKit::DownloadID downloadID)
+ ContinueWillSubmitForm(uint64_t frameID, uint64_t listenerID)
ClearSelection()
RestoreSelectionInFocusedEditableElement()
Modified: releases/WebKitGTK/webkit-2.18/Source/WebKitLegacy/mac/ChangeLog (223403 => 223404)
--- releases/WebKitGTK/webkit-2.18/Source/WebKitLegacy/mac/ChangeLog 2017-10-16 13:28:18 UTC (rev 223403)
+++ releases/WebKitGTK/webkit-2.18/Source/WebKitLegacy/mac/ChangeLog 2017-10-16 13:34:17 UTC (rev 223404)
@@ -1,3 +1,14 @@
+2017-09-25 Alex Christensen <achristen...@webkit.org>
+
+ Separate form submission from PolicyChecker infrastructure
+ https://bugs.webkit.org/show_bug.cgi?id=177396
+
+ Reviewed by Geoffrey Garen.
+
+ * WebCoreSupport/WebFrameLoaderClient.h:
+ * WebCoreSupport/WebFrameLoaderClient.mm:
+ (WebFrameLoaderClient::dispatchWillSubmitForm):
+
2017-08-14 Simon Fraser <simon.fra...@apple.com>
Remove Proximity Events and related code
Modified: releases/WebKitGTK/webkit-2.18/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.h (223403 => 223404)
--- releases/WebKitGTK/webkit-2.18/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.h 2017-10-16 13:28:18 UTC (rev 223403)
+++ releases/WebKitGTK/webkit-2.18/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.h 2017-10-16 13:34:17 UTC (rev 223404)
@@ -126,7 +126,7 @@
void dispatchUnableToImplementPolicy(const WebCore::ResourceError&) final;
void dispatchWillSendSubmitEvent(Ref<WebCore::FormState>&&) final;
- void dispatchWillSubmitForm(WebCore::FormState&, WebCore::FramePolicyFunction&&) final;
+ void dispatchWillSubmitForm(WebCore::FormState&, WTF::Function<void(void)>&&) final;
void revertToProvisionalState(WebCore::DocumentLoader*) final;
void setMainDocumentError(WebCore::DocumentLoader*, const WebCore::ResourceError&) final;
Modified: releases/WebKitGTK/webkit-2.18/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm (223403 => 223404)
--- releases/WebKitGTK/webkit-2.18/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm 2017-10-16 13:28:18 UTC (rev 223403)
+++ releases/WebKitGTK/webkit-2.18/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm 2017-10-16 13:34:17 UTC (rev 223404)
@@ -937,16 +937,16 @@
CallFormDelegate(getWebView(m_webFrame.get()), @selector(willSendSubmitEventToForm:inFrame:withValues:), formElement, m_webFrame.get(), values);
}
-void WebFrameLoaderClient::dispatchWillSubmitForm(FormState& formState, FramePolicyFunction&& function)
+void WebFrameLoaderClient::dispatchWillSubmitForm(FormState& formState, WTF::Function<void(void)>&& function)
{
id <WebFormDelegate> formDelegate = [getWebView(m_webFrame.get()) _formDelegate];
if (!formDelegate) {
- function(PolicyUse);
+ function();
return;
}
NSDictionary *values = makeFormFieldValuesDictionary(formState);
- CallFormDelegate(getWebView(m_webFrame.get()), @selector(frame:sourceFrame:willSubmitForm:withValues:submissionListener:), m_webFrame.get(), kit(formState.sourceDocument().frame()), kit(&formState.form()), values, setUpPolicyListener(WTFMove(function)).get());
+ CallFormDelegate(getWebView(m_webFrame.get()), @selector(frame:sourceFrame:willSubmitForm:withValues:submissionListener:), m_webFrame.get(), kit(formState.sourceDocument().frame()), kit(&formState.form()), values, setUpPolicyListener([function = WTFMove(function)](PolicyAction) { function(); }).get());
}
void WebFrameLoaderClient::revertToProvisionalState(DocumentLoader* loader)
Modified: releases/WebKitGTK/webkit-2.18/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp (223403 => 223404)
--- releases/WebKitGTK/webkit-2.18/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp 2017-10-16 13:28:18 UTC (rev 223403)
+++ releases/WebKitGTK/webkit-2.18/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp 2017-10-16 13:34:17 UTC (rev 223404)
@@ -583,7 +583,7 @@
{
}
-void WebFrameLoaderClient::dispatchWillSubmitForm(FormState& formState, FramePolicyFunction&& function)
+void WebFrameLoaderClient::dispatchWillSubmitForm(FormState& formState, WTF::Function<void(void)>&& function)
{
WebView* webView = m_webFrame->webView();
Frame* coreFrame = core(m_webFrame);
@@ -592,7 +592,7 @@
COMPtr<IWebFormDelegate> formDelegate;
if (FAILED(webView->formDelegate(&formDelegate))) {
- function(PolicyUse);
+ function();
return;
}
@@ -607,11 +607,11 @@
COMPtr<IPropertyBag> formValuesPropertyBag(AdoptCOM, COMPropertyBag<String>::createInstance(formValuesMap));
COMPtr<WebFrame> sourceFrame(kit(formState.sourceDocument().frame()));
- if (SUCCEEDED(formDelegate->willSubmitForm(m_webFrame, sourceFrame.get(), formElement.get(), formValuesPropertyBag.get(), setUpPolicyListener(WTFMove(function)).get())))
+ if (SUCCEEDED(formDelegate->willSubmitForm(m_webFrame, sourceFrame.get(), formElement.get(), formValuesPropertyBag.get(), setUpPolicyListener([function = WTFMove(function)] (PolicyAction) { function(); }).get())))
return;
// FIXME: Add a sane default implementation
- function(PolicyUse);
+ function();
}
void WebFrameLoaderClient::setMainDocumentError(DocumentLoader*, const ResourceError& error)
Modified: releases/WebKitGTK/webkit-2.18/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.h (223403 => 223404)
--- releases/WebKitGTK/webkit-2.18/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.h 2017-10-16 13:28:18 UTC (rev 223403)
+++ releases/WebKitGTK/webkit-2.18/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.h 2017-10-16 13:34:17 UTC (rev 223404)
@@ -104,7 +104,7 @@
void dispatchUnableToImplementPolicy(const WebCore::ResourceError&) override;
void dispatchWillSendSubmitEvent(Ref<WebCore::FormState>&&) override;
- void dispatchWillSubmitForm(WebCore::FormState&, WebCore::FramePolicyFunction&&) override;
+ void dispatchWillSubmitForm(WebCore::FormState&, WTF::Function<void(void)>&&) override;
void revertToProvisionalState(WebCore::DocumentLoader*) override;
bool dispatchDidLoadResourceFromMemoryCache(WebCore::DocumentLoader*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&, int length) override;