#3133 Inspector > Trackers: Look for favicon.png

This commit is contained in:
Mitchell Livingston 2010-04-12 02:55:50 +00:00
parent 10dced5bb5
commit e115a0a2ad
1 changed files with 12 additions and 0 deletions

View File

@ -224,6 +224,7 @@ NSMutableSet * fTrackerIconLoading;
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
//try favicon.ico
NSURL * favIconUrl = [NSURL URLWithString: [baseAddress stringByAppendingPathComponent: @"favicon.ico"]];
NSURLRequest * request = [NSURLRequest requestWithURL: favIconUrl cachePolicy: NSURLRequestUseProtocolCachePolicy
@ -231,6 +232,17 @@ NSMutableSet * fTrackerIconLoading;
NSData * iconData = [NSURLConnection sendSynchronousRequest: request returningResponse: NULL error: NULL];
NSImage * icon = [[NSImage alloc] initWithData: iconData];
//try favicon.png
if (!icon)
{
favIconUrl = [NSURL URLWithString: [baseAddress stringByAppendingPathComponent: @"favicon.png"]];
request = [NSURLRequest requestWithURL: favIconUrl cachePolicy: NSURLRequestUseProtocolCachePolicy
timeoutInterval: 30.0];
iconData = [NSURLConnection sendSynchronousRequest: request returningResponse: NULL error: NULL];
icon = [[NSImage alloc] initWithData: iconData];
}
if (icon)
{
[fTrackerIconCache setObject: icon forKey: baseAddress];