Page 1 of 1

CefNavigationEntry::GetFaviconURLs()

PostPosted: Wed Jul 12, 2017 1:32 pm
by cretz
Both FF and Chrome show the favicons of the navigation state in their back and forward dropdowns. Is there any way to include this in the navigation entry? Otherwise, what is the recommended approach and how do browsers like Chrome solve this?

Options as I see them:

1. Ask for domain.com/favicon.ico - Con: doesn't include the PNG they may have set in the meta tag...important for per-page favicon differences
2. Store favicon URL change and maintain my own forward/back - Con: At this point I should just have my own history stack then
3. Cache favicons per browser by URL - Con: A bit of memory leak problem (cache invalidation is tough here, though I guess I could invalidate entries that aren't in the nav list), Con: Two identical URLs w/ different favicons might have issues
4. CefNavigationEntry::GetFaviconURLs()

Is #4 a reasonable request to open an issue for? If not, what's the best workaround? #3?

Re: CefNavigationEntry::GetFaviconURLs()

PostPosted: Wed Jul 12, 2017 2:36 pm
by magreenblatt
There's already a CefDisplayHandler::OnFaviconURLChange callback. Is there some reason that doesn't work for you?

Re: CefNavigationEntry::GetFaviconURLs()

PostPosted: Wed Jul 12, 2017 3:14 pm
by fddima
magreenblatt wrote:There's already a CefDisplayHandler::OnFaviconURLChange callback. Is there some reason that doesn't work for you?


I think it is listed in option #2 . But somewhy own history stack used, while store/matching favicons by host:port from target URL should be enough.

Re: CefNavigationEntry::GetFaviconURLs()

PostPosted: Wed Jul 12, 2017 3:35 pm
by cretz
There's already a CefDisplayHandler::OnFaviconURLChange callback. Is there some reason that doesn't work for you?


I'm afraid not. What if the favicon URL doesn't change? What if some JS does pushState affecting the nav entries? Not sure...I haven't checked.

But even besides those things, if I saved the URL from OnFaviconURLChange, then someone did history.go(-2), how would I know that the URL in "two forwards" is that favicon I retrieved? I don't want to cache per URL because the same URL can have different "shortcut icon" meta tags.

I should dig through the Chrome source and see how they hold the favicons for nav entries, but I am not that familiar w/ the Chrome source, so It'd take me a bit.

Re: CefNavigationEntry::GetFaviconURLs()

PostPosted: Wed Jul 12, 2017 3:50 pm
by cretz
I have done some digging, and https://cs.chromium.org/chromium/src/co ... 473a&l=161 (wrapped by CefNavigationEntryImpl) seems to be able to return https://cs.chromium.org/chromium/src/co ... c1be771ce9. Granted I may have other needs for nav entries like post data (I still have to see how the popup for re-submitting form state when using history.go works).

Re: CefNavigationEntry::GetFaviconURLs()

PostPosted: Tue Jul 18, 2017 4:46 pm
by magreenblatt
Please add a bug. Pull requests welcome.

Re: CefNavigationEntry::GetFaviconURLs()

PostPosted: Wed Jul 19, 2017 11:41 am
by cretz
Thanks. Issue added: https://bitbucket.org/chromiumembedded/ ... avicons-to. I don't really have the chrome build env setup to send an immediate PR (and maybe not a powerful enough machine to support it, heh), but if I get a weekend free I may be able to tackle it, who knows.