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

kocienda kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 05:52:42 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 680d006d4c2b1909849758b3dc4d56611aafcc9b
Author: kocienda <kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Nov 30 20:49:53 2001 +0000

    Changes that make the back and forward button work.
    As a bonus, we also get a progress indicator for page loads.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@471 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/include/WCBackForwardList.h b/WebCore/include/WCBackForwardList.h
new file mode 100644
index 0000000..8d9bdaa
--- /dev/null
+++ b/WebCore/include/WCBackForwardList.h
@@ -0,0 +1,32 @@
+/*	WKBackForwardList.h
+	Copyright 2001, Apple, Inc. All rights reserved.
+*/
+
+#import <Foundation/Foundation.h>
+#import "WCURIEntry.h"
+
+ at protocol WCBackForwardList
+
+-(void)addEntry:(id <WCURIEntry>)entry;
+-(id <WCURIEntry>)back;
+-(id <WCURIEntry>)forward;
+
+-(NSArray *)backList;
+-(NSArray *)forwardList;
+
+-(BOOL)canGoBack;
+-(BOOL)canGoForward;
+
+ at end
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+// *** Factory method for WCBackForwardList objects
+
+id <WCBackForwardList> WCCreateBackForwardList(); 
+
+#if defined(__cplusplus)
+} // extern "C"
+#endif
diff --git a/WebKit/History.subproj/WebHistoryItem.h b/WebCore/include/WCURIEntry.h
similarity index 67%
copy from WebKit/History.subproj/WebHistoryItem.h
copy to WebCore/include/WCURIEntry.h
index b7d63ae..0950091 100644
--- a/WebKit/History.subproj/WebHistoryItem.h
+++ b/WebCore/include/WCURIEntry.h
@@ -1,25 +1,12 @@
-//
-//  WKURIEntry.h
-//  WebKit
-//
-//  Created by Kenneth Kocienda on Thu Nov 29 2001.
-//  Copyright (c) 2001 __MyCompanyName__. All rights reserved.
-//
+/*	WCURIEntry.h
+	Copyright 2001, Apple, Inc. All rights reserved.
+*/
 
 #import <Foundation/Foundation.h>
 #import <AppKit/AppKit.h>
 
 
- at interface WKURIEntry : NSObject 
-{
-    NSURL *_url;
-    NSString *_title;
-    NSImage *_image;
-    NSString *_comment;
-    NSDate *_creationDate;
-    NSDate *_modificationDate;
-    NSDate *_lastVisitedDate;
-}
+ at protocol WCURIEntry
 
 -(id)initWithURL:(NSURL *)url title:(NSString *)title;
 -(id)initWithURL:(NSURL *)url title:(NSString *)title image:(NSImage *)image;
@@ -45,3 +32,14 @@
 
 @end
 
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+// *** Factory method for WCURIEntry objects
+
+id <WCURIEntry> WCCreateURIEntry(); 
+
+#if defined(__cplusplus)
+} // extern "C"
+#endif
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index 958eb00..2cf4d80 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -88,6 +88,11 @@ static void recursive(const DOM::Node &pNode, const DOM::Node &node)
     m_part->closeURL();
 }
 
+-(void)checkCompleted:(NSNotification *)notification
+{
+    m_part->checkCompleted();
+}
+
 @end
 
 
@@ -106,6 +111,7 @@ public:
     KHTMLSettings *m_settings;
     
     KURL m_workingURL;
+    KURL m_url;
     KURL m_baseURL;
     
     KHTMLPart *m_part;
@@ -229,14 +235,26 @@ bool KHTMLPart::openURL( const KURL &url )
     
     // Keep a reference to the current working URL.
     d->m_workingURL = url;
+    d->m_url = url;
 
     id <WCURICache> cache;
-    NSString *nsurl;
-    
+
     cache = WCGetDefaultURICache();
-    nsurl = [NSString stringWithCString:url.url().latin1()];
+
+    NSString *urlString;
+    
+    urlString = [NSString stringWithCString:d->m_workingURL.url().latin1()];
+    if ([urlString hasSuffix:@"/"]) {
+        urlString = [urlString substringToIndex:([urlString length] - 1)];
+    }
+    
+    [cache requestWithString:urlString requestor:d->m_recv userData:nil];
+
+    [[NSNotificationCenter defaultCenter] addObserver:d->m_recv
+        selector:@selector(checkCompleted:) name:urlString object:nil];
     
-    [cache requestWithString:nsurl requestor:d->m_recv userData:nil];
+    // tell anyone who's interested that we've started to load a uri
+    [[NSNotificationCenter defaultCenter] postNotificationName:@"uri-start" object:urlString];
     
     return true;
 }
@@ -248,9 +266,18 @@ bool KHTMLPart::closeURL()
     //}
 
     // Cancel any pending loads.
+    NSString *urlString;
+    
+    urlString = [NSString stringWithCString:d->m_url.url().latin1()];
+    if ([urlString hasSuffix:@"/"]) {
+        urlString = [urlString substringToIndex:([urlString length] - 1)];
+    }
+    [[NSNotificationCenter defaultCenter] postNotificationName:urlString object:nil];
     
     // Reset the the current working URL to the default URL.
     d->m_workingURL = KURL();
+    
+
     //d->m_doc = 0;
 }
 
@@ -1054,7 +1081,13 @@ void KHTMLPart::khtmlMouseReleaseEvent( khtml::MouseReleaseEvent *event )
     // HACK!  FIXME!
     if (d->m_strSelectedURL != QString::null) {
         [((QWidget *)view())->getView() resetView];
-        openURL (KURL(completeURL( splitUrlTarget(d->m_strSelectedURL))));
+        KURL clickedURL(completeURL( splitUrlTarget(d->m_strSelectedURL)));
+        openURL (clickedURL);
+        // [kocienda]: shield your eyes!
+        // this hack is to get link clicks to show up in the history list of the test app
+        // this should be removed and replaced by something better
+        NSString *urlString = [NSString stringWithCString:clickedURL.url().latin1()];
+        [[NSNotificationCenter defaultCenter] postNotificationName:@"uri-click" object:urlString];
     }
     
 #define QT_NO_CLIPBOARD 1
@@ -1320,3 +1353,29 @@ void KHTMLPart::overURL( const QString &url, const QString &target )
     _logNeverImplemented();
 }
 
+void KHTMLPart::checkCompleted()
+{
+    int requests;
+    
+    
+    // Still waiting for images/scripts from the loader ?
+    requests = khtml::Cache::loader()->numRequests(d->m_url.url().latin1());
+    if (requests == 0) {
+        // FIXME: check for same URL with slash appended
+        // We should not have to do this
+        QString urlString = d->m_url.url();
+        urlString += '/';
+        requests = khtml::Cache::loader()->numRequests(urlString);
+    }
+    if (requests == 0) {
+        NSString *urlString;
+        urlString = [NSString stringWithCString:d->m_url.url().latin1()];
+        if ([urlString hasSuffix:@"/"]) {
+            urlString = [urlString substringToIndex:([urlString length] - 1)];
+        }
+        // remove us from the notification center that checks for the end of a load
+        [[NSNotificationCenter defaultCenter] removeObserver:d->m_recv name:urlString object:nil];
+        // tell anyone who's interested that we're done
+        [[NSNotificationCenter defaultCenter] postNotificationName:@"uri-done" object:urlString];
+    }
+}
\ No newline at end of file
diff --git a/WebCore/kwq/KWQKHTMLPartImpl.mm b/WebCore/kwq/KWQKHTMLPartImpl.mm
index 958eb00..2cf4d80 100644
--- a/WebCore/kwq/KWQKHTMLPartImpl.mm
+++ b/WebCore/kwq/KWQKHTMLPartImpl.mm
@@ -88,6 +88,11 @@ static void recursive(const DOM::Node &pNode, const DOM::Node &node)
     m_part->closeURL();
 }
 
+-(void)checkCompleted:(NSNotification *)notification
+{
+    m_part->checkCompleted();
+}
+
 @end
 
 
@@ -106,6 +111,7 @@ public:
     KHTMLSettings *m_settings;
     
     KURL m_workingURL;
+    KURL m_url;
     KURL m_baseURL;
     
     KHTMLPart *m_part;
@@ -229,14 +235,26 @@ bool KHTMLPart::openURL( const KURL &url )
     
     // Keep a reference to the current working URL.
     d->m_workingURL = url;
+    d->m_url = url;
 
     id <WCURICache> cache;
-    NSString *nsurl;
-    
+
     cache = WCGetDefaultURICache();
