[epiphany] Find web app names using OpenGraph site_name in name attribute
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] Find web app names using OpenGraph site_name in name attribute
- Date: Fri, 3 Jun 2016 23:47:07 +0000 (UTC)
commit a5c34fb402ea8d1455dbb0e904fe84d0f78bfbdf
Author: Daniel Aleksandersen <code daniel priv no>
Date: Fri Jun 3 23:54:18 2016 +0200
Find web app names using OpenGraph site_name in name attribute
Not standards compliant, but common mistake to set og:site_name
as a name attribute instead of a property attribute. There is no
harm in supporting both.
Case-insensitive comparison for compatibility.
https://bugzilla.gnome.org/show_bug.cgi?id=767184
embed/web-extension/ephy-web-dom-utils.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/embed/web-extension/ephy-web-dom-utils.c b/embed/web-extension/ephy-web-dom-utils.c
index cf32786..bff1643 100644
--- a/embed/web-extension/ephy-web-dom-utils.c
+++ b/embed/web-extension/ephy-web-dom-utils.c
@@ -121,10 +121,13 @@ ephy_web_dom_utils_get_application_title (WebKitDOMDocument *document)
char *property;
WebKitDOMNode *node = webkit_dom_node_list_item (metas, i);
+ /* og:site_name is read from the property attribute (standard), but is
+ * commonly seen on the web in the name attribute. Both are supported. */
name = webkit_dom_html_meta_element_get_name (WEBKIT_DOM_HTML_META_ELEMENT (node));
property = webkit_dom_element_get_attribute (WEBKIT_DOM_ELEMENT (node), "property");
- if (g_strcmp0 (name, "application-name") == 0
- || g_strcmp0 (property, "og:site_name") == 0) {
+ if ((name != NULL && g_ascii_strcasecmp (name, "application-name") == 0) ||
+ (property != NULL && g_ascii_strcasecmp (property, "og:site_name") == 0) ||
+ (name != NULL && g_ascii_strcasecmp (name, "og:site_name") == 0)) {
title = webkit_dom_html_meta_element_get_content (WEBKIT_DOM_HTML_META_ELEMENT (node));
}
g_free (property);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]