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

rjw rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:38:34 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 6973f274fc853c71a963dd2b71fae8aa035cea6a
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Apr 25 01:03:01 2003 +0000

    WebKit:
            Final API review changes.
    
            Reviewed by Chris.
    
            * History.subproj/WebBackForwardList.h:
            * History.subproj/WebBackForwardList.m:
            (-[WebBackForwardList containsItem:]):
            (-[WebBackForwardList capacity]):
            (-[WebBackForwardList setCapacity:]):
            (-[WebBackForwardList _clearPageCache]):
            (-[WebBackForwardList setPageCacheSize:]):
            (-[WebBackForwardList _setUsesPageCache:]):
            (-[WebBackForwardList _usesPageCache]):
            * History.subproj/WebHistory.h:
            * History.subproj/WebHistory.m:
            (+[WebHistory optionalSharedHistory]):
            (+[WebHistory setOptionalSharedHistory:]):
            (-[WebHistory init]):
            (-[WebHistory loadFromURL:error:]):
            (-[WebHistory saveToURL:error:]):
            * History.subproj/WebHistoryItemPrivate.h:
            * History.subproj/WebHistoryPrivate.h:
            * History.subproj/WebHistoryPrivate.m:
            (-[WebHistoryPrivate init]):
            (-[WebHistoryPrivate dealloc]):
            (-[WebHistoryPrivate _loadHistoryGuts:URL:error:]):
            (-[WebHistoryPrivate loadFromURL:error:]):
            (-[WebHistoryPrivate _saveHistoryGuts:URL:error:]):
            (-[WebHistoryPrivate saveToURL:error:]):
            * WebView.subproj/WebDataSourcePrivate.m:
            (-[WebDataSource _setTitle:]):
            * WebView.subproj/WebFramePrivate.m:
            (-[WebFrame _transitionToCommitted:]):
            (-[WebFrame _canCachePage]):
            (-[WebFrame _purgePageCache]):
    
    WebBrowser:
    
            Final API review changes.
    
            Reviewed by Chris.
    
            * BrowserDocument.m:
            (-[BrowserDocument backListMenuForButton:]):
            (-[BrowserDocument forwardListMenuForButton:]):
            * BrowserWebController.m:
            (-[BrowserWebController initWithDocument:request:frameName:]):
            (-[BrowserWebController clearPageCache]):
            * Debug/DebugUtilities.m:
            (-[BrowserDocument toggleBackForwardEnabled:]):
            (-[BrowserDocument validate_toggleBackForwardEnabled:]):
            (-[WebHistory populateHistoryWithTestData:]):
            * GlobalHistory.h:
            * GlobalHistory.m:
            (+[GlobalHistory historyURL]):
            (-[GlobalHistory init]):
            (-[GlobalHistory savePendingChanges]):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@4180 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 3a7c91d..b02f68e 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,41 @@
+2003-04-24  Richard Williamson   <rjw at apple.com>
+
+        Final API review changes.
+        
+        Reviewed by Chris.
+
+        * History.subproj/WebBackForwardList.h:
+        * History.subproj/WebBackForwardList.m:
+        (-[WebBackForwardList containsItem:]):
+        (-[WebBackForwardList capacity]):
+        (-[WebBackForwardList setCapacity:]):
+        (-[WebBackForwardList _clearPageCache]):
+        (-[WebBackForwardList setPageCacheSize:]):
+        (-[WebBackForwardList _setUsesPageCache:]):
+        (-[WebBackForwardList _usesPageCache]):
+        * History.subproj/WebHistory.h:
+        * History.subproj/WebHistory.m:
+        (+[WebHistory optionalSharedHistory]):
+        (+[WebHistory setOptionalSharedHistory:]):
+        (-[WebHistory init]):
+        (-[WebHistory loadFromURL:error:]):
+        (-[WebHistory saveToURL:error:]):
+        * History.subproj/WebHistoryItemPrivate.h:
+        * History.subproj/WebHistoryPrivate.h:
+        * History.subproj/WebHistoryPrivate.m:
+        (-[WebHistoryPrivate init]):
+        (-[WebHistoryPrivate dealloc]):
+        (-[WebHistoryPrivate _loadHistoryGuts:URL:error:]):
+        (-[WebHistoryPrivate loadFromURL:error:]):
+        (-[WebHistoryPrivate _saveHistoryGuts:URL:error:]):
+        (-[WebHistoryPrivate saveToURL:error:]):
+        * WebView.subproj/WebDataSourcePrivate.m:
+        (-[WebDataSource _setTitle:]):
+        * WebView.subproj/WebFramePrivate.m:
+        (-[WebFrame _transitionToCommitted:]):
+        (-[WebFrame _canCachePage]):
+        (-[WebFrame _purgePageCache]):
+
 2003-04-24  Maciej Stachowiak  <mjs at apple.com>
 
         Reviewed by Chris.
