I am having trouble using the IconDatabase successfully. I was wondering if I am either using it incorrectly or if Safari is doing some extra work to get the correct favicon for a given site. Here is the scenario. I am going to assume that each icon is retained at least once so that icons are never deleted (in fact, for testing this is exactly what I'm doing). Load www.google.com, FrameLoaderClient::dispatchDidReceiveIcon is called. IconDatabase::iconForPageURL returns an icon, this is perfect. Load www.google.com/search?hl=en&q=some_query&btnG=Google +Search, dispatchDidReceiveIcon is *not* called. If I call iconForPageURL *before* the load is finished, I won't get an icon unless I have already visited the site. If I call it after the load has finished, this could potentially show the wrong icon until the load has finished. Here is the behavior that I want: Load www.google.com, show the default icon until the google favicon is loaded and dispatchDidReceiveIcon is called. Load www.google.com/ search?hl=whatever, show the google favicon unless dispatchDidReceiveIcon is called. Load www.someothersite.com, show the default icon until dispatchDidReceiveIcon is called. How can I accomplish this behavior when the IconDatabase doesn't know about pageUrls->iconUrls until *after* the load has completed? Thanks, Patrick
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 is called. IconDatabase::iconForPageURL returns an icon, this is perfect.
Right
Load www.google.com/search?hl=en&q=some_query&btnG=Google+Search, dispatchDidReceiveIcon is *not* called.
In current ToT WebKit, it should be called for every single page load. Specifically as of revision 25557 (http://trac.webkit.org/projects/webkit/changeset/25557 )
If I call iconForPageURL *before* the load is finished, I won't get an icon unless I have already visited the site. If I call it after the load has finished, this could potentially show the wrong icon until the load has finished.
This is expected - until you visit a site, the icon database doesn't know what icon belongs to the site. You might think it quite obvious that "www.google.com/search?hl=en&q=some_query&btnG=Google+Search" should use the google site icon, but "www.google.com/search?hl=en&q=some_query&btnG=Google+Search " might manually link to "www.foobar.com/favicon.ico" in it's <head> element - we simply don't know until the sight has loaded once. Therefore, until you do actually load the site, iconForPageURL("www.google.com/search?hl=en&q=some_query&btnG=Google+Search ") should return the default icon.
Here is the behavior that I want: Load www.google.com, show the default icon until the google favicon is loaded and dispatchDidReceiveIcon is called. Load www.google.com/search?hl=whatever , show the google favicon unless dispatchDidReceiveIcon is called. Load www.someothersite.com, show the default icon until dispatchDidReceiveIcon is called. How can I accomplish this behavior when the IconDatabase doesn't know about pageUrls->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 belongs to a site until you've visited that site once. But I think it's quite reasonable if an API client wants to make assumptions by itself and ask for a different icon. Maybe what you're going for here is to have your API client run it's own logic that says "Okay, I don't know the icon for http://www.google.com/search?hl=en&q=some_query&btnG=Google+Search , but I do know the icon for http://www.google.com/, so I'll show that icon instead until I know the http://www.google.com/search?hl=en&q=some_query&btnG=Google+Search icon for sure" And the tools *are* in place to accomplish that now. Hope this helps, Brady Safari/WebKit Engineer
Thanks, Patrick _______________________________________________ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo/webkit-dev
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 this something that Safari does? I would love to be able to show the google.com icon until I know the real icon but I don't know how to use the IconDatabase to accomplish this. For one thing, I don't want to assume that google.com/search?hl=whatever uses google.com/ favicon.ico. I would rather have either the FrameLoader or the IconDatabase tell me early on what icon or icon url it *thinks* is correct until the real url is known. Pat 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 is called. IconDatabase::iconForPageURL returns an icon, this is perfect.
Right
Load www.google.com/search?hl=en&q=some_query&btnG=Google+Search, dispatchDidReceiveIcon is *not* called.
In current ToT WebKit, it should be called for every single page load. Specifically as of revision 25557 (http://trac.webkit.org/ projects/webkit/changeset/25557)
If I call iconForPageURL *before* the load is finished, I won't get an icon unless I have already visited the site. If I call it after the load has finished, this could potentially show the wrong icon until the load has finished.
This is expected - until you visit a site, the icon database doesn't know what icon belongs to the site. You might think it quite obvious that "www.google.com/search? hl=en&q=some_query&btnG=Google+Search" should use the google site icon, but "www.google.com/search?hl=en&q=some_query&btnG=Google +Search" might manually link to "www.foobar.com/favicon.ico" in it's <head> element - we simply don't know until the sight has loaded once.
Therefore, until you do actually load the site, iconForPageURL ("www.google.com/search?hl=en&q=some_query&btnG=Google+Search") should return the default icon.
Here is the behavior that I want: Load www.google.com, show the default icon until the google favicon is loaded and dispatchDidReceiveIcon is called. Load www.google.com/search?hl=whatever, show the google favicon unless dispatchDidReceiveIcon is called. Load www.someothersite.com, show the default icon until dispatchDidReceiveIcon is called. How can I accomplish this behavior when the IconDatabase doesn't know about pageUrls->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 belongs to a site until you've visited that site once. But I think it's quite reasonable if an API client wants to make assumptions by itself and ask for a different icon.
Maybe what you're going for here is to have your API client run it's own logic that says "Okay, I don't know the icon for http:// www.google.com/search?hl=en&q=some_query&btnG=Google+Search, but I do know the icon for http://www.google.com/, so I'll show that icon instead until I know the http://www.google.com/search? hl=en&q=some_query&btnG=Google+Search icon for sure"
And the tools *are* in place to accomplish that now.
Hope this helps,
Brady Safari/WebKit Engineer
Thanks, Patrick _______________________________________________ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo/webkit-dev
Safari has no logic of its own about which icon goes with which site; it relies on the icon database for this knowledge. Safari does have a little logic to pevent the icon in the URL field from flashing back and forth between a generic and non-generic icon as you type in a URL. John 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 this something that Safari does? I would love to be able to show the google.com icon until I know the real icon but I don't know how to use the IconDatabase to accomplish this. For one thing, I don't want to assume that google.com/search?hl=whatever uses google.com/ favicon.ico. I would rather have either the FrameLoader or the IconDatabase tell me early on what icon or icon url it *thinks* is correct until the real url is known.
Pat
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 is called. IconDatabase::iconForPageURL returns an icon, this is perfect.
Right
Load www.google.com/search?hl=en&q=some_query&btnG=Google+Search, dispatchDidReceiveIcon is *not* called.
In current ToT WebKit, it should be called for every single page load. Specifically as of revision 25557 (http://trac.webkit.org/projects/webkit/changeset/25557 )
If I call iconForPageURL *before* the load is finished, I won't get an icon unless I have already visited the site. If I call it after the load has finished, this could potentially show the wrong icon until the load has finished.
This is expected - until you visit a site, the icon database doesn't know what icon belongs to the site. You might think it quite obvious that "www.google.com/search?hl=en&q=some_query&btnG=Google+Search " should use the google site icon, but "www.google.com/search?hl=en&q=some_query&btnG=Google+Search " might manually link to "www.foobar.com/favicon.ico" in it's <head> element - we simply don't know until the sight has loaded once.
Therefore, until you do actually load the site, iconForPageURL("www.google.com/search?hl=en&q=some_query&btnG=Google+Search ") should return the default icon.
Here is the behavior that I want: Load www.google.com, show the default icon until the google favicon is loaded and dispatchDidReceiveIcon is called. Load www.google.com/search?hl=whatever , show the google favicon unless dispatchDidReceiveIcon is called. Load www.someothersite.com, show the default icon until dispatchDidReceiveIcon is called. How can I accomplish this behavior when the IconDatabase doesn't know about pageUrls-
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 belongs to a site until you've visited that site once. But I think it's quite reasonable if an API client wants to make assumptions by itself and ask for a different icon.
Maybe what you're going for here is to have your API client run it's own logic that says "Okay, I don't know the icon for http://www.google.com/search?hl=en&q=some_query&btnG=Google+Search , but I do know the icon for http://www.google.com/, so I'll show that icon instead until I know the http://www.google.com/search?hl=en&q=some_query&btnG=Google+Search icon for sure"
And the tools *are* in place to accomplish that now.
Hope this helps,
Brady Safari/WebKit Engineer
Thanks, Patrick _______________________________________________ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo/webkit-dev
_______________________________________________ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo/webkit-dev
I have discovered that I have an IconDatabase that is older than the new multi-thread database if that is any help. If Safari has no extra knowledge, how does it decide to display the google icon for www.google.com/search before visiting the site but after visiting www.google.com? The same applies for visiting news.google.com, images.google.com, maps.google.com, etc. I tried setting a breakpoint on iconForPageURL but it just returned NULL. Pat On Sep 18, 2007, at 1:02 PM, John Sullivan wrote:
Safari has no logic of its own about which icon goes with which site; it relies on the icon database for this knowledge.
Safari does have a little logic to pevent the icon in the URL field from flashing back and forth between a generic and non-generic icon as you type in a URL.
John
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 this something that Safari does? I would love to be able to show the google.com icon until I know the real icon but I don't know how to use the IconDatabase to accomplish this. For one thing, I don't want to assume that google.com/search?hl=whatever uses google.com/favicon.ico. I would rather have either the FrameLoader or the IconDatabase tell me early on what icon or icon url it *thinks* is correct until the real url is known.
Pat
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 is called. IconDatabase::iconForPageURL returns an icon, this is perfect.
Right
Load www.google.com/search?hl=en&q=some_query&btnG=Google +Search, dispatchDidReceiveIcon is *not* called.
In current ToT WebKit, it should be called for every single page load. Specifically as of revision 25557 (http://trac.webkit.org/ projects/webkit/changeset/25557)
If I call iconForPageURL *before* the load is finished, I won't get an icon unless I have already visited the site. If I call it after the load has finished, this could potentially show the wrong icon until the load has finished.
This is expected - until you visit a site, the icon database doesn't know what icon belongs to the site. You might think it quite obvious that "www.google.com/search? hl=en&q=some_query&btnG=Google+Search" should use the google site icon, but "www.google.com/search?hl=en&q=some_query&btnG=Google +Search" might manually link to "www.foobar.com/favicon.ico" in it's <head> element - we simply don't know until the sight has loaded once.
Therefore, until you do actually load the site, iconForPageURL ("www.google.com/search?hl=en&q=some_query&btnG=Google+Search") should return the default icon.
Here is the behavior that I want: Load www.google.com, show the default icon until the google favicon is loaded and dispatchDidReceiveIcon is called. Load www.google.com/search?hl=whatever, show the google favicon unless dispatchDidReceiveIcon is called. Load www.someothersite.com, show the default icon until dispatchDidReceiveIcon is called. How can I accomplish this behavior when the IconDatabase doesn't know about pageUrls-
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 belongs to a site until you've visited that site once. But I think it's quite reasonable if an API client wants to make assumptions by itself and ask for a different icon.
Maybe what you're going for here is to have your API client run it's own logic that says "Okay, I don't know the icon for http:// www.google.com/search?hl=en&q=some_query&btnG=Google+Search, but I do know the icon for http://www.google.com/, so I'll show that icon instead until I know the http://www.google.com/search? hl=en&q=some_query&btnG=Google+Search icon for sure"
And the tools *are* in place to accomplish that now.
Hope this helps,
Brady Safari/WebKit Engineer
Thanks, Patrick _______________________________________________ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo/webkit-dev
_______________________________________________ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo/webkit-dev
On Sep 18, 2007, at 10:25 AM, Patrick Hanna wrote:
I have discovered that I have an IconDatabase that is older than the new multi-thread database if that is any help.
If Safari has no extra knowledge, how does it decide to display the google icon for www.google.com/search before visiting the site but after visiting www.google.com? The same applies for visiting news.google.com, images.google.com, maps.google.com, etc. I tried setting a breakpoint on iconForPageURL but it just returned NULL.
Pat
I can't reproduce this. This is what I see: 1. use Reset Safari to clear the icon database 2. type http://www.google.com into URL field and hit Return -- custom icon appears after page loads 3. type http://www.google.com/search into URL field -- no custom icon 4. hit Return -- custom icon appears during/after page load 5. type http://news.google.com into URL field -- no custom icon 6. hit Return -- custom icon appears during/after page load John
It looks like you have to completely delete the address in the Address bar to get the icon to go away. If you don't delete the whole thing, the icon stays there. That looks like what you mentioned earlier about not flashing between the default icon and the custom icon while typing. Maybe I just need to add that sort of logic for hosts that match. Thanks for the help, Pat On Sep 18, 2007, at 1:32 PM, John Sullivan wrote:
On Sep 18, 2007, at 10:25 AM, Patrick Hanna wrote:
I have discovered that I have an IconDatabase that is older than the new multi-thread database if that is any help.
If Safari has no extra knowledge, how does it decide to display the google icon for www.google.com/search before visiting the site but after visiting www.google.com? The same applies for visiting news.google.com, images.google.com, maps.google.com, etc. I tried setting a breakpoint on iconForPageURL but it just returned NULL.
Pat
I can't reproduce this. This is what I see:
1. use Reset Safari to clear the icon database 2. type http://www.google.com into URL field and hit Return -- custom icon appears after page loads 3. type http://www.google.com/search into URL field -- no custom icon 4. hit Return -- custom icon appears during/after page load 5. type http://news.google.com into URL field -- no custom icon 6. hit Return -- custom icon appears during/after page load
John
On Sep 18, 2007, at 9:53 AM, Patrick Hanna wrote:
So I do *not* have the 25557 patch and that will help.
Upgrade past that point, your plight will be significantly lessened ;)
What tools are in place to accomplish the behavior that I want? Is this something that Safari does?
We can't talk about implementation details of Safari.
I would love to be able to show the google.com icon until I know the real icon but I don't know how to use the IconDatabase to accomplish this. For one thing, I don't want to assume that google.com/search? hl=whatever uses google.com/favicon.ico.
The way that comes to mind is to call iconURLForPageURL(<your long, unvisited page url here>). If the result is empty, you know that icon is not in the database and you can start making your own guesses about what icon it might be. "http://www.google.com/search?hl=whatever" becomes "http://www.google.com/" until the didReceiveIcon call arrives, for example. I can think of a number of cases where the above assumption would fail, however. It really is a "guess"
I would rather have either the FrameLoader or the IconDatabase tell me early on what icon or icon url it *thinks* is correct until the real url is known.
I sympathize with your desire, but what you're asking is for a feature of the engine to start making assumptions which I don't think it should. Adding extra logic to "guess" at the right icon and to do the didReceiveIcon dispatch multiple times per load *will* incur a performance penalty, in addition to being wrong in a number of cases in the wild. I really do think this type of guessing should be the job of your API client, and not the engine itself. Hope all this helps, Brady Safari/WebKit Engineer
Pat
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 is called. IconDatabase::iconForPageURL returns an icon, this is perfect.
Right
Load www.google.com/search?hl=en&q=some_query&btnG=Google+Search, dispatchDidReceiveIcon is *not* called.
In current ToT WebKit, it should be called for every single page load. Specifically as of revision 25557 (http://trac.webkit.org/projects/webkit/changeset/25557 )
If I call iconForPageURL *before* the load is finished, I won't get an icon unless I have already visited the site. If I call it after the load has finished, this could potentially show the wrong icon until the load has finished.
This is expected - until you visit a site, the icon database doesn't know what icon belongs to the site. You might think it quite obvious that "www.google.com/search?hl=en&q=some_query&btnG=Google+Search " should use the google site icon, but "www.google.com/search?hl=en&q=some_query&btnG=Google+Search " might manually link to "www.foobar.com/favicon.ico" in it's <head> element - we simply don't know until the sight has loaded once.
Therefore, until you do actually load the site, iconForPageURL("www.google.com/search?hl=en&q=some_query&btnG=Google+Search ") should return the default icon.
Here is the behavior that I want: Load www.google.com, show the default icon until the google favicon is loaded and dispatchDidReceiveIcon is called. Load www.google.com/search?hl=whatever , show the google favicon unless dispatchDidReceiveIcon is called. Load www.someothersite.com, show the default icon until dispatchDidReceiveIcon is called. How can I accomplish this behavior when the IconDatabase doesn't know about pageUrls-
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 belongs to a site until you've visited that site once. But I think it's quite reasonable if an API client wants to make assumptions by itself and ask for a different icon.
Maybe what you're going for here is to have your API client run it's own logic that says "Okay, I don't know the icon for http://www.google.com/search?hl=en&q=some_query&btnG=Google+Search , but I do know the icon for http://www.google.com/, so I'll show that icon instead until I know the http://www.google.com/search?hl=en&q=some_query&btnG=Google+Search icon for sure"
And the tools *are* in place to accomplish that now.
Hope this helps,
Brady Safari/WebKit Engineer
Thanks, Patrick _______________________________________________ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo/webkit-dev
participants (3)
-
Brady Eidson
-
John Sullivan
-
Patrick Hanna