Changeset 91540 in webkit
- Timestamp:
- Jul 21, 2011 5:40:30 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r91533 r91540 1 2011-07-21 Rafael Brandao <rafael.lobo@openbossa.org> 2 3 Local files cannot load icons. 4 https://bugs.webkit.org/show_bug.cgi?id=62459 5 6 Previous policy only allowed favicons for pages whose protocol was part of HTTP family. 7 Changed that to allow to any url that's not empty and whose protocol is not "about". 8 Also added this check where it attempts to start loading the favicon, so it can avoid 9 wasting time downloading a resource that won't be stored and won't be used. 10 11 Reviewed by Adam Barth. 12 13 Test: manual-tests/resources/favicon-loads-for-local-files.html 14 15 * loader/icon/IconController.cpp: 16 (WebCore::IconController::startLoader): Added check to avoid to request a favicon 17 when there's no way to store it. 18 19 * loader/icon/IconDatabase.cpp: 20 (WebCore::IconDatabase::documentCanHaveIcon): Renamed function "pageCanHaveIcon" 21 to reflect better which url we're handling. 22 23 (WebCore::IconDatabase::synchronousIconForPageURL): Ditto. 24 (WebCore::IconDatabase::synchronousIconURLForPageURL): Ditto. 25 (WebCore::IconDatabase::retainIconForPageURL): Ditto. 26 (WebCore::IconDatabase::releaseIconForPageURL): Ditto. 27 (WebCore::IconDatabase::setIconURLForPageURL): Ditto. 28 (WebCore::IconDatabase::getOrCreatePageURLRecord): Ditto. 29 (WebCore::IconDatabase::importIconURLForPageURL): Ditto. 30 (WebCore::IconDatabase::performURLImport): Ditto. 31 * loader/icon/IconDatabase.h: 32 * loader/icon/IconDatabaseBase.h: 33 (WebCore::IconDatabaseBase::documentCanHaveIcon): Added it as virtual to replace its 34 default behavior of not allowing favicons when we have IconDatabase enabled. 35 36 * manual-tests/resources/favicon-loads-for-local-files.html: Added. 37 * manual-tests/resources/favicon.png: Added. 38 1 39 2011-07-21 Kulanthaivel Palanichamy <kulanthaivel@codeaurora.org> 2 40 -
trunk/Source/WebCore/loader/icon/IconController.cpp
r88682 r91540 114 114 return; 115 115 116 ASSERT(!m_frame->tree()->parent()); 117 if (!iconDatabase().documentCanHaveIcon(m_frame->document()->url())) 118 return; 119 116 120 KURL iconURL(url()); 117 121 String urlString(iconURL.string()); -
trunk/Source/WebCore/loader/icon/IconDatabase.cpp
r90486 r91540 100 100 } 101 101 102 static inline bool pageCanHaveIcon(const String& pageURL) 103 { 104 return protocolIsInHTTPFamily(pageURL);102 bool IconDatabase::documentCanHaveIcon(const String& documentURL) const 103 { 104 return !documentURL.isEmpty() && !protocolIs(documentURL, "about"); 105 105 } 106 106 … … 224 224 // We should go our of our way to only copy it if we have to store it 225 225 226 if (!isOpen() || ! pageCanHaveIcon(pageURLOriginal))226 if (!isOpen() || !documentCanHaveIcon(pageURLOriginal)) 227 227 return 0; 228 228 … … 311 311 // Also, in the case we have a real answer for the caller, we must deep copy that as well 312 312 313 if (!isOpen() || ! pageCanHaveIcon(pageURLOriginal))313 if (!isOpen() || !documentCanHaveIcon(pageURLOriginal)) 314 314 return String(); 315 315 … … 401 401 // Cannot do anything with pageURLOriginal that would end up storing it without deep copying first 402 402 403 if (!isEnabled() || ! pageCanHaveIcon(pageURLOriginal))403 if (!isEnabled() || !documentCanHaveIcon(pageURLOriginal)) 404 404 return; 405 405 … … 445 445 // Cannot do anything with pageURLOriginal that would end up storing it without deep copying first 446 446 447 if (!isEnabled() || ! pageCanHaveIcon(pageURLOriginal))447 if (!isEnabled() || !documentCanHaveIcon(pageURLOriginal)) 448 448 return; 449 449 … … 580 580 ASSERT(!iconURLOriginal.isEmpty()); 581 581 582 if (!isOpen() || ! pageCanHaveIcon(pageURLOriginal))582 if (!isOpen() || !documentCanHaveIcon(pageURLOriginal)) 583 583 return; 584 584 … … 890 890 ASSERT(!m_urlAndIconLock.tryLock()); 891 891 892 if (! pageCanHaveIcon(pageURL))892 if (!documentCanHaveIcon(pageURL)) 893 893 return 0; 894 894 … … 928 928 ASSERT(!iconURL.isEmpty()); 929 929 ASSERT(!pageURL.isEmpty()); 930 ASSERT( pageCanHaveIcon(pageURL));930 ASSERT(documentCanHaveIcon(pageURL)); 931 931 932 932 setIconURLForPageURLInSQLDatabase(iconURL, pageURL); … … 1235 1235 // If database cleanup *is* allowed, we don't want to bother pulling in a page url from disk that noone is actually interested 1236 1236 // in - we'll prune it later instead! 1237 if (!pageRecord && databaseCleanupCounter && pageCanHaveIcon(pageURL)) {1237 if (!pageRecord && databaseCleanupCounter && documentCanHaveIcon(pageURL)) { 1238 1238 pageRecord = new PageURLRecord(pageURL); 1239 1239 m_pageURLToRecordMap.set(pageURL, pageRecord); -
trunk/Source/WebCore/loader/icon/IconDatabase.h
r84892 r91540 137 137 virtual bool isOpen() const; 138 138 virtual String databasePath() const; 139 virtual bool documentCanHaveIcon(const String& documentURL) const; 139 140 static String defaultDatabaseFilename(); 140 141 -
trunk/Source/WebCore/loader/icon/IconDatabaseBase.h
r81892 r91540 166 166 // Used internally by WebCore 167 167 virtual bool isEnabled() const { return false; } 168 virtual bool documentCanHaveIcon(const String&) const { return false; } 168 169 169 170 virtual void retainIconForPageURL(const String&) { }
Note: See TracChangeset
for help on using the changeset viewer.