[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

trey trey at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:32:57 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 4e81c3b349a928abc36cfedb89bed125f9e6b381
Author: trey <trey at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Apr 1 02:49:11 2003 +0000

    WebKit:
    
    	3212724 - bookmarks and history items have screwed up designated inits
    
    	and support code for:
    	3116315 - autocomplete needs some prioritization magic
    
    	The main changes are adding and maintaining a visitCount to the HistoryItem,
    	cleaning up the init methods of HistoryItem.  Also lastVisitedDate is now
    	set explicitly instead of automatically getting the current date.
    
            Reviewed by John.
    
            * History.subproj/WebHistory.m:
            (-[WebHistory addItemForURL:]):  Set lastVisitedDate of new item.
            (-[WebHistory _itemForURLString:]):  New helper routine.
            * History.subproj/WebHistoryItem.h:  Conform to NSCopying.
            * History.subproj/WebHistoryItem.m:
            (-[WebHistoryItem init]):  Behave like a designated initializer.
            (-[WebHistoryItem copyWithZone:]):  New.
            (-[WebHistoryItem initWithURL:title:]):  Call the designated initializer.
            (-[WebHistoryItem initWithURL:target:parent:title:]):    Call the designated initializer.
    	Don't blindly init lastVisitedDate.
            (-[WebHistoryItem setLastVisitedDate:]):  Update visitCount too.
            (-[WebHistoryItem visitCount]):  New getter.
            (-[WebHistoryItem setVisitCount:]):  New setter.
            (-[WebHistoryItem _mergeAutoCompleteHints:]):  Combine autocomplete info
    	of two items.  Used when one item replaces another in the history.
            (-[WebHistoryItem dictionaryRepresentation]):  Write visitCount.
            (-[WebHistoryItem initFromDictionaryRepresentation:]):  Read visitCount.
            * History.subproj/WebHistoryItemPrivate.h:
            * History.subproj/WebHistoryPrivate.h:
            * History.subproj/WebHistoryPrivate.m:
            (-[WebHistoryPrivate addItem:]):  Merge autocomplete date from old item to new.
            (-[WebHistoryPrivate itemForURLString:]):   s/entry/item/
            (-[WebHistoryPrivate containsItemForURLString:]):   s/entry/item/
            (-[WebHistoryPrivate containsURL:]):   s/entry/item/
            (-[WebHistoryPrivate itemForURL:]):   s/entry/item/
            (-[WebHistoryPrivate _loadHistoryGuts:]):  Skip history items without visitDate.
            * WebView.subproj/WebFramePrivate.m:
            (-[WebFrame _transitionToCommitted:]):  Update last visitTime when we revisit
    	the same URL (since no new history item is created).
    
    WebBrowser:
    
    	3116315 - autocomplete needs some prioritization magic
    	3181925 - editing redundant bookmarks could lead to screwed up autocomplete, likely crash
    	3212724 - bookmarks and history items have screwed up designated inits
    	3213092 - REGRESSION: infinite loop on launch if no bookmarks file exists
    
            Reviewed by John.
    
            * BookmarksController.h:
            * BookmarksController.m:
            (-[BookmarksController bookmarksFileHasChanged]):
    	Don't return YES if the file doesn't exist - fixes 3213092.
            (-[BookmarksController savePendingChangesWhenever]):
    	New method to dirty bookmarks file without causing save.
            * BrowserWebBookmarkExtras.m:
            (-[WebBookmark _goToWithWindowPolicy:]):  Set lastVisited date of bookmark.
    	Rearranged code to get rid of embedded return statements.
    
    	General idea here is that the _instantRedirectPending is replaced by the
    	delay of the redirect.  I ended up tossing the client code that used this,
    	but it seems like a useful thing to keep for no cost.
            * BrowserWebController.h:
            * BrowserWebController.m:
            (-[BrowserWebController initWithDocument:request:frameName:]):
    	Init _redirectDelay.
            (-[BrowserWebController displayName]):  Test _redirectDelay.
            (-[BrowserWebController setPendingRedirectDelay:]):
    	Set the _redirectDelay instead of just the BOOL.
            (-[BrowserWebController cancelPendingRedirect]):  Clear _redirectDelay.
            (-[BrowserWebController pendingRedirectDelay]):  Return _redirectDelay.
            (-[BrowserWebController pageLoadingStatusHasChanged]): Test _redirectDelay.
            * LocationChangeHandler.m:
            (-[LocationChangeHandler webView:locationChangeStartedForDataSource:]):
    	Don't clear redirectDelay yet.  Wait for clientRedirectCancelled.
            (-[LocationChangeHandler webView:locationChangeDone:forDataSource:]):
    	Adopt coding standards.  clear redirectDelay
            (-[LocationChangeHandler webView:willCloseLocationForDataSource:]): Add LOG
            (-[LocationChangeHandler webView:locationChangedWithinPageForDataSource:]):
    	Add LOG
            (-[LocationChangeHandler webView:clientWillRedirectTo:delay:fireDate:forFrame:]):
    	Add LOG, set redirectDelay.
            (-[LocationChangeHandler webView:clientRedirectCancelledForFrame:]):
    	Add LOG, clear redirectDelay.
    
            * BrowserWindowController.m:
            (-[BrowserWindowController frameLoadFinished:]):
    	Renamed a variable, noted an existing bug.
            * English.lproj/Localizable.strings:
            * English.lproj/StringsNotToBeLocalized.txt:
            * GlobalHistory.m:
            (-[GlobalHistory parentOfContentItem:]):  Added ASSERT.
            * LoadProgressMonitor.m:
            (-[LoadProgressMonitor _createProgressEntryWithRequest:dataSource:]):
    	Comment out overly verbose, misfit LOG.
    
    	Two things going on here:  1) We changed the Patricia Trie data structure to
    	hold an array of bookmarks instead of just one with a refcount, to fix problems
    	when bookmarks were added/deleted.  In addition, this also means that when we
    	have both a HistoryItem and Bookmark added, we prefer the Bookmark instead of
    	the History item.  2) Added code to pick the selected autocomplete element
    	based on various heuristics.
            * URLCompletionController.m:
            (isDeleted):  Use deleted flag instead of refCount.
            (+[URLCompletionController _tree_create]):  Set deleted instead of refCount.
            (_keyStringFromNode): Test deleted flag instead of isKindOf:NSString.
    	This is functionally the same thing, but would make it easier to separate
    	out the data structure into a reusable class someday.
            (_findPotentialNode):  Added ASSERT.
            (setKeyForNode):  New utility routine for setting the key of a node.
            (deleteKeyForNode):  New utility routine for deleting the key of a node.
            (+[URLCompletionController _tree_addItem:]):  Deal with all the cases of
    	adding items and bookmarks in different order.
            (+[URLCompletionController _tree_deleteItem:]): Deal with all the cases of
    	removing items and bookmarks in different order.
            (_rawStringFromItem):  Handle the array-of-bookmarks case.
            (+[URLCompletionController _loadDB]):  Use GlobalHistory instead of
    	WebHistory so we know the thing will be created if needed.
            (-[URLCompletionController _queryStringForAbsoluteURL:fullScan:]):
    	This is just code factored from the next method.
            (-[URLCompletionController _queryStringForString:fullScan:]):
    	Cut out code of above method for factoring.
            (visitCountForResult):  Calc the visit count for a given result.
            (-[URLCompletionController _indexOfBestMatch:]):  Pick the best result.
            (-[URLCompletionController queryResultsForString:startingMatch:]):
    	Call _indexOfBestMatch instead of just using 0.  All other changes here are
    	diff being dumb.
            (+[URLCompletionController _registerForNotifications]):  Use GlobalHistory
    	instead of  WebHistory so we know the thing will be created if needed.
            (-[URLCompletionController _addStatsForURL:]):  NOP'ed code.
    
    	This is all mostly sorting out the designated inits.
            * WebBookmark.h:
            * WebBookmark.m:
            (-[WebBookmark initFromDictionaryRepresentation:withGroup:]):
    	Call super like a designated init should.
            * WebBookmarkGroup.h:
            * WebBookmark.h:
            * WebBookmark.m:
            (-[WebBookmarkLeaf setLastVisitedDate:]):  New abstract method.
            (-[WebBookmarkLeaf lastVisitedDate]):  New abstract method.
            * WebBookmarkLeaf.m:
            (-[WebBookmarkLeaf init]):  Call super like a designated init should.
            (-[WebBookmarkLeaf initWithURLString: title:group:]):
    	Call [self init] like a non-designated init should.
            (-[WebBookmarkLeaf initFromDictionaryRepresentation:withGroup:]):
    	No need to free wasted entry now that this is a designated init.
            (-[WebBookmarkLeaf dictionaryRepresentation]):  Nil out visitCount, since
    	we don't want this to end up in the bookmarks file.
            (-[WebBookmarkLeaf copyWithZone:]):  Do a real copy of the HistoryItem.
            (-[WebBookmarkLeaf setLastVisitedDate:]):  New setter.
            (-[WebBookmarkLeaf lastVisitedDate]):  New getter.
            * WebBookmarkList.m:
            (-[WebBookmarkList init]):  Call super like a designated init should.
            (-[WebBookmarkList initWithTitle:group:]):
    	Call [self init] like a non-designated init should.
            (-[WebBookmarkList initFromDictionaryRepresentation:withGroup:]):
    	Alloc _list, since we are a designated init.
            * WebBookmarkProxy.m:
    	Nuke init method.  Now that it is a designated init, it can use the inherited
    	one.
            (-[WebBookmarkList initWithTitle:group:]):
    	Call [self init] like a non-designated init should.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3983 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 7954753..d23d955 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,48 @@
+2003-03-31  Trey Matteson  <trey at apple.com>
+
+	3212724 - bookmarks and history items have screwed up designated inits
+
+	and support code for:
+	3116315 - autocomplete needs some prioritization magic
+
+	The main changes are adding and maintaining a visitCount to the HistoryItem,
+	cleaning up the init methods of HistoryItem.  Also lastVisitedDate is now
+	set explicitly instead of automatically getting the current date.
+
+        Reviewed by John.
+
+        * History.subproj/WebHistory.m:
+        (-[WebHistory addItemForURL:]):  Set lastVisitedDate of new item.
+        (-[WebHistory _itemForURLString:]):  New helper routine.
+        * History.subproj/WebHistoryItem.h:  Conform to NSCopying.
+        * History.subproj/WebHistoryItem.m:
+        (-[WebHistoryItem init]):  Behave like a designated initializer.
+        (-[WebHistoryItem copyWithZone:]):  New.
+        (-[WebHistoryItem initWithURL:title:]):  Call the designated initializer.
+        (-[WebHistoryItem initWithURL:target:parent:title:]):    Call the designated initializer.
+	Don't blindly init lastVisitedDate.
+        (-[WebHistoryItem setLastVisitedDate:]):  Update visitCount too.
+        (-[WebHistoryItem visitCount]):  New getter.
+        (-[WebHistoryItem setVisitCount:]):  New setter.
+        (-[WebHistoryItem _mergeAutoCompleteHints:]):  Combine autocomplete info
+	of two items.  Used when one item replaces another in the history.
+        (-[WebHistoryItem dictionaryRepresentation]):  Write visitCount.
+        (-[WebHistoryItem initFromDictionaryRepresentation:]):  Read visitCount.
+        * History.subproj/WebHistoryItemPrivate.h:
+        * History.subproj/WebHistoryPrivate.h:
+        * History.subproj/WebHistoryPrivate.m:
+        (-[WebHistoryPrivate addItem:]):  Merge autocomplete date from old item to new.
+        (-[WebHistoryPrivate itemForURLString:]):   s/entry/item/
+        (-[WebHistoryPrivate containsItemForURLString:]):   s/entry/item/
+        (-[WebHistoryPrivate containsURL:]):   s/entry/item/
+        (-[WebHistoryPrivate itemForURL:]):   s/entry/item/
+        (-[WebHistoryPrivate _loadHistoryGuts:]):  Skip history items without visitDate.
+        * WebView.subproj/WebFramePrivate.m:
+        (-[WebFrame _transitionToCommitted:]):  Update last visitTime when we revisit
+	the same URL (since no new history item is created).
+
+2003-03-31  Richard Williamson  <rjw at apple.com>
+
 2003-03-31  Richard Williamson  <rjw at apple.com>
 
         Fixed 3213637.  We weren't calling the correct delegate method,