diff --git a/WebKit/History.subproj/WebBackForwardList.h b/WebKit/History.subproj/WebBackForwardList.h
index dfa3c59..328f7d1 100644
--- a/WebKit/History.subproj/WebBackForwardList.h
+++ b/WebKit/History.subproj/WebBackForwardList.h
@@ -22,42 +22,6 @@
 }
 
 /*!
-    @method setUsesPageCache:
-    @param flag Set to YES if pages should be cached
-    @discussion Pages in the back/forward list may be cached.  Pages in this cache
-    will load much more quickly; however, they may not always be up-to-date.  The
-    page cache may not apply to all pages.
-*/
-- (void)setUsesPageCache: (BOOL)flag;
-
-/*!
-    @method usesPageCache
-    @abstract Returns whether page cacheing is enabled. 
-    @result YES if the page cache is enabled, otherwise NO. 
-*/
-- (BOOL)usesPageCache;
-
-/*!
-    @method setPageCacheSize:
-    @abstract Sets the size of the page cache.
-    @param size The number of pages to allow in the page cache.
-*/
-- (void)setPageCacheSize: (unsigned)size;
-
-/*!
-    @method pageCacheSize
-    @abstract Returns the number of pages that may be cached.
-    @result The number of pages that may be cached.
-*/
-- (unsigned)pageCacheSize;
-
-/*!
-    @method clearPageCache
-    @abstract Clears all items in the page cache. 
-*/
-- (void)clearPageCache;
-
-/*!
     @method addItem:
     @abstract Adds an entry to the list.
     @param entry The entry to add.
@@ -109,42 +73,34 @@
 - (WebHistoryItem *)forwardItem;
 
 /*!
-    @method containsItem:
-    @abstract Returns whether the receiver contains the given entry.
-    @param item The history item to search for.
-    @result YES if the list contains the given entry, otherwise NO.
-*/
-- (BOOL)containsItem:(WebHistoryItem *)item;
-
-/*!
-    @method backListWithSizeLimit:
+    @method backListWithLimit:
     @abstract Returns a portion of the list before the current entry.
     @param limit A cap on the size of the array returned.
     @result An array of items before the current entry, or nil if there are none.  The entries are in the order that they were originally visited.
 */
-- (NSArray *)backListWithSizeLimit:(int)limit;
+- (NSArray *)backListWithLimit:(int)limit;
 
 /*!
-    @method forwardListWithSizeLimit:
+    @method forwardListWithLimit:
     @abstract Returns a portion of the list after the current entry.
     @param limit A cap on the size of the array returned.
     @result An array of items after the current entry, or nil if there are none.  The entries are in the order that they were originally visited.
 */
-- (NSArray *)forwardListWithSizeLimit:(int)limit;
+- (NSArray *)forwardListWithLimit:(int)limit;
 
 /*!
-    @method maximumSize
+    @method capacity
     @abstract Returns the list's maximum size.
     @result The list's maximum size.
 */
-- (int)maximumSize;
+- (int)capacity;
 
 /*!
-    @method maximumSize
+    @method setCacpacity
     @abstract Sets the list's maximum size.
     @param size The new maximum size for the list.
 */
-- (void)setMaximumSize:(int)size;
+- (void)setCapacity:(int)size;
 
 /*!
     @method backListCount
@@ -161,6 +117,13 @@
 - (int)forwardListCount;
 
 /*!
+    @method containsItem:
+    @param item The item that will be checked for presence in the WebBackForwardList.
+    @result Returns YES if the item is in the list. 
+*/
+- (BOOL)containsItem:(WebHistoryItem *)item;
+
+/*!
     @method itemAtIndex:
     @abstract Returns an entry the given distance from the current entry.
     @param index Index of the desired list item relative to the current item; 0 is current item, -1 is back item, 1 is forward item, etc.
@@ -168,4 +131,18 @@
 */
 - (WebHistoryItem *)itemAtIndex:(int)index;
 
+    /*!
+       @method setPageCacheSize:
+     @abstract Sets the size of the page cache.
+     @param size The number of pages to allow in the page cache.
+     */
+- (void)setPageCacheSize: (unsigned)size;
+
+    /*!
+    @method pageCacheSize
+     @abstract Returns the number of pages that may be cached.
+     @result The number of pages that may be cached.
+     */
+- (unsigned)pageCacheSize;
+
 @end
diff --git a/WebKit/History.subproj/WebBackForwardList.m b/WebKit/History.subproj/WebBackForwardList.m
index 03bf6dd..ed8d2fa 100644
--- a/WebKit/History.subproj/WebBackForwardList.m
+++ b/WebKit/History.subproj/WebBackForwardList.m
@@ -23,6 +23,7 @@
 @end
 
 @implementation WebBackForwardListPrivate
+
 - (void)dealloc
 {
     [entries release];
@@ -93,6 +94,12 @@
     _private->current++;
 }
 
+- (BOOL)containsItem:(WebHistoryItem *)entry
+{
+    return [_private->entries indexOfObjectIdenticalTo:entry] != NSNotFound;
+}
+
+
 - (void)goBack
 {
     if(_private->current > 0)
@@ -145,12 +152,7 @@
     }
 }
 
-- (BOOL)containsItem:(WebHistoryItem *)entry
-{
-    return [_private->entries indexOfObjectIdenticalTo:entry] != NSNotFound;
-}
-
-- (NSArray *)backListWithSizeLimit:(int)limit;
+- (NSArray *)backListWithLimit:(int)limit;
 {
     if (_private->current > 0) {
         NSRange r;
@@ -162,7 +164,7 @@
     }
 }
 
-- (NSArray *)forwardListWithSizeLimit:(int)limit;
+- (NSArray *)forwardListWithLimit:(int)limit;
 {
     int lastEntry = (int)[_private->entries count]-1;
     if (_private->current < lastEntry) {
@@ -175,12 +177,12 @@
     }
 }
 
-- (int)maximumSize
+- (int)capacity
 {
     return _private->maximumSize;
 }
 
-- (void)setMaximumSize:(int)size
+- (void)setCapacity:(int)size
 {
     _private->maximumSize = size;
 }
@@ -219,7 +221,7 @@
     return result;
 }
 
-- (void)clearPageCache
+- (void)_clearPageCache
 {
     int i;
     for (i = 0; i < (int)[_private->entries count]; i++) {
@@ -233,6 +235,10 @@
 {
     _private->pageCacheSizeModified = YES;
     _private->pageCacheSize = size;
+    if (size == 0){
+        [self _clearPageCache];
+        [self _setUsesPageCache: NO];
+    }
 }
 
 #ifndef NDEBUG
@@ -266,12 +272,12 @@ static BOOL loggedPageCacheSize = NO;
 
 // On be default for now.
 
-- (void)setUsesPageCache: (BOOL)f
+- (void)_setUsesPageCache: (BOOL)f
 {
     _private->usesPageCache = f ? YES : NO;
 }
 
-- (BOOL)usesPageCache
+- (BOOL)_usesPageCache
 {
     if ([self pageCacheSize] == 0)
         return NO;
diff --git a/WebKit/History.subproj/WebHistory.h b/WebKit/History.subproj/WebHistory.h
index c0d4d46..dfff218 100644
--- a/WebKit/History.subproj/WebHistory.h
+++ b/WebKit/History.subproj/WebHistory.h
@@ -6,6 +6,8 @@
 */
 #import <Foundation/Foundation.h>
 
+ at class NSError;
+
 @class WebHistoryItem;
 @class WebHistoryPrivate;
 
@@ -38,26 +40,33 @@ extern NSString *WebHistoryItemsKey;
 }
 
 /*!
-    @method sharedHistory
+    @method optionalSharedHistory
     @abstract Returns a shared WebHistory instance initialized with the default history file.
     @result A WebHistory object.
 */
-+ (WebHistory *)sharedHistory;
++ (WebHistory *)optionalSharedHistory;
 
 /*!
-    @method createSharedHistoryWithFile:
+    @method setOptionalSharedHistory:
     @param history The history to use for the global WebHistory.
     @result Returns a WebHistory initialized with the contents of file.
 */
-+ (void)setSharedHistory:(WebHistory *)history;
++ (void)setOptionalSharedHistory:(WebHistory *)history;
 
 /*!
-    @method initWithContentsOfURL:
+    @method loadFromURL:error:
     @param URL The URL to use to initialize the WebHistory.
     @abstract The designated initializer for WebHistory.
     @result Returns an initialized WebHistory.
 */
-- initWithContentsOfURL:(NSURL *)URL;
+- (BOOL)loadFromURL:(NSURL *)URL error:(NSError **)error;
+
+/*!
+    @method saveToURL:error:
+    @discussion Save history to URL. It is the client's responsibility to call this at appropriate times.
+    @result Returns YES if successful, NO otherwise.
+*/
+- (BOOL)saveToURL:(NSURL *)URL error:(NSError **)error;
 
 /*!
     @method addItems:
@@ -94,15 +103,6 @@ extern NSString *WebHistoryItemsKey;
 - (NSArray *)orderedItemsLastVisitedOnDay:(NSCalendarDate *)calendarDate;
 
 /*!
-    @method containsURL:
-    @abstract Return whether a URL is in the WebHistory.
-    @param URL The URL for which to search the WebHistory.
-    @discussion This method is useful for implementing a visited-link mechanism.
-    @result YES if WebHistory contains a history item for the given URL, otherwise NO.
-*/
-- (BOOL)containsURL:(NSURL *)URL;
-
-/*!
     @method entryForURL:
     @abstract Get an item for a specific URL
     @param URL The URL of the history item to search for
@@ -110,25 +110,4 @@ extern NSString *WebHistoryItemsKey;
 */
 - (WebHistoryItem *)itemForURL:(NSURL *)URL;
 
-/*!
-    @method file
-    @discussion The file path used for storing history, specified in -[WebHistory initWithFile:] or +[WebHistory webHistoryWithFile:]
-    @result Returns the file path used to store the history.
-*/
-- (NSURL *)URL;
-
-/*!
-    @method loadHistory
-    @discussion Load history from file. This happens automatically at init time, and need not normally be called.
-    @result Returns YES if successful, NO otherwise.
-*/
-- (BOOL)loadHistory;
-
-/*!
-    @method saveHistory
-    @discussion Save history to file. It is the client's responsibility to call this at appropriate times.
-    @result Returns YES if successful, NO otherwise.
-*/
-- (BOOL)saveHistory;
-
 @end
diff --git a/WebKit/History.subproj/WebHistory.m b/WebKit/History.subproj/WebHistory.m
index 800e638..ea4e0c5 100644
--- a/WebKit/History.subproj/WebHistory.m
+++ b/WebKit/History.subproj/WebHistory.m
@@ -10,8 +10,10 @@
 #import <WebKit/WebHistoryItem.h>
 #import <WebKit/WebHistoryItemPrivate.h>
 
+#import <WebFoundation/NSError.h>
 #import <WebFoundation/WebAssertions.h>
 #import <WebFoundation/WebNSURLExtras.h>
+#import <WebFoundation/WebNSURLExtras.h>
 
 #import <WebCore/WebCoreHistory.h>
 
@@ -53,13 +55,13 @@ static WebHistory *_sharedHistory = nil;
 
 @implementation WebHistory
 
-+ (WebHistory *)sharedHistory
++ (WebHistory *)optionalSharedHistory
 {
     return _sharedHistory;
 }
 
 
-+ (void)setSharedHistory: (WebHistory *)history
++ (void)setOptionalSharedHistory: (WebHistory *)history
 {
     // FIXME.  Need to think about multiple instances of WebHistory per application
     // and correct synchronization of history file between applications.
@@ -70,10 +72,10 @@ static WebHistory *_sharedHistory = nil;
     }
 }
 
-- (id)initWithContentsOfURL: (NSURL *)URL
+- (id)init
 {
     if ((self = [super init]) != nil) {
-        _historyPrivate = [[WebHistoryPrivate alloc] initWithContentsOfURL:URL];
+        _historyPrivate = [[WebHistoryPrivate alloc] init];
     }
 
     return self;
@@ -174,14 +176,9 @@ static WebHistory *_sharedHistory = nil;
 
 #pragma mark SAVING TO DISK
 
-- (NSURL *)URL
-{
-    return [_historyPrivate URL];
-}
-
-- (BOOL)loadHistory
+- (BOOL)loadFromURL:(NSURL *)URL error:(NSError **)error
 {
-    if ([_historyPrivate loadHistory]) {
+    if ([_historyPrivate loadFromURL:URL error:error]) {
         [[NSNotificationCenter defaultCenter]
             postNotificationName: WebHistoryLoadedNotification
                           object: self];
@@ -190,9 +187,10 @@ static WebHistory *_sharedHistory = nil;
     return NO;
 }
 
-- (BOOL)saveHistory
+- (BOOL)saveToURL:(NSURL *)URL error:(NSError **)error
 {
-    return [_historyPrivate saveHistory];
+    // FIXME:  Use new foundation API to get error when ready.
+    return [_historyPrivate saveToURL:URL error:error];
 }
 
 - (WebHistoryItem *)_itemForURLString:(NSString *)URLString
diff --git a/WebKit/History.subproj/WebHistoryItemPrivate.h b/WebKit/History.subproj/WebHistoryItemPrivate.h
index f23a135..eac1634 100644
--- a/WebKit/History.subproj/WebHistoryItemPrivate.h
+++ b/WebKit/History.subproj/WebHistoryItemPrivate.h
@@ -4,6 +4,7 @@
  */
 #import <Cocoa/Cocoa.h>
 
+#import <WebKit/WebBackForwardList.h>
 #import <WebKit/WebHistoryItem.h>
 
 @interface WebHistoryItem (WebPrivate)
@@ -58,3 +59,10 @@
 - (BOOL)alwaysAttemptToUsePageCache;
 
 @end
+
+ at interface WebBackForwardList (WebPrivate)
+- (void)_clearPageCache;
+- (void)_setUsesPageCache: (BOOL)f;
+- (BOOL)_usesPageCache;
+ at end
+
diff --git a/WebKit/History.subproj/WebHistoryPrivate.h b/WebKit/History.subproj/WebHistoryPrivate.h
index 70b0624..952c980 100644
--- a/WebKit/History.subproj/WebHistoryPrivate.h
+++ b/WebKit/History.subproj/WebHistoryPrivate.h
@@ -11,17 +11,15 @@
 #import <WebKit/WebHistory.h>
 
 @class WebHistoryItem;
+ at class NSError;
 
 @interface WebHistoryPrivate : NSObject {
 @private
     NSMutableDictionary *_entriesByURL;
     NSMutableArray *_datesWithEntries;
     NSMutableArray *_entriesByDate;
-    NSURL *_URL;
 }
 
-- (id)initWithContentsOfURL: (NSURL *)URL;
-
 - (void)addItem: (WebHistoryItem *)entry;
 - (void)addItems:(NSArray *)newEntries;
 - (BOOL)removeItem: (WebHistoryItem *)entry;
@@ -35,9 +33,8 @@
 - (WebHistoryItem *)itemForURL:(NSURL *)URL;
 - (WebHistoryItem *)itemForURLString:(NSString *)URLString;
 
-- (NSURL *)URL;
-- (BOOL)loadHistory;
-- (BOOL)saveHistory;
+- (BOOL)loadFromURL:(NSURL *)URL error:(NSError **)error;
+- (BOOL)saveToURL:(NSURL *)URL error:(NSError **)error;
 
 @end
 
diff --git a/WebKit/History.subproj/WebHistoryPrivate.m b/WebKit/History.subproj/WebHistoryPrivate.m
index eabad0c..1c71628 100644
--- a/WebKit/History.subproj/WebHistoryPrivate.m
+++ b/WebKit/History.subproj/WebHistoryPrivate.m
@@ -12,6 +12,10 @@
 #import <WebKit/WebHistoryItemPrivate.h>
 #import <WebKit/WebKitLogging.h>
 
+#import <WebFoundation/NSError.h>
+#import <WebFoundation/NSURLConnection.h>
+#import <WebFoundation/NSURLRequest.h>
+
 #import <WebFoundation/WebNSCalendarDateExtras.h>
 #import <WebFoundation/WebNSURLExtras.h>
 
@@ -35,7 +39,7 @@ NSString *DatesArrayKey = @"WebHistoryDates";
             nil]];    
 }
 
-- (id)initWithContentsOfURL: (NSURL *)URL
+- (id)init
 {
     if (![super init]) {
         return nil;
@@ -44,11 +48,7 @@ NSString *DatesArrayKey = @"WebHistoryDates";
     _entriesByURL = [[NSMutableDictionary alloc] init];
     _datesWithEntries = [[NSMutableArray alloc] init];
     _entriesByDate = [[NSMutableArray alloc] init];
-    _URL = [URL retain];
 
-    // read history from disk
-    [self loadHistory];
-    
     return self;
 }
 
@@ -57,7 +57,6 @@ NSString *DatesArrayKey = @"WebHistoryDates";
     [_entriesByURL release];
     [_datesWithEntries release];
     [_entriesByDate release];
-    [_URL release];
     
     [super dealloc];
 }
@@ -346,24 +345,26 @@ NSString *DatesArrayKey = @"WebHistoryDates";
     return arrayRep;
 }
 