-    nsurl = [NSString stringWithCString:url.url().latin1()];
+
+    NSString *urlString;
+    
+    urlString = [NSString stringWithCString:d->m_workingURL.url().latin1()];
+    if ([urlString hasSuffix:@"/"]) {
+        urlString = [urlString substringToIndex:([urlString length] - 1)];
+    }
+    
+    [cache requestWithString:urlString requestor:d->m_recv userData:nil];
+
+    [[NSNotificationCenter defaultCenter] addObserver:d->m_recv
+        selector:@selector(checkCompleted:) name:urlString object:nil];
     
-    [cache requestWithString:nsurl requestor:d->m_recv userData:nil];
+    // tell anyone who's interested that we've started to load a uri
+    [[NSNotificationCenter defaultCenter] postNotificationName:@"uri-start" object:urlString];
     
     return true;
 }
@@ -248,9 +266,18 @@ bool KHTMLPart::closeURL()
     //}
 
     // Cancel any pending loads.
+    NSString *urlString;
+    
+    urlString = [NSString stringWithCString:d->m_url.url().latin1()];
+    if ([urlString hasSuffix:@"/"]) {
+        urlString = [urlString substringToIndex:([urlString length] - 1)];
+    }
+    [[NSNotificationCenter defaultCenter] postNotificationName:urlString object:nil];
     
     // Reset the the current working URL to the default URL.
     d->m_workingURL = KURL();
+    
+
     //d->m_doc = 0;
 }
 
@@ -1054,7 +1081,13 @@ void KHTMLPart::khtmlMouseReleaseEvent( khtml::MouseReleaseEvent *event )
     // HACK!  FIXME!
     if (d->m_strSelectedURL != QString::null) {
         [((QWidget *)view())->getView() resetView];
-        openURL (KURL(completeURL( splitUrlTarget(d->m_strSelectedURL))));
+        KURL clickedURL(completeURL( splitUrlTarget(d->m_strSelectedURL)));
+        openURL (clickedURL);
+        // [kocienda]: shield your eyes!
+        // this hack is to get link clicks to show up in the history list of the test app
+        // this should be removed and replaced by something better
+        NSString *urlString = [NSString stringWithCString:clickedURL.url().latin1()];
+        [[NSNotificationCenter defaultCenter] postNotificationName:@"uri-click" object:urlString];
     }
     
 #define QT_NO_CLIPBOARD 1
@@ -1320,3 +1353,29 @@ void KHTMLPart::overURL( const QString &url, const QString &target )
     _logNeverImplemented();
 }
 
+void KHTMLPart::checkCompleted()
+{
+    int requests;
+    
+    
+    // Still waiting for images/scripts from the loader ?
+    requests = khtml::Cache::loader()->numRequests(d->m_url.url().latin1());
+    if (requests == 0) {
+        // FIXME: check for same URL with slash appended
+        // We should not have to do this
+        QString urlString = d->m_url.url();
+        urlString += '/';
+        requests = khtml::Cache::loader()->numRequests(urlString);
+    }
+    if (requests == 0) {
+        NSString *urlString;
+        urlString = [NSString stringWithCString:d->m_url.url().latin1()];
+        if ([urlString hasSuffix:@"/"]) {
+            urlString = [urlString substringToIndex:([urlString length] - 1)];
+        }
+        // remove us from the notification center that checks for the end of a load
+        [[NSNotificationCenter defaultCenter] removeObserver:d->m_recv name:urlString object:nil];
+        // tell anyone who's interested that we're done
+        [[NSNotificationCenter defaultCenter] postNotificationName:@"uri-done" object:urlString];
+    }
+}
\ No newline at end of file
diff --git a/WebCore/kwq/KWQKloader.mm b/WebCore/kwq/KWQKloader.mm
index f20bee3..e5af97b 100644
--- a/WebCore/kwq/KWQKloader.mm
+++ b/WebCore/kwq/KWQKloader.mm
@@ -962,7 +962,7 @@ public:
     
     ~LoaderPrivate()
     {
-        [m_recv release];
+        [m_recv autorelease];
     }       
 
 private:
@@ -1044,6 +1044,13 @@ void Loader::slotFinished( KIO::Job* job )
       r->object->data(r->m_buffer, true);
       emit requestDone( r->m_baseURL, r->object );
   }
+    
+    NSString *urlString;
+    urlString = [NSString stringWithCString:r->m_baseURL.string().latin1()];
+    if ([urlString hasSuffix:@"/"]) {
+        urlString = [urlString substringToIndex:([urlString length] - 1)];
+    }
+    [[NSNotificationCenter defaultCenter] postNotificationName:urlString object:nil];
 
   r->object->finish();
 
@@ -1096,7 +1103,7 @@ void Loader::slotData( KIO::Job*job, const QByteArray &data )
 int Loader::numRequests( const DOMString &baseURL ) const
 {
     int res = 0;
-
+    
     QListIterator<Request> pIt( m_requestsPending );
     for (; pIt.current(); ++pIt )
         if ( pIt.current()->m_baseURL == baseURL )
diff --git a/WebCore/kwq/KWQLoader.mm b/WebCore/kwq/KWQLoader.mm
index f20bee3..e5af97b 100644
--- a/WebCore/kwq/KWQLoader.mm
+++ b/WebCore/kwq/KWQLoader.mm
@@ -962,7 +962,7 @@ public:
     
     ~LoaderPrivate()
     {
-        [m_recv release];
+        [m_recv autorelease];
     }       
 
 private:
@@ -1044,6 +1044,13 @@ void Loader::slotFinished( KIO::Job* job )
       r->object->data(r->m_buffer, true);
       emit requestDone( r->m_baseURL, r->object );
   }
+    
+    NSString *urlString;
+    urlString = [NSString stringWithCString:r->m_baseURL.string().latin1()];
+    if ([urlString hasSuffix:@"/"]) {
+        urlString = [urlString substringToIndex:([urlString length] - 1)];
+    }
+    [[NSNotificationCenter defaultCenter] postNotificationName:urlString object:nil];
 
   r->object->finish();
 
@@ -1096,7 +1103,7 @@ void Loader::slotData( KIO::Job*job, const QByteArray &data )
 int Loader::numRequests( const DOMString &baseURL ) const
 {
     int res = 0;
-
+    
     QListIterator<Request> pIt( m_requestsPending );
     for (; pIt.current(); ++pIt )
         if ( pIt.current()->m_baseURL == baseURL )
diff --git a/WebCore/kwq/KWQLoaderImpl.mm b/WebCore/kwq/KWQLoaderImpl.mm
index f20bee3..e5af97b 100644
--- a/WebCore/kwq/KWQLoaderImpl.mm
+++ b/WebCore/kwq/KWQLoaderImpl.mm
@@ -962,7 +962,7 @@ public:
     
     ~LoaderPrivate()
     {
-        [m_recv release];
+        [m_recv autorelease];
     }       
 
 private:
@@ -1044,6 +1044,13 @@ void Loader::slotFinished( KIO::Job* job )
       r->object->data(r->m_buffer, true);
       emit requestDone( r->m_baseURL, r->object );
   }
+    
+    NSString *urlString;
+    urlString = [NSString stringWithCString:r->m_baseURL.string().latin1()];
+    if ([urlString hasSuffix:@"/"]) {
+        urlString = [urlString substringToIndex:([urlString length] - 1)];
+    }
+    [[NSNotificationCenter defaultCenter] postNotificationName:urlString object:nil];
 
   r->object->finish();
 
