[epiphany/mcatanzaro/#1373: 3/3] Stop sending safe browsing requests when safe browsing is disabled




commit 692d5c97b49403ce91a74e8e98609f3f02687aa0
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Sun Dec 6 08:51:04 2020 -0600

    Stop sending safe browsing requests when safe browsing is disabled
    
    We check if ENABLE_GSB is defined, then go ahead and enable it when we
    see it is defined to 0. Oops. It's always defined, so let's check its
    value instead.
    
    Then avoid a crash that would otherwise occur when it is NULL.
    
    Fixes #1373

 lib/safe-browsing/ephy-gsb-service.c |  2 +-
 src/ephy-window.c                    | 16 +++++++++-------
 2 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/lib/safe-browsing/ephy-gsb-service.c b/lib/safe-browsing/ephy-gsb-service.c
index 44c244f4c..701a361f9 100644
--- a/lib/safe-browsing/ephy-gsb-service.c
+++ b/lib/safe-browsing/ephy-gsb-service.c
@@ -484,7 +484,7 @@ EphyGSBService *
 ephy_gsb_service_new (const char *api_key,
                       const char *db_path)
 {
-#ifdef ENABLE_GSB
+#if ENABLE_GSB
   EphyGSBService *service;
   EphyGSBStorage *storage;
 
diff --git a/src/ephy-window.c b/src/ephy-window.c
index b661d99d1..cba7ac252 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -2287,13 +2287,15 @@ decide_navigation (EphyWindow               *window,
     }
 
     service = ephy_embed_shell_get_global_gsb_service (ephy_embed_shell_get_default ());
-    ephy_gsb_service_verify_url (service, request_uri,
-                                 (GAsyncReadyCallback)verify_url_cb,
-                                 /* Note: this refs the policy decision, so we can complete it 
asynchronously. */
-                                 verify_url_async_data_new (window, web_view,
-                                                            decision, decision_type,
-                                                            request_uri));
-    return TRUE;
+    if (service) {
+      ephy_gsb_service_verify_url (service, request_uri,
+                                   (GAsyncReadyCallback)verify_url_cb,
+                                   /* Note: this refs the policy decision, so we can complete it 
asynchronously. */
+                                   verify_url_async_data_new (window, web_view,
+                                                              decision, decision_type,
+                                                              request_uri));
+      return TRUE;
+    }
   }
 
   return decide_navigation_policy (web_view, decision, decision_type, window);


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