diff options
Diffstat (limited to 'desktop/browser.c')
-rw-r--r-- | desktop/browser.c | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/desktop/browser.c b/desktop/browser.c index b442a224b..50dcc484a 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -912,11 +912,7 @@ static nserror browser_window_favicon_callback(hlcache_handle *c, /* content_get_bitmap on the hlcache_handle should give * us the favicon bitmap at this point */ - if (bw->window != NULL) { - gui_window_set_icon(bw->window, c); - } else { - LOG(("null browser window on favicon!")); - } + gui_window_set_icon(bw->window, c); break; case CONTENT_MSG_ERROR: @@ -930,9 +926,32 @@ static nserror browser_window_favicon_callback(hlcache_handle *c, hlcache_handle_release(c); - /** @todo if this was not the default - * resource:favicon.png start a fetch for it. - */ + if (bw->failed_favicon == false) { + nsurl *nsref = NULL; + nsurl *nsurl; + nserror error; + + bw->failed_favicon = true; + + error = nsurl_create("resource:favicon.ico", &nsurl); + if (error != NSERROR_OK) { + LOG(("Unable to create default location url")); + } else { + + hlcache_handle_retrieve(nsurl, + HLCACHE_RETRIEVE_SNIFF_TYPE, + nsref, + NULL, + browser_window_favicon_callback, + bw, + NULL, + CONTENT_IMAGE, + &bw->loading_favicon); + + nsurl_unref(nsurl); + } + + } break; default: @@ -962,6 +981,8 @@ static void browser_window_update_favicon(hlcache_handle *c, if (bw->loading_favicon != NULL) return; + bw->failed_favicon = false; + if (link == NULL) { /* look for favicon metadata link */ lwc_intern_string("icon", SLEN("icon"), &icon_str); @@ -1001,6 +1022,7 @@ static void browser_window_update_favicon(hlcache_handle *c, /* no favicon via link, try for the default location */ error = nsurl_join(nsurl, "/favicon.ico", &nsurl); } else { + bw->failed_favicon = true; error = nsurl_create("resource:favicon.ico", &nsurl); } if (error != NSERROR_OK) { |