]> spindle.queued.net Git - midori/commitdiff
Recognize effectively empty prefixes of a stylesheet
authorChristian Dywan <christian@twotoasts.de>
Thu, 27 Oct 2011 17:28:40 +0000 (19:28 +0200)
committerChristian Dywan <christian@twotoasts.de>
Thu, 27 Oct 2011 17:32:17 +0000 (19:32 +0200)
extensions/addons.c

index 190cfdb95a2efe3c254f7b11a08f200cb238b9d8..e08f45dad8246bca08ed3fcd54d0b4aa613eb700 100644 (file)
@@ -1070,6 +1070,28 @@ css_metadata_from_file (const gchar* filename,
     g_io_channel_shutdown (channel, false, 0);
     g_io_channel_unref (channel);
 
+    if (*includes != NULL)
+    {
+        /* Styles may have a whitelist even though it is as good as none.
+           It's more efficient if we avoid that. */
+        GSList* list = *includes;
+        gboolean effectively_empty = TRUE;
+        while (list != NULL)
+        {
+            if (!g_str_has_suffix (list->data, "://"))
+            {
+                effectively_empty = FALSE;
+                break;
+            }
+            list = g_slist_next (list);
+        }
+        if (effectively_empty)
+        {
+            g_slist_free (list);
+            *includes = NULL;
+        }
+    }
+
     return TRUE;
 }