@@ -1096,7 +1103,7 @@ void Loader::slotData( KIO::Job*job, const QByteArray &data )
 int Loader::numRequests( const DOMString &baseURL ) const
 {
     int res = 0;
-
+    
     QListIterator<Request> pIt( m_requestsPending );
     for (; pIt.current(); ++pIt )
         if ( pIt.current()->m_baseURL == baseURL )
diff --git a/WebCore/kwq/Makefile.in b/WebCore/kwq/Makefile.in
index 7dd28e3..38a248e 100644
--- a/WebCore/kwq/Makefile.in
+++ b/WebCore/kwq/Makefile.in
@@ -180,6 +180,7 @@ DEPFLAGS = $(CMMFLAGS)
 
 CMFLAGS = $(BASECMFLAGS) \
     -I$(TOPSRCDIR) \
+    -I$(TOPSRCDIR)/WebCore/include \
     -I$(TOPSRCDIR)/WebCore/src/kdelibs/khtml \
     -I$(TOPSRCDIR)/WebCore/src/kwq \
     -I$(TOPSRCDIR)/WebCore/src/kwq/qt \
diff --git a/WebCore/kwq/_KWQOwner.h b/WebCore/kwq/_KWQOwner.h
index 6f26d3a..f6b9ba4 100644
--- a/WebCore/kwq/_KWQOwner.h
+++ b/WebCore/kwq/_KWQOwner.h
@@ -1,8 +1,17 @@
 #import <Cocoa/Cocoa.h>
+#import <WCBackForwardList.h>
 
 @interface _KWQOwner : NSApplication
 {
     IBOutlet id window;
     IBOutlet id containerView;
+    IBOutlet NSProgressIndicator *throbber;
+    IBOutlet NSComboBox *urlBar;
+    IBOutlet NSButton *backButton;
+    IBOutlet NSButton *forwardButton;
+    id <WCBackForwardList> backForwardList;
 }
+
+-(void)updateButtons;
+
 @end
diff --git a/WebCore/kwq/_KWQOwner.m b/WebCore/kwq/_KWQOwner.m
index 520adca..f9fe747 100644
--- a/WebCore/kwq/_KWQOwner.m
+++ b/WebCore/kwq/_KWQOwner.m
@@ -6,6 +6,8 @@
 - (void)setURL: (NSString *)urlString;
 @end
 
+static BOOL flag = NO;
+
 @implementation _KWQOwner
 
 - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
@@ -20,12 +22,120 @@
     KWQHTMLView *htmlView;
     NSArray *subs;
     
+    if (!flag) {
+        flag = YES;
+        backForwardList = WCCreateBackForwardList();
+        [self updateButtons];
+        [throbber setUsesThreadedAnimation:YES];
+        [[NSNotificationCenter defaultCenter] addObserver:self
+            selector:@selector(uriClick:) name:@"uri-click" object:nil];
+    }
+
+    [[NSNotificationCenter defaultCenter] addObserver:self
+        selector:@selector(newUriDone:) name:@"uri-done" object:nil];
+    
     subs = [containerView subviews];
     htmlView = (KWQHTMLView *)[[subs objectAtIndex: 0] documentView];
     [htmlView setURL: url];
-    
+    [throbber startAnimation:self];
+       
     return self;
 }
 
+-(void)back:(id)sender
+{
+    NSString *url;
+    KWQHTMLView *htmlView;
+    NSArray *subs;
+    id <WCURIEntry> entry;
+ 
+    entry = [backForwardList back];
+    url = [[entry url] absoluteString];
+    [urlBar setStringValue:url];
+
+    [[NSNotificationCenter defaultCenter] addObserver:self
+        selector:@selector(backForwardUriDone:) name:@"uri-done" object:nil];
+    
+    subs = [containerView subviews];
+    htmlView = (KWQHTMLView *)[[subs objectAtIndex: 0] documentView];
+    [htmlView setURL: url];
+    [throbber startAnimation:self];
+}
+
+-(void)forward:(id)sender
+{
+    NSString *url;
+    KWQHTMLView *htmlView;
+    NSArray *subs;
+    id <WCURIEntry> entry;
+    
+    entry = [backForwardList forward];
+    url = [[entry url] absoluteString];
+    [urlBar setStringValue:url];
+
+    [[NSNotificationCenter defaultCenter] addObserver:self
+        selector:@selector(backForwardUriDone:) name:@"uri-done" object:nil];
+    
+    subs = [containerView subviews];
+    htmlView = (KWQHTMLView *)[[subs objectAtIndex: 0] documentView];
+    [htmlView setURL: url];
+    [throbber startAnimation:self];
+}
+
+-(void)uriClick:(NSNotification *)notification
+{
+    [[NSNotificationCenter defaultCenter] addObserver:self
+        selector:@selector(newUriDone:) name:@"uri-done" object:nil];
+    [urlBar setStringValue:[notification object]];
+    [throbber startAnimation:self];
+}
+
+-(void)backForwardUriDone:(NSNotification *)notification
+{
+    NSString *uriString;
+    id <WCURIEntry> entry;
+    
+    uriString = [notification object];
+
+    [[NSNotificationCenter defaultCenter] removeObserver:self 
+        name:@"uri-done" object:nil];
+
+    [self updateButtons];
+    [throbber stopAnimation:self];
+}
+
+-(void)newUriDone:(NSNotification *)notification
+{
+    NSString *uriString;
+    id <WCURIEntry> entry;
+    
+    uriString = [notification object];
+
+    entry = WCCreateURIEntry();
+    [entry setURL:[NSURL URLWithString:uriString]];
+    [backForwardList addEntry: entry];
+
+    [[NSNotificationCenter defaultCenter] removeObserver:self 
+        name:@"uri-done" object:nil];
+
+    [self updateButtons];
+    [throbber stopAnimation:self];
+}
+
+-(void)updateButtons
+{
+    if ([backForwardList canGoBack]) {
+        [backButton setEnabled: YES];
+    }
+    else {
+        [backButton setEnabled: NO];
+    }
+    if ([backForwardList canGoForward]) {
+        [forwardButton setEnabled: YES];
+    }
+    else {
+        [forwardButton setEnabled: NO];
+    }
+}
 
 @end
diff --git a/WebCore/lib/Makefile.in b/WebCore/lib/Makefile.in
index 0b9be3d..fe1ed35 100644
--- a/WebCore/lib/Makefile.in
+++ b/WebCore/lib/Makefile.in
@@ -47,7 +47,7 @@ all: $(LIBRARY)
 
 $(LIBRARY): $(OBJECTS)
 	rm -f $(LIBRARY_BASE_NAME).*.dylib; \
-	$(CC) -flat_namespace -undefined suppress -compatibility_version $(LIBRARY_COMPAT_VERSION) -current_version $(LIBRARY_VERSION) $(DYLIBFLAGS) -o $(LIBRARY) $(OBJECTS) -lstdc++ -ljpeg
+	$(CC) -flat_namespace -undefined suppress -compatibility_version $(LIBRARY_COMPAT_VERSION) -current_version $(LIBRARY_VERSION) $(DYLIBFLAGS) -o $(LIBRARY) $(OBJECTS) -lstdc++ -ljpeg -install_name "`echo "@executable_path/../Frameworks/libwebcore.1.0.0.dylib" | /usr/bin/sed 's!//*!/!g'`"
 	ln -fs $(LIBRARY) $(LIBRARY_DYNAMIC_LINK)
 	ln -fs $(LIBRARY) $(LIBRARY_STATIC_LINK)
 	if [ -d "/symroots" ]; then \
diff --git a/WebCore/src/kwq/KWQKHTMLPart.h b/WebCore/src/kwq/KWQKHTMLPart.h
index d2f27a0..7967a3b 100644
--- a/WebCore/src/kwq/KWQKHTMLPart.h
+++ b/WebCore/src/kwq/KWQKHTMLPart.h
@@ -582,11 +582,15 @@ public:
 #endif
 #endif
 
+    // this function checks to see whether a base URI and all its
+    // associated sub-URIs have loaded
+    void checkCompleted();
+
 private:
 
     KHTMLPartPrivate *d;
     // DUBIOUS, why are impls being referenced?
-    DOM::HTMLDocumentImpl *docImpl() const;
+    DOM::HTMLDocumentImpl *docImpl() const;    
 
 };
 
diff --git a/WebCore/src/kwq/KWQKHTMLPart.mm b/WebCore/src/kwq/KWQKHTMLPart.mm
index 958eb00..2cf4d80 100644
--- a/WebCore/src/kwq/KWQKHTMLPart.mm
+++ b/WebCore/src/kwq/KWQKHTMLPart.mm
@@ -88,6 +88,11 @@ static void recursive(const DOM::Node &pNode, const DOM::Node &node)
     m_part->closeURL();
 }
 
+-(void)checkCompleted:(NSNotification *)notification
+{
+    m_part->checkCompleted();
+}
+
 @end
 
 
@@ -106,6 +111,7 @@ public:
     KHTMLSettings *m_settings;
     
     KURL m_workingURL;
+    KURL m_url;
     KURL m_baseURL;
     
     KHTMLPart *m_part;
@@ -229,14 +235,26 @@ bool KHTMLPart::openURL( const KURL &url )
     
     // Keep a reference to the current working URL.
     d->m_workingURL = url;
+    d->m_url = url;
 
     id <WCURICache> cache;
-    NSString *nsurl;
-    
+
     cache = WCGetDefaultURICache();
-    nsurl = [NSString stringWithCString:url.url().latin1()];
+
+    NSString *urlString;
+    
+    urlString = [NSString stringWithCString:d->m_workingURL.url().latin1()];
+    if ([urlString hasSuffix:@"/"]) {
+        urlString = [urlString substringToIndex:([urlString length] - 1)];
+    }
+    
+    [cache requestWithString:urlString requestor:d->m_recv userData:nil];
+
+    [[NSNotificationCenter defaultCenter] addObserver:d->m_recv
+        selector:@selector(checkCompleted:) name:urlString object:nil];
     
