Reviewed by Tim Hatcher's rubberstamp
[WebKit-https.git] / WebKit / Misc / WebIconDatabase.m
index a002a2e6936eddace417870743404e5250a8902c..56467993c9d2b4f9577e4f9e8a5e4d44cbfa1fe5 100644 (file)
@@ -338,6 +338,7 @@ NSSize WebIconLargeSize = {128, 128};
     databaseDirectory = [databaseDirectory stringByExpandingTildeInPath];
     
     _private->fileDatabase = [[WebFileDatabase alloc] initWithPath:databaseDirectory];
+    [_private->fileDatabase setSizeLimit:20000000];
     [_private->fileDatabase open];
 }
 
@@ -380,8 +381,11 @@ NSSize WebIconLargeSize = {128, 128};
     NSMutableDictionary *pageURLToIconURL = nil;
     if (v <= WebIconDatabaseCurrentVersion) {
         pageURLToIconURL = [fileDB objectForKey:WebURLToIconURLKey];
-        // Removing old unnecessary mapping files is unecessary here as it will
-        // happen after the conversion to WebCore format when we wipe everything
+        // Remove the old unnecessary mapping files.
+        if (v < WebIconDatabaseCurrentVersion) {
+            [fileDB removeObjectForKey:ObsoleteIconsOnDiskKey];
+            [fileDB removeObjectForKey:ObsoleteIconURLToURLsKey];
+        }        
     }
     
     // Must double-check all values read from disk. If any are bogus, we just throw out the whole icon cache.