Title: [281606] trunk/Source/WebKit
Revision
281606
Author
[email protected]
Date
2021-08-25 17:39:38 -0700 (Wed, 25 Aug 2021)

Log Message

Replace the uint64_t used to identify form submits with a strongly typed identifier
https://bugs.webkit.org/show_bug.cgi?id=229513

Reviewed by Alex Christensen.

Introduce FormSubmitListenerIdentifier and use it in place of a uint64_t.

* Scripts/webkit/messages.py:
(types_that_cannot_be_forward_declared):
(headers_for_type):
* Shared/IdentifierTypes.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::willSubmitForm):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchWillSubmitForm):
* 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:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (281605 => 281606)


--- trunk/Source/WebKit/ChangeLog	2021-08-26 00:01:36 UTC (rev 281605)
+++ trunk/Source/WebKit/ChangeLog	2021-08-26 00:39:38 UTC (rev 281606)
@@ -1,3 +1,31 @@
+2021-08-25  Simon Fraser  <[email protected]>
+
+        Replace the uint64_t used to identify form submits with a strongly typed identifier
+        https://bugs.webkit.org/show_bug.cgi?id=229513
+
+        Reviewed by Alex Christensen.
+
+        Introduce FormSubmitListenerIdentifier and use it in place of a uint64_t.
+
+        * Scripts/webkit/messages.py:
+        (types_that_cannot_be_forward_declared):
+        (headers_for_type):
+        * Shared/IdentifierTypes.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::willSubmitForm):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::dispatchWillSubmitForm):
+        * 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:
+
 2021-08-25  Wenson Hsieh  <[email protected]>
 
         [iOS] Visual Look Up animates from the wrong rect when the web view is scaled

Modified: trunk/Source/WebKit/Scripts/webkit/messages.py (281605 => 281606)


--- trunk/Source/WebKit/Scripts/webkit/messages.py	2021-08-26 00:01:36 UTC (rev 281605)
+++ trunk/Source/WebKit/Scripts/webkit/messages.py	2021-08-26 00:39:38 UTC (rev 281606)
@@ -314,6 +314,7 @@
         'WebKit::ContentWorldIdentifier',
         'WebKit::DisplayLinkObserverID',
         'WebKit::DownloadID',
+        'WebKit::FormSubmitListenerIdentifier',
         'WebKit::GeolocationIdentifier',
         'WebKit::GraphicsContextGLIdentifier',
         'WebKit::ImageBufferBackendHandle',
@@ -775,6 +776,7 @@
         'WebKit::ContentWorldIdentifier': ['"ContentWorldShared.h"'],
         'WebKit::DocumentEditingContextRequest': ['"DocumentEditingContext.h"'],
         'WebKit::FindOptions': ['"WebFindOptions.h"'],
+        'WebKit::FormSubmitListenerIdentifier': ['"IdentifierTypes.h"'],
         'WebKit::GestureRecognizerState': ['"GestureTypes.h"'],
         'WebKit::GestureType': ['"GestureTypes.h"'],
         'WebKit::LastNavigationWasAppInitiated': ['"AppPrivacyReport.h"'],

Modified: trunk/Source/WebKit/Shared/IdentifierTypes.h (281605 => 281606)


--- trunk/Source/WebKit/Shared/IdentifierTypes.h	2021-08-26 00:01:36 UTC (rev 281605)
+++ trunk/Source/WebKit/Shared/IdentifierTypes.h	2021-08-26 00:39:38 UTC (rev 281606)
@@ -29,6 +29,9 @@
 
 namespace WebKit {
 
+enum FormSubmitListenerIdentifierType { };
+using FormSubmitListenerIdentifier = ObjectIdentifier<FormSubmitListenerIdentifierType>;
+
 enum PageGroupIdentifierType { };
 using PageGroupIdentifier = ObjectIdentifier<PageGroupIdentifierType>;
 

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (281605 => 281606)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2021-08-26 00:01:36 UTC (rev 281605)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2021-08-26 00:39:38 UTC (rev 281606)
@@ -5686,7 +5686,7 @@
 
 // FormClient
 
-void WebPageProxy::willSubmitForm(FrameIdentifier frameID, FrameIdentifier sourceFrameID, const Vector<std::pair<String, String>>& textFieldValues, uint64_t listenerID, const UserData& userData)
+void WebPageProxy::willSubmitForm(FrameIdentifier frameID, FrameIdentifier sourceFrameID, const Vector<std::pair<String, String>>& textFieldValues, FormSubmitListenerIdentifier listenerID, const UserData& userData)
 {
     WebFrameProxy* frame = m_process->webFrame(frameID);
     MESSAGE_CHECK(m_process, frame);

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (281605 => 281606)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.h	2021-08-26 00:01:36 UTC (rev 281605)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h	2021-08-26 00:39:38 UTC (rev 281606)
@@ -2066,7 +2066,7 @@
 
     WebContentMode effectiveContentModeAfterAdjustingPolicies(API::WebsitePolicies&, const WebCore::ResourceRequest&);
 
-    void willSubmitForm(WebCore::FrameIdentifier, WebCore::FrameIdentifier sourceFrameID, const Vector<std::pair<String, String>>& textFieldValues, uint64_t listenerID, const UserData&);
+    void willSubmitForm(WebCore::FrameIdentifier, WebCore::FrameIdentifier sourceFrameID, const Vector<std::pair<String, String>>& textFieldValues, FormSubmitListenerIdentifier, const UserData&);
 
     void contentRuleListNotification(URL&&, WebCore::ContentRuleListResults&&);
 

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in (281605 => 281606)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in	2021-08-26 00:01:36 UTC (rev 281605)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in	2021-08-26 00:39:38 UTC (rev 281606)
@@ -161,7 +161,7 @@
     DidFinishLoadingDataForCustomContentProvider(String suggestedFilename, IPC::DataReference data)
 
     # Forms messages
-    WillSubmitForm(WebCore::FrameIdentifier frameID, WebCore::FrameIdentifier sourceFrameID, Vector<std::pair<String, String>> textFieldValues, uint64_t listenerID, WebKit::UserData userData)
+    WillSubmitForm(WebCore::FrameIdentifier frameID, WebCore::FrameIdentifier sourceFrameID, Vector<std::pair<String, String>> textFieldValues, WebKit::FormSubmitListenerIdentifier listenerID, WebKit::UserData userData)
 
 #if PLATFORM(IOS_FAMILY)
     InterpretKeyEvent(struct WebKit::EditorState state, bool isCharEvent) -> (bool handled) Synchronous

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (281605 => 281606)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2021-08-26 00:01:36 UTC (rev 281605)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2021-08-26 00:39:38 UTC (rev 281606)
@@ -1094,7 +1094,7 @@
     RefPtr<API::Object> userData;
     webPage->injectedBundleFormClient().willSubmitForm(webPage, &form, m_frame.ptr(), sourceFrame, values, userData);
 
-    uint64_t listenerID = m_frame->setUpWillSubmitFormListener(WTFMove(completionHandler));
+    auto listenerID = m_frame->setUpWillSubmitFormListener(WTFMove(completionHandler));
 
     webPage->send(Messages::WebPageProxy::WillSubmitForm(m_frame->frameID(), sourceFrame->frameID(), values, listenerID, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
 }

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebFrame.cpp (281605 => 281606)


--- trunk/Source/WebKit/WebProcess/WebPage/WebFrame.cpp	2021-08-26 00:01:36 UTC (rev 281605)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebFrame.cpp	2021-08-26 00:39:38 UTC (rev 281606)
@@ -218,14 +218,14 @@
     return policyListenerID;
 }
 
-uint64_t WebFrame::setUpWillSubmitFormListener(CompletionHandler<void()>&& completionHandler)
+FormSubmitListenerIdentifier WebFrame::setUpWillSubmitFormListener(CompletionHandler<void()>&& completionHandler)
 {
-    uint64_t identifier = generateListenerID();
+    auto identifier = FormSubmitListenerIdentifier::generate();
     m_willSubmitFormCompletionHandlers.set(identifier, WTFMove(completionHandler));
     return identifier;
 }
 
-void WebFrame::continueWillSubmitForm(uint64_t listenerID)
+void WebFrame::continueWillSubmitForm(FormSubmitListenerIdentifier listenerID)
 {
     Ref<WebFrame> protectedThis(*this);
     if (auto completionHandler = m_willSubmitFormCompletionHandlers.take(listenerID))

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebFrame.h (281605 => 281606)


--- trunk/Source/WebKit/WebProcess/WebPage/WebFrame.h	2021-08-26 00:01:36 UTC (rev 281605)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebFrame.h	2021-08-26 00:39:38 UTC (rev 281606)
@@ -27,6 +27,7 @@
 
 #include "APIObject.h"
 #include "DownloadID.h"
+#include "IdentifierTypes.h"
 #include "PolicyDecision.h"
 #include "ShareableBitmap.h"
 #include "TransactionID.h"
@@ -89,8 +90,8 @@
     void invalidatePolicyListeners();
     void didReceivePolicyDecision(uint64_t listenerID, PolicyDecision&&);
 
-    uint64_t setUpWillSubmitFormListener(CompletionHandler<void()>&&);
-    void continueWillSubmitForm(uint64_t);
+    FormSubmitListenerIdentifier setUpWillSubmitFormListener(CompletionHandler<void()>&&);
+    void continueWillSubmitForm(FormSubmitListenerIdentifier);
 
     void startDownload(const WebCore::ResourceRequest&, const String& suggestedName = { });
     void convertMainResourceLoadToDownload(WebCore::DocumentLoader*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&);
@@ -207,7 +208,7 @@
     };
     HashMap<uint64_t, PolicyCheck> m_pendingPolicyChecks;
 
-    HashMap<uint64_t, CompletionHandler<void()>> m_willSubmitFormCompletionHandlers;
+    HashMap<FormSubmitListenerIdentifier, CompletionHandler<void()>> m_willSubmitFormCompletionHandlers;
     std::optional<DownloadID> m_policyDownloadID;
 
     WeakPtr<LoadListener> m_loadListener;

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (281605 => 281606)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2021-08-26 00:01:36 UTC (rev 281605)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2021-08-26 00:39:38 UTC (rev 281606)
@@ -3521,7 +3521,7 @@
     frame->didReceivePolicyDecision(listenerID, WTFMove(policyDecision));
 }
 
-void WebPage::continueWillSubmitForm(FrameIdentifier frameID, uint64_t listenerID)
+void WebPage::continueWillSubmitForm(FrameIdentifier frameID, FormSubmitListenerIdentifier listenerID)
 {
     WebFrame* frame = WebProcess::singleton().webFrame(frameID);
     if (!frame)

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (281605 => 281606)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2021-08-26 00:01:36 UTC (rev 281605)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2021-08-26 00:39:38 UTC (rev 281606)
@@ -1693,7 +1693,7 @@
 #endif
 
     void didReceivePolicyDecision(WebCore::FrameIdentifier, uint64_t listenerID, PolicyDecision&&, const Vector<SandboxExtension::Handle>&);
-    void continueWillSubmitForm(WebCore::FrameIdentifier, uint64_t listenerID);
+    void continueWillSubmitForm(WebCore::FrameIdentifier, FormSubmitListenerIdentifier);
     void setUserAgent(const String&);
     void setCustomTextEncodingName(const String&);
     void suspendActiveDOMObjectsAndAnimations();

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (281605 => 281606)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in	2021-08-26 00:01:36 UTC (rev 281605)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in	2021-08-26 00:39:38 UTC (rev 281606)
@@ -196,7 +196,7 @@
     NotifyUserScripts()
     DidReceivePolicyDecision(WebCore::FrameIdentifier frameID, uint64_t listenerID, struct WebKit::PolicyDecision policyDecision, Vector<WebKit::SandboxExtension::Handle> networkExtensionsSandboxExtensions)
 
-    ContinueWillSubmitForm(WebCore::FrameIdentifier frameID, uint64_t listenerID)
+    ContinueWillSubmitForm(WebCore::FrameIdentifier frameID, WebKit::FormSubmitListenerIdentifier listenerID)
 
     ClearSelection()
     RestoreSelectionInFocusedEditableElement()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to