[epiphany] Do not schedule a DNS prefetch for invalid URIs or without a hostname



commit 09f9b5f9865aa7e58dd912a4ac0f328b5de48ad4
Author: Carlos Garcia Campos <cgarcia igalia com>
Date:   Thu Mar 28 16:16:02 2013 +0100

    Do not schedule a DNS prefetch for invalid URIs or without a hostname
    
    It produces a runtime critical warning when trying to use
    webkit_web_context_prefetch_dns() with a NULL hostname.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=696787

 lib/widgets/ephy-location-entry.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c
index b21f656..bb5300e 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -966,13 +966,20 @@ static void
 schedule_dns_prefetch (EphyLocationEntry *entry, guint interval, const gchar *url)
 {
        PrefetchHelper *helper;
+       SoupURI *uri;
+
+       uri = soup_uri_new (url);
+       if (!uri || !uri->host) {
+               soup_uri_free (uri);
+               return;
+       }
 
        if (entry->priv->dns_prefetch_handler)
                g_source_remove (entry->priv->dns_prefetch_handler);
 
        helper = g_slice_new0 (PrefetchHelper);
        helper->entry = g_object_ref (entry);
-       helper->uri = soup_uri_new (url);
+       helper->uri = uri;
 
        entry->priv->dns_prefetch_handler =
                g_timeout_add_full (G_PRIORITY_DEFAULT, interval,


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