[Webkit-unassigned] [Bug 54024] New: QWebSettings::iconForURL() returns NULL at first call

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Feb 8 11:23:27 PST 2011


https://bugs.webkit.org/show_bug.cgi?id=54024

           Summary: QWebSettings::iconForURL() returns NULL at first call
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: PC
        OS/Version: Windows 7
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: WebKit Qt
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: chaohydra at hotmail.com


I am running to an issue with QWebSettings::iconForURL. Let's assume an icon of a certain web page has been cached in the icon database in a previous session. In a fresh new session, the first call to QWebSettings::iconForURL will always return null. I have to wait for some time and then make a second call. The second call will return a valid icon. 

Here is the steps to produce the problem, 

1. Cache the icon by using QWebView to navigate to the target website first. Then close the application.

2. Restart the application, the first call to QWebSettings::iconForURL for the same URL will return null. 

3. Wait some time, make a second call to iconForURL, it will return a valid icon this time. 

4. If the two calls are made continuously without delay, both times will return null. 

So, to summarize, if an icon has been cached in a previous session, then the first call will return null. We have to wait some time and make a second call to get a valid icon. I believe a QWebView navigation also counts as a first time call. So, if you perform a navigation first and then make a call iconForURL in the same session, it will always succeed. 

The following code serves as a test case:

int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QWebSettings::setIconDatabasePath(".");

//run this for only once and then comment it out.
QWebView view;
view.load(QUrl("http://www.cnn.com/"));
view.show();
app.exec();

QIcon icon=QWebSettings::iconForUrl(QUrl("http://www.cnn.com/"));
QPushButton button;
button.setIcon(icon);
button.show();
app.exec();
icon=QWebSettings::iconForUrl(QUrl("http://www.cnn.com/"));
button.setIcon(icon);
button.show();
return app.exec();
}

Please cache the icon with QWebView when you run it for the first time. After that, comment out the code block related to QWebView. Then run it again. You will see that the first button has no icon while the second button has the cnn icon.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list