[epiphany/wip/js-forms] web-extension: Handle password forms submitted via JS
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/wip/js-forms] web-extension: Handle password forms submitted via JS
- Date: Wed, 16 Aug 2017 05:13:32 +0000 (UTC)
commit 3b09e14f93b9bd66c9dc88509fb6efbf7c6c682e
Author: Michael Catanzaro <mcatanzaro igalia com>
Date: Wed Aug 16 00:05:59 2017 -0500
web-extension: Handle password forms submitted via JS
Currently, Epiphany relies on the DOM submit event to detect if a form
has been submitted. However, this fails if the form has been submitted
via JavaScript, as the submit event is not emitted in this case. We
can't detect this using DOM alone, so use the new WebKitWebPage signal
that has been provided for this purpose.
https://bugzilla.gnome.org/show_bug.cgi?id=742573
embed/web-extension/ephy-web-extension.c | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/embed/web-extension/ephy-web-extension.c b/embed/web-extension/ephy-web-extension.c
index df984b5..a8c195c 100644
--- a/embed/web-extension/ephy-web-extension.c
+++ b/embed/web-extension/ephy-web-extension.c
@@ -449,9 +449,12 @@ out:
}
static gboolean
-form_submitted_cb (WebKitDOMHTMLFormElement *dom_form,
- WebKitDOMEvent *dom_event,
- WebKitWebPage *web_page)
+web_page_will_submit_form (WebKitWebPage *web_page,
+ WebKitDOMHTMLFormElement *dom_form,
+ WebKitFrame *frame,
+ WebKitFrame *source_frame,
+ GPtrArray *text_field_names,
+ GPtrArray *text_field_values)
{
EphyWebExtension *extension = ephy_web_extension_get ();
EphyEmbedFormAuth *form_auth;
@@ -1118,9 +1121,6 @@ web_page_form_controls_associated (WebKitWebPage *web_page,
/* EphyEmbedFormAuth takes ownership of the nodes */
form_auth = ephy_embed_form_auth_new (web_page, username_node, password_node, NULL);
- webkit_dom_event_target_add_event_listener (WEBKIT_DOM_EVENT_TARGET (form), "submit",
- G_CALLBACK (form_submitted_cb), FALSE,
- web_page);
if (username_node) {
webkit_dom_event_target_add_event_listener (WEBKIT_DOM_EVENT_TARGET (username_node), "blur",
G_CALLBACK (username_changed_cb), FALSE,
@@ -1278,6 +1278,9 @@ ephy_web_extension_page_created_cb (EphyWebExtension *extension,
g_signal_connect (web_page, "context-menu",
G_CALLBACK (web_page_context_menu),
extension);
+ g_signal_connect (web_page, "will-submit-form",
+ G_CALLBACK (web_page_will_submit_form),
+ extension);
g_signal_connect (web_page, "form-controls-associated",
G_CALLBACK (web_page_form_controls_associated),
extension);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]