From a845f6cc6f99053ee334cc5e194ce76baa1048c1 Mon Sep 17 00:00:00 2001 From: "stridey%gmail.com" Date: Fri, 9 Feb 2007 17:52:38 +0000 Subject: [PATCH] Camino only - Bug 369042: Fix bookmark icon for missing files. r=smorgan sr=pink --- camino/src/application/MainController.mm | 1 + camino/src/browser/SiteIconProvider.mm | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/camino/src/application/MainController.mm b/camino/src/application/MainController.mm index eb9ba1f1db8..9f3ef8a5a97 100644 --- a/camino/src/application/MainController.mm +++ b/camino/src/application/MainController.mm @@ -234,6 +234,7 @@ NSString* const kPreviousSessionTerminatedNormallyKey = @"PreviousSessionTermina // register some special favicon images [[SiteIconProvider sharedFavoriteIconProvider] registerFaviconImage:[NSImage imageNamed:@"smallDocument"] forPageURI:@"about:blank"]; + [[SiteIconProvider sharedFavoriteIconProvider] registerFaviconImage:[NSImage imageNamed:@"smallDocument"] forPageURI:@"about:local_file"]; [[SiteIconProvider sharedFavoriteIconProvider] registerFaviconImage:[NSImage imageNamed:@"bm_favicon"] forPageURI:@"about:bookmarks"]; [[SiteIconProvider sharedFavoriteIconProvider] registerFaviconImage:[NSImage imageNamed:@"historyicon"] forPageURI:@"about:history"]; diff --git a/camino/src/browser/SiteIconProvider.mm b/camino/src/browser/SiteIconProvider.mm index 103afe88cf3..bca23928e02 100644 --- a/camino/src/browser/SiteIconProvider.mm +++ b/camino/src/browser/SiteIconProvider.mm @@ -555,10 +555,13 @@ NeckoCacheHelper::ClearCache() + (NSString*)defaultFaviconLocationStringFromURI:(NSString*)inURI { - // about: urls and local files are special - if ([inURI hasPrefix:@"about:"] || [inURI hasPrefix:@"file:"]) + if ([inURI hasPrefix:@"about:"]) return inURI; + // If the file exists, return its path, otherwise use generic icon location + if ([inURI hasPrefix:@"file:"]) + return ([[NSFileManager defaultManager] fileExistsAtPath:[[NSURL URLWithString:inURI] path]] ? inURI : @"about:local_file"); + // we use nsIURI here, rather than NSURL, because the former does // a better job with suspect urls (e.g. those containing |), and // allows us go keep the port