Merge pull request #1752 from Wevah/ios-candidate
Fix homePageURLsWithNoFaviconURLCache
This commit is contained in:
commit
d67f04ce4d
|
@ -24,6 +24,7 @@ final class FaviconDownloader {
|
||||||
private let diskCache: BinaryDiskCache
|
private let diskCache: BinaryDiskCache
|
||||||
private var singleFaviconDownloaderCache = [String: SingleFaviconDownloader]() // faviconURL: SingleFaviconDownloader
|
private var singleFaviconDownloaderCache = [String: SingleFaviconDownloader]() // faviconURL: SingleFaviconDownloader
|
||||||
private var remainingFaviconURLs = [String: ArraySlice<String>]() // homePageURL: array of faviconURLs that haven't been checked yet
|
private var remainingFaviconURLs = [String: ArraySlice<String>]() // homePageURL: array of faviconURLs that haven't been checked yet
|
||||||
|
private var currentHomePageHasOnlyFaviconICO = false
|
||||||
|
|
||||||
private var homePageToFaviconURLCache = [String: String]() //homePageURL: faviconURL
|
private var homePageToFaviconURLCache = [String: String]() //homePageURL: faviconURL
|
||||||
private var homePageToFaviconURLCachePath: String
|
private var homePageToFaviconURLCachePath: String
|
||||||
|
@ -131,20 +132,14 @@ final class FaviconDownloader {
|
||||||
}
|
}
|
||||||
|
|
||||||
findFaviconURLs(with: url) { (faviconURLs) in
|
findFaviconURLs(with: url) { (faviconURLs) in
|
||||||
var hasIcons = false
|
|
||||||
|
|
||||||
if let faviconURLs = faviconURLs {
|
if let faviconURLs = faviconURLs {
|
||||||
|
self.currentHomePageHasOnlyFaviconICO = faviconURLs.count == 1
|
||||||
|
|
||||||
if let firstIconURL = faviconURLs.first {
|
if let firstIconURL = faviconURLs.first {
|
||||||
hasIcons = true
|
|
||||||
let _ = self.favicon(with: firstIconURL, homePageURL: url)
|
let _ = self.favicon(with: firstIconURL, homePageURL: url)
|
||||||
self.remainingFaviconURLs[url] = faviconURLs.dropFirst()
|
self.remainingFaviconURLs[url] = faviconURLs.dropFirst()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hasIcons) {
|
|
||||||
self.homePageURLsWithNoFaviconURLCache.insert(url)
|
|
||||||
self.homePageURLsWithNoFaviconURLCacheDirty = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -167,6 +162,11 @@ final class FaviconDownloader {
|
||||||
remainingFaviconURLs[homePageURL] = faviconURLs.dropFirst();
|
remainingFaviconURLs[homePageURL] = faviconURLs.dropFirst();
|
||||||
} else {
|
} else {
|
||||||
remainingFaviconURLs[homePageURL] = nil
|
remainingFaviconURLs[homePageURL] = nil
|
||||||
|
|
||||||
|
if currentHomePageHasOnlyFaviconICO {
|
||||||
|
self.homePageURLsWithNoFaviconURLCache.insert(homePageURL)
|
||||||
|
self.homePageURLsWithNoFaviconURLCacheDirty = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue