[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
sullivan
sullivan at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 05:57:33 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 1b2d0ab27f439d2a32b244597560c975dee959e4
Author: sullivan <sullivan at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Mar 15 22:17:51 2002 +0000
Fixed bug where history entry images weren't showing up, except by historical
accident in some cases.
Made IFWebHistory no longer be a singleton class; made the file location
be passed in at init time.
* History.subproj/IFURIEntry.m: (-[IFURIEntry image]): Get the default image
a way that works with frameworks; only get the default image once.
* History.subproj/IFWebHistory.h:
* History.subproj/IFWebHistory.m:
(+[IFWebHistory webHistoryWithFile:]): New convenience constructor that returns
a new IFWebHistory object with a particular disk file.
(-[IFWebHistory initWithFile:]): New init method for specifying a disk file.
(-[IFWebHistory file]): New accessor for file path.
(-[IFWebHistory loadHistory]),
(-[IFWebHistory saveHistory]): Use file accessor.
Also removed the methods that were computing a file path to use.
* History.subproj/IFWebHistoryPrivate.h:
* History.subproj/IFWebHistoryPrivate.m:
(-[IFWebHistoryPrivate initWithFile:]),
(-[IFWebHistoryPrivate dealloc]), (-[IFWebHistoryPrivate file]),
(-[IFWebHistoryPrivate loadHistory]), (-[IFWebHistoryPrivate saveHistory]):
Guts of implementation for file-manipulation stuff.
* Resources/url_icon.tiff: ran tiffUtil to premultiply the alpha channel. This
was spewing error messages that I didn't notice before because they only
happen on Puma and I was on Jaguar.
* WebKit.pbproj/project.pbxproj: not sure what change I made, maybe version wars.
Made app's IFWebHistory object come from AppController rather than using
the now-obsolete sharedWebHistory; made Populate History Debug item create
a large number of items so I can test the performance of loading them; added
Erase All History item to Debug menu for convenience.
* AppController.h:
* AppController.m:
(GetRefPath), (FindFolderPath),
(-[AppController _computeHistoryFilePath]): New methods, moved from
IFWebHistory, to determine the file path for the History file.
(-[AppController webHistory]): new method to get at app-wide IFWebHistory.
(-[AppController awakeFromNib]), (-[AppController dealloc]),
(-[AppController applicationWillTerminate:]),
(-[AppController insertItemsForDate:intoMenu:atIndex:withRunningTotal:limit:]),
(-[AppController updateHistoryInMenu]): Updated to use [AppController webHistory]
instead of [IFWebHistory sharedWebHistory]
* BrowserDocument.m: (-[BrowserDocument addHistoryEntryForCurrentPage]):
Updated to use [AppController webHistory] instead of [IFWebHistory sharedWebHistory]
* Debug/DebugUtilities.m:
(+[DebugUtilities createDebugMenu]): Added Erase All History and separator.
(-[IFWebHistory populateHistoryWithTestData:]): Changed approach. It used to read
a few valid URLs from a disk file; now it creates a lot of bogus ones.
* Debug/FakeHistory.plist: Removed this list now that Populate History computes
items from scratch.
* GlobalHistory.m: (+[GlobalHistory sharedGlobalHistory]),
(-[GlobalHistory webHistory]), (-[GlobalHistory init]),
(-[GlobalHistory outlineView:child:ofItem:]),
(-[GlobalHistory outlineView:numberOfChildrenOfItem:]),
(-[GlobalHistory receivedEntriesChangedNotification:]),
(-[GlobalHistory removeSelectedItems:]), (-[GlobalHistory removeAll:]):
Updated to use AppController's webHistory instead of [IFWebHistory sharedWebHistory]
* WebBrowser.pbproj/project.pbxproj: updated for removed file
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@752 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 43b461f..df597f5 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,36 @@
+2002-03-15 John Sullivan <sullivan at apple.com>
+
+ Fixed bug where history entry images weren't showing up, except by historical
+ accident in some cases.
+ Made IFWebHistory no longer be a singleton class; made the file location
+ be passed in at init time.
+
+ * History.subproj/IFURIEntry.m: (-[IFURIEntry image]): Get the default image
+ a way that works with frameworks; only get the default image once.
+
+ * History.subproj/IFWebHistory.h:
+ * History.subproj/IFWebHistory.m:
+ (+[IFWebHistory webHistoryWithFile:]): New convenience constructor that returns
+ a new IFWebHistory object with a particular disk file.
+ (-[IFWebHistory initWithFile:]): New init method for specifying a disk file.
+ (-[IFWebHistory file]): New accessor for file path.
+ (-[IFWebHistory loadHistory]),
+ (-[IFWebHistory saveHistory]): Use file accessor.
+ Also removed the methods that were computing a file path to use.
+
+ * History.subproj/IFWebHistoryPrivate.h:
+ * History.subproj/IFWebHistoryPrivate.m:
+ (-[IFWebHistoryPrivate initWithFile:]),
+ (-[IFWebHistoryPrivate dealloc]), (-[IFWebHistoryPrivate file]),
+ (-[IFWebHistoryPrivate loadHistory]), (-[IFWebHistoryPrivate saveHistory]):
+ Guts of implementation for file-manipulation stuff.
+
+ * Resources/url_icon.tiff: ran tiffUtil to premultiply the alpha channel. This
+ was spewing error messages that I didn't notice before because they only
+ happen on Puma and I was on Jaguar.
+
+ * WebKit.pbproj/project.pbxproj: not sure what change I made, maybe version wars.
+
2002-03-14 John Sullivan <sullivan at apple.com>
Made history store its data in ~/Library/Application Support/<app name>/History.plist
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 43b461f..df597f5 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,36 @@
+2002-03-15 John Sullivan <sullivan at apple.com>
+
+ Fixed bug where history entry images weren't showing up, except by historical
+ accident in some cases.
+ Made IFWebHistory no longer be a singleton class; made the file location
+ be passed in at init time.
+
+ * History.subproj/IFURIEntry.m: (-[IFURIEntry image]): Get the default image
+ a way that works with frameworks; only get the default image once.
+
+ * History.subproj/IFWebHistory.h:
+ * History.subproj/IFWebHistory.m:
+ (+[IFWebHistory webHistoryWithFile:]): New convenience constructor that returns
+ a new IFWebHistory object with a particular disk file.
+ (-[IFWebHistory initWithFile:]): New init method for specifying a disk file.
+ (-[IFWebHistory file]): New accessor for file path.
+ (-[IFWebHistory loadHistory]),
+ (-[IFWebHistory saveHistory]): Use file accessor.
+ Also removed the methods that were computing a file path to use.
+
+ * History.subproj/IFWebHistoryPrivate.h:
+ * History.subproj/IFWebHistoryPrivate.m:
+ (-[IFWebHistoryPrivate initWithFile:]),
+ (-[IFWebHistoryPrivate dealloc]), (-[IFWebHistoryPrivate file]),
+ (-[IFWebHistoryPrivate loadHistory]), (-[IFWebHistoryPrivate saveHistory]):
+ Guts of implementation for file-manipulation stuff.
+
+ * Resources/url_icon.tiff: ran tiffUtil to premultiply the alpha channel. This
+ was spewing error messages that I didn't notice before because they only
+ happen on Puma and I was on Jaguar.
+
+ * WebKit.pbproj/project.pbxproj: not sure what change I made, maybe version wars.
+
2002-03-14 John Sullivan <sullivan at apple.com>
Made history store its data in ~/Library/Application Support/<app name>/History.plist
diff --git a/WebKit/History.subproj/IFURIEntry.m b/WebKit/History.subproj/IFURIEntry.m
index 6cebdf7..07a52db 100644
--- a/WebKit/History.subproj/IFURIEntry.m
+++ b/WebKit/History.subproj/IFURIEntry.m
@@ -69,10 +69,23 @@
-(NSImage *)image
{
+ static NSImage *defaultImage = nil;
+ static BOOL loadedDefaultImage = NO;
+
if (_image != nil) {
return _image;
}
- return [NSImage imageNamed:@"url_icon"];
+
+ // Attempt to load default image only once, to avoid performance penalty of repeatedly
+ // trying and failing to find it.
+ if (!loadedDefaultImage) {
+ NSString *pathForDefaultImage =
+ [[NSBundle bundleForClass:[self class]] pathForResource:@"url_icon" ofType:@"tiff"];
+ defaultImage = [[NSImage alloc] initByReferencingFile: pathForDefaultImage];
+ loadedDefaultImage = YES;
+ }
+
+ return defaultImage;
}
-(NSString *)comment
diff --git a/WebKit/History.subproj/IFWebHistory.h b/WebKit/History.subproj/IFWebHistory.h
index d32a863..856358b 100644
--- a/WebKit/History.subproj/IFWebHistory.h
+++ b/WebKit/History.subproj/IFWebHistory.h
@@ -19,7 +19,8 @@
IFWebHistoryPrivate *_historyPrivate;
}
-+ (IFWebHistory *)sharedWebHistory;
++ (IFWebHistory *)webHistoryWithFile: (NSString *)file;
+- (id)initWithFile: (NSString *)file;
// modifying contents
- (void)addEntry: (IFURIEntry *)entry;
@@ -46,7 +47,15 @@
// testing contents for visited-link mechanism
- (BOOL)containsURL: (NSURL *)url;
-// saving contents to disk
-- (void)saveHistory;
+// storing contents on disk
+
+// The file path used for storing history, specified in -[IFWebHistory initWithFile:] or +[IFWebHistory webHistoryWithFile:]
+- (NSString *)file;
+
+// Load history from file. This happens automatically at init time, and need not normally be called.
+- (BOOL)loadHistory;
+
+// Save history to file. It is the client's responsibility to call this at appropriate times.
+- (BOOL)saveHistory;
@end
diff --git a/WebKit/History.subproj/IFWebHistory.m b/WebKit/History.subproj/IFWebHistory.m
index b485cdd..45b2826 100644
--- a/WebKit/History.subproj/IFWebHistory.m
+++ b/WebKit/History.subproj/IFWebHistory.m
@@ -9,23 +9,17 @@
#import "IFWebHistory.h"
#import "IFWebHistoryPrivate.h"
-static IFWebHistory *sharedWebHistory = nil;
-
@implementation IFWebHistory
-+ (IFWebHistory *)sharedWebHistory
++ (IFWebHistory *)webHistoryWithFile: (NSString*)file
{
- if (sharedWebHistory == nil) {
- sharedWebHistory = [[[self class] alloc] init];
- }
-
- return sharedWebHistory;
+ return [[[self alloc] initWithFile:file] autorelease];
}
-- (id)init
+- (id)initWithFile: (NSString *)file;
{
if ((self = [super init]) != nil) {
- _historyPrivate = [[IFWebHistoryPrivate alloc] init];
+ _historyPrivate = [[IFWebHistoryPrivate alloc] initWithFile:file];
}
return self;
@@ -107,9 +101,23 @@ static IFWebHistory *sharedWebHistory = nil;
#pragma mark SAVING TO DISK
-- (void)saveHistory
+- (NSString *)file
+{
+ return [_historyPrivate file];
+}
+
+- (BOOL)loadHistory
+{
+ if ([_historyPrivate loadHistory]) {
+ [self sendEntriesChangedNotification];
+ return YES;
+ }
+ return NO;
+}
+
+- (BOOL)saveHistory
{
- [_historyPrivate saveHistory];
+ return [_historyPrivate saveHistory];
}
@end
diff --git a/WebKit/History.subproj/IFWebHistoryPrivate.h b/WebKit/History.subproj/IFWebHistoryPrivate.h
index 2818b71..a5cd751 100644
--- a/WebKit/History.subproj/IFWebHistoryPrivate.h
+++ b/WebKit/History.subproj/IFWebHistoryPrivate.h
@@ -14,8 +14,11 @@
NSMutableDictionary *_urlDictionary;
NSMutableArray *_datesWithEntries;
NSMutableArray *_entriesByDate;
+ NSString *_file;
}
+- (id)initWithFile: (NSString *)file;
+
- (void)addEntry: (IFURIEntry *)entry;
- (BOOL)removeEntry: (IFURIEntry *)entry;
- (BOOL)removeEntriesForDay: (NSCalendarDate *)calendarDate;
@@ -27,6 +30,8 @@
- (NSArray *)entriesWithTitleOrAddressContainingString: (NSString *)string;
- (BOOL)containsURL: (NSURL *)url;
-- (void)saveHistory;
+- (NSString *)file;
+- (BOOL)loadHistory;
+- (BOOL)saveHistory;
@end
diff --git a/WebKit/History.subproj/IFWebHistoryPrivate.m b/WebKit/History.subproj/IFWebHistoryPrivate.m
index 669039e..83a330d 100644
--- a/WebKit/History.subproj/IFWebHistoryPrivate.m
+++ b/WebKit/History.subproj/IFWebHistoryPrivate.m
@@ -19,17 +19,20 @@
#pragma mark OBJECT FRAMEWORK
-- (id)init
+- (id)initWithFile: (NSString *)file
{
- if ((self = [super init]) != nil) {
- _urlDictionary = [[NSMutableDictionary alloc] init];
- _datesWithEntries = [[NSMutableArray alloc] init];
- _entriesByDate = [[NSMutableArray alloc] init];
-
- // read history from disk
- [self loadHistory];
+ if (![super init]) {
+ return nil;
}
+ _urlDictionary = [[NSMutableDictionary alloc] init];
+ _datesWithEntries = [[NSMutableArray alloc] init];
+ _entriesByDate = [[NSMutableArray alloc] init];
+ _file = [file retain];
+
+ // read history from disk
+ [self loadHistory];
+
return self;
}
@@ -38,6 +41,7 @@
[_urlDictionary release];
[_datesWithEntries release];
[_entriesByDate release];
+ [_file release];
[super dealloc];
}
@@ -259,74 +263,21 @@
return arrayRep;
}
-static NSString* GetRefPath(FSRef* ref)
+- (NSString *)file
{
- // This function was cribbed from NSSavePanel.m
- CFURLRef url = CFURLCreateFromFSRef((CFAllocatorRef)NULL, ref);
- CFStringRef path = CFURLCopyFileSystemPath(url, kCFURLPOSIXPathStyle);
- CFRelease(url);
- return [(NSString*)path autorelease];
-}
-
-static NSString* FindFolderPath(OSType domainType, OSType folderType)
-{
- // create URL from FSRef. Then get path string in our POSIX style that we so know and love
- // This function was cribbed from NSSavePanel.m, 'cept the createFolder parameter flopped.
- FSRef folderRef;
- if (FSFindFolder(domainType, folderType, YES /*createFolder*/, &folderRef) == noErr) {
- return GetRefPath(&folderRef);
- } else {
- return nil;
- }
-}
-
-- (NSString *)historyFilePath
-{
- NSFileManager *fileManager;
- NSString *applicationSupportDirectoryPath;
- NSString *appName;
- NSString *appInAppSupportPath;
- BOOL fileExists;
- BOOL isDirectory;
-
- // FIXME: Ken's going to put the equivalent of FindFolderPath in IFNSFileManagerExtensions; use
- // that when it's available and delete the previous two functions.
- applicationSupportDirectoryPath = FindFolderPath(kUserDomain, kApplicationSupportFolderType);
- if (applicationSupportDirectoryPath == nil) {
- WEBKITDEBUG("FindFolderPath(kUserDomain, kApplicationSupportFolderType) failed\n");
- return nil;
- }
-
- appName = [[[NSBundle mainBundle] infoDictionary] objectForKey: (NSString *)kCFBundleExecutableKey];
- if (appName == nil) {
- WEBKITDEBUG("Couldn't get application name using kCFBundleExecutableKey\n");
- return nil;
- }
-
- appInAppSupportPath = [applicationSupportDirectoryPath stringByAppendingPathComponent: appName];
- fileManager = [NSFileManager defaultManager];
- fileExists = [fileManager fileExistsAtPath: appInAppSupportPath isDirectory: &isDirectory];
- if (fileExists && !isDirectory) {
- WEBKITDEBUG1("Non-directory file exists at %s\n", DEBUG_OBJECT(appInAppSupportPath));
- return nil;
- } else if (!fileExists && ![fileManager createDirectoryAtPath: appInAppSupportPath attributes: nil]) {
- WEBKITDEBUG1("Couldn't create directory %s\n", DEBUG_OBJECT(appInAppSupportPath));
- return nil;
- }
-
- return [appInAppSupportPath stringByAppendingPathComponent: @"History.plist"];
+ return _file;
}
-- (void)loadHistory
+- (BOOL)loadHistory
{
NSString *path;
NSArray *array;
int index, count;
- path = [self historyFilePath];
+ path = [self file];
if (path == nil) {
WEBKITDEBUG("couldn't load history; couldn't find or create directory to store it in\n");
- return;
+ return NO;
}
array = [NSArray arrayWithContentsOfFile: path];
@@ -338,7 +289,7 @@ static NSString* FindFolderPath(OSType domainType, OSType folderType)
WEBKITDEBUG1("attempt to read history from %s failed; perhaps contents are corrupted\n",
DEBUG_OBJECT(path));
}
- return;
+ return NO;
}
count = [array count];
@@ -347,23 +298,28 @@ static NSString* FindFolderPath(OSType domainType, OSType folderType)
[array objectAtIndex: index]];
[self addEntry: entry];
}
+
+ return YES;
}
-- (void)saveHistory
+- (BOOL)saveHistory
{
NSString *path;
NSArray *array;
- path = [self historyFilePath];
+ path = [self file];
if (path == nil) {
WEBKITDEBUG("couldn't save history; couldn't find or create directory to store it in\n");
- return;
+ return NO;
}
array = [self arrayRepresentation];
- if (![array writeToFile:path atomically:NO]) {
- WEBKITDEBUG2("attempt to save %s to %s failed\n", DEBUG_OBJECT(array), DEBUG_OBJECT(path));
+ if ([array writeToFile:path atomically:YES]) {
+ return YES;
}
+
+ WEBKITDEBUG2("attempt to save %s to %s failed\n", DEBUG_OBJECT(array), DEBUG_OBJECT(path));
+ return NO;
}
@end
diff --git a/WebKit/History.subproj/WebHistory.h b/WebKit/History.subproj/WebHistory.h
index d32a863..856358b 100644
--- a/WebKit/History.subproj/WebHistory.h
+++ b/WebKit/History.subproj/WebHistory.h
@@ -19,7 +19,8 @@
IFWebHistoryPrivate *_historyPrivate;
}
-+ (IFWebHistory *)sharedWebHistory;
++ (IFWebHistory *)webHistoryWithFile: (NSString *)file;
+- (id)initWithFile: (NSString *)file;
// modifying contents
- (void)addEntry: (IFURIEntry *)entry;
@@ -46,7 +47,15 @@
// testing contents for visited-link mechanism
- (BOOL)containsURL: (NSURL *)url;
-// saving contents to disk
-- (void)saveHistory;
+// storing contents on disk
+
+// The file path used for storing history, specified in -[IFWebHistory initWithFile:] or +[IFWebHistory webHistoryWithFile:]
+- (NSString *)file;
+
+// Load history from file. This happens automatically at init time, and need not normally be called.
+- (BOOL)loadHistory;
+
+// Save history to file. It is the client's responsibility to call this at appropriate times.
+- (BOOL)saveHistory;
@end
diff --git a/WebKit/History.subproj/WebHistory.m b/WebKit/History.subproj/WebHistory.m
index b485cdd..45b2826 100644
--- a/WebKit/History.subproj/WebHistory.m
+++ b/WebKit/History.subproj/WebHistory.m
@@ -9,23 +9,17 @@
#import "IFWebHistory.h"
#import "IFWebHistoryPrivate.h"
-static IFWebHistory *sharedWebHistory = nil;
-
@implementation IFWebHistory
-+ (IFWebHistory *)sharedWebHistory
++ (IFWebHistory *)webHistoryWithFile: (NSString*)file
{
- if (sharedWebHistory == nil) {
- sharedWebHistory = [[[self class] alloc] init];
- }
-
- return sharedWebHistory;
+ return [[[self alloc] initWithFile:file] autorelease];
}
-- (id)init
+- (id)initWithFile: (NSString *)file;
{
if ((self = [super init]) != nil) {
- _historyPrivate = [[IFWebHistoryPrivate alloc] init];
+ _historyPrivate = [[IFWebHistoryPrivate alloc] initWithFile:file];
}
return self;
@@ -107,9 +101,23 @@ static IFWebHistory *sharedWebHistory = nil;
#pragma mark SAVING TO DISK
-- (void)saveHistory
+- (NSString *)file
+{
+ return [_historyPrivate file];
+}
+
+- (BOOL)loadHistory
+{
+ if ([_historyPrivate loadHistory]) {
+ [self sendEntriesChangedNotification];
+ return YES;
+ }
+ return NO;
+}
+
+- (BOOL)saveHistory
{
- [_historyPrivate saveHistory];
+ return [_historyPrivate saveHistory];
}
@end
diff --git a/WebKit/History.subproj/WebHistoryItem.m b/WebKit/History.subproj/WebHistoryItem.m
index 6cebdf7..07a52db 100644
--- a/WebKit/History.subproj/WebHistoryItem.m
+++ b/WebKit/History.subproj/WebHistoryItem.m
@@ -69,10 +69,23 @@
-(NSImage *)image
{
+ static NSImage *defaultImage = nil;
+ static BOOL loadedDefaultImage = NO;
+
if (_image != nil) {
return _image;
}
- return [NSImage imageNamed:@"url_icon"];
+
+ // Attempt to load default image only once, to avoid performance penalty of repeatedly
+ // trying and failing to find it.
+ if (!loadedDefaultImage) {
+ NSString *pathForDefaultImage =
+ [[NSBundle bundleForClass:[self class]] pathForResource:@"url_icon" ofType:@"tiff"];
+ defaultImage = [[NSImage alloc] initByReferencingFile: pathForDefaultImage];
+ loadedDefaultImage = YES;
+ }
+
+ return defaultImage;
}
-(NSString *)comment
diff --git a/WebKit/History.subproj/WebHistoryPrivate.h b/WebKit/History.subproj/WebHistoryPrivate.h
index 2818b71..a5cd751 100644
--- a/WebKit/History.subproj/WebHistoryPrivate.h
+++ b/WebKit/History.subproj/WebHistoryPrivate.h
@@ -14,8 +14,11 @@
NSMutableDictionary *_urlDictionary;
NSMutableArray *_datesWithEntries;
NSMutableArray *_entriesByDate;
+ NSString *_file;
}
+- (id)initWithFile: (NSString *)file;
+
- (void)addEntry: (IFURIEntry *)entry;
- (BOOL)removeEntry: (IFURIEntry *)entry;
- (BOOL)removeEntriesForDay: (NSCalendarDate *)calendarDate;
@@ -27,6 +30,8 @@
- (NSArray *)entriesWithTitleOrAddressContainingString: (NSString *)string;
- (BOOL)containsURL: (NSURL *)url;
-- (void)saveHistory;
+- (NSString *)file;
+- (BOOL)loadHistory;
+- (BOOL)saveHistory;
@end
diff --git a/WebKit/History.subproj/WebHistoryPrivate.m b/WebKit/History.subproj/WebHistoryPrivate.m
index 669039e..83a330d 100644
--- a/WebKit/History.subproj/WebHistoryPrivate.m
+++ b/WebKit/History.subproj/WebHistoryPrivate.m
@@ -19,17 +19,20 @@
#pragma mark OBJECT FRAMEWORK
-- (id)init
+- (id)initWithFile: (NSString *)file
{
- if ((self = [super init]) != nil) {
- _urlDictionary = [[NSMutableDictionary alloc] init];
- _datesWithEntries = [[NSMutableArray alloc] init];
- _entriesByDate = [[NSMutableArray alloc] init];
-
- // read history from disk
- [self loadHistory];
+ if (![super init]) {
+ return nil;
}
+ _urlDictionary = [[NSMutableDictionary alloc] init];
+ _datesWithEntries = [[NSMutableArray alloc] init];
+ _entriesByDate = [[NSMutableArray alloc] init];
+ _file = [file retain];
+
+ // read history from disk
+ [self loadHistory];
+
return self;
}
@@ -38,6 +41,7 @@
[_urlDictionary release];
[_datesWithEntries release];
[_entriesByDate release];
+ [_file release];
[super dealloc];
}
@@ -259,74 +263,21 @@
return arrayRep;
}
-static NSString* GetRefPath(FSRef* ref)
+- (NSString *)file
{
- // This function was cribbed from NSSavePanel.m
- CFURLRef url = CFURLCreateFromFSRef((CFAllocatorRef)NULL, ref);
- CFStringRef path = CFURLCopyFileSystemPath(url, kCFURLPOSIXPathStyle);
- CFRelease(url);
- return [(NSString*)path autorelease];
-}
-
-static NSString* FindFolderPath(OSType domainType, OSType folderType)
-{
- // create URL from FSRef. Then get path string in our POSIX style that we so know and love
- // This function was cribbed from NSSavePanel.m, 'cept the createFolder parameter flopped.
- FSRef folderRef;
- if (FSFindFolder(domainType, folderType, YES /*createFolder*/, &folderRef) == noErr) {
- return GetRefPath(&folderRef);
- } else {
- return nil;
- }
-}
-
-- (NSString *)historyFilePath
-{
- NSFileManager *fileManager;
- NSString *applicationSupportDirectoryPath;
- NSString *appName;
- NSString *appInAppSupportPath;
- BOOL fileExists;
- BOOL isDirectory;
-
- // FIXME: Ken's going to put the equivalent of FindFolderPath in IFNSFileManagerExtensions; use
- // that when it's available and delete the previous two functions.
- applicationSupportDirectoryPath = FindFolderPath(kUserDomain, kApplicationSupportFolderType);
- if (applicationSupportDirectoryPath == nil) {
- WEBKITDEBUG("FindFolderPath(kUserDomain, kApplicationSupportFolderType) failed\n");
- return nil;
- }
-
- appName = [[[NSBundle mainBundle] infoDictionary] objectForKey: (NSString *)kCFBundleExecutableKey];
- if (appName == nil) {
- WEBKITDEBUG("Couldn't get application name using kCFBundleExecutableKey\n");
- return nil;
- }
-
- appInAppSupportPath = [applicationSupportDirectoryPath stringByAppendingPathComponent: appName];
- fileManager = [NSFileManager defaultManager];
- fileExists = [fileManager fileExistsAtPath: appInAppSupportPath isDirectory: &isDirectory];
- if (fileExists && !isDirectory) {
- WEBKITDEBUG1("Non-directory file exists at %s\n", DEBUG_OBJECT(appInAppSupportPath));
- return nil;
- } else if (!fileExists && ![fileManager createDirectoryAtPath: appInAppSupportPath attributes: nil]) {
- WEBKITDEBUG1("Couldn't create directory %s\n", DEBUG_OBJECT(appInAppSupportPath));
- return nil;
- }
-
- return [appInAppSupportPath stringByAppendingPathComponent: @"History.plist"];
+ return _file;
}
-- (void)loadHistory
+- (BOOL)loadHistory
{
NSString *path;
NSArray *array;
int index, count;
- path = [self historyFilePath];
+ path = [self file];
if (path == nil) {
WEBKITDEBUG("couldn't load history; couldn't find or create directory to store it in\n");
- return;
+ return NO;
}
array = [NSArray arrayWithContentsOfFile: path];
@@ -338,7 +289,7 @@ static NSString* FindFolderPath(OSType domainType, OSType folderType)
WEBKITDEBUG1("attempt to read history from %s failed; perhaps contents are corrupted\n",
DEBUG_OBJECT(path));
}
- return;
+ return NO;
}
count = [array count];
@@ -347,23 +298,28 @@ static NSString* FindFolderPath(OSType domainType, OSType folderType)
[array objectAtIndex: index]];
[self addEntry: entry];
}
+
+ return YES;
}
-- (void)saveHistory
+- (BOOL)saveHistory
{
NSString *path;
NSArray *array;
- path = [self historyFilePath];
+ path = [self file];
if (path == nil) {
WEBKITDEBUG("couldn't save history; couldn't find or create directory to store it in\n");
- return;
+ return NO;
}
array = [self arrayRepresentation];
- if (![array writeToFile:path atomically:NO]) {
- WEBKITDEBUG2("attempt to save %s to %s failed\n", DEBUG_OBJECT(array), DEBUG_OBJECT(path));
+ if ([array writeToFile:path atomically:YES]) {
+ return YES;
}
+
+ WEBKITDEBUG2("attempt to save %s to %s failed\n", DEBUG_OBJECT(array), DEBUG_OBJECT(path));
+ return NO;
}
@end
diff --git a/WebKit/Resources/url_icon.tiff b/WebKit/Resources/url_icon.tiff
index d35b749..20e0c16 100644
Binary files a/WebKit/Resources/url_icon.tiff and b/WebKit/Resources/url_icon.tiff differ
diff --git a/WebKit/WebKit.pbproj/project.pbxproj b/WebKit/WebKit.pbproj/project.pbxproj
index 549cda3..7f16e62 100644
--- a/WebKit/WebKit.pbproj/project.pbxproj
+++ b/WebKit/WebKit.pbproj/project.pbxproj
@@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
- objectVersion = 36;
+ objectVersion = 34;
objects = {
014CEA440018CDF011CA2923 = {
buildRules = (
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list