diff --git a/WebKit/English.lproj/StringsNotToBeLocalized.txt b/WebKit/English.lproj/StringsNotToBeLocalized.txt
index 982438b..bf56105 100644
--- a/WebKit/English.lproj/StringsNotToBeLocalized.txt
+++ b/WebKit/English.lproj/StringsNotToBeLocalized.txt
@@ -9,7 +9,7 @@
 "%@/Library/Preferences/%@"
 "%@:%u"
 "%d"
-"%lf"
+"%.1lf"
 "(This file must be converted with BinHex 4.0)"
 ","
 "/"
@@ -230,6 +230,7 @@
 "tiff"
 "url_icon"
 "video/mp4"
+"visitCount"
 "x"
 History.subproj/WebHistoryItem.m:" in \"%@\""
 History.subproj/WebHistoryItem.m:"children"
diff --git a/WebKit/History.subproj/WebHistory.m b/WebKit/History.subproj/WebHistory.m
index a8bf93b..800e638 100644
--- a/WebKit/History.subproj/WebHistory.m
+++ b/WebKit/History.subproj/WebHistory.m
@@ -97,6 +97,7 @@ static WebHistory *_sharedHistory = nil;
 - (WebHistoryItem *)addItemForURL: (NSURL *)URL
 {
     WebHistoryItem *entry = [[WebHistoryItem alloc] initWithURL:URL title:nil];
+    [entry setLastVisitedDate: [NSCalendarDate date]];
     [self addItem: entry];
     [entry release];
     return entry;
@@ -194,4 +195,10 @@ static WebHistory *_sharedHistory = nil;
     return [_historyPrivate saveHistory];
 }
 
