Title: [229524] releases/WebKitGTK/webkit-2.20
Revision
229524
Author
[email protected]
Date
2018-03-12 02:12:12 -0700 (Mon, 12 Mar 2018)

Log Message

Merge r229461 - [GTK] Do not use WebKitDOMHTMLFormElement as argument of signal WebKitWebPage::will-submit-form
https://bugs.webkit.org/show_bug.cgi?id=183510

Reviewed by Michael Catanzaro.

Source/WebKit:

In 2.22 WebKitDOMHTMLFormElement will be deprecated in GTK+ port and won't still exist in WPE. The new
_javascript_ GLib API will be used to replace most of the DOM API, but a few classes will remain with a minimal
API for things that can't be done with _javascript_. WebKitDOMElement will stay and will be added to WPE as well,
so if we change the signal parameter to WebKitDOMElement we will be able to keep using
WebKitWebPage::will-submit-form without any changes. WPE will gain this signal and the rest of the API that uses
DOM.

* WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp:
(webkit_web_page_class_init):

Tools:

Update the test to use WebKitDOMElement instead and fix a memory leak.

* TestWebKitAPI/Tests/WebKitGLib/WebExtensionTest.cpp:
(handleFormSubmissionCallback):
(willSubmitFormCallback):

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.20/Source/WebKit/ChangeLog (229523 => 229524)


--- releases/WebKitGTK/webkit-2.20/Source/WebKit/ChangeLog	2018-03-12 09:10:23 UTC (rev 229523)
+++ releases/WebKitGTK/webkit-2.20/Source/WebKit/ChangeLog	2018-03-12 09:12:12 UTC (rev 229524)
@@ -1,3 +1,20 @@
+2018-03-09  Carlos Garcia Campos  <[email protected]>
+
+        [GTK] Do not use WebKitDOMHTMLFormElement as argument of signal WebKitWebPage::will-submit-form
+        https://bugs.webkit.org/show_bug.cgi?id=183510
+
+        Reviewed by Michael Catanzaro.
+
+        In 2.22 WebKitDOMHTMLFormElement will be deprecated in GTK+ port and won't still exist in WPE. The new
+        _javascript_ GLib API will be used to replace most of the DOM API, but a few classes will remain with a minimal
+        API for things that can't be done with _javascript_. WebKitDOMElement will stay and will be added to WPE as well,
+        so if we change the signal parameter to WebKitDOMElement we will be able to keep using
+        WebKitWebPage::will-submit-form without any changes. WPE will gain this signal and the rest of the API that uses
+        DOM.
+
+        * WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp:
+        (webkit_web_page_class_init):
+
 2018-03-07  Carlos Garcia Campos  <[email protected]>
 
         REGRESSION(r218089): [GTK] webkit_web_view_get_inspector() needs to be called, otherwise inspector does not close

Modified: releases/WebKitGTK/webkit-2.20/Source/WebKit/WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp (229523 => 229524)


--- releases/WebKitGTK/webkit-2.20/Source/WebKit/WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp	2018-03-12 09:10:23 UTC (rev 229523)
+++ releases/WebKitGTK/webkit-2.20/Source/WebKit/WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp	2018-03-12 09:12:12 UTC (rev 229524)
@@ -417,7 +417,7 @@
             g_ptr_array_add(textFieldValues.get(), g_strdup(pair.second.utf8().data()));
         }
 
-        g_signal_emit(m_webPage, signals[WILL_SUBMIT_FORM], 0, WebKit::kit(formElement), step, webkitSourceFrame, webkitTargetFrame, textFieldNames.get(), textFieldValues.get());
+        g_signal_emit(m_webPage, signals[WILL_SUBMIT_FORM], 0, WEBKIT_DOM_ELEMENT(WebKit::kit(formElement)), step, webkitSourceFrame, webkitTargetFrame, textFieldNames.get(), textFieldValues.get());
     }
 
     WebKitWebPage* m_webPage;
