[webkit-dev] The mysterious IconDatabase
phanna at email.unc.edu
Tue Sep 18 10:25:51 PDT 2007
I have discovered that I have an IconDatabase that is older than the =20
new multi-thread database if that is any help.
If Safari has no extra knowledge, how does it decide to display the =20
google icon for www.google.com/search before visiting the site but =20
after visiting www.google.com? The same applies for visiting =20
news.google.com, images.google.com, maps.google.com, etc. I tried =20
setting a breakpoint on iconForPageURL but it just returned NULL.
On Sep 18, 2007, at 1:02 PM, John Sullivan wrote:
> Safari has no logic of its own about which icon goes with which =20
> site; it relies on the icon database for this knowledge.
> Safari does have a little logic to pevent the icon in the URL field =20=
> from flashing back and forth between a generic and non-generic icon =20=
> as you type in a URL.
> On Sep 18, 2007, at 9:53 AM, Patrick Hanna wrote:
>> So I do *not* have the 25557 patch and that will help.
>> What tools are in place to accomplish the behavior that I want? Is =20=
>> this something that Safari does? I would love to be able to show =20
>> the google.com icon until I know the real icon but I don't know =20
>> how to use the IconDatabase to accomplish this. For one thing, I =20
>> don't want to assume that google.com/search?hl=3Dwhatever uses =20
>> google.com/favicon.ico. I would rather have either the FrameLoader =20=
>> or the IconDatabase tell me early on what icon or icon url it =20
>> *thinks* is correct until the real url is known.
>> On Sep 18, 2007, at 12:46 PM, Brady Eidson wrote:
>>> Hi Patrick,
>>> Could you give a little more context? Are you using ToT WebKit?
>>> On Sep 18, 2007, at 9:27 AM, Patrick Hanna wrote:
>>>> Load www.google.com, FrameLoaderClient::dispatchDidReceiveIcon =20
>>>> is called. IconDatabase::iconForPageURL returns an icon, this is =20=
>>>> Load www.google.com/search?hl=3Den&q=3Dsome_query&btnG=3DGoogle=20
>>>> +Search, dispatchDidReceiveIcon is *not* called.
>>> In current ToT WebKit, it should be called for every single page =20
>>> load. Specifically as of revision 25557 (http://trac.webkit.org/=20
>>>> If I call iconForPageURL *before* the load is finished, I won't =20
>>>> get an icon unless I have already visited the site. If I call it =20=
>>>> after the load has finished, this could potentially show the =20
>>>> wrong icon until the load has finished.
>>> This is expected - until you visit a site, the icon database =20
>>> doesn't know what icon belongs to the site. You might think it =20
>>> quite obvious that "www.google.com/search?=20
>>> hl=3Den&q=3Dsome_query&btnG=3DGoogle+Search" should use the google =
>>> icon, but "www.google.com/search?hl=3Den&q=3Dsome_query&btnG=3DGoogle=20=
>>> +Search" might manually link to "www.foobar.com/favicon.ico" in =20
>>> it's <head> element - we simply don't know until the sight has =20
>>> loaded once.
>>> Therefore, until you do actually load the site, iconForPageURL=20
>>> ("www.google.com/search?hl=3Den&q=3Dsome_query&btnG=3DGoogle+Search") =
>>> should return the default icon.
>>>> Here is the behavior that I want:
>>>> Load www.google.com, show the default icon until the google =20
>>>> favicon is loaded and dispatchDidReceiveIcon is called. Load =20
>>>> www.google.com/search?hl=3Dwhatever, show the google favicon =20
>>>> unless dispatchDidReceiveIcon is called. Load =20
>>>> www.someothersite.com, show the default icon until =20
>>>> dispatchDidReceiveIcon is called. How can I accomplish this =20
>>>> behavior when the IconDatabase doesn't know about pageUrls-=20
>>>> >iconUrls until *after* the load has completed?
>>> To accomplish this behavior you'll have to do a little work.
>>> As I said above, it is impossible to know for sure which icon =20
>>> belongs to a site until you've visited that site once. But I =20
>>> think it's quite reasonable if an API client wants to make =20
>>> assumptions by itself and ask for a different icon.
>>> Maybe what you're going for here is to have your API client run =20
>>> it's own logic that says "Okay, I don't know the icon for http://=20
>>> www.google.com/search?hl=3Den&q=3Dsome_query&btnG=3DGoogle+Search, =
>>> I do know the icon for http://www.google.com/, so I'll show that =20
>>> icon instead until I know the http://www.google.com/search?=20
>>> hl=3Den&q=3Dsome_query&btnG=3DGoogle+Search icon for sure"
>>> And the tools *are* in place to accomplish that now.
>>> Hope this helps,
>>> =F0 Brady
>>> Safari/WebKit Engineer
>>>> webkit-dev mailing list
>>>> webkit-dev at lists.webkit.org
>> webkit-dev mailing list
>> webkit-dev at lists.webkit.org
More information about the webkit-dev