[tlu] favicons

Adam R. Maxwell amaxwell at mac.com
Sat Mar 12 18:56:40 CET 2022

> On Mar 12, 2022, at 07:51 , Bruno Voisin via tlu <tlu at tug.org> wrote:
> I tried to look at TLMFaviconCache.m to figure out what's happening, but it's definitely not the type of code you can casually look at with no previous experience of programming and expect to understand in a flash!

You boys just have to keep looking at my debug logging, no matter how many times I tell you to ignore it, eh? Give this a try. :-)


It now only logs when actually downloading something. No other changes.

Note that if the queue is already downloading a given instance of _TLMFaviconQueueItem, it doesn't add a new request to the queue (see the check in the code here for indexOfObject:). 

        NSURL *faviconURL = [[[NSURL alloc] initWithScheme:[aURL scheme] host:[aURL host] path:@"/favicon.ico"] autorelease];

        _TLMFaviconQueueItem *item = [[_TLMFaviconQueueItem alloc] initWithURL:faviconURL];
        [item setIconURL:faviconURL];
        if (delegate) [[item delegates] addObject:delegate];
        const NSUInteger idx = [_queue indexOfObject:item];
        if (NSNotFound != idx) {
            if (delegate) [[[_queue objectAtIndex:idx] delegates] addObject:delegate];
        else {
            TLMLog(__func__, @"Will look for favicon at %@", faviconURL);
            [_queue insertObject:item atIndex:0];
            [self _downloadItems];

You can look in the implementation and see that -[_TLMFaviconQueueItem isEqual:] is implemented based on icon URL. 

Let me know if this matches what you expect. I'm off to play ham radio with my new antenna, replace the center hinge on my wife's car's sliding doors, and maybe dig some irrigation ditch.


More information about the tlu mailing list.