@@ -591,7 +591,7 @@
     /**
      * WebKitWebPage::will-submit-form:
      * @web_page: the #WebKitWebPage on which the signal is emitted
-     * @form: the #WebKitDOMHTMLFormElement to be submitted
+     * @form: the #WebKitDOMElement to be submitted, which will always correspond to an HTMLFormElement
      * @step: a #WebKitFormSubmissionEventType indicating the current
      * stage of form submission
      * @source_frame: the #WebKitFrame containing the form to be
@@ -640,7 +640,7 @@
         0, 0, nullptr,
         g_cclosure_marshal_generic,
         G_TYPE_NONE, 6,
-        WEBKIT_DOM_TYPE_HTML_FORM_ELEMENT,
+        WEBKIT_DOM_TYPE_ELEMENT,
         WEBKIT_TYPE_FORM_SUBMISSION_STEP,
         WEBKIT_TYPE_FRAME,
         WEBKIT_TYPE_FRAME,

Modified: releases/WebKitGTK/webkit-2.20/Tools/ChangeLog (229523 => 229524)


--- releases/WebKitGTK/webkit-2.20/Tools/ChangeLog	2018-03-12 09:10:23 UTC (rev 229523)
+++ releases/WebKitGTK/webkit-2.20/Tools/ChangeLog	2018-03-12 09:12:12 UTC (rev 229524)
@@ -1,3 +1,16 @@
+2018-03-09  Carlos Garcia Campos  <[email protected]>
+
+        [GTK] Do not use WebKitDOMHTMLFormElement as argument of signal WebKitWebPage::will-submit-form
+        https://bugs.webkit.org/show_bug.cgi?id=183510
+
+        Reviewed by Michael Catanzaro.
+
+        Update the test to use WebKitDOMElement instead and fix a memory leak.
+
+        * TestWebKitAPI/Tests/WebKitGLib/WebExtensionTest.cpp:
+        (handleFormSubmissionCallback):
+        (willSubmitFormCallback):
+
 2018-02-27  Daniel Bates  <[email protected]>
 
         Standardize terminology for marked text

Modified: releases/WebKitGTK/webkit-2.20/Tools/TestWebKitAPI/Tests/WebKitGLib/WebExtensionTest.cpp (229523 => 229524)


--- releases/WebKitGTK/webkit-2.20/Tools/TestWebKitAPI/Tests/WebKitGLib/WebExtensionTest.cpp	2018-03-12 09:10:23 UTC (rev 229523)
+++ releases/WebKitGTK/webkit-2.20/Tools/TestWebKitAPI/Tests/WebKitGLib/WebExtensionTest.cpp	2018-03-12 09:12:12 UTC (rev 229524)
@@ -354,7 +354,7 @@
     g_assert(ok);
 }
 
-static void handleFormSubmissionCallback(WebKitWebPage* webPage, DelayedSignalType delayedSignalType, const char* methodName, WebKitDOMHTMLFormElement* formElement, WebKitFrame* sourceFrame, WebKitFrame* targetFrame, GPtrArray* textFieldNames, GPtrArray* textFieldValues, WebKitWebExtension* extension)
+static void handleFormSubmissionCallback(WebKitWebPage* webPage, DelayedSignalType delayedSignalType, const char* methodName, const char* formID, WebKitFrame* sourceFrame, WebKitFrame* targetFrame, GPtrArray* textFieldNames, GPtrArray* textFieldValues, WebKitWebExtension* extension)
 {
     GString* namesBuilder = g_string_new(nullptr);
     for (guint i = 0; i < textFieldNames->len; ++i) {
@@ -374,19 +374,21 @@
 
     gpointer data = "" "dbus-connection");
     if (data)
-        emitFormSubmissionEvent(G_DBUS_CONNECTION(data), methodName, webkit_dom_element_get_id(WEBKIT_DOM_ELEMENT(formElement)), names.get(), values.get(), webkit_frame_is_main_frame(targetFrame), webkit_frame_is_main_frame(sourceFrame));
+        emitFormSubmissionEvent(G_DBUS_CONNECTION(data), methodName, formID, names.get(), values.get(), webkit_frame_is_main_frame(targetFrame), webkit_frame_is_main_frame(sourceFrame));
     else
-        delayedSignalsQueue.append(DelayedSignal(delayedSignalType, webkit_dom_element_get_id(WEBKIT_DOM_ELEMENT(formElement)), names.get(), values.get(), webkit_frame_is_main_frame(targetFrame), webkit_frame_is_main_frame(sourceFrame)));
+        delayedSignalsQueue.append(DelayedSignal(delayedSignalType, formID, names.get(), values.get(), webkit_frame_is_main_frame(targetFrame), webkit_frame_is_main_frame(sourceFrame)));
 }
 
-static void willSubmitFormCallback(WebKitWebPage* webPage, WebKitDOMHTMLFormElement* formElement, WebKitFormSubmissionStep step, WebKitFrame* sourceFrame, WebKitFrame* targetFrame, GPtrArray* textFieldNames, GPtrArray* textFieldValues, WebKitWebExtension* extension)
+static void willSubmitFormCallback(WebKitWebPage* webPage, WebKitDOMElement* formElement, WebKitFormSubmissionStep step, WebKitFrame* sourceFrame, WebKitFrame* targetFrame, GPtrArray* textFieldNames, GPtrArray* textFieldValues, WebKitWebExtension* extension)
 {
+    g_assert(WEBKIT_DOM_IS_HTML_FORM_ELEMENT(formElement));
+    GUniquePtr<char> formID(webkit_dom_element_get_id(formElement));
     switch (step) {
     case WEBKIT_FORM_SUBMISSION_WILL_SEND_DOM_EVENT:
-        handleFormSubmissionCallback(webPage, FormSubmissionWillSendDOMEventSignal, "FormSubmissionWillSendDOMEvent", formElement, sourceFrame, targetFrame, textFieldNames, textFieldValues, extension);
+        handleFormSubmissionCallback(webPage, FormSubmissionWillSendDOMEventSignal, "FormSubmissionWillSendDOMEvent", formID.get(), sourceFrame, targetFrame, textFieldNames, textFieldValues, extension);
         break;
     case WEBKIT_FORM_SUBMISSION_WILL_COMPLETE:
-        handleFormSubmissionCallback(webPage, FormSubmissionWillCompleteSignal, "FormSubmissionWillComplete", formElement, sourceFrame, targetFrame, textFieldNames, textFieldValues, extension);
+        handleFormSubmissionCallback(webPage, FormSubmissionWillCompleteSignal, "FormSubmissionWillComplete", formID.get(), sourceFrame, targetFrame, textFieldNames, textFieldValues, extension);
         break;
     default:
         g_assert_not_reached();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to