[epiphany] [REGRESSION] Infinite loop in forms with multiple saved credentials



commit 7f3a9f7186ba6367a21054d8df0d75b1eddc5e13
Author: Sergio Villar Senin <svillar igalia com>
Date:   Wed Nov 2 15:20:21 2016 +0100

    [REGRESSION] Infinite loop in forms with multiple saved credentials
    
    We should not listen to changes in the username input field while editing
    its contents by using webkit_dom_html_input_element_set_editing_values()
    under the risk of ending up recursively calling fill_form_cbi() forever.
    
    Ideally WebKitGtk+ should provide a mechanism similar to
    g_signal_handlers_block_by_func() to address this kind of issues. We could
    surround the set_editing_values() call by a pair of
    webkit_dom_event_target_remove_event_listener() and
    webkit_dom_event_target_add_event_listener() but that would force us to
    somehow pass the webpage to fill_form_cb, and what's worst, duplicate the
    multiple credentials detection code.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=773830

 embed/web-extension/ephy-web-extension.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/embed/web-extension/ephy-web-extension.c b/embed/web-extension/ephy-web-extension.c
index 6f7d912..3e7e91d 100644
--- a/embed/web-extension/ephy-web-extension.c
+++ b/embed/web-extension/ephy-web-extension.c
@@ -391,8 +391,10 @@ fill_form_cb (const char *username,
 
   LOG ("Found: user %s pass (hidden)", username_node ? username : "(none)");
   if (username_node) {
+    g_object_set_data (G_OBJECT (username_node), "ephy-is-auto-filling", TRUE);
     webkit_dom_html_input_element_set_auto_filled (username_node, TRUE);
     webkit_dom_html_input_element_set_editing_value (username_node, username);
+    g_object_set_data (G_OBJECT (username_node), "ephy-is-auto-filling", FALSE);
   }
   webkit_dom_html_input_element_set_auto_filled (password_node, TRUE);
   webkit_dom_html_input_element_set_editing_value (password_node, password);
@@ -910,6 +912,9 @@ username_node_input_cb (WebKitDOMNode  *username_node,
   WebKitDOMDocument *document;
   WebKitDOMElement *main_div;
 
+  if (g_object_get_data (G_OBJECT (username_node), "ephy-is-auto-filling"))
+    return TRUE;
+
   g_object_set_data (G_OBJECT (username_node), "ephy-user-ever-edited", GINT_TO_POINTER (TRUE));
   document = webkit_web_page_get_dom_document (web_page);
   remove_user_choices (document);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]