+- (WebHistoryItem *)_itemForURLString:(NSString *)URLString
+{
+    return [_historyPrivate itemForURLString: URLString];
+}
+
+
 @end
diff --git a/WebKit/History.subproj/WebHistoryItem.h b/WebKit/History.subproj/WebHistoryItem.h
index 8f7301e..7a8b355 100644
--- a/WebKit/History.subproj/WebHistoryItem.h
+++ b/WebKit/History.subproj/WebHistoryItem.h
@@ -18,7 +18,7 @@
     WebHistoryItems are set by WebKit.
     WebHistoryItems cannot be created directly.
 */
- at interface WebHistoryItem : NSObject
+ at interface WebHistoryItem : NSObject <NSCopying>
 {
 @private
     WebHistoryItemPrivate *_private;
diff --git a/WebKit/History.subproj/WebHistoryItem.m b/WebKit/History.subproj/WebHistoryItem.m
index 6ea5e93..8d9e3df 100644
--- a/WebKit/History.subproj/WebHistoryItem.m
+++ b/WebKit/History.subproj/WebHistoryItem.m
@@ -33,6 +33,7 @@
     NSMutableDictionary *pageCache;
     BOOL isTargetItem;
     BOOL alwaysAttemptToUsePageCache;
+    int visitCount;
     // info used to repost form data
     NSData *formData;
     NSString *formContentType;
@@ -66,7 +67,9 @@
 
 - (id)init
 {
-    return [self initWithURL:nil title:nil];
+    self = [super init];
+    _private = [[WebHistoryItemPrivate alloc] init];
+    return self;
 }
 
 - (void)dealloc
@@ -78,6 +81,29 @@
     [super dealloc];
 }
 
