Commit 2e037c18 authored by beidson's avatar beidson
Browse files

Reviewed by Geoose Garen

        <rdar://problem/4758919> - Incorrect favicon shown for URL after going back

        When restoring a cached page, we'd try to kick off the icon load for it, which ended up causing 
        shenanigans with the icon url -> page url mapping.  

        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::endIfNotLoading): Only try an icon load if we're not restoring from the page cache
        (WebCore::FrameLoader::startIconLoader): Added helpful logging that helped me track this down
        (WebCore::FrameLoader::commitIconURLToIconDatabase): Ditto (and fixed a comment typo)

        * loader/icon/IconLoader.cpp:
        (WebCore::IconLoader::stopLoading): Don't null out the ResourceLoader here, as clearLoadingState() does that
        (WebCore::IconLoader::finishLoading): Added helpful logging that helped me track this down



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@21612 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 29df4b01
2007-05-20 Brady Eidson <beidson@apple.com>
Reviewed by Geoose Garen
<rdar://problem/4758919> - Incorrect favicon shown for URL after going back
When restoring a cached page, we'd try to kick off the icon load for it, which ended up causing
shenanigans with the icon url -> page url mapping.
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::endIfNotLoading): Only try an icon load if we're not restoring from the page cache
(WebCore::FrameLoader::startIconLoader): Added helpful logging that helped me track this down
(WebCore::FrameLoader::commitIconURLToIconDatabase): Ditto (and fixed a comment typo)
* loader/icon/IconLoader.cpp:
(WebCore::IconLoader::stopLoading): Don't null out the ResourceLoader here, as clearLoadingState() does that
(WebCore::IconLoader::finishLoading): Added helpful logging that helped me track this down
2007-05-20 Darin Adler <darin@apple.com>
 
Reviewed by Oliver Hunt.
......@@ -992,7 +992,8 @@ void FrameLoader::endIfNotLoading()
// last one to complete.
checkCompleted();
startIconLoader();
if (m_documentLoader && !m_documentLoader->isLoadingFromCachedPage())
startIconLoader();
}
void FrameLoader::startIconLoader()
......@@ -1012,6 +1013,7 @@ void FrameLoader::startIconLoader()
// If we already have an unexpired icon, we won't kick off a load but we *will* map the appropriate URLs to it
if (iconDatabase()->hasEntryForIconURL(urlString) && loadType() != FrameLoadTypeReload && !iconDatabase()->isIconExpiredForIconURL(urlString)) {
LOG(IconDatabase, "FrameLoader::startIconLoader() - Committing iconURL %s to database", urlString.ascii().data());
commitIconURLToIconDatabase(url);
return;
}
......@@ -1046,6 +1048,7 @@ static HashSet<String, CaseInsensitiveHash<String> >& localSchemes()
void FrameLoader::commitIconURLToIconDatabase(const KURL& icon)
{
ASSERT(iconDatabase());
LOG(IconDatabase, "Committing iconURL %s to database for pageURLs %s and %s", icon.url().ascii(), m_URL.url().ascii(), originalRequestURL().url().ascii());
iconDatabase()->setIconURLForPageURL(icon.url(), m_URL.url());
iconDatabase()->setIconURLForPageURL(icon.url(), originalRequestURL().url());
}
......
......@@ -85,7 +85,6 @@ void IconLoader::startLoading()
void IconLoader::stopLoading()
{
m_resourceLoader = 0;
clearLoadingState();
}
......@@ -132,11 +131,12 @@ void IconLoader::finishLoading(const KURL& iconURL)
{
// <rdar://5071341> - Crash in IconLoader::finishLoading()
// In certain circumstance where there is no favicon and the site's 404 page is large and complex, the IconLoader can get
// cancelled/failed twice. Reproducibility of these phenomenom is unknown, so we'd like to catch this case in debug builds,
// cancelled/failed twice. Reproducibility of this phenomenom is unknown, so we'd like to catch this case in debug builds,
// but must handle it gracefully in release
ASSERT(m_resourceLoader);
if (!iconURL.isEmpty() && m_resourceLoader) {
iconDatabase()->setIconDataForIconURL(m_resourceLoader->resourceData(), iconURL.url());
LOG(IconDatabase, "IconLoader::finishLoading() - Committing iconURL %s to database", iconURL.url().ascii());
m_frame->loader()->commitIconURLToIconDatabase(iconURL);
m_frame->loader()->client()->dispatchDidReceiveIcon();
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment