[rhythmbox] podcast: suppress facebook like button iframes (bug #631218)



commit 534fde683b006b15fd1f62286d3ed4c35d9e9187
Author: Jonathan Matthew <jonathan d14n org>
Date:   Mon Oct 25 12:13:50 2010 +1000

    podcast: suppress facebook like button iframes (bug #631218)

 podcast/rb-podcast-properties-dialog.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/podcast/rb-podcast-properties-dialog.c b/podcast/rb-podcast-properties-dialog.c
index 8dc0e70..e61e604 100644
--- a/podcast/rb-podcast-properties-dialog.c
+++ b/podcast/rb-podcast-properties-dialog.c
@@ -135,6 +135,15 @@ static const char *html_clues[] = {
 	"&#8",
 	"&#x"
 };
+
+/* list of URI prefixes for things we ignore when handling navigation requests.
+ * some podcast descriptions include facebook 'like' buttons as iframes, which otherwise
+ * show up as external web browser windows.
+ */
+static const char *ignore_uris[] = {
+	"http://www.facebook.com/plugins/like.php?";
+};
+
 #endif
 
 static void
@@ -169,8 +178,18 @@ navigation_requested_cb (WebKitWebView *web_view,
 {
 	const char *uri;
 	GError *error = NULL;
+	int i;
 
 	uri = webkit_network_request_get_uri (request);
+
+	/* ignore some obnoxious social networking stuff */
+	for (i = 0; i < G_N_ELEMENTS (ignore_uris); i++) {
+		if (g_str_has_prefix (uri, ignore_uris[i])) {
+			rb_debug ("ignoring external URI %s", uri);
+			return WEBKIT_NAVIGATION_RESPONSE_IGNORE;
+		}
+	}
+
 	gtk_show_uri (gtk_widget_get_screen (GTK_WIDGET (dialog)), uri, GDK_CURRENT_TIME, &error);
 	if (error != NULL) {
 		rb_error_dialog (NULL, _("Unable to display requested URI"), "%s", error->message);



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