-    [cache requestWithString:nsurl requestor:d->m_recv userData:nil];
+    // tell anyone who's interested that we've started to load a uri
+    [[NSNotificationCenter defaultCenter] postNotificationName:@"uri-start" object:urlString];
     
     return true;
 }
@@ -248,9 +266,18 @@ bool KHTMLPart::closeURL()
     //}
 
     // Cancel any pending loads.
+    NSString *urlString;
+    
+    urlString = [NSString stringWithCString:d->m_url.url().latin1()];
+    if ([urlString hasSuffix:@"/"]) {
+        urlString = [urlString substringToIndex:([urlString length] - 1)];
+    }
+    [[NSNotificationCenter defaultCenter] postNotificationName:urlString object:nil];
     
     // Reset the the current working URL to the default URL.
     d->m_workingURL = KURL();
+    
+
     //d->m_doc = 0;
 }
 
@@ -1054,7 +1081,13 @@ void KHTMLPart::khtmlMouseReleaseEvent( khtml::MouseReleaseEvent *event )
     // HACK!  FIXME!
     if (d->m_strSelectedURL != QString::null) {
         [((QWidget *)view())->getView() resetView];
-        openURL (KURL(completeURL( splitUrlTarget(d->m_strSelectedURL))));
+        KURL clickedURL(completeURL( splitUrlTarget(d->m_strSelectedURL)));
+        openURL (clickedURL);
+        // [kocienda]: shield your eyes!
+        // this hack is to get link clicks to show up in the history list of the test app
+        // this should be removed and replaced by something better
+        NSString *urlString = [NSString stringWithCString:clickedURL.url().latin1()];
+        [[NSNotificationCenter defaultCenter] postNotificationName:@"uri-click" object:urlString];
     }
     
 #define QT_NO_CLIPBOARD 1
@@ -1320,3 +1353,29 @@ void KHTMLPart::overURL( const QString &url, const QString &target )
     _logNeverImplemented();
 }
 
+void KHTMLPart::checkCompleted()
+{
+    int requests;
+    
+    
+    // Still waiting for images/scripts from the loader ?
+    requests = khtml::Cache::loader()->numRequests(d->m_url.url().latin1());
+    if (requests == 0) {
+        // FIXME: check for same URL with slash appended
+        // We should not have to do this
+        QString urlString = d->m_url.url();
+        urlString += '/';
+        requests = khtml::Cache::loader()->numRequests(urlString);
+    }
+    if (requests == 0) {
+        NSString *urlString;
+        urlString = [NSString stringWithCString:d->m_url.url().latin1()];
+        if ([urlString hasSuffix:@"/"]) {
+            urlString = [urlString substringToIndex:([urlString length] - 1)];
+        }
+        // remove us from the notification center that checks for the end of a load
+        [[NSNotificationCenter defaultCenter] removeObserver:d->m_recv name:urlString object:nil];
+        // tell anyone who's interested that we're done
+        [[NSNotificationCenter defaultCenter] postNotificationName:@"uri-done" object:urlString];
+    }
+}
\ No newline at end of file
diff --git a/WebCore/src/kwq/KWQKloader.mm b/WebCore/src/kwq/KWQKloader.mm
index f20bee3..e5af97b 100644
--- a/WebCore/src/kwq/KWQKloader.mm
+++ b/WebCore/src/kwq/KWQKloader.mm
@@ -962,7 +962,7 @@ public:
     
     ~LoaderPrivate()
     {
-        [m_recv release];
+        [m_recv autorelease];
     }       
 
 private:
@@ -1044,6 +1044,13 @@ void Loader::slotFinished( KIO::Job* job )
       r->object->data(r->m_buffer, true);
       emit requestDone( r->m_baseURL, r->object );
   }
+    
+    NSString *urlString;
+    urlString = [NSString stringWithCString:r->m_baseURL.string().latin1()];
+    if ([urlString hasSuffix:@"/"]) {
+        urlString = [urlString substringToIndex:([urlString length] - 1)];
+    }
+    [[NSNotificationCenter defaultCenter] postNotificationName:urlString object:nil];
 
   r->object->finish();
 
@@ -1096,7 +1103,7 @@ void Loader::slotData( KIO::Job*job, const QByteArray &data )
 int Loader::numRequests( const DOMString &baseURL ) const
 {
     int res = 0;
-
+    
     QListIterator<Request> pIt( m_requestsPending );
     for (; pIt.current(); ++pIt )
         if ( pIt.current()->m_baseURL == baseURL )
diff --git a/WebCore/src/kwq/Makefile.in b/WebCore/src/kwq/Makefile.in
index 7dd28e3..38a248e 100644
--- a/WebCore/src/kwq/Makefile.in
+++ b/WebCore/src/kwq/Makefile.in
@@ -180,6 +180,7 @@ DEPFLAGS = $(CMMFLAGS)
 
 CMFLAGS = $(BASECMFLAGS) \
     -I$(TOPSRCDIR) \
+    -I$(TOPSRCDIR)/WebCore/include \
     -I$(TOPSRCDIR)/WebCore/src/kdelibs/khtml \
     -I$(TOPSRCDIR)/WebCore/src/kwq \
     -I$(TOPSRCDIR)/WebCore/src/kwq/qt \
diff --git a/WebCore/src/kwq/_KWQOwner.h b/WebCore/src/kwq/_KWQOwner.h
index 6f26d3a..f6b9ba4 100644
--- a/WebCore/src/kwq/_KWQOwner.h
+++ b/WebCore/src/kwq/_KWQOwner.h
@@ -1,8 +1,17 @@
 #import <Cocoa/Cocoa.h>
+#import <WCBackForwardList.h>
 
 @interface _KWQOwner : NSApplication
 {
     IBOutlet id window;
     IBOutlet id containerView;
+    IBOutlet NSProgressIndicator *throbber;
+    IBOutlet NSComboBox *urlBar;
+    IBOutlet NSButton *backButton;
+    IBOutlet NSButton *forwardButton;
+    id <WCBackForwardList> backForwardList;
 }
+
+-(void)updateButtons;
+
 @end
diff --git a/WebCore/src/kwq/_KWQOwner.m b/WebCore/src/kwq/_KWQOwner.m
index 520adca..f9fe747 100644
--- a/WebCore/src/kwq/_KWQOwner.m
+++ b/WebCore/src/kwq/_KWQOwner.m
@@ -6,6 +6,8 @@
 - (void)setURL: (NSString *)urlString;
 @end
 
+static BOOL flag = NO;
+
 @implementation _KWQOwner
 
 - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
@@ -20,12 +22,120 @@
     KWQHTMLView *htmlView;
     NSArray *subs;
     
+    if (!flag) {
+        flag = YES;
+        backForwardList = WCCreateBackForwardList();
+        [self updateButtons];
+        [throbber setUsesThreadedAnimation:YES];
+        [[NSNotificationCenter defaultCenter] addObserver:self
+            selector:@selector(uriClick:) name:@"uri-click" object:nil];
+    }
+
+    [[NSNotificationCenter defaultCenter] addObserver:self
+        selector:@selector(newUriDone:) name:@"uri-done" object:nil];
+    
     subs = [containerView subviews];
     htmlView = (KWQHTMLView *)[[subs objectAtIndex: 0] documentView];
     [htmlView setURL: url];
-    
+    [throbber startAnimation:self];
+       
     return self;
 }
 
