From 2433525e3232b8819fa1ea999e17274e0c1d54b9 Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Wed, 23 Sep 2009 21:45:51 +0000 Subject: [PATCH] add a 10-second timeout to the favicon request --- macosx/InfoWindowController.m | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/macosx/InfoWindowController.m b/macosx/InfoWindowController.m index 0612132cd..763cd45a1 100644 --- a/macosx/InfoWindowController.m +++ b/macosx/InfoWindowController.m @@ -958,7 +958,12 @@ typedef enum NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSURL * favIconUrl = [NSURL URLWithString: [baseAddress stringByAppendingPathComponent: @"favicon.ico"]]; - NSImage * icon = [[NSImage alloc] initWithContentsOfURL: favIconUrl]; + + NSURLRequest * request = [NSURLRequest requestWithURL: favIconUrl cachePolicy: NSURLRequestUseProtocolCachePolicy + timeoutInterval: 10.0]; + NSData * iconData = [NSURLConnection sendSynchronousRequest: request returningResponse: NULL error: NULL]; + NSImage * icon = [[NSImage alloc] initWithData: iconData]; + if (icon) { [fTrackerIconCache setObject: icon forKey: baseAddress];