[epiphany/gnome-3-28] web-view: don't connect to embed-shell in page-created cb



commit 9bc50399e7844eb2a56de932048b7112c520ae7a
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Wed Sep 4 08:54:11 2019 -0500

    web-view: don't connect to embed-shell in page-created cb
    
    This isn't the right place. It could lead to these signals being
    connected multiple times due to PSON.

 embed/ephy-web-view.c | 40 ++++++++++++++++++++++------------------
 1 file changed, 22 insertions(+), 18 deletions(-)
---
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 2e5f53d76..5d55eb907 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -896,22 +896,6 @@ page_created_cb (EphyEmbedShell        *shell,
 
   view->web_extension = web_extension;
   g_object_add_weak_pointer (G_OBJECT (view->web_extension), (gpointer *)&view->web_extension);
-
-  g_signal_connect_object (shell, "form-auth-data-save-requested",
-                           G_CALLBACK (form_auth_data_save_requested),
-                           view, 0);
-
-  g_signal_connect_object (shell, "sensitive-form-focused",
-                           G_CALLBACK (sensitive_form_focused_cb),
-                           view, 0);
-
-  g_signal_connect_object (shell, "allow-tls-certificate",
-                           G_CALLBACK (allow_tls_certificate_cb),
-                           view, 0);
-
-  g_signal_connect_object (shell, "allow-unsafe-browsing",
-                           G_CALLBACK (allow_unsafe_browsing_cb),
-                           view, 0);
 }
 
 static void
@@ -2649,6 +2633,10 @@ script_dialog_cb (WebKitWebView      *web_view,
 static void
 ephy_web_view_init (EphyWebView *web_view)
 {
+  EphyEmbedShell *shell;
+
+  shell = ephy_embed_shell_get_default ();
+
   web_view->is_blank = TRUE;
   web_view->ever_committed = FALSE;
   web_view->document_type = EPHY_WEB_VIEW_DOCUMENT_HTML;
@@ -2656,7 +2644,7 @@ ephy_web_view_init (EphyWebView *web_view)
 
   web_view->file_monitor = ephy_file_monitor_new (web_view);
 
-  web_view->history_service = ephy_embed_shell_get_global_history_service (ephy_embed_shell_get_default ());
+  web_view->history_service = ephy_embed_shell_get_global_history_service (shell);
   web_view->history_service_cancellable = g_cancellable_new ();
 
   g_signal_connect_object (web_view->history_service,
@@ -2718,9 +2706,25 @@ ephy_web_view_init (EphyWebView *web_view)
                     G_CALLBACK (new_window_cb),
                     NULL);
 
-  g_signal_connect_object (ephy_embed_shell_get_default (), "page-created",
+  g_signal_connect_object (shell, "page-created",
                            G_CALLBACK (page_created_cb),
                            web_view, 0);
+
+  g_signal_connect_object (shell, "form-auth-data-save-requested",
+                           G_CALLBACK (form_auth_data_save_requested),
+                           web_view, 0);
+
+  g_signal_connect_object (shell, "sensitive-form-focused",
+                           G_CALLBACK (sensitive_form_focused_cb),
+                           web_view, 0);
+
+  g_signal_connect_object (shell, "allow-tls-certificate",
+                           G_CALLBACK (allow_tls_certificate_cb),
+                           web_view, 0);
+
+  g_signal_connect_object (shell, "allow-unsafe-browsing",
+                           G_CALLBACK (allow_unsafe_browsing_cb),
+                           web_view, 0);
 }
 
 /**


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