[Webkit-unassigned] [Bug 29440] [Qt] QWebSettings::iconForUrl() does not return a valid icon

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jan 19 12:24:35 PST 2011


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


Stephen <chaohydra at hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |chaohydra at hotmail.com




--- Comment #3 from Stephen <chaohydra at hotmail.com>  2011-01-19 12:24:35 PST ---
Simon, I believe there is still bug with QWebSettings::iconForURL for the QT 4.7.0 (32-bit, running on Windows). 

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. 

Can you guys investigate? Thanks a lot.

-- 
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