+- (id)copyWithZone:(NSZone *)zone
+{
+    WebHistoryItem *copy = NSCopyObject(self, 0, zone);
+    copy->_private = [[WebHistoryItemPrivate alloc] init];
+    copy->_private->URLString = [_private->URLString copy];
+    [copy _retainIconInDatabase:YES];
+    copy->_private->originalURLString = [_private->originalURLString copy];
+    copy->_private->target = [_private->target copy];
+    copy->_private->parent = [_private->parent copy];
+    copy->_private->title = [_private->title copy];
+    copy->_private->displayTitle = [_private->displayTitle copy];
+    copy->_private->lastVisitedDate = [_private->lastVisitedDate copy];
+    copy->_private->anchor = [_private->anchor copy];
+    if (_private->subItems) {
+        copy->_private->subItems = [[NSMutableArray alloc] initWithArray:_private->subItems copyItems:YES];
+    }
+    copy->_private->formData = [_private->formData copy];
+    copy->_private->formContentType = [_private->formContentType copy];
+    copy->_private->formReferrer = [_private->formReferrer copy];
+
+    return copy;
+}
+
 // FIXME: need to decide it this class ever returns URLs, and the name of this method
 - (NSString *)URLString
 {
@@ -193,34 +219,24 @@
     }
 }
 
-
 + (WebHistoryItem *)entryWithURL:(NSURL *)URL
 {
     return [[[self alloc] initWithURL:URL title:nil] autorelease];
 }
 
-
 - (id)initWithURL:(NSURL *)URL title:(NSString *)title
 {
-    return [self initWithURL:URL target:nil parent:nil title:title];
+    self = [self init];
+    [self setURL:URL];
+    _private->title = [title copy];
+    return self;
 }
 
 - (id)initWithURL:(NSURL *)URL target:(NSString *)target parent:(NSString *)parent title:(NSString *)title
 {
-    if (self != [super init])
-    {
-        return nil;
-    }
-
-    _private = [[WebHistoryItemPrivate alloc] init];
-    _private->URLString = [[URL absoluteString] copy];
+    self = [self initWithURL:URL title:title];
     _private->target = [target copy];
     _private->parent = [parent copy];
-    _private->title = [title copy];
-    _private->lastVisitedDate = [[NSCalendarDate alloc] init];
-
-    [self _retainIconInDatabase:YES];
-
     return self;
 }
 
@@ -287,9 +303,24 @@
 
 - (void)setLastVisitedDate:(NSCalendarDate *)date
 {
-    [date retain];
-    [_private->lastVisitedDate release];
-    _private->lastVisitedDate = date;
+    if (date != _private->lastVisitedDate) {
+        if (![_private->lastVisitedDate isEqual:date]) {
+            _private->visitCount++;
+        }
+        [date retain];
+        [_private->lastVisitedDate release];
+        _private->lastVisitedDate = date;
+    }
+}
+
+- (int)visitCount
+{
+    return _private->visitCount;
+}
+
+- (void)setVisitCount:(int)count
+{
+    _private->visitCount = count;
 }
 
 - (void)setDocumentState:(NSArray *)state;
@@ -401,6 +432,13 @@
     return _private->subItems;
 }
 