-- (BOOL)_loadHistoryGuts: (int *)numberOfItemsLoaded
+- (BOOL)_loadHistoryGuts: (int *)numberOfItemsLoaded URL:(NSURL *)URL error:(NSError **)error
 {
     NSEnumerator *enumerator;
     int index;
     int limit;
     NSCalendarDate *ageLimitDate;
+    NSDictionary *fileAsDictionary;
     BOOL ageLimitPassed;
 
     *numberOfItemsLoaded = 0;
 
-    NSDictionary *fileAsDictionary = [NSDictionary dictionaryWithContentsOfURL: [self URL]];
+    NSData *data = [NSURLConnection sendSynchronousRequest:[NSURLRequest requestWithURL:URL] returningResponse:nil error:error];
+    fileAsDictionary = [NSPropertyListSerialization propertyListFromData:data mutabilityOption:NSPropertyListImmutable format:nil errorDescription:nil];
     if (fileAsDictionary == nil) {
         // Couldn't read a dictionary; let's see if we can read an old-style array instead
-        NSArray *fileAsArray = [NSArray arrayWithContentsOfURL:[self URL]];
+        NSArray *fileAsArray = [NSArray arrayWithContentsOfURL:URL];
         if (fileAsArray == nil) {
 #if !ERROR_DISABLED
-            if ([[self URL] isFileURL] && [[NSFileManager defaultManager] fileExistsAtPath: [[self URL] path]]) {
-                ERROR("unable to read history from file %@; perhaps contents are corrupted", [[self URL] path]);
+            if ([URL isFileURL] && [[NSFileManager defaultManager] fileExistsAtPath: [URL path]]) {
+                ERROR("unable to read history from file %@; perhaps contents are corrupted", [URL path]);
             }
 #endif
             return NO;
@@ -430,35 +431,39 @@ NSString *DatesArrayKey = @"WebHistoryDates";
     return YES;    
 }
 
-- (BOOL)loadHistory
+- (BOOL)loadFromURL:(NSURL *)URL error:(NSError **)error
 {
     int numberOfItems;
     double start, duration;
     BOOL result;
 
     start = CFAbsoluteTimeGetCurrent();
-    result = [self _loadHistoryGuts: &numberOfItems];
+    result = [self _loadHistoryGuts: &numberOfItems URL:URL error:error];
 
     if (result) {
         duration = CFAbsoluteTimeGetCurrent() - start;
         LOG(Timing, "loading %d history entries from %@ took %f seconds",
-            numberOfItems, [[self URL] absoluteString], duration);
+            numberOfItems, [URL absoluteString], duration);
     }
 
     return result;
 }
 
-- (BOOL)_saveHistoryGuts: (int *)numberOfItemsSaved
+- (BOOL)_saveHistoryGuts: (int *)numberOfItemsSaved URL:(NSURL *)URL error:(NSError **)error
 {
     *numberOfItemsSaved = 0;
 
+    // FIXME:  Correctly report error when new API is ready.
+    if (error)
+        *error = nil;
+
     NSArray *array = [self arrayRepresentation];
     NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:
         array, DatesArrayKey,
         [NSNumber numberWithInt:currentFileVersion], FileVersionKey,
         nil];
-    if (![dictionary writeToURL:[self URL] atomically:YES]) {
-        ERROR("attempt to save %@ to %@ failed", dictionary, [[self URL] absoluteString]);
+    if (![dictionary writeToURL:URL atomically:YES]) {
+        ERROR("attempt to save %@ to %@ failed", dictionary, [URL absoluteString]);
         return NO;
     }
     
@@ -466,25 +471,19 @@ NSString *DatesArrayKey = @"WebHistoryDates";
     return YES;
 }
 
-- (NSURL *)URL
-{
-    return _URL;
-}
-
-
-- (BOOL)saveHistory
+- (BOOL)saveToURL:(NSURL *)URL error:(NSError **)error
 {
     int numberOfItems;
     double start, duration;
     BOOL result;
 
     start = CFAbsoluteTimeGetCurrent();
-    result = [self _saveHistoryGuts: &numberOfItems];
+    result = [self _saveHistoryGuts: &numberOfItems URL:URL error:error];
 
     if (result) {
         duration = CFAbsoluteTimeGetCurrent() - start;
         LOG(Timing, "saving %d history entries to %@ took %f seconds",
-            numberOfItems, [[self URL] absoluteString], duration);
+            numberOfItems, [URL absoluteString], duration);
     }
 
     return result;
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.m b/WebKit/WebView.subproj/WebDataSourcePrivate.m
index df8ae15..a6964b9 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.m
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.m
@@ -300,7 +300,7 @@
     if (_private->committed) {
         WebHistoryItem *entry;
         NSURL *canonURL = [[[self _originalRequest] URL] _web_canonicalize];
-        entry = [[WebHistory sharedHistory] itemForURL: canonURL];
+        entry = [[WebHistory optionalSharedHistory] itemForURL: canonURL];
         [entry setTitle: _private->pageTitle];
 
         // Must update the entries in the back-forward list too.
diff --git a/WebKit/WebView.subproj/WebFramePrivate.m b/WebKit/WebView.subproj/WebFramePrivate.m
index bc0e9c0..6e2a0d8 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.m
+++ b/WebKit/WebView.subproj/WebFramePrivate.m
@@ -656,7 +656,7 @@ Repeat load of the same URL (by any other means of navigation other than the rel
                 // Update the last visited time.  Mostly interesting for URL autocompletion
                 // statistics.
                 NSURL *URL = [[[ds _originalRequest] URL] _web_canonicalize];
-                WebHistoryItem *oldItem = [[WebHistory sharedHistory] itemForURL:URL];
+                WebHistoryItem *oldItem = [[WebHistory optionalSharedHistory] itemForURL:URL];
                 if (oldItem) {
                     [oldItem setLastVisitedDate:[NSCalendarDate date]];
                 }
@@ -674,7 +674,7 @@ Repeat load of the same URL (by any other means of navigation other than the rel
                     // Add item to history.
 		    NSURL *URL = [[[ds _originalRequest] URL] _web_canonicalize];
 		    if ([[URL absoluteString] length] > 0 && ![WebDataProtocol _webIsDataProtocolURL:URL]) {
-			entry = [[WebHistory sharedHistory] addItemForURL:URL];
+			entry = [[WebHistory optionalSharedHistory] addItemForURL:URL];
 			if (ptitle)
 			    [entry setTitle: ptitle];
                         [self _addBackForwardItemClippedAtTarget:YES];
@@ -736,7 +736,7 @@ Repeat load of the same URL (by any other means of navigation other than the rel
 
 - (BOOL)_canCachePage
 {
-    return [[[self webView] backForwardList] usesPageCache];
+    return [[[self webView] backForwardList] _usesPageCache];
 }
 
 - (void)_purgePageCache
@@ -745,7 +745,7 @@ Repeat load of the same URL (by any other means of navigation other than the rel
     unsigned sizeLimit = [[[self webView] backForwardList] pageCacheSize];
     unsigned pagesCached = 0;
     WebBackForwardList *backForwardList = [[self webView] backForwardList];
-    NSArray *backList = [backForwardList backListWithSizeLimit: 999999];
+    NSArray *backList = [backForwardList backListWithLimit: 999999];
     WebHistoryItem *oldestItem = nil;
     
     unsigned i;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list