Bug 18637 - Creation of WebKit icon database causes data loss if ~/Library/Icons exists
Summary: Creation of WebKit icon database causes data loss if ~/Library/Icons exists
Status: UNCONFIRMED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Images (show other bugs)
Version: 525.x (Safari 3.1)
Hardware: Mac OS X 10.5
: P2 Critical
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-04-20 12:36 PDT by Jesper
Modified: 2008-04-20 22:08 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jesper 2008-04-20 12:36:00 PDT
Whenever the icon database in WebKit is created, it creates the ~/Library/Icons folder, *overwriting anything that's already there*. If people don't know to keep their stuff out of the Library folder, it causes data loss.

I am short on details for where exactly this applies since it has happened to a user of my product who sent me an email telling me that my product is misbehaving, but it is certainly reproducible using the WebKit that's used with Safari 3.1.
Comment 1 Jesper 2008-04-20 12:40:19 PDT
I should note that I created the bug with a severity as critical since it triggers data loss when it happens, even if it is perhaps unlikely to happen, especially with the icon database being disabled by default in order to not put WebKit into multi-threaded mode lately.
Comment 2 Brady Eidson 2008-04-20 17:41:39 PDT
I can't reproduce this issue.  I tried the latest WebKit nightly, ran it, visited some sites with icons, and quit.  My default ~/Library/Safari/WebpageIcons.db database was modified, but no ~/Library/Icons file or directory was created...

"but it is certainly reproducible using the WebKit that's used with Safari 3.1."

Can you provide some exact steps to reproduce?

Comment 3 Jesper 2008-04-20 22:08:09 PDT
I should note that my product contains the following workaround code in its awakeFromNib method, which might be what triggers the bug:

	// http://bugs.webkit.org/show_bug.cgi?id=16296 says:
	// "Calling [WebIconDatabase sharedIconDatabase] is enough to instantiate the
	// global icon database, enable it, and result in icon loads.  Slapping that
	// one-liner into your - (void)setupIconDatabase; method made it work.
	//
	// It really sucks that the only way to enable part of the API is to use SPI
	// (granted, very stable SPI that's been around forever) but the alternative is to
	// have the overhead of icon loads and multithreading for *all* WebKit apps, which
	// is entirely unacceptable."
	@try {
		Class webIconDatabaseClass = NSClassFromString(@"WebIconDatabase");
		if (webIconDatabaseClass != Nil) {
			[webIconDatabaseClass performSelector:@selector(sharedIconDatabase)];
		}
	} @catch (NSException *exc) {
#pragma unused(exc)
	}

Without this code, I never got any icon delegate messages at all. (For more details on that, see the bug referenced.)