+-(void)back:(id)sender
+{
+    NSString *url;
+    KWQHTMLView *htmlView;
+    NSArray *subs;
+    id <WCURIEntry> entry;
+ 
+    entry = [backForwardList back];
+    url = [[entry url] absoluteString];
+    [urlBar setStringValue:url];
+
+    [[NSNotificationCenter defaultCenter] addObserver:self
+        selector:@selector(backForwardUriDone:) name:@"uri-done" object:nil];
+    
+    subs = [containerView subviews];
+    htmlView = (KWQHTMLView *)[[subs objectAtIndex: 0] documentView];
+    [htmlView setURL: url];
+    [throbber startAnimation:self];
+}
+
+-(void)forward:(id)sender
+{
+    NSString *url;
+    KWQHTMLView *htmlView;
+    NSArray *subs;
+    id <WCURIEntry> entry;
+    
+    entry = [backForwardList forward];
+    url = [[entry url] absoluteString];
+    [urlBar setStringValue:url];
+
+    [[NSNotificationCenter defaultCenter] addObserver:self
+        selector:@selector(backForwardUriDone:) name:@"uri-done" object:nil];
+    
+    subs = [containerView subviews];
+    htmlView = (KWQHTMLView *)[[subs objectAtIndex: 0] documentView];
+    [htmlView setURL: url];
+    [throbber startAnimation:self];
+}
+
+-(void)uriClick:(NSNotification *)notification
+{
+    [[NSNotificationCenter defaultCenter] addObserver:self
+        selector:@selector(newUriDone:) name:@"uri-done" object:nil];
+    [urlBar setStringValue:[notification object]];
+    [throbber startAnimation:self];
+}
+
+-(void)backForwardUriDone:(NSNotification *)notification
+{
+    NSString *uriString;
+    id <WCURIEntry> entry;
+    
+    uriString = [notification object];
+
+    [[NSNotificationCenter defaultCenter] removeObserver:self 
+        name:@"uri-done" object:nil];
+
+    [self updateButtons];
+    [throbber stopAnimation:self];
+}
+
+-(void)newUriDone:(NSNotification *)notification
+{
+    NSString *uriString;
+    id <WCURIEntry> entry;
+    
+    uriString = [notification object];
+
+    entry = WCCreateURIEntry();
+    [entry setURL:[NSURL URLWithString:uriString]];
+    [backForwardList addEntry: entry];
+
+    [[NSNotificationCenter defaultCenter] removeObserver:self 
+        name:@"uri-done" object:nil];
+
+    [self updateButtons];
+    [throbber stopAnimation:self];
+}
+
+-(void)updateButtons
+{
+    if ([backForwardList canGoBack]) {
+        [backButton setEnabled: YES];
+    }
+    else {
+        [backButton setEnabled: NO];
+    }
+    if ([backForwardList canGoForward]) {
+        [forwardButton setEnabled: YES];
+    }
+    else {
+        [forwardButton setEnabled: NO];
+    }
+}
 
 @end
diff --git a/WebKit/History.subproj/IFBackForwardList.h b/WebKit/History.subproj/IFBackForwardList.h
index 4d77d10..5838060 100644
--- a/WebKit/History.subproj/IFBackForwardList.h
+++ b/WebKit/History.subproj/IFBackForwardList.h
@@ -8,11 +8,26 @@
 
 #import <Foundation/Foundation.h>
 #import "WKURIList.h"
+#import "WKURIEntry.h"
+#import <WCBackForwardList.h>
 