+- (void)_mergeAutoCompleteHints:(WebHistoryItem *)otherItem
+{
+    if (otherItem != self) {
+        _private->visitCount += otherItem->_private->visitCount;
+    }
+}
+
 - (void)addChildItem:(WebHistoryItem *)item
 {
     if (!_private->subItems) {
@@ -436,9 +474,12 @@
         [dict setObject:_private->displayTitle forKey:@"displayTitle"];
     }
     if (_private->lastVisitedDate) {
-        [dict setObject:[NSString stringWithFormat:@"%lf", [_private->lastVisitedDate timeIntervalSinceReferenceDate]]
+        [dict setObject:[NSString stringWithFormat:@"%.1lf", [_private->lastVisitedDate timeIntervalSinceReferenceDate]]
                  forKey:@"lastVisitedDate"];
     }
+    if (_private->visitCount) {
+        [dict setObject:[NSNumber numberWithInt:_private->visitCount] forKey:@"visitCount"];
+    }
     if (_private->subItems != nil) {
         NSMutableArray *childDicts = [NSMutableArray arrayWithCapacity:[_private->subItems count]];
         int i;
@@ -456,9 +497,10 @@
     NSString *URLString = [dict _web_stringForKey:@""];
     NSString *title = [dict _web_stringForKey:@"title"];
 
-    [self initWithURL:(URLString ? [NSURL _web_URLWithString:URLString] : nil) title:title];
+    self = [self initWithURL:(URLString ? [NSURL _web_URLWithString:URLString] : nil) title:title];
 
     [self setDisplayTitle:[dict _web_stringForKey:@"displayTitle"]];
+
     NSString *date = [dict _web_stringForKey:@"lastVisitedDate"];
     if (date) {
         NSCalendarDate *calendarDate = [[NSCalendarDate alloc]
@@ -467,6 +509,8 @@
         [calendarDate release];
     }
 
+    _private->visitCount = [dict _web_intForKey:@"visitCount"];
+
     NSArray *childDicts = [dict objectForKey:@"children"];
     if (childDicts) {
         _private->subItems = [[NSMutableArray alloc] initWithCapacity:[childDicts count]];
diff --git a/WebKit/History.subproj/WebHistoryItemPrivate.h b/WebKit/History.subproj/WebHistoryItemPrivate.h
index f6a23ec..f23a135 100644
--- a/WebKit/History.subproj/WebHistoryItemPrivate.h
+++ b/WebKit/History.subproj/WebHistoryItemPrivate.h
@@ -6,7 +6,6 @@
 
 #import <WebKit/WebHistoryItem.h>
 
-
 @interface WebHistoryItem (WebPrivate)
 - (void)_retainIconInDatabase:(BOOL)retain;
 + (void)_releaseAllPendingPageCaches;
@@ -31,6 +30,9 @@
 - (NSData *)formData;
 - (NSString *)formContentType;
 - (NSString *)formReferrer;
+- (int)visitCount;
+
+- (void)_mergeAutoCompleteHints:(WebHistoryItem *)otherItem;
 
 - (void)setURL:(NSURL *)URL;
 - (void)setOriginalURLString:(NSString *)URL;
@@ -45,6 +47,7 @@
 - (void)setFormData:(NSData *)data;
 - (void)setFormContentType:(NSString *)type;
 - (void)setFormReferrer:(NSString *)referrer;
+- (void)setVisitCount:(int)count;
 
 - (NSArray *)children;
 - (void)addChildItem:(WebHistoryItem *)item;
diff --git a/WebKit/History.subproj/WebHistoryPrivate.h b/WebKit/History.subproj/WebHistoryPrivate.h
index 16b7cf1..70b0624 100644
--- a/WebKit/History.subproj/WebHistoryPrivate.h
+++ b/WebKit/History.subproj/WebHistoryPrivate.h
@@ -33,6 +33,7 @@
 - (BOOL)containsItemForURLString: (NSString *)URLString;
 - (BOOL)containsURL: (NSURL *)URL;
 - (WebHistoryItem *)itemForURL:(NSURL *)URL;
+- (WebHistoryItem *)itemForURLString:(NSString *)URLString;
 
 - (NSURL *)URL;
 - (BOOL)loadHistory;
@@ -48,4 +49,6 @@
 - initWithFile: (NSString *)file;
 - (WebHistoryItem *)addItemForURL: (NSURL *)URL;
 - (BOOL)containsItemForURLString: (NSString *)URLString;
+- (WebHistoryItem *)_itemForURLString:(NSString *)URLString;
+
 @end
diff --git a/WebKit/History.subproj/WebHistoryPrivate.m b/WebKit/History.subproj/WebHistoryPrivate.m
index 61d35bb..7980b27 100644
--- a/WebKit/History.subproj/WebHistoryPrivate.m
+++ b/WebKit/History.subproj/WebHistoryPrivate.m
@@ -16,10 +16,6 @@
 #import <WebFoundation/WebNSURLExtras.h>
 
 
- at interface WebHistoryPrivate (Private)
--(WebHistoryItem *)_entryForURLString:(NSString *)URLString;
- at end
-
 @implementation WebHistoryPrivate
 
 //#define FIX_VISITED
@@ -153,6 +149,14 @@
 #else
     URLString = [[entry URL] absoluteString];
 #endif
+
+    // If we already have an item with this URL, we need to merge info that drives the
+    // URL autocomplete heuristics from that item into the new one.
+    WebHistoryItem *oldEntry = [_entriesByURL objectForKey: URLString];
+    if (oldEntry) {
+        [entry _mergeAutoCompleteHints:oldEntry];
+    }
+
     [self removeItemForURLString: URLString];
 
     if ([self findIndex: &dateIndex forDay: [entry lastVisitedDate]]) {
@@ -256,31 +260,31 @@
 
 #pragma mark URL MATCHING
 
--(WebHistoryItem *)_entryForURLString:(NSString *)URLString
+- (WebHistoryItem *)itemForURLString:(NSString *)URLString
 {
     return [_entriesByURL objectForKey: URLString];
 }
 
 - (BOOL)containsItemForURLString: (NSString *)URLString
 {
-    return [self _entryForURLString:URLString] != nil;
+    return [self itemForURLString:URLString] != nil;
 }
 
 - (BOOL)containsURL: (NSURL *)URL
 {
 #ifdef FIX_VISITED
-    return [self _entryForURLString:[[URL _web_canonicalize] absoluteString]] != nil;
+    return [self itemForURLString:[[URL _web_canonicalize] absoluteString]] != nil;
 #else
-    return [self _entryForURLString:[URL absoluteString]] != nil;
+    return [self itemForURLString:[URL absoluteString]] != nil;
 #endif
 }
 
 - (WebHistoryItem *)itemForURL:(NSURL *)URL
 {
 #ifdef FIX_VISITED
-    return [self _entryForURLString:[[URL _web_canonicalize] absoluteString]];
+    return [self itemForURLString:[[URL _web_canonicalize] absoluteString]];
 #else
-    return [self _entryForURLString:[URL absoluteString]];
+    return [self itemForURLString:[URL absoluteString]];
 #endif
 }	
 
@@ -368,8 +372,9 @@
 
         entry = [[[WebHistoryItem alloc] initFromDictionaryRepresentation: dictionary] autorelease];
 
-        if ([entry URL] == nil) {
+        if ([entry URL] == nil || [entry lastVisitedDate] == nil) {
             // entry without URL is useless; data on disk must have been bad; ignore this one
+            // entry without lastVisitDate should never happen; ignore that one
             continue;
         }
 
diff --git a/WebKit/WebView.subproj/WebFramePrivate.m b/WebKit/WebView.subproj/WebFramePrivate.m
index b60b963..25ca5fc 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.m
+++ b/WebKit/WebView.subproj/WebFramePrivate.m
@@ -629,6 +629,13 @@ Repeat load of the same URL (by any other means of navigation other than the rel
                 if (loadType == WebFrameLoadTypeReload) {
                     [self _saveScrollPositionToItem:currItem];
                 }
+                // Update the last visited time.  Mostly interesting for URL autocompletion
+                // statistics.
+                NSURL *URL = [[[ds _originalRequest] URL] _web_canonicalize];
+                WebHistoryItem *oldItem = [[WebHistory sharedHistory] itemForURL:URL];
+                if (oldItem) {
+                    [oldItem setLastVisitedDate:[NSCalendarDate date]];
+                }
                 [self _makeDocumentView];
                 break;
             }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list