diff options
author | Vincent Sanders <vince@netsurf-browser.org> | 2011-10-07 20:47:34 +0000 |
---|---|---|
committer | Vincent Sanders <vince@netsurf-browser.org> | 2011-10-07 20:47:34 +0000 |
commit | 8a293636fbe2b4cc57fd542e4b18af4cf0bc3fe3 (patch) | |
tree | 02d79790ed4c95d4b449c3896c73427fe847541c /desktop | |
parent | 33af42360f4609e30efaf72b241dfaae8998db07 (diff) | |
download | netsurf-8a293636fbe2b4cc57fd542e4b18af4cf0bc3fe3.tar.gz netsurf-8a293636fbe2b4cc57fd542e4b18af4cf0bc3fe3.tar.bz2 |
fix favicon default selection for non http(s) urls
svn path=/trunk/netsurf/; revision=12981
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/browser.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/desktop/browser.c b/desktop/browser.c index b74a27d89..f442809f9 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -973,8 +973,32 @@ static void browser_window_update_favicon(hlcache_handle *c, } if (link == NULL) { - /* no favicon via link, try for the default location - bletch */ - error = nsurl_join(content_get_url(c), "/favicon.ico", &nsurl); + lwc_string *scheme; + + lwc_string *http_str; + lwc_string *https_str; + bool http_match = false; + bool https_match = false; + + nsurl = content_get_url(c); + + scheme = nsurl_get_component(nsurl, NSURL_SCHEME); + + lwc_intern_string("http", SLEN("http"), &http_str); + lwc_intern_string("https", SLEN("https"), &https_str); + lwc_string_caseless_isequal(scheme, http_str, &http_match); + lwc_string_caseless_isequal(scheme, https_str, &https_match); + lwc_string_unref(http_str); + lwc_string_unref(https_str); + + lwc_string_unref(scheme); + + if (http_match || https_match) { + /* no favicon via link, try for the default location */ + error = nsurl_join(nsurl, "/favicon.ico", &nsurl); + } else { + error = nsurl_create("resource:favicon.png", &nsurl); + } if (error != NSERROR_OK) { LOG(("Unable to create default location url")); return; |