- at interface WKBackForwardList : NSObject {
+ at interface WKBackForwardList : NSObject <WCBackForwardList> {
     WKURIList *uriList;
+    int index;
+    NSLock *mutex;
+    int state;
 }
 
+-(id)init;
 
+-(void)addEntry:(WKURIEntry *)entry;
+-(WKURIEntry *)back;
+-(WKURIEntry *)forward;
+
+-(NSArray *)backList;
+-(NSArray *)forwardList;
+
+-(BOOL)canGoBack;
+-(BOOL)canGoForward;
 
 @end
diff --git a/WebKit/History.subproj/IFBackForwardList.m b/WebKit/History.subproj/IFBackForwardList.m
index cf40808..e991d9a 100644
--- a/WebKit/History.subproj/IFBackForwardList.m
+++ b/WebKit/History.subproj/IFBackForwardList.m
@@ -8,7 +8,139 @@
 
 #import "WKBackForwardList.h"
 
+// *** Function to access WCURICache singleton
+
+id <WCBackForwardList> WCCreateBackForwardList()
+{
+    return [[WKBackForwardList alloc] init];
+}
+
 
 @implementation WKBackForwardList
 
+-(id)init
+{
+    if (self != [super init])
+    {
+        return nil;
+    }
+    
+    uriList = [[WKURIList alloc] init];
+    [uriList setAllowsDuplicates:YES];
+    index = 0;
+    mutex = [[NSLock alloc] init];
+
+    return self;
+}
+
+-(void)dealloc
+{
+    [uriList release];
+    [mutex release];
+
+    [super dealloc];
+}
+
+-(void)addEntry:(WKURIEntry *)entry
+{
+    [mutex lock];
+    if (index > 0) {
+        [uriList removeEntriesToIndex:index];
+        index = 0;
+    }
+    [uriList addEntry:entry];
+    [mutex unlock];
+}
+
+-(WKURIEntry *)back
+{
+    WKURIEntry *result;
+    
+    [mutex lock];
+    index++;
+    result = [uriList entryAtIndex:index];
+    [mutex unlock];
+
+    return result;
+}
+
+-(WKURIEntry *)forward
+{
+    WKURIEntry *result;
+
+    [mutex lock];
+    index--;
+    result = [uriList entryAtIndex:index];
+    [mutex unlock];
+    
+    return result;
+}
+
+-(BOOL)canGoBack
+{
+    BOOL result;
+    int count;
+    
+    [mutex lock];
+    count = [uriList count];
+    result = (count > 1 && index < (count - 1));
+    [mutex unlock];
+    
+    return result;
+}
+
+-(BOOL)canGoForward
+{
+    BOOL result;
+
+    [mutex lock];
+    result = (index > 0);
+    [mutex unlock];
+    
+    return result;
+}
+
+-(NSArray *)backList
+{
+    // FIXME: implement this some day
+    return nil;
+}
+
+-(NSArray *)forwardList
+{
+    // FIXME: implement this some day
+    return nil;
+}
+
+-(NSString *)description
+{
+    NSMutableString *result;
+    int i;
+
+    [mutex lock];
+    
+    result = [NSMutableString stringWithCapacity:512];
+    
+    [result appendString:@"\n--------------------------------------------\n"];    
+    [result appendString:@"WKBackForwardList:\n"];
+    
+    for (i = 0; i < [uriList count]; i++) {
+        if (i == index) {
+            [result appendString:@" >>>"]; 
+        }
+        else {
+            [result appendString:@"    "]; 
+        }   
+        [result appendFormat:@" %d) ", i]; 
+        [result appendString:[[uriList entryAtIndex:i] description]]; 
+        [result appendString:@"\n"]; 
+    }
+
+    [result appendString:@"\n--------------------------------------------\n"];    
+
+    [mutex unlock];
+
+    return result;
+}
+
 @end
diff --git a/WebKit/History.subproj/IFURIEntry.h b/WebKit/History.subproj/IFURIEntry.h
index b7d63ae..6e4d9f6 100644
--- a/WebKit/History.subproj/IFURIEntry.h
+++ b/WebKit/History.subproj/IFURIEntry.h
@@ -8,9 +8,9 @@
 
 #import <Foundation/Foundation.h>
 #import <AppKit/AppKit.h>
+#import <WCURIEntry.h>
 
-
- at interface WKURIEntry : NSObject 
+ at interface WKURIEntry : NSObject <WCURIEntry>
 {
     NSURL *_url;
     NSString *_title;
@@ -21,6 +21,7 @@
     NSDate *_lastVisitedDate;
 }
 
+-(id)init;
 -(id)initWithURL:(NSURL *)url title:(NSString *)title;
 -(id)initWithURL:(NSURL *)url title:(NSString *)title image:(NSImage *)image;
 -(id)initWithURL:(NSURL *)url title:(NSString *)title image:(NSImage *)image comment:(NSString *)comment;
diff --git a/WebKit/History.subproj/IFURIEntry.m b/WebKit/History.subproj/IFURIEntry.m
index dab9c0d..955c954 100644
--- a/WebKit/History.subproj/IFURIEntry.m
+++ b/WebKit/History.subproj/IFURIEntry.m
@@ -9,9 +9,21 @@
 #import "WKURIEntry.h"
 #import "WebKitReallyPrivate.h"
 
+// *** Function to access WCURICache singleton
+
+id <WCURIEntry> WCCreateURIEntry()
+{
+    return [[WKURIEntry alloc] init];
+}
+
 
 @implementation WKURIEntry
 
+-(id)init
+{
+    return [self initWithURL:nil title:nil image:nil comment:nil];
+}
+
 -(id)initWithURL:(NSURL *)url title:(NSString *)title
 {
     return [self initWithURL:url title:title image:nil comment:nil];
@@ -24,9 +36,6 @@
 
 -(id)initWithURL:(NSURL *)url title:(NSString *)title image:(NSImage *)image comment:(NSString *)comment
 {
-    WEBKIT_ASSERT_NOT_NIL(url);
-    WEBKIT_ASSERT_NOT_NIL(title);
-
     if (self != [super init])
     {
         return nil;
@@ -144,6 +153,10 @@
     return result;
 }
 
+-(NSString *)description
+{
+    return [NSString stringWithFormat:@"WKURIEntry %@", _url];
+}
     
 @end
 
diff --git a/WebKit/History.subproj/IFURIList.m b/WebKit/History.subproj/IFURIList.m
index 27b50ab..e7e66cd 100644
--- a/WebKit/History.subproj/IFURIList.m
+++ b/WebKit/History.subproj/IFURIList.m
@@ -90,6 +90,7 @@ static void freeNode(WKURIListNode *node)
 
 -(void)setMaximumSize:(int)size
 {
+    WEBKIT_ASSERT(size > 0 || size == -1);
     _maximumSize = size;
 }
 
@@ -120,11 +121,15 @@ static void freeNode(WKURIListNode *node)
                 _count--;
                 if (node == _head) {
                     _head = node->next;
-                    _head->prev = nil;
+                    if (_head) {
+                        _head->prev = nil;
+                    }
                 }
                 else if (node == _tail) {
                     _tail = node->prev;
-                    _tail->next = nil;
+                    if (_tail) {
+                        _tail->next = nil;
+                    }
                 }
                 else {
                     node->prev->next = node->next;
@@ -145,7 +150,7 @@ static void freeNode(WKURIListNode *node)
         _tail = _head;
     }
     
-    if (_count > _maximumSize) {
+    if (_maximumSize != -1 && _count > _maximumSize) {
         // drop off the tail
         node = _tail;
         _tail = _tail->prev;
@@ -170,11 +175,15 @@ static void freeNode(WKURIListNode *node)
             removedEntry = node->entry;
             if (node == _head) {
                 _head = node->next;
-                _head->prev = nil;
+                if (_head) {
+                    _head->prev = nil;
+                }
             }
             else if (node == _tail) {
                 _tail = node->prev;
-                _tail->next = nil;
+                if (_tail) {
+                    _tail->next = nil;
+                }
             }
             else {
                 node->prev->next = node->next;
@@ -203,11 +212,15 @@ static void freeNode(WKURIListNode *node)
             removed = YES;
             if (node == _head) {
                 _head = node->next;
-                _head->prev = nil;
+                if (_head) {
+                    _head->prev = nil;
+                }
             }
             else if (node == _tail) {
                 _tail = node->prev;
-                _tail->next = nil;
+                if (_tail) {
+                    _tail->next = nil;
+                }
             }
             else {
                 node->prev->next = node->next;
@@ -245,7 +258,7 @@ static void freeNode(WKURIListNode *node)
     int i;
     WKURIListNode *node;
 
-    WEBKIT_ASSERT(index > 0 && index < _count);
+    WEBKIT_ASSERT(index >= 0 && index < _count);
 
     node = _head;
 
@@ -274,11 +287,15 @@ static void freeNode(WKURIListNode *node)
     removedEntry = node->entry;
     if (node == _head) {
         _head = node->next;
-        _head->prev = nil;
+        if (_head) {
+            _head->prev = nil;
+        }
     }
     else if (node == _tail) {
         _tail = node->prev;
-        _tail->next = nil;
+        if (_tail) {
+            _tail->next = nil;
+        }
     }
     else {
         node->prev->next = node->next;
@@ -303,11 +320,10 @@ static void freeNode(WKURIListNode *node)
         delNode = node;
         node = node->next;
         freeNode(delNode);
+        _count--;
     }
     
     _head = node;
 }
 
-
-
 @end
diff --git a/WebKit/History.subproj/WKBackForwardList.h b/WebKit/History.subproj/WKBackForwardList.h
index 4d77d10..5838060 100644
--- a/WebKit/History.subproj/WKBackForwardList.h
+++ b/WebKit/History.subproj/WKBackForwardList.h
@@ -8,11 +8,26 @@
 
 #import <Foundation/Foundation.h>
 #import "WKURIList.h"
+#import "WKURIEntry.h"
+#import <WCBackForwardList.h>
 
- at interface WKBackForwardList : NSObject {
+ at interface WKBackForwardList : NSObject <WCBackForwardList> {
     WKURIList *uriList;
+    int index;
+    NSLock *mutex;
+    int state;
 }
 
+-(id)init;
 
+-(void)addEntry:(WKURIEntry *)entry;
+-(WKURIEntry *)back;
+-(WKURIEntry *)forward;
+
+-(NSArray *)backList;
+-(NSArray *)forwardList;
+
+-(BOOL)canGoBack;
+-(BOOL)canGoForward;
 
 @end
diff --git a/WebKit/History.subproj/WKBackForwardList.m b/WebKit/History.subproj/WKBackForwardList.m
index cf40808..e991d9a 100644
--- a/WebKit/History.subproj/WKBackForwardList.m
+++ b/WebKit/History.subproj/WKBackForwardList.m
@@ -8,7 +8,139 @@
 
 #import "WKBackForwardList.h"
 
+// *** Function to access WCURICache singleton
+
+id <WCBackForwardList> WCCreateBackForwardList()
+{
+    return [[WKBackForwardList alloc] init];
+}
+
 
 @implementation WKBackForwardList
 
+-(id)init
+{
+    if (self != [super init])
+    {
+        return nil;
+    }
+    
+    uriList = [[WKURIList alloc] init];
+    [uriList setAllowsDuplicates:YES];
+    index = 0;
+    mutex = [[NSLock alloc] init];
+
+    return self;
+}
+
+-(void)dealloc
+{
+    [uriList release];
+    [mutex release];
+
+    [super dealloc];
+}
+
+-(void)addEntry:(WKURIEntry *)entry
+{
+    [mutex lock];
+    if (index > 0) {
+        [uriList removeEntriesToIndex:index];
+        index = 0;
+    }
+    [uriList addEntry:entry];
+    [mutex unlock];
+}
+
+-(WKURIEntry *)back
+{
+    WKURIEntry *result;
+    
+    [mutex lock];
+    index++;
+    result = [uriList entryAtIndex:index];
+    [mutex unlock];
+
+    return result;
+}
+
+-(WKURIEntry *)forward
+{
+    WKURIEntry *result;
+
+    [mutex lock];
+    index--;
+    result = [uriList entryAtIndex:index];
+    [mutex unlock];
+    
+    return result;
+}
+
+-(BOOL)canGoBack
+{
+    BOOL result;
+    int count;
+    
+    [mutex lock];
+    count = [uriList count];
+    result = (count > 1 && index < (count - 1));
+    [mutex unlock];
+    
+    return result;
+}
+
+-(BOOL)canGoForward
+{
+    BOOL result;
+
+    [mutex lock];
+    result = (index > 0);
+    [mutex unlock];
+    
+    return result;
+}
+
+-(NSArray *)backList
+{
+    // FIXME: implement this some day
+    return nil;
+}
+
+-(NSArray *)forwardList
+{
+    // FIXME: implement this some day
+    return nil;
+}
+
+-(NSString *)description
+{
+    NSMutableString *result;
+    int i;
+
+    [mutex lock];
+    
+    result = [NSMutableString stringWithCapacity:512];
+    
+    [result appendString:@"\n--------------------------------------------\n"];    
+    [result appendString:@"WKBackForwardList:\n"];
+    
+    for (i = 0; i < [uriList count]; i++) {
+        if (i == index) {
+            [result appendString:@" >>>"]; 
+        }
+        else {
+            [result appendString:@"    "]; 
+        }   
+        [result appendFormat:@" %d) ", i]; 
+        [result appendString:[[uriList entryAtIndex:i] description]]; 
+        [result appendString:@"\n"]; 
+    }
+
+    [result appendString:@"\n--------------------------------------------\n"];    
+
+    [mutex unlock];
+
+    return result;
+}
+
 @end
diff --git a/WebKit/History.subproj/WKURIEntry.h b/WebKit/History.subproj/WKURIEntry.h
index b7d63ae..6e4d9f6 100644
--- a/WebKit/History.subproj/WKURIEntry.h
+++ b/WebKit/History.subproj/WKURIEntry.h
@@ -8,9 +8,9 @@
 
 #import <Foundation/Foundation.h>
 #import <AppKit/AppKit.h>
+#import <WCURIEntry.h>
 
-
- at interface WKURIEntry : NSObject 
+ at interface WKURIEntry : NSObject <WCURIEntry>
 {
     NSURL *_url;
     NSString *_title;
@@ -21,6 +21,7 @@
     NSDate *_lastVisitedDate;
 }
 
+-(id)init;
 -(id)initWithURL:(NSURL *)url title:(NSString *)title;
 -(id)initWithURL:(NSURL *)url title:(NSString *)title image:(NSImage *)image;
 -(id)initWithURL:(NSURL *)url title:(NSString *)title image:(NSImage *)image comment:(NSString *)comment;
diff --git a/WebKit/History.subproj/WKURIEntry.m b/WebKit/History.subproj/WKURIEntry.m
index dab9c0d..955c954 100644
--- a/WebKit/History.subproj/WKURIEntry.m
+++ b/WebKit/History.subproj/WKURIEntry.m
@@ -9,9 +9,21 @@
 #import "WKURIEntry.h"
 #import "WebKitReallyPrivate.h"
 
+// *** Function to access WCURICache singleton
+
+id <WCURIEntry> WCCreateURIEntry()
+{
+    return [[WKURIEntry alloc] init];
+}
+
 
 @implementation WKURIEntry
 
+-(id)init
+{
+    return [self initWithURL:nil title:nil image:nil comment:nil];
+}
+
 -(id)initWithURL:(NSURL *)url title:(NSString *)title
 {
     return [self initWithURL:url title:title image:nil comment:nil];
@@ -24,9 +36,6 @@
 
 -(id)initWithURL:(NSURL *)url title:(NSString *)title image:(NSImage *)image comment:(NSString *)comment
 {
-    WEBKIT_ASSERT_NOT_NIL(url);
-    WEBKIT_ASSERT_NOT_NIL(title);
-
     if (self != [super init])
     {
         return nil;
@@ -144,6 +153,10 @@
     return result;
 }
 
+-(NSString *)description
+{
+    return [NSString stringWithFormat:@"WKURIEntry %@", _url];
+}
     
 @end
 
diff --git a/WebKit/History.subproj/WKURIList.m b/WebKit/History.subproj/WKURIList.m
index 27b50ab..e7e66cd 100644
--- a/WebKit/History.subproj/WKURIList.m
+++ b/WebKit/History.subproj/WKURIList.m
@@ -90,6 +90,7 @@ static void freeNode(WKURIListNode *node)
 
 -(void)setMaximumSize:(int)size
 {
+    WEBKIT_ASSERT(size > 0 || size == -1);
     _maximumSize = size;
 }
 
@@ -120,11 +121,15 @@ static void freeNode(WKURIListNode *node)
                 _count--;
                 if (node == _head) {
                     _head = node->next;
-                    _head->prev = nil;
+                    if (_head) {
+                        _head->prev = nil;
+                    }
                 }
                 else if (node == _tail) {
                     _tail = node->prev;
-                    _tail->next = nil;
+                    if (_tail) {
+                        _tail->next = nil;
+                    }
                 }
                 else {
                     node->prev->next = node->next;
@@ -145,7 +150,7 @@ static void freeNode(WKURIListNode *node)
         _tail = _head;
     }
     
-    if (_count > _maximumSize) {
+    if (_maximumSize != -1 && _count > _maximumSize) {
         // drop off the tail
         node = _tail;
         _tail = _tail->prev;
@@ -170,11 +175,15 @@ static void freeNode(WKURIListNode *node)
             removedEntry = node->entry;
             if (node == _head) {
                 _head = node->next;
-                _head->prev = nil;
+                if (_head) {
+                    _head->prev = nil;
+                }
             }
             else if (node == _tail) {
                 _tail = node->prev;
-                _tail->next = nil;
+                if (_tail) {
+                    _tail->next = nil;
+                }
             }
             else {
                 node->prev->next = node->next;
@@ -203,11 +212,15 @@ static void freeNode(WKURIListNode *node)
             removed = YES;
             if (node == _head) {
                 _head = node->next;
-                _head->prev = nil;
+                if (_head) {
+                    _head->prev = nil;
+                }
             }
             else if (node == _tail) {
                 _tail = node->prev;
-                _tail->next = nil;
+                if (_tail) {
+                    _tail->next = nil;
+                }
             }
             else {
                 node->prev->next = node->next;
@@ -245,7 +258,7 @@ static void freeNode(WKURIListNode *node)
     int i;
     WKURIListNode *node;
 
-    WEBKIT_ASSERT(index > 0 && index < _count);
+    WEBKIT_ASSERT(index >= 0 && index < _count);
 
     node = _head;
 
@@ -274,11 +287,15 @@ static void freeNode(WKURIListNode *node)
     removedEntry = node->entry;
     if (node == _head) {
         _head = node->next;
-        _head->prev = nil;
+        if (_head) {
+            _head->prev = nil;
+        }
     }
     else if (node == _tail) {
         _tail = node->prev;
-        _tail->next = nil;
+        if (_tail) {
+            _tail->next = nil;
+        }
     }
     else {
         node->prev->next = node->next;
@@ -303,11 +320,10 @@ static void freeNode(WKURIListNode *node)
         delNode = node;
         node = node->next;
         freeNode(delNode);
+        _count--;
     }
     
     _head = node;
 }
 
-
-
 @end
diff --git a/WebKit/History.subproj/WebBackForwardList.h b/WebKit/History.subproj/WebBackForwardList.h
index 4d77d10..5838060 100644
--- a/WebKit/History.subproj/WebBackForwardList.h
+++ b/WebKit/History.subproj/WebBackForwardList.h
@@ -8,11 +8,26 @@
 
 #import <Foundation/Foundation.h>
 #import "WKURIList.h"
+#import "WKURIEntry.h"
+#import <WCBackForwardList.h>
 
- at interface WKBackForwardList : NSObject {
+ at interface WKBackForwardList : NSObject <WCBackForwardList> {
     WKURIList *uriList;
+    int index;
+    NSLock *mutex;
+    int state;
 }
 
+-(id)init;
 
+-(void)addEntry:(WKURIEntry *)entry;
+-(WKURIEntry *)back;
+-(WKURIEntry *)forward;
+
+-(NSArray *)backList;
+-(NSArray *)forwardList;
+
+-(BOOL)canGoBack;
+-(BOOL)canGoForward;
 
 @end
diff --git a/WebKit/History.subproj/WebBackForwardList.m b/WebKit/History.subproj/WebBackForwardList.m
index cf40808..e991d9a 100644
--- a/WebKit/History.subproj/WebBackForwardList.m
+++ b/WebKit/History.subproj/WebBackForwardList.m
@@ -8,7 +8,139 @@
 
 #import "WKBackForwardList.h"
 
+// *** Function to access WCURICache singleton
+
+id <WCBackForwardList> WCCreateBackForwardList()
+{
+    return [[WKBackForwardList alloc] init];
+}
+
 
 @implementation WKBackForwardList
 
+-(id)init
+{
+    if (self != [super init])
+    {
+        return nil;
+    }
+    
+    uriList = [[WKURIList alloc] init];
+    [uriList setAllowsDuplicates:YES];
+    index = 0;
+    mutex = [[NSLock alloc] init];
+
+    return self;
+}
+
+-(void)dealloc
+{
+    [uriList release];
+    [mutex release];
+
+    [super dealloc];
+}
+
+-(void)addEntry:(WKURIEntry *)entry
+{
+    [mutex lock];
+    if (index > 0) {
+        [uriList removeEntriesToIndex:index];
+        index = 0;
+    }
+    [uriList addEntry:entry];
+    [mutex unlock];
+}
+
+-(WKURIEntry *)back
+{
+    WKURIEntry *result;
+    
+    [mutex lock];
+    index++;
+    result = [uriList entryAtIndex:index];
+    [mutex unlock];
+
+    return result;
+}
+
+-(WKURIEntry *)forward
+{
+    WKURIEntry *result;
+
+    [mutex lock];
+    index--;
+    result = [uriList entryAtIndex:index];
+    [mutex unlock];
+    
+    return result;
+}
+
+-(BOOL)canGoBack
+{
+    BOOL result;
+    int count;
+    
+    [mutex lock];
+    count = [uriList count];
+    result = (count > 1 && index < (count - 1));
+    [mutex unlock];
+    
+    return result;
+}
+
+-(BOOL)canGoForward
+{
+    BOOL result;
+
+    [mutex lock];
+    result = (index > 0);
+    [mutex unlock];
+    
+    return result;
+}
+
+-(NSArray *)backList
+{
+    // FIXME: implement this some day
+    return nil;
+}
+
+-(NSArray *)forwardList
+{
+    // FIXME: implement this some day
+    return nil;
+}
+
+-(NSString *)description
+{
+    NSMutableString *result;
+    int i;
+
+    [mutex lock];
+    
+    result = [NSMutableString stringWithCapacity:512];
+    
+    [result appendString:@"\n--------------------------------------------\n"];    
+    [result appendString:@"WKBackForwardList:\n"];
+    
+    for (i = 0; i < [uriList count]; i++) {
+        if (i == index) {
+            [result appendString:@" >>>"]; 
+        }
+        else {
+            [result appendString:@"    "]; 
+        }   
+        [result appendFormat:@" %d) ", i]; 
+        [result appendString:[[uriList entryAtIndex:i] description]]; 
+        [result appendString:@"\n"]; 
+    }
+
+    [result appendString:@"\n--------------------------------------------\n"];    
+
+    [mutex unlock];
+
+    return result;
+}
+
 @end
diff --git a/WebKit/History.subproj/WebHistoryItem.h b/WebKit/History.subproj/WebHistoryItem.h
index b7d63ae..6e4d9f6 100644
--- a/WebKit/History.subproj/WebHistoryItem.h
+++ b/WebKit/History.subproj/WebHistoryItem.h
@@ -8,9 +8,9 @@
 
 #import <Foundation/Foundation.h>
 #import <AppKit/AppKit.h>
+#import <WCURIEntry.h>
 
-
- at interface WKURIEntry : NSObject 
+ at interface WKURIEntry : NSObject <WCURIEntry>
 {
     NSURL *_url;
     NSString *_title;
@@ -21,6 +21,7 @@
     NSDate *_lastVisitedDate;
 }
 
+-(id)init;
 -(id)initWithURL:(NSURL *)url title:(NSString *)title;
 -(id)initWithURL:(NSURL *)url title:(NSString *)title image:(NSImage *)image;
 -(id)initWithURL:(NSURL *)url title:(NSString *)title image:(NSImage *)image comment:(NSString *)comment;
diff --git a/WebKit/History.subproj/WebHistoryItem.m b/WebKit/History.subproj/WebHistoryItem.m
index dab9c0d..955c954 100644
--- a/WebKit/History.subproj/WebHistoryItem.m
+++ b/WebKit/History.subproj/WebHistoryItem.m
@@ -9,9 +9,21 @@
 #import "WKURIEntry.h"
 #import "WebKitReallyPrivate.h"
 
+// *** Function to access WCURICache singleton
+
+id <WCURIEntry> WCCreateURIEntry()
+{
+    return [[WKURIEntry alloc] init];
+}
+
 
 @implementation WKURIEntry
 
+-(id)init
+{
+    return [self initWithURL:nil title:nil image:nil comment:nil];
+}
+
 -(id)initWithURL:(NSURL *)url title:(NSString *)title
 {
     return [self initWithURL:url title:title image:nil comment:nil];
@@ -24,9 +36,6 @@
 
 -(id)initWithURL:(NSURL *)url title:(NSString *)title image:(NSImage *)image comment:(NSString *)comment
 {
-    WEBKIT_ASSERT_NOT_NIL(url);
-    WEBKIT_ASSERT_NOT_NIL(title);
-
     if (self != [super init])
     {
         return nil;
@@ -144,6 +153,10 @@
     return result;
 }
 
+-(NSString *)description
+{
+    return [NSString stringWithFormat:@"WKURIEntry %@", _url];
+}
     
 @end
 
diff --git a/WebKit/History.subproj/WebHistoryList.m b/WebKit/History.subproj/WebHistoryList.m
index 27b50ab..e7e66cd 100644
--- a/WebKit/History.subproj/WebHistoryList.m
+++ b/WebKit/History.subproj/WebHistoryList.m
@@ -90,6 +90,7 @@ static void freeNode(WKURIListNode *node)
 
 -(void)setMaximumSize:(int)size
 {
+    WEBKIT_ASSERT(size > 0 || size == -1);
     _maximumSize = size;
 }
 
@@ -120,11 +121,15 @@ static void freeNode(WKURIListNode *node)
                 _count--;
                 if (node == _head) {
                     _head = node->next;
-                    _head->prev = nil;
+                    if (_head) {
+                        _head->prev = nil;
+                    }
                 }
                 else if (node == _tail) {
                     _tail = node->prev;
-                    _tail->next = nil;
+                    if (_tail) {
+                        _tail->next = nil;
+                    }
                 }
                 else {
                     node->prev->next = node->next;
@@ -145,7 +150,7 @@ static void freeNode(WKURIListNode *node)
         _tail = _head;
     }
     
-    if (_count > _maximumSize) {
+    if (_maximumSize != -1 && _count > _maximumSize) {
         // drop off the tail
         node = _tail;
         _tail = _tail->prev;
@@ -170,11 +175,15 @@ static void freeNode(WKURIListNode *node)
             removedEntry = node->entry;
             if (node == _head) {
                 _head = node->next;
-                _head->prev = nil;
+                if (_head) {
+                    _head->prev = nil;
+                }
             }
             else if (node == _tail) {
                 _tail = node->prev;
-                _tail->next = nil;
+                if (_tail) {
+                    _tail->next = nil;
+                }
             }
             else {
                 node->prev->next = node->next;
@@ -203,11 +212,15 @@ static void freeNode(WKURIListNode *node)
             removed = YES;
             if (node == _head) {
                 _head = node->next;
-                _head->prev = nil;
+                if (_head) {
+                    _head->prev = nil;
+                }
             }
             else if (node == _tail) {
                 _tail = node->prev;
-                _tail->next = nil;
+                if (_tail) {
+                    _tail->next = nil;
+                }
             }
             else {
                 node->prev->next = node->next;
@@ -245,7 +258,7 @@ static void freeNode(WKURIListNode *node)
     int i;
     WKURIListNode *node;
 
-    WEBKIT_ASSERT(index > 0 && index < _count);
+    WEBKIT_ASSERT(index >= 0 && index < _count);
 
     node = _head;
 
@@ -274,11 +287,15 @@ static void freeNode(WKURIListNode *node)
     removedEntry = node->entry;
     if (node == _head) {
         _head = node->next;
-        _head->prev = nil;
+        if (_head) {
+            _head->prev = nil;
+        }
     }
     else if (node == _tail) {
         _tail = node->prev;
-        _tail->next = nil;
+        if (_tail) {
+            _tail->next = nil;
+        }
     }
     else {
         node->prev->next = node->next;
@@ -303,11 +320,10 @@ static void freeNode(WKURIListNode *node)
         delNode = node;
         node = node->next;
         freeNode(delNode);
+        _count--;
     }
     
     _head = node;
 }
 
-
-
 @end
diff --git a/WebKit/WebKit.pbproj/kocienda.pbxuser b/WebKit/WebKit.pbproj/kocienda.pbxuser
index 54b2ec9..8c71961 100644
--- a/WebKit/WebKit.pbproj/kocienda.pbxuser
+++ b/WebKit/WebKit.pbproj/kocienda.pbxuser
@@ -99,6 +99,11 @@
 	0867D69CFE84028FC02AAC07 = {
 		activeExec = 0;
 	};
+	25A5593101A5996D0ECA149E = {
+		uiCtxt = {
+			sepNavWindowFrame = "{{728, 20}, {750, 502}}";
+		};
+	};
 	25A5593201A5996D0ECA149E = {
 		uiCtxt = {
 			sepNavWindowFrame = "{{38, 650}, {750, 502}}";
@@ -114,6 +119,11 @@
 			sepNavWindowFrame = "{{672, 74}, {790, 1081}}";
 		};
 	};
+	25BECC94017E0A0D0ECA149E = {
+		uiCtxt = {
+			sepNavWindowFrame = "{{130, 100}, {1058, 968}}";
+		};
+	};
 	25C29825016E29620ECA149E = {
 		uiCtxt = {
 			sepNavWindowFrame = "{{38, 650}, {750, 502}}";
diff --git a/WebKit/WebKit.pbproj/project.pbxproj b/WebKit/WebKit.pbproj/project.pbxproj
index f9961b7..fdeb761 100644
--- a/WebKit/WebKit.pbproj/project.pbxproj
+++ b/WebKit/WebKit.pbproj/project.pbxproj
@@ -119,7 +119,7 @@
 			buildSettings = {
 				DYLIB_COMPATIBILITY_VERSION = 1;
 				DYLIB_CURRENT_VERSION = 1;
-				FRAMEWORK_SEARCH_PATHS = "";
+				FRAMEWORK_SEARCH_PATHS = /symroots;
 				FRAMEWORK_VERSION = A;
 				HEADER_SEARCH_PATHS = ../WebCore/include;
 				INSTALL_PATH = "@executable_path/../Frameworks";
@@ -522,6 +522,9 @@
 			fileRef = 25A8177101B698760ECA149E;
 			isa = PBXBuildFile;
 			settings = {
+				ATTRIBUTES = (
+					Public,
+				);
 			};
 		};
 		25A8177401B698760ECA149E = {
@@ -544,6 +547,9 @@
 			fileRef = 25A8177501B6A5240ECA149E;
 			isa = PBXBuildFile;
 			settings = {
+				ATTRIBUTES = (
+					Public,
+				);
 			};
 		};
 		25A8177801B6A5240ECA149E = {

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list