[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 05:56:48 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit f373bee020f34ef16c8d0e5f37d4268b5a76035a
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Mar 6 00:33:23 2002 +0000

            Pass errors correctly to browser.
            Removed old notification code.
            Added support for IFError.
            Lots of little cleanups.
            Improved IFWebFrame state handling.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@696 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index 93cda6f..0798345 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,5 +1,26 @@
 2002-03-05  Richard Williamson  <rjw at apple.com>
 
+        Pass errors correctly to browser.
+        Removed old notification code.
+        Added support for IFError.
+        Lots of little cleanups.
+        
+	* src/kwq/KWQComboBox.mm: (QComboBox::setCurrentItem):
+	* src/kwq/KWQKHTMLPart.mm: (-[KHTMLPartLoadClient
+	IFURLHandleResourceDidBeginLoading:]), (-[KHTMLPartLoadClient
+	IFURLHandleResourceDidCancelLoading:]), (-[KHTMLPartLoadClient
+	IFURLHandleResourceDidFinishLoading:data:]), (-[KHTMLPartLoadClient
+	IFURLHandle:resourceDataDidBecomeAvailable:]), (-[KHTMLPartLoadClient
+	IFURLHandle:resourceDidFailLoadingWithResult:]), (KHTMLPart::openURL),
+	(KHTMLPart::closeURL):
+	* src/kwq/KWQKloader.mm: (-[URLLoadClient
+	IFURLHandle:resourceDidFailLoadingWithResult:]):
+	* src/kwq/WCError.h:
+	* src/kwq/WCWebDataSource.h:
+	* src/kwq/external.h:
+
+2002-03-05  Richard Williamson  <rjw at apple.com>
+
         With fonts now being correctly specified we're exercising some new code paths.  This introduced a new
         class of weird string bugs.  Turns out that CFString is doing some mojo that I suspect is a performance
         optimization.  Constants strings appears to be uniqued and hard-wired to have a -1 retain count.  It
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 93cda6f..0798345 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,5 +1,26 @@
 2002-03-05  Richard Williamson  <rjw at apple.com>
 
+        Pass errors correctly to browser.
+        Removed old notification code.
+        Added support for IFError.
+        Lots of little cleanups.
+        
+	* src/kwq/KWQComboBox.mm: (QComboBox::setCurrentItem):
+	* src/kwq/KWQKHTMLPart.mm: (-[KHTMLPartLoadClient
+	IFURLHandleResourceDidBeginLoading:]), (-[KHTMLPartLoadClient
+	IFURLHandleResourceDidCancelLoading:]), (-[KHTMLPartLoadClient
+	IFURLHandleResourceDidFinishLoading:data:]), (-[KHTMLPartLoadClient
+	IFURLHandle:resourceDataDidBecomeAvailable:]), (-[KHTMLPartLoadClient
+	IFURLHandle:resourceDidFailLoadingWithResult:]), (KHTMLPart::openURL),
+	(KHTMLPart::closeURL):
+	* src/kwq/KWQKloader.mm: (-[URLLoadClient
+	IFURLHandle:resourceDidFailLoadingWithResult:]):
+	* src/kwq/WCError.h:
+	* src/kwq/WCWebDataSource.h:
+	* src/kwq/external.h:
+
+2002-03-05  Richard Williamson  <rjw at apple.com>
+
         With fonts now being correctly specified we're exercising some new code paths.  This introduced a new
         class of weird string bugs.  Turns out that CFString is doing some mojo that I suspect is a performance
         optimization.  Constants strings appears to be uniqued and hard-wired to have a -1 retain count.  It
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 93cda6f..0798345 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,5 +1,26 @@
 2002-03-05  Richard Williamson  <rjw at apple.com>
 
+        Pass errors correctly to browser.
+        Removed old notification code.
+        Added support for IFError.
+        Lots of little cleanups.
+        
+	* src/kwq/KWQComboBox.mm: (QComboBox::setCurrentItem):
+	* src/kwq/KWQKHTMLPart.mm: (-[KHTMLPartLoadClient
+	IFURLHandleResourceDidBeginLoading:]), (-[KHTMLPartLoadClient
+	IFURLHandleResourceDidCancelLoading:]), (-[KHTMLPartLoadClient
+	IFURLHandleResourceDidFinishLoading:data:]), (-[KHTMLPartLoadClient
+	IFURLHandle:resourceDataDidBecomeAvailable:]), (-[KHTMLPartLoadClient
+	IFURLHandle:resourceDidFailLoadingWithResult:]), (KHTMLPart::openURL),
+	(KHTMLPart::closeURL):
+	* src/kwq/KWQKloader.mm: (-[URLLoadClient
+	IFURLHandle:resourceDidFailLoadingWithResult:]):
+	* src/kwq/WCError.h:
+	* src/kwq/WCWebDataSource.h:
+	* src/kwq/external.h:
+
+2002-03-05  Richard Williamson  <rjw at apple.com>
+
         With fonts now being correctly specified we're exercising some new code paths.  This introduced a new
         class of weird string bugs.  Turns out that CFString is doing some mojo that I suspect is a performance
         optimization.  Constants strings appears to be uniqued and hard-wired to have a -1 retain count.  It
diff --git a/WebCore/kwq/KWQComboBox.mm b/WebCore/kwq/KWQComboBox.mm
index 2e6f7a9..3265e85 100644
--- a/WebCore/kwq/KWQComboBox.mm
+++ b/WebCore/kwq/KWQComboBox.mm
@@ -128,7 +128,7 @@ void QComboBox::setCurrentItem(int index)
     if (num != 0 && index < num)
         [comboBox selectItemAtIndex: index];
     else
-        NSLog (@"Error, index incorrect");
+        KWQDEBUG2 ("Error, index = %d, numberOfItems = %d", index, num);
 }
 
 
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index ed7c246..6ec51f1 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -59,6 +59,9 @@
 
 #include <WCLoadProgress.h>
 #include <WCWebDataSource.h>
+#include <WCError.h>
+
+#include <loader.h>
 
 #include <external.h>
 
@@ -70,6 +73,16 @@ void WCSetIFWebDataSourceMakeFunc(WCIFWebDataSourceMakeFunc func)
     WCIFWebDataSourceMake = func;
 }
 
+extern "C" {
+
+WCIFErrorMakeFunc WCIFErrorMake;
+
+void WCSetIFErrorMakeFunc(WCIFErrorMakeFunc func)
+{
+    WCIFErrorMake = func;
+}
+
+}
 
 static bool cache_init = false;
 
@@ -112,29 +125,17 @@ static void recursive(const DOM::Node &pNode, const DOM::Node &node)
 
 - (void)IFURLHandleResourceDidBeginLoading:(IFURLHandle *)sender
 {
-    void *userData;
-    
-    userData = [[[sender attributes] objectForKey:IFURLHandleUserData] pointerValue];
-    
     KWQDEBUGLEVEL1 (0x2000, "url = %s\n", [[[sender url] absoluteString] cString]);
 }
 
 - (void)IFURLHandleResourceDidCancelLoading:(IFURLHandle *)sender
 {
-    void *userData;
-    
-    userData = [[[sender attributes] objectForKey:IFURLHandleUserData] pointerValue];
-
     KWQDEBUGLEVEL1 (0x2000, "url = %s\n", [[[sender url] absoluteString] cString]);
     [sender autorelease];
 }
 
 - (void)IFURLHandleResourceDidFinishLoading:(IFURLHandle *)sender data: (NSData *)data
 {
-    void *userData;
-    
-    userData = [[[sender attributes] objectForKey:IFURLHandleUserData] pointerValue];
-
     KWQDEBUGLEVEL1 (0x2000, "url = %s\n", [[[sender url] absoluteString] cString]);
     m_part->closeURL();
 
@@ -148,10 +149,6 @@ static void recursive(const DOM::Node &pNode, const DOM::Node &node)
 
 - (void)IFURLHandle:(IFURLHandle *)sender resourceDataDidBecomeAvailable:(NSData *)data
 {
-    void *userData;
-    
-    userData = [[[sender attributes] objectForKey:IFURLHandleUserData] pointerValue];
-
     KWQDEBUGLEVEL3 (0x2000, "url = %s, data = 0x%08x, length %d\n", [[[sender url] absoluteString] cString], data, [data length]);
     if (!m_data) {
         m_data = [data retain];
@@ -166,11 +163,15 @@ static void recursive(const DOM::Node &pNode, const DOM::Node &node)
 
 - (void)IFURLHandle:(IFURLHandle *)sender resourceDidFailLoadingWithResult:(int)result
 {
-    void *userData;
-    
-    userData = [[[sender attributes] objectForKey:IFURLHandleUserData] pointerValue];
-
     KWQDEBUGLEVEL2 (0x2000, "url = %s, result = %d\n", [[[sender url] absoluteString] cString], result);
+
+    IFLoadProgress *loadProgress = WCIFLoadProgressMake();
+    loadProgress->totalToLoad = [sender contentLength];
+    loadProgress->bytesSoFar = [[sender availableResourceData] length];
+
+    IFError *error = WCIFErrorMake(result);
+    [[dataSource controller] receivedError: error forResource: [[sender url] absoluteString] partialProgress: loadProgress fromDataSource: dataSource];
+
     [sender autorelease];
 }
 
@@ -181,10 +182,12 @@ static void recursive(const DOM::Node &pNode, const DOM::Node &node)
 }
 
 
+/*
 -(void)checkCompleted:(NSNotification *)notification
 {
     m_part->checkCompleted();
 }
+*/
 
 -(void)dealloc
 {
@@ -425,12 +428,14 @@ bool KHTMLPart::openURL( const KURL &url )
     d->m_handle = [[IFURLHandle alloc] initWithURL:theURL];
     [d->m_handle addClient:d->m_recv];
     [d->m_handle loadInBackground];
-    
+
+/*    
     [[NSNotificationCenter defaultCenter] addObserver:d->m_recv
         selector:@selector(checkCompleted:) name:urlString object:nil];
     
     // tell anyone who's interested that we've started to load a uri
     [[NSNotificationCenter defaultCenter] postNotificationName:@"uri-start" object:urlString];
+*/
     
     return true;
 }
@@ -452,8 +457,10 @@ bool KHTMLPart::closeURL()
     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();
 
@@ -1796,6 +1803,7 @@ void KHTMLPart::overURL( const QString &url, const QString &target )
     _logNeverImplemented();
 }
 
+/*
 void KHTMLPart::checkCompleted()
 {
     int requests;
@@ -1835,3 +1843,4 @@ void KHTMLPart::checkCompleted()
         end();
     }
 }
+*/
\ No newline at end of file
diff --git a/WebCore/kwq/KWQKHTMLPartImpl.mm b/WebCore/kwq/KWQKHTMLPartImpl.mm
index ed7c246..6ec51f1 100644
--- a/WebCore/kwq/KWQKHTMLPartImpl.mm
+++ b/WebCore/kwq/KWQKHTMLPartImpl.mm
@@ -59,6 +59,9 @@
 
 #include <WCLoadProgress.h>
 #include <WCWebDataSource.h>
+#include <WCError.h>
+
+#include <loader.h>
 
 #include <external.h>
 
@@ -70,6 +73,16 @@ void WCSetIFWebDataSourceMakeFunc(WCIFWebDataSourceMakeFunc func)
     WCIFWebDataSourceMake = func;
 }
 
+extern "C" {
+
+WCIFErrorMakeFunc WCIFErrorMake;
+
+void WCSetIFErrorMakeFunc(WCIFErrorMakeFunc func)
+{
+    WCIFErrorMake = func;
+}
+
+}
 
 static bool cache_init = false;
 
@@ -112,29 +125,17 @@ static void recursive(const DOM::Node &pNode, const DOM::Node &node)
 
 - (void)IFURLHandleResourceDidBeginLoading:(IFURLHandle *)sender
 {
-    void *userData;
-    
-    userData = [[[sender attributes] objectForKey:IFURLHandleUserData] pointerValue];
-    
     KWQDEBUGLEVEL1 (0x2000, "url = %s\n", [[[sender url] absoluteString] cString]);
 }
 
 - (void)IFURLHandleResourceDidCancelLoading:(IFURLHandle *)sender
 {
-    void *userData;
-    
-    userData = [[[sender attributes] objectForKey:IFURLHandleUserData] pointerValue];
-
     KWQDEBUGLEVEL1 (0x2000, "url = %s\n", [[[sender url] absoluteString] cString]);
     [sender autorelease];
 }
 
 - (void)IFURLHandleResourceDidFinishLoading:(IFURLHandle *)sender data: (NSData *)data
 {
-    void *userData;
-    
-    userData = [[[sender attributes] objectForKey:IFURLHandleUserData] pointerValue];
-
     KWQDEBUGLEVEL1 (0x2000, "url = %s\n", [[[sender url] absoluteString] cString]);
     m_part->closeURL();
 
@@ -148,10 +149,6 @@ static void recursive(const DOM::Node &pNode, const DOM::Node &node)
 
 - (void)IFURLHandle:(IFURLHandle *)sender resourceDataDidBecomeAvailable:(NSData *)data
 {
-    void *userData;
-    
-    userData = [[[sender attributes] objectForKey:IFURLHandleUserData] pointerValue];
-
     KWQDEBUGLEVEL3 (0x2000, "url = %s, data = 0x%08x, length %d\n", [[[sender url] absoluteString] cString], data, [data length]);
     if (!m_data) {
         m_data = [data retain];
@@ -166,11 +163,15 @@ static void recursive(const DOM::Node &pNode, const DOM::Node &node)
 
 - (void)IFURLHandle:(IFURLHandle *)sender resourceDidFailLoadingWithResult:(int)result
 {
-    void *userData;
-    
-    userData = [[[sender attributes] objectForKey:IFURLHandleUserData] pointerValue];
-
     KWQDEBUGLEVEL2 (0x2000, "url = %s, result = %d\n", [[[sender url] absoluteString] cString], result);
+
+    IFLoadProgress *loadProgress = WCIFLoadProgressMake();
+    loadProgress->totalToLoad = [sender contentLength];
+    loadProgress->bytesSoFar = [[sender availableResourceData] length];
+
+    IFError *error = WCIFErrorMake(result);
+    [[dataSource controller] receivedError: error forResource: [[sender url] absoluteString] partialProgress: loadProgress fromDataSource: dataSource];
+
     [sender autorelease];
 }
 
@@ -181,10 +182,12 @@ static void recursive(const DOM::Node &pNode, const DOM::Node &node)
 }
 
 
+/*
 -(void)checkCompleted:(NSNotification *)notification
 {
     m_part->checkCompleted();
 }
+*/
 
 -(void)dealloc
 {
@@ -425,12 +428,14 @@ bool KHTMLPart::openURL( const KURL &url )
     d->m_handle = [[IFURLHandle alloc] initWithURL:theURL];
     [d->m_handle addClient:d->m_recv];
     [d->m_handle loadInBackground];
-    
+
+/*    
     [[NSNotificationCenter defaultCenter] addObserver:d->m_recv
         selector:@selector(checkCompleted:) name:urlString object:nil];
     
     // tell anyone who's interested that we've started to load a uri
     [[NSNotificationCenter defaultCenter] postNotificationName:@"uri-start" object:urlString];
+*/
     
     return true;
 }
@@ -452,8 +457,10 @@ bool KHTMLPart::closeURL()
     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();
 
@@ -1796,6 +1803,7 @@ void KHTMLPart::overURL( const QString &url, const QString &target )
     _logNeverImplemented();
 }
 
+/*
 void KHTMLPart::checkCompleted()
 {
     int requests;
@@ -1835,3 +1843,4 @@ void KHTMLPart::checkCompleted()
         end();
     }
 }
+*/
\ No newline at end of file
diff --git a/WebCore/kwq/KWQKloader.mm b/WebCore/kwq/KWQKloader.mm
index 5bd0c5d..2d2d7a6 100644
--- a/WebCore/kwq/KWQKloader.mm
+++ b/WebCore/kwq/KWQKloader.mm
@@ -30,6 +30,8 @@
 #include <loader.h>
 
 #include <WCLoadProgress.h>
+#include <WCError.h>
+#include <external.h>
 
 // up to which size is a picture for sure cacheable
 #define MAXCACHEABLE 40*1024
@@ -55,6 +57,7 @@
 
 #include "css/css_stylesheetimpl.h"
 
+
 using namespace khtml;
 using namespace DOM;
 
@@ -912,56 +915,6 @@ void DocLoader::removeCachedObject( CachedObject* o ) const
 
 // Class URLLoadClient ======================================================================
 
- at interface URLLoadClient : NSObject <IFURLHandleClient>
-{
-    @public
-    Loader *m_loader;
-    id m_dataSource;
-}
-
--(id)initWithLoader:(Loader *)loader dataSource: dataSource;
-
- at end
-
-typedef enum {
-    IF_LOAD_TYPE_CSS    = 1,
-    IF_LOAD_TYPE_IMAGE  = 2,
-    IF_LOAD_TYPE_SCRIPT = 3,
-    IF_LOAD_TYPE_HTML   = 4
-} IF_LOAD_TYPE;
-
-
- at interface IFLoadProgress : NSObject
-{
-    int bytesSoFar;	// 0 if this is the start of load
-    int totalToLoad;	// -1 if this is not known.
-                        // bytesSoFar == totalLoaded when complete
-    IF_LOAD_TYPE type;	// load types, either image, css, or jscript
-}
-- init;
- at end
-
- at class IFError;
- at class IFURLHandle;
-
- at protocol  IFLoadHandler
-- (void)receivedProgress: (IFLoadProgress *)progress forResource: (NSString *)resourceDescription fromDataSource: (IFWebDataSource *)dataSource;
-
-- (void)receivedError: (IFError *)error forResource: (NSString *)resourceDescription partialProgress: (IFLoadProgress *)progress fromDataSource: (IFWebDataSource *)dataSource;
-
- at end
-
- at interface IFWebDataSource
-- (void)_addURLHandle: (IFURLHandle *)handle;
-- (void)_removeURLHandle: (IFURLHandle *)handle;
-- controller;
- at end
-
- at interface WCURLHandle
--(int)contentLength;
- at end
-
-
 @implementation URLLoadClient
 
 -(id)initWithLoader:(Loader *)loader dataSource: dataSource
@@ -1058,6 +1011,17 @@ typedef enum {
     KWQDEBUGLEVEL2 (0x2000, "dataSource = 0x%08x for URL %s\n", m_dataSource, job->url().url().latin1());
 
     [m_dataSource _removeURLHandle: job->handle()];
+
+    IFError *error = WCIFErrorMake(result);
+    id <IFLoadHandler> controller = [m_dataSource controller];
+    
+
+    IFLoadProgress *loadProgress = WCIFLoadProgressMake();
+    loadProgress->totalToLoad = [sender contentLength];
+    loadProgress->bytesSoFar = [[sender availableResourceData] length];
+
+    [controller receivedError: error forResource: [[sender url] absoluteString] partialProgress: loadProgress fromDataSource: m_dataSource];
+
     [sender autorelease];
 }
 
diff --git a/WebCore/kwq/KWQLoader.mm b/WebCore/kwq/KWQLoader.mm
index 5bd0c5d..2d2d7a6 100644
--- a/WebCore/kwq/KWQLoader.mm
+++ b/WebCore/kwq/KWQLoader.mm
@@ -30,6 +30,8 @@
 #include <loader.h>
 
 #include <WCLoadProgress.h>
+#include <WCError.h>
+#include <external.h>
 
 // up to which size is a picture for sure cacheable
 #define MAXCACHEABLE 40*1024
@@ -55,6 +57,7 @@
 
 #include "css/css_stylesheetimpl.h"
 
+
 using namespace khtml;
 using namespace DOM;
 
@@ -912,56 +915,6 @@ void DocLoader::removeCachedObject( CachedObject* o ) const
 
 // Class URLLoadClient ======================================================================
 
- at interface URLLoadClient : NSObject <IFURLHandleClient>
-{
-    @public
-    Loader *m_loader;
-    id m_dataSource;
-}
-
--(id)initWithLoader:(Loader *)loader dataSource: dataSource;
-
- at end
-
-typedef enum {
-    IF_LOAD_TYPE_CSS    = 1,
-    IF_LOAD_TYPE_IMAGE  = 2,
-    IF_LOAD_TYPE_SCRIPT = 3,
-    IF_LOAD_TYPE_HTML   = 4
-} IF_LOAD_TYPE;
-
-
- at interface IFLoadProgress : NSObject
-{
-    int bytesSoFar;	// 0 if this is the start of load
-    int totalToLoad;	// -1 if this is not known.
-                        // bytesSoFar == totalLoaded when complete
-    IF_LOAD_TYPE type;	// load types, either image, css, or jscript
-}
-- init;
- at end
-
- at class IFError;
- at class IFURLHandle;
-
- at protocol  IFLoadHandler
-- (void)receivedProgress: (IFLoadProgress *)progress forResource: (NSString *)resourceDescription fromDataSource: (IFWebDataSource *)dataSource;
-
-- (void)receivedError: (IFError *)error forResource: (NSString *)resourceDescription partialProgress: (IFLoadProgress *)progress fromDataSource: (IFWebDataSource *)dataSource;
-
- at end
-
- at interface IFWebDataSource
-- (void)_addURLHandle: (IFURLHandle *)handle;
-- (void)_removeURLHandle: (IFURLHandle *)handle;
-- controller;
- at end
-
- at interface WCURLHandle
--(int)contentLength;
- at end
-
-
 @implementation URLLoadClient
 
 -(id)initWithLoader:(Loader *)loader dataSource: dataSource
@@ -1058,6 +1011,17 @@ typedef enum {
     KWQDEBUGLEVEL2 (0x2000, "dataSource = 0x%08x for URL %s\n", m_dataSource, job->url().url().latin1());
 
     [m_dataSource _removeURLHandle: job->handle()];
+
+    IFError *error = WCIFErrorMake(result);
+    id <IFLoadHandler> controller = [m_dataSource controller];
+    
+
+    IFLoadProgress *loadProgress = WCIFLoadProgressMake();
+    loadProgress->totalToLoad = [sender contentLength];
+    loadProgress->bytesSoFar = [[sender availableResourceData] length];
+
+    [controller receivedError: error forResource: [[sender url] absoluteString] partialProgress: loadProgress fromDataSource: m_dataSource];
+
     [sender autorelease];
 }
 
diff --git a/WebCore/kwq/KWQLoaderImpl.mm b/WebCore/kwq/KWQLoaderImpl.mm
index 5bd0c5d..2d2d7a6 100644
--- a/WebCore/kwq/KWQLoaderImpl.mm
+++ b/WebCore/kwq/KWQLoaderImpl.mm
@@ -30,6 +30,8 @@
 #include <loader.h>
 
 #include <WCLoadProgress.h>
+#include <WCError.h>
+#include <external.h>
 
 // up to which size is a picture for sure cacheable
 #define MAXCACHEABLE 40*1024
@@ -55,6 +57,7 @@
 
 #include "css/css_stylesheetimpl.h"
 
+
 using namespace khtml;
 using namespace DOM;
 
@@ -912,56 +915,6 @@ void DocLoader::removeCachedObject( CachedObject* o ) const
 
 // Class URLLoadClient ======================================================================
 
- at interface URLLoadClient : NSObject <IFURLHandleClient>
-{
-    @public
-    Loader *m_loader;
-    id m_dataSource;
-}
-
--(id)initWithLoader:(Loader *)loader dataSource: dataSource;
-
- at end
-
-typedef enum {
-    IF_LOAD_TYPE_CSS    = 1,
-    IF_LOAD_TYPE_IMAGE  = 2,
-    IF_LOAD_TYPE_SCRIPT = 3,
-    IF_LOAD_TYPE_HTML   = 4
-} IF_LOAD_TYPE;
-
-
- at interface IFLoadProgress : NSObject
-{
-    int bytesSoFar;	// 0 if this is the start of load
-    int totalToLoad;	// -1 if this is not known.
-                        // bytesSoFar == totalLoaded when complete
-    IF_LOAD_TYPE type;	// load types, either image, css, or jscript
-}
-- init;
- at end
-
- at class IFError;
- at class IFURLHandle;
-
- at protocol  IFLoadHandler
-- (void)receivedProgress: (IFLoadProgress *)progress forResource: (NSString *)resourceDescription fromDataSource: (IFWebDataSource *)dataSource;
-
-- (void)receivedError: (IFError *)error forResource: (NSString *)resourceDescription partialProgress: (IFLoadProgress *)progress fromDataSource: (IFWebDataSource *)dataSource;
-
- at end
-
- at interface IFWebDataSource
-- (void)_addURLHandle: (IFURLHandle *)handle;
-- (void)_removeURLHandle: (IFURLHandle *)handle;
-- controller;
- at end
-
- at interface WCURLHandle
--(int)contentLength;
- at end
-
-
 @implementation URLLoadClient
 
 -(id)initWithLoader:(Loader *)loader dataSource: dataSource
@@ -1058,6 +1011,17 @@ typedef enum {
     KWQDEBUGLEVEL2 (0x2000, "dataSource = 0x%08x for URL %s\n", m_dataSource, job->url().url().latin1());
 
     [m_dataSource _removeURLHandle: job->handle()];
+
+    IFError *error = WCIFErrorMake(result);
+    id <IFLoadHandler> controller = [m_dataSource controller];
+    
+
+    IFLoadProgress *loadProgress = WCIFLoadProgressMake();
+    loadProgress->totalToLoad = [sender contentLength];
+    loadProgress->bytesSoFar = [[sender availableResourceData] length];
+
+    [controller receivedError: error forResource: [[sender url] absoluteString] partialProgress: loadProgress fromDataSource: m_dataSource];
+
     [sender autorelease];
 }
 
diff --git a/WebCore/kwq/WCLoadProgress.h b/WebCore/kwq/WCError.h
similarity index 85%
copy from WebCore/kwq/WCLoadProgress.h
copy to WebCore/kwq/WCError.h
index c33f1b4..8cad35f 100644
--- a/WebCore/kwq/WCLoadProgress.h
+++ b/WebCore/kwq/WCError.h
@@ -23,15 +23,18 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef __WCLOADPROGRESS__
-#define __WCLOADPROGRESS__
+#ifndef __WCERROR__
+#define __WCERROR__
 
 #import <Foundation/Foundation.h>
 
+extern "C" {
 
-typedef id (*WCIFLoadProgressMakeFunc)();
-void WCSetIFLoadProgressMakeFunc(WCIFLoadProgressMakeFunc func);
+typedef id (*WCIFErrorMakeFunc)(int);
+void WCSetIFErrorMakeFunc(WCIFErrorMakeFunc func);
 
-extern WCIFLoadProgressMakeFunc WCIFLoadProgressMake;
+extern WCIFErrorMakeFunc WCIFErrorMake;
 
-#endif /* __WCLOADPROGRESS__ */
+}
+
+#endif /* __WCERROR__ */
diff --git a/WebCore/kwq/WCWebDataSource.h b/WebCore/kwq/WCWebDataSource.h
index af99c33..b9e66f7 100644
--- a/WebCore/kwq/WCWebDataSource.h
+++ b/WebCore/kwq/WCWebDataSource.h
@@ -34,4 +34,5 @@ void WCSetIFWebDataSourceMakeFunc(WCIFWebDataSourceMakeFunc func);
 
 extern WCIFWebDataSourceMakeFunc WCIFWebDataSourceMake;
 
+
 #endif /* __WCWEBDATASOURCE__ */
diff --git a/WebCore/kwq/external.h b/WebCore/kwq/external.h
index cadbdca..7bb118d 100644
--- a/WebCore/kwq/external.h
+++ b/WebCore/kwq/external.h
@@ -23,13 +23,18 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
  
-#ifndef _EXTERNAL_H
-#define _EXTERNAL_H_
+#ifndef __EXTERNAL_H
+#define __EXTERNAL_H_
+
+#import <WebFoundation/WebFoundation.h>
+
 
 @class IFWebDataSource;
 @class IFWebView;
 @class IFWebFrame;
 @class IFError;
+ at class IFURLHandle;
+
 
 @protocol IFWebController
 - (IFWebFrame *)createFrameNamed: (NSString *)name for: (IFWebDataSource *)dataSource inParent: (IFWebDataSource *)dataSource;
@@ -50,6 +55,9 @@
 - frameNamed: (NSString *)f;
 - (void)_setParent: (IFWebDataSource *)p;
 - (IFWebDataSource *)parent;
+- (void)_addURLHandle: (IFURLHandle *)handle;
+- (void)_removeURLHandle: (IFURLHandle *)handle;
+- controller;
 @end
 
 // This should not be allowed here.  data source should not reference view
@@ -94,4 +102,20 @@ typedef enum {
 
 @end
 
+
+ at interface URLLoadClient : NSObject <IFURLHandleClient>
+{
+    @public
+    khtml::Loader *m_loader;
+    id m_dataSource;
+}
+
+-(id)initWithLoader:(khtml::Loader *)loader dataSource: dataSource;
+
+ at end
+
+ at interface WCURLHandle
+-(int)contentLength;
+ at end
+
 #endif
diff --git a/WebCore/src/kwq/KWQComboBox.mm b/WebCore/src/kwq/KWQComboBox.mm
index 2e6f7a9..3265e85 100644
--- a/WebCore/src/kwq/KWQComboBox.mm
+++ b/WebCore/src/kwq/KWQComboBox.mm
@@ -128,7 +128,7 @@ void QComboBox::setCurrentItem(int index)
     if (num != 0 && index < num)
         [comboBox selectItemAtIndex: index];
     else
-        NSLog (@"Error, index incorrect");
+        KWQDEBUG2 ("Error, index = %d, numberOfItems = %d", index, num);
 }
 
 
diff --git a/WebCore/src/kwq/KWQKHTMLPart.mm b/WebCore/src/kwq/KWQKHTMLPart.mm
index ed7c246..6ec51f1 100644
--- a/WebCore/src/kwq/KWQKHTMLPart.mm
+++ b/WebCore/src/kwq/KWQKHTMLPart.mm
@@ -59,6 +59,9 @@
 
 #include <WCLoadProgress.h>
 #include <WCWebDataSource.h>
+#include <WCError.h>
+
+#include <loader.h>
 
 #include <external.h>
 
@@ -70,6 +73,16 @@ void WCSetIFWebDataSourceMakeFunc(WCIFWebDataSourceMakeFunc func)
     WCIFWebDataSourceMake = func;
 }
 
+extern "C" {
+
+WCIFErrorMakeFunc WCIFErrorMake;
+
+void WCSetIFErrorMakeFunc(WCIFErrorMakeFunc func)
+{
+    WCIFErrorMake = func;
+}
+
+}
 
 static bool cache_init = false;
 
@@ -112,29 +125,17 @@ static void recursive(const DOM::Node &pNode, const DOM::Node &node)
 
 - (void)IFURLHandleResourceDidBeginLoading:(IFURLHandle *)sender
 {
-    void *userData;
-    
-    userData = [[[sender attributes] objectForKey:IFURLHandleUserData] pointerValue];
-    
     KWQDEBUGLEVEL1 (0x2000, "url = %s\n", [[[sender url] absoluteString] cString]);
 }
 
 - (void)IFURLHandleResourceDidCancelLoading:(IFURLHandle *)sender
 {
-    void *userData;
-    
-    userData = [[[sender attributes] objectForKey:IFURLHandleUserData] pointerValue];
-
     KWQDEBUGLEVEL1 (0x2000, "url = %s\n", [[[sender url] absoluteString] cString]);
     [sender autorelease];
 }
 
 - (void)IFURLHandleResourceDidFinishLoading:(IFURLHandle *)sender data: (NSData *)data
 {
-    void *userData;
-    
-    userData = [[[sender attributes] objectForKey:IFURLHandleUserData] pointerValue];
-
     KWQDEBUGLEVEL1 (0x2000, "url = %s\n", [[[sender url] absoluteString] cString]);
     m_part->closeURL();
 
@@ -148,10 +149,6 @@ static void recursive(const DOM::Node &pNode, const DOM::Node &node)
 
 - (void)IFURLHandle:(IFURLHandle *)sender resourceDataDidBecomeAvailable:(NSData *)data
 {
-    void *userData;
-    
-    userData = [[[sender attributes] objectForKey:IFURLHandleUserData] pointerValue];
-
     KWQDEBUGLEVEL3 (0x2000, "url = %s, data = 0x%08x, length %d\n", [[[sender url] absoluteString] cString], data, [data length]);
     if (!m_data) {
         m_data = [data retain];
@@ -166,11 +163,15 @@ static void recursive(const DOM::Node &pNode, const DOM::Node &node)
 
 - (void)IFURLHandle:(IFURLHandle *)sender resourceDidFailLoadingWithResult:(int)result
 {
-    void *userData;
-    
-    userData = [[[sender attributes] objectForKey:IFURLHandleUserData] pointerValue];
-
     KWQDEBUGLEVEL2 (0x2000, "url = %s, result = %d\n", [[[sender url] absoluteString] cString], result);
+
+    IFLoadProgress *loadProgress = WCIFLoadProgressMake();
+    loadProgress->totalToLoad = [sender contentLength];
+    loadProgress->bytesSoFar = [[sender availableResourceData] length];
+
+    IFError *error = WCIFErrorMake(result);
+    [[dataSource controller] receivedError: error forResource: [[sender url] absoluteString] partialProgress: loadProgress fromDataSource: dataSource];
+
     [sender autorelease];
 }
 
@@ -181,10 +182,12 @@ static void recursive(const DOM::Node &pNode, const DOM::Node &node)
 }
 
 
+/*
 -(void)checkCompleted:(NSNotification *)notification
 {
     m_part->checkCompleted();
 }
+*/
 
 -(void)dealloc
 {
@@ -425,12 +428,14 @@ bool KHTMLPart::openURL( const KURL &url )
     d->m_handle = [[IFURLHandle alloc] initWithURL:theURL];
     [d->m_handle addClient:d->m_recv];
     [d->m_handle loadInBackground];
-    
+
+/*    
     [[NSNotificationCenter defaultCenter] addObserver:d->m_recv
         selector:@selector(checkCompleted:) name:urlString object:nil];
     
     // tell anyone who's interested that we've started to load a uri
     [[NSNotificationCenter defaultCenter] postNotificationName:@"uri-start" object:urlString];
+*/
     
     return true;
 }
@@ -452,8 +457,10 @@ bool KHTMLPart::closeURL()
     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();
 
@@ -1796,6 +1803,7 @@ void KHTMLPart::overURL( const QString &url, const QString &target )
     _logNeverImplemented();
 }
 
+/*
 void KHTMLPart::checkCompleted()
 {
     int requests;
@@ -1835,3 +1843,4 @@ void KHTMLPart::checkCompleted()
         end();
     }
 }
+*/
\ No newline at end of file
diff --git a/WebCore/src/kwq/KWQKloader.mm b/WebCore/src/kwq/KWQKloader.mm
index 5bd0c5d..2d2d7a6 100644
--- a/WebCore/src/kwq/KWQKloader.mm
+++ b/WebCore/src/kwq/KWQKloader.mm
@@ -30,6 +30,8 @@
 #include <loader.h>
 
 #include <WCLoadProgress.h>
+#include <WCError.h>
+#include <external.h>
 
 // up to which size is a picture for sure cacheable
 #define MAXCACHEABLE 40*1024
@@ -55,6 +57,7 @@
 
 #include "css/css_stylesheetimpl.h"
 
+
 using namespace khtml;
 using namespace DOM;
 
@@ -912,56 +915,6 @@ void DocLoader::removeCachedObject( CachedObject* o ) const
 
 // Class URLLoadClient ======================================================================
 
- at interface URLLoadClient : NSObject <IFURLHandleClient>
-{
-    @public
-    Loader *m_loader;
-    id m_dataSource;
-}
-
--(id)initWithLoader:(Loader *)loader dataSource: dataSource;
-
- at end
-
-typedef enum {
-    IF_LOAD_TYPE_CSS    = 1,
-    IF_LOAD_TYPE_IMAGE  = 2,
-    IF_LOAD_TYPE_SCRIPT = 3,
-    IF_LOAD_TYPE_HTML   = 4
-} IF_LOAD_TYPE;
-
-
- at interface IFLoadProgress : NSObject
-{
-    int bytesSoFar;	// 0 if this is the start of load
-    int totalToLoad;	// -1 if this is not known.
-                        // bytesSoFar == totalLoaded when complete
-    IF_LOAD_TYPE type;	// load types, either image, css, or jscript
-}
-- init;
- at end
-
- at class IFError;
- at class IFURLHandle;
-
- at protocol  IFLoadHandler
-- (void)receivedProgress: (IFLoadProgress *)progress forResource: (NSString *)resourceDescription fromDataSource: (IFWebDataSource *)dataSource;
-
-- (void)receivedError: (IFError *)error forResource: (NSString *)resourceDescription partialProgress: (IFLoadProgress *)progress fromDataSource: (IFWebDataSource *)dataSource;
-
- at end
-
- at interface IFWebDataSource
-- (void)_addURLHandle: (IFURLHandle *)handle;
-- (void)_removeURLHandle: (IFURLHandle *)handle;
-- controller;
- at end
-
- at interface WCURLHandle
--(int)contentLength;
- at end
-
-
 @implementation URLLoadClient
 
 -(id)initWithLoader:(Loader *)loader dataSource: dataSource
@@ -1058,6 +1011,17 @@ typedef enum {
     KWQDEBUGLEVEL2 (0x2000, "dataSource = 0x%08x for URL %s\n", m_dataSource, job->url().url().latin1());
 
     [m_dataSource _removeURLHandle: job->handle()];
+
+    IFError *error = WCIFErrorMake(result);
+    id <IFLoadHandler> controller = [m_dataSource controller];
+    
+
+    IFLoadProgress *loadProgress = WCIFLoadProgressMake();
+    loadProgress->totalToLoad = [sender contentLength];
+    loadProgress->bytesSoFar = [[sender availableResourceData] length];
+
+    [controller receivedError: error forResource: [[sender url] absoluteString] partialProgress: loadProgress fromDataSource: m_dataSource];
+
     [sender autorelease];
 }
 
diff --git a/WebCore/kwq/WCLoadProgress.h b/WebCore/src/kwq/WCError.h
similarity index 85%
copy from WebCore/kwq/WCLoadProgress.h
copy to WebCore/src/kwq/WCError.h
index c33f1b4..8cad35f 100644
--- a/WebCore/kwq/WCLoadProgress.h
+++ b/WebCore/src/kwq/WCError.h
@@ -23,15 +23,18 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef __WCLOADPROGRESS__
-#define __WCLOADPROGRESS__
+#ifndef __WCERROR__
+#define __WCERROR__
 
 #import <Foundation/Foundation.h>
 
+extern "C" {
 
-typedef id (*WCIFLoadProgressMakeFunc)();
-void WCSetIFLoadProgressMakeFunc(WCIFLoadProgressMakeFunc func);
+typedef id (*WCIFErrorMakeFunc)(int);
+void WCSetIFErrorMakeFunc(WCIFErrorMakeFunc func);
 
-extern WCIFLoadProgressMakeFunc WCIFLoadProgressMake;
+extern WCIFErrorMakeFunc WCIFErrorMake;
 
-#endif /* __WCLOADPROGRESS__ */
+}
+
+#endif /* __WCERROR__ */
diff --git a/WebCore/src/kwq/WCWebDataSource.h b/WebCore/src/kwq/WCWebDataSource.h
index af99c33..b9e66f7 100644
--- a/WebCore/src/kwq/WCWebDataSource.h
+++ b/WebCore/src/kwq/WCWebDataSource.h
@@ -34,4 +34,5 @@ void WCSetIFWebDataSourceMakeFunc(WCIFWebDataSourceMakeFunc func);
 
 extern WCIFWebDataSourceMakeFunc WCIFWebDataSourceMake;
 
+
 #endif /* __WCWEBDATASOURCE__ */
diff --git a/WebCore/src/kwq/external.h b/WebCore/src/kwq/external.h
index cadbdca..7bb118d 100644
--- a/WebCore/src/kwq/external.h
+++ b/WebCore/src/kwq/external.h
@@ -23,13 +23,18 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
  
-#ifndef _EXTERNAL_H
-#define _EXTERNAL_H_
+#ifndef __EXTERNAL_H
+#define __EXTERNAL_H_
+
+#import <WebFoundation/WebFoundation.h>
+
 
 @class IFWebDataSource;
 @class IFWebView;
 @class IFWebFrame;
 @class IFError;
+ at class IFURLHandle;
+
 
 @protocol IFWebController
 - (IFWebFrame *)createFrameNamed: (NSString *)name for: (IFWebDataSource *)dataSource inParent: (IFWebDataSource *)dataSource;
@@ -50,6 +55,9 @@
 - frameNamed: (NSString *)f;
 - (void)_setParent: (IFWebDataSource *)p;
 - (IFWebDataSource *)parent;
+- (void)_addURLHandle: (IFURLHandle *)handle;
+- (void)_removeURLHandle: (IFURLHandle *)handle;
+- controller;
 @end
 
 // This should not be allowed here.  data source should not reference view
@@ -94,4 +102,20 @@ typedef enum {
 
 @end
 
+
+ at interface URLLoadClient : NSObject <IFURLHandleClient>
+{
+    @public
+    khtml::Loader *m_loader;
+    id m_dataSource;
+}
+
+-(id)initWithLoader:(khtml::Loader *)loader dataSource: dataSource;
+
+ at end
+
+ at interface WCURLHandle
+-(int)contentLength;
+ at end
+
 #endif
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 4b90d41..e0dd0f8 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,31 @@
+2002-03-05  Richard Williamson  <rjw at apple.com>
+
+        Pass errors correctly to browser.
+        Removed old notification code.
+        Added support for IFError.
+        Lots of little cleanups.
+        Improved IFWebFrame state handling.
+
+	* Misc.subproj/IFError.h:
+	* Misc.subproj/IFError.m: (IFErrorMake), (+[IFError load]), (-[IFError
+	initWithErrorCode:]), (-[IFError errorCode]), (-[IFError errorDescription]):
+	* WebKit.pbproj/project.pbxproj:
+	* WebView.subproj/IFBaseWebController.mm: (-[IFBaseWebController
+	receivedProgress:forResource:fromDataSource:]), (-[IFBaseWebController
+	receivedError:forResource:partialProgress:fromDataSource:]):
+	* WebView.subproj/IFBaseWebControllerPrivate.h:
+	* WebView.subproj/IFBaseWebControllerPrivate.mm:
+	* WebView.subproj/IFWebDataSource.mm: (-[IFWebDataSource isLoading]):
+	* WebView.subproj/IFWebDataSourcePrivate.mm: (-[IFWebDataSource
+	_startLoading:initiatedByUserEvent:]):
+	* WebView.subproj/IFWebFrame.mm: (-[IFWebFrame
+	initWithName:view:provisionalDataSource:controller:]), (-[IFWebFrame
+	setProvisionalDataSource:]):
+	* WebView.subproj/IFWebFramePrivate.h:
+	* WebView.subproj/IFWebFramePrivate.mm: (-[IFWebFrame
+	_transitionProvisionalToCommitted]), (-[IFWebFrame _state]), (-[IFWebFrame
+	_setState:]), (-[IFWebFrame _checkLoadComplete:]):
+
 2002-03-05  John Sullivan  <sullivan at apple.com>
 
 	* WebView.subproj/IFWebDataSource.mm: (+[IFWebDataSource initialize]):
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 4b90d41..e0dd0f8 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,31 @@
+2002-03-05  Richard Williamson  <rjw at apple.com>
+
+        Pass errors correctly to browser.
+        Removed old notification code.
+        Added support for IFError.
+        Lots of little cleanups.
+        Improved IFWebFrame state handling.
+
+	* Misc.subproj/IFError.h:
+	* Misc.subproj/IFError.m: (IFErrorMake), (+[IFError load]), (-[IFError
+	initWithErrorCode:]), (-[IFError errorCode]), (-[IFError errorDescription]):
+	* WebKit.pbproj/project.pbxproj:
+	* WebView.subproj/IFBaseWebController.mm: (-[IFBaseWebController
+	receivedProgress:forResource:fromDataSource:]), (-[IFBaseWebController
+	receivedError:forResource:partialProgress:fromDataSource:]):
+	* WebView.subproj/IFBaseWebControllerPrivate.h:
+	* WebView.subproj/IFBaseWebControllerPrivate.mm:
+	* WebView.subproj/IFWebDataSource.mm: (-[IFWebDataSource isLoading]):
+	* WebView.subproj/IFWebDataSourcePrivate.mm: (-[IFWebDataSource
+	_startLoading:initiatedByUserEvent:]):
+	* WebView.subproj/IFWebFrame.mm: (-[IFWebFrame
+	initWithName:view:provisionalDataSource:controller:]), (-[IFWebFrame
+	setProvisionalDataSource:]):
+	* WebView.subproj/IFWebFramePrivate.h:
+	* WebView.subproj/IFWebFramePrivate.mm: (-[IFWebFrame
+	_transitionProvisionalToCommitted]), (-[IFWebFrame _state]), (-[IFWebFrame
+	_setState:]), (-[IFWebFrame _checkLoadComplete:]):
+
 2002-03-05  John Sullivan  <sullivan at apple.com>
 
 	* WebView.subproj/IFWebDataSource.mm: (+[IFWebDataSource initialize]):
diff --git a/WebKit/Misc.subproj/IFError.h b/WebKit/Misc.subproj/IFError.h
new file mode 100644
index 0000000..9a87612
--- /dev/null
+++ b/WebKit/Misc.subproj/IFError.h
@@ -0,0 +1,20 @@
+/*	
+        IFError.h
+	Copyright 2001, Apple, Inc. All rights reserved.
+        
+        Public header file.
+*/
+#import <Foundation/Foundation.h>
+
+#import <IFError.h>
+
+ at interface IFError : NSObject
+{
+    int errorCode;
+}
+
+- initWithErrorCode: (int)c;
+- (int)errorCode;
+- (NSString *)errorDescription;
+
+ at end
diff --git a/WebKit/Misc.subproj/IFError.m b/WebKit/Misc.subproj/IFError.m
new file mode 100644
index 0000000..a399a91
--- /dev/null
+++ b/WebKit/Misc.subproj/IFError.m
@@ -0,0 +1,39 @@
+/*	
+        IFError.m
+	Copyright 2001, Apple, Inc. All rights reserved.
+*/
+#import <IFError.h>
+
+#include <WCError.h>
+
+ at implementation IFError
+
+static id IFErrorMake(int code) 
+{
+    return [[[IFError alloc] initWithErrorCode: (int)code] autorelease];
+}
+
++(void) load
+{
+    WCSetIFErrorMakeFunc(IFErrorMake);
+}
+
+- initWithErrorCode: (int)c
+{
+    [super init];
+    errorCode = c;
+    return self;
+}
+
+- (int)errorCode
+{
+    return errorCode;
+}
+
+- (NSString *)errorDescription
+{
+    // FIXME!
+    return nil;
+}
+
+ at end
diff --git a/WebKit/WebKit.pbproj/project.pbxproj b/WebKit/WebKit.pbproj/project.pbxproj
index 3565adf..ea0db81 100644
--- a/WebKit/WebKit.pbproj/project.pbxproj
+++ b/WebKit/WebKit.pbproj/project.pbxproj
@@ -193,6 +193,7 @@
 				F5EBC45802134BC301CA1520,
 				9CF0E24B021361B10ECA16EA,
 				F5B92B840223191D01C1A525,
+				F5DE3CB4023575AA01A80181,
 			);
 			isa = PBXHeadersBuildPhase;
 		};
@@ -225,6 +226,7 @@
 				F5143A380221DCCE01A80181,
 				F520FB1C0221DEFD01C1A525,
 				F5B92B850223191D01C1A525,
+				F5DE3CB5023575AA01A80181,
 			);
 			isa = PBXSourcesBuildPhase;
 		};
@@ -343,6 +345,8 @@
 				25C29825016E29620ECA149E,
 				25A5593101A5996D0ECA149E,
 				25A5593201A5996D0ECA149E,
+				F5DE3CB2023575AA01A80181,
+				F5DE3CB3023575AA01A80181,
 			);
 			isa = PBXGroup;
 			name = Misc;
@@ -1043,6 +1047,33 @@
 			settings = {
 			};
 		};
+		F5DE3CB2023575AA01A80181 = {
+			isa = PBXFileReference;
+			name = IFError.h;
+			path = Misc.subproj/IFError.h;
+			refType = 4;
+		};
+		F5DE3CB3023575AA01A80181 = {
+			isa = PBXFileReference;
+			name = IFError.m;
+			path = Misc.subproj/IFError.m;
+			refType = 4;
+		};
+		F5DE3CB4023575AA01A80181 = {
+			fileRef = F5DE3CB2023575AA01A80181;
+			isa = PBXBuildFile;
+			settings = {
+				ATTRIBUTES = (
+					Public,
+				);
+			};
+		};
+		F5DE3CB5023575AA01A80181 = {
+			fileRef = F5DE3CB3023575AA01A80181;
+			isa = PBXBuildFile;
+			settings = {
+			};
+		};
 		F5EBC45202134BB601CA1520 = {
 			children = (
 				F5EBC45502134BC301CA1520,
diff --git a/WebKit/WebView.subproj/IFBaseWebController.mm b/WebKit/WebView.subproj/IFBaseWebController.mm
index 1372697..6555f6e 100644
--- a/WebKit/WebView.subproj/IFBaseWebController.mm
+++ b/WebKit/WebView.subproj/IFBaseWebController.mm
@@ -188,18 +188,17 @@ static id IFLoadProgressMake()
         [frame _transitionProvisionalToCommitted];
     }
     
-    // Check if the load is complete for this data source.
+    // This resouce has completed, so check if the load is complete for all frames.
     if (progress->bytesSoFar == progress->totalToLoad)
-        [self _checkLoadCompleteForDataSource: dataSource];
+        [[self mainFrame] _checkLoadComplete: nil];
 }
 
 
 - (void)receivedError: (IFError *)error forResource: (NSString *)resourceDescription partialProgress: (IFLoadProgress *)progress fromDataSource: (IFWebDataSource *)dataSource
 {
-    WEBKIT_ASSERT (dataSource != nil);
+    WEBKIT_ASSERT ([self mainFrame] != nil);
 
-    // FIXME What should we do if the error is for a provisional data source?
-    [self _checkLoadCompleteForDataSource: dataSource];
+    [[self mainFrame] _checkLoadComplete: error];
 }
 
 
diff --git a/WebKit/WebView.subproj/IFBaseWebControllerPrivate.h b/WebKit/WebView.subproj/IFBaseWebControllerPrivate.h
index b31f3ea..46fb27c 100644
--- a/WebKit/WebView.subproj/IFBaseWebControllerPrivate.h
+++ b/WebKit/WebView.subproj/IFBaseWebControllerPrivate.h
@@ -15,5 +15,4 @@
 
 
 @interface IFBaseWebController (IFPrivate);
-- (void)_checkLoadCompleteForDataSource: (IFWebDataSource *)dataSource;
 @end
diff --git a/WebKit/WebView.subproj/IFBaseWebControllerPrivate.mm b/WebKit/WebView.subproj/IFBaseWebControllerPrivate.mm
index 9ae00ce..621227f 100644
--- a/WebKit/WebView.subproj/IFBaseWebControllerPrivate.mm
+++ b/WebKit/WebView.subproj/IFBaseWebControllerPrivate.mm
@@ -31,11 +31,4 @@
 
 @implementation IFBaseWebController (IFPrivate)
 
-- (void)_checkLoadCompleteForDataSource: (IFWebDataSource *)dataSource
-{
-    // Check that all handle clients have been removed,
-    // and that all descendent data sources are done
-    // loading.  Then call locationChangeDone:forFrame:
-}
-
 @end
diff --git a/WebKit/WebView.subproj/IFWebDataSource.mm b/WebKit/WebView.subproj/IFWebDataSource.mm
index 4aba657..99094b0 100644
--- a/WebKit/WebView.subproj/IFWebDataSource.mm
+++ b/WebKit/WebView.subproj/IFWebDataSource.mm
@@ -234,9 +234,21 @@ static id IFWebDataSourceMake(void *url)
 // Returns YES if there are any pending loads.
 - (BOOL)isLoading
 {
-    // FIXME!  Also need to account for main document.
+    int i, count;
+    
     IFWebDataSourcePrivate *data = (IFWebDataSourcePrivate *)_dataSourcePrivate;
-    return [data->urlHandles count] ? YES : NO;
+    if ([data->urlHandles count])
+        return YES;
+    
+    count = [[self children] count];
+    for (i = 0; i < count; i++){
+        IFWebFrame *childFrame;
+        
+        childFrame = [[self children] objectAtIndex: i];
+        if ([[childFrame dataSource] isLoading])
+            return YES;
+    }
+    return NO;
 }
 
 
diff --git a/WebKit/WebView.subproj/IFWebDataSourcePrivate.mm b/WebKit/WebView.subproj/IFWebDataSourcePrivate.mm
index 3339e51..285572f 100644
--- a/WebKit/WebView.subproj/IFWebDataSourcePrivate.mm
+++ b/WebKit/WebView.subproj/IFWebDataSourcePrivate.mm
@@ -67,6 +67,8 @@
 - (void)_startLoading: (BOOL)forceRefresh initiatedByUserEvent: (BOOL)byUserEvent
 {
     KURL url = [[[self inputURL] absoluteString] cString];
+
+    WEBKIT_ASSERT ([self frame] != nil);
     
     [self _part]->openURL (url);
     
diff --git a/WebKit/WebView.subproj/IFWebFrame.mm b/WebKit/WebView.subproj/IFWebFrame.mm
index bdbe133..6ae6931 100644
--- a/WebKit/WebView.subproj/IFWebFrame.mm
+++ b/WebKit/WebView.subproj/IFWebFrame.mm
@@ -28,9 +28,11 @@
     IFWebFramePrivate *data;
 
     [super init];
-    
+
     _framePrivate = [[IFWebFramePrivate alloc] init];   
 
+    [self _setState: IFWEBFRAMESTATE_UNINITIALIZED];    
+
     [self setController: c];
 
     // Allow controller to override?
@@ -143,6 +145,7 @@
     if (renderPartFrame && [view isKindOfClass: NSClassFromString(@"IFWebView")])
         renderPartFrame->setWidget ([view _provisionalWidget]);
 
+    [self _setState: IFWEBFRAMESTATE_PROVISIONAL];
     
     return YES;
 }
diff --git a/WebKit/WebView.subproj/IFWebFramePrivate.h b/WebKit/WebView.subproj/IFWebFramePrivate.h
index 0bf9993..44c26c8 100644
--- a/WebKit/WebView.subproj/IFWebFramePrivate.h
+++ b/WebKit/WebView.subproj/IFWebFramePrivate.h
@@ -10,6 +10,14 @@
 #import <WebKit/IFWebFrame.h>
 #import <WebKit/IFWebDataSource.h>
 
+typedef enum {
+    IFWEBFRAMESTATE_UNINITIALIZED = 1,
+    IFWEBFRAMESTATE_PROVISIONAL = 2,
+    IFWEBFRAMESTATE_COMMITTED = 3,
+    IFWEBFRAMESTATE_COMPLETE = 4,
+    IFWEBFRAMESTATE_ERROR = 5
+} IFWebFrameState;
+
 @interface IFWebFramePrivate : NSObject
 {
     NSString *name;
@@ -18,6 +26,7 @@
     IFWebDataSource *provisionalDataSource;
     void *renderFramePart;
     id <IFWebController>controller;
+    IFWebFrameState state;
 }
 
 - (void)setName: (NSString *)n;
@@ -40,4 +49,7 @@
 - (void *)_renderFramePart;
 - (void)_setDataSource: (IFWebDataSource *)d;
 - (void)_transitionProvisionalToCommitted;
+- (IFWebFrameState)_state;
+- (void)_setState: (IFWebFrameState)newState;
+- (BOOL)_checkLoadComplete: (IFError *)error;
 @end
diff --git a/WebKit/WebView.subproj/IFWebFramePrivate.mm b/WebKit/WebView.subproj/IFWebFramePrivate.mm
index c5d726d..fac21f2 100644
--- a/WebKit/WebView.subproj/IFWebFramePrivate.mm
+++ b/WebKit/WebView.subproj/IFWebFramePrivate.mm
@@ -5,6 +5,7 @@
 */
 #import <WebKit/IFWebDataSource.h>
 #import <WebKit/IFWebDataSourcePrivate.h>
+#import <WebKit/IFWebViewPrivate.h>
 #import <WebKit/IFWebFramePrivate.h>
 
 #import <WebKit/WebKitDebug.h>
@@ -98,6 +99,8 @@
 
     WEBKIT_ASSERT ([self controller] != nil);
 
+    WEBKIT_ASSERT ([self _state] == IFWEBFRAMESTATE_PROVISIONAL);
+
     // Set the committed data source on the frame.
     [self _setDataSource: data->provisionalDataSource];
     
@@ -109,9 +112,63 @@
     // Now that the provisional data source is committed, release it.
     [data setProvisionalDataSource: nil];
 
+    [self _setState: IFWEBFRAMESTATE_COMMITTED];
+
     [[self controller] locationChangeCommittedForFrame: self];
 }
 
+- (IFWebFrameState)_state
+{
+    IFWebFramePrivate *data = (IFWebFramePrivate *)_framePrivate;
+    
+    return data->state;
+}
+
+- (void)_setState: (IFWebFrameState)newState
+{
+    IFWebFramePrivate *data = (IFWebFramePrivate *)_framePrivate;
+
+    data->state = newState;
+}
+
+- (BOOL)_checkLoadComplete: (IFError *)error
+{
+    int i, count;
+    
+    WEBKIT_ASSERT ([self controller] != nil);
+
+    if ([self _state] == IFWEBFRAMESTATE_COMPLETE)
+        return YES;
+
+    if (error){
+        [self _setState: IFWEBFRAMESTATE_ERROR];
+        [[self controller] locationChangeDone: error forFrame: self];
+        return YES;
+    }
+        
+    if ([self _state] == IFWEBFRAMESTATE_PROVISIONAL)
+        return NO;
+
+    // Check all children first.
+    count = [[[self dataSource] children] count];
+    for (i = 0; i < count; i++){
+        IFWebFrame *childFrame;
+        
+        childFrame = [[[self dataSource] children] objectAtIndex: i];
+        if ([childFrame _checkLoadComplete: nil] == NO)
+            return NO;
+    }
+
+    if (![[self dataSource] isLoading]){
+        [self _setState: IFWEBFRAMESTATE_COMPLETE];
+        [[self view] setNeedsLayout: YES];
+        [[self view] setNeedsDisplay: YES];
+        [[self controller] locationChangeDone: nil forFrame: self];
+        return YES;
+    }
+    return NO;
+}
+
 
 @end
 
diff --git a/WebKit/WebView.subproj/WebDataSource.m b/WebKit/WebView.subproj/WebDataSource.m
index 4aba657..99094b0 100644
--- a/WebKit/WebView.subproj/WebDataSource.m
+++ b/WebKit/WebView.subproj/WebDataSource.m
@@ -234,9 +234,21 @@ static id IFWebDataSourceMake(void *url)
 // Returns YES if there are any pending loads.
 - (BOOL)isLoading
 {
-    // FIXME!  Also need to account for main document.
+    int i, count;
+    
     IFWebDataSourcePrivate *data = (IFWebDataSourcePrivate *)_dataSourcePrivate;
-    return [data->urlHandles count] ? YES : NO;
+    if ([data->urlHandles count])
+        return YES;
+    
+    count = [[self children] count];
+    for (i = 0; i < count; i++){
+        IFWebFrame *childFrame;
+        
+        childFrame = [[self children] objectAtIndex: i];
+        if ([[childFrame dataSource] isLoading])
+            return YES;
+    }
+    return NO;
 }
 
 
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.m b/WebKit/WebView.subproj/WebDataSourcePrivate.m
index 3339e51..285572f 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.m
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.m
@@ -67,6 +67,8 @@
 - (void)_startLoading: (BOOL)forceRefresh initiatedByUserEvent: (BOOL)byUserEvent
 {
     KURL url = [[[self inputURL] absoluteString] cString];
+
+    WEBKIT_ASSERT ([self frame] != nil);
     
     [self _part]->openURL (url);
     
diff --git a/WebKit/WebView.subproj/WebFrame.m b/WebKit/WebView.subproj/WebFrame.m
index bdbe133..6ae6931 100644
--- a/WebKit/WebView.subproj/WebFrame.m
+++ b/WebKit/WebView.subproj/WebFrame.m
@@ -28,9 +28,11 @@
     IFWebFramePrivate *data;
 
     [super init];
-    
+
     _framePrivate = [[IFWebFramePrivate alloc] init];   
 
+    [self _setState: IFWEBFRAMESTATE_UNINITIALIZED];    
+
     [self setController: c];
 
     // Allow controller to override?
@@ -143,6 +145,7 @@
     if (renderPartFrame && [view isKindOfClass: NSClassFromString(@"IFWebView")])
         renderPartFrame->setWidget ([view _provisionalWidget]);
 
+    [self _setState: IFWEBFRAMESTATE_PROVISIONAL];
     
     return YES;
 }
diff --git a/WebKit/WebView.subproj/WebFramePrivate.h b/WebKit/WebView.subproj/WebFramePrivate.h
index 0bf9993..44c26c8 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.h
+++ b/WebKit/WebView.subproj/WebFramePrivate.h
@@ -10,6 +10,14 @@
 #import <WebKit/IFWebFrame.h>
 #import <WebKit/IFWebDataSource.h>
 
+typedef enum {
+    IFWEBFRAMESTATE_UNINITIALIZED = 1,
+    IFWEBFRAMESTATE_PROVISIONAL = 2,
+    IFWEBFRAMESTATE_COMMITTED = 3,
+    IFWEBFRAMESTATE_COMPLETE = 4,
+    IFWEBFRAMESTATE_ERROR = 5
+} IFWebFrameState;
+
 @interface IFWebFramePrivate : NSObject
 {
     NSString *name;
@@ -18,6 +26,7 @@
     IFWebDataSource *provisionalDataSource;
     void *renderFramePart;
     id <IFWebController>controller;
+    IFWebFrameState state;
 }
 
 - (void)setName: (NSString *)n;
@@ -40,4 +49,7 @@
 - (void *)_renderFramePart;
 - (void)_setDataSource: (IFWebDataSource *)d;
 - (void)_transitionProvisionalToCommitted;
+- (IFWebFrameState)_state;
+- (void)_setState: (IFWebFrameState)newState;
+- (BOOL)_checkLoadComplete: (IFError *)error;
 @end
diff --git a/WebKit/WebView.subproj/WebFramePrivate.m b/WebKit/WebView.subproj/WebFramePrivate.m
index c5d726d..fac21f2 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.m
+++ b/WebKit/WebView.subproj/WebFramePrivate.m
@@ -5,6 +5,7 @@
 */
 #import <WebKit/IFWebDataSource.h>
 #import <WebKit/IFWebDataSourcePrivate.h>
+#import <WebKit/IFWebViewPrivate.h>
 #import <WebKit/IFWebFramePrivate.h>
 
 #import <WebKit/WebKitDebug.h>
@@ -98,6 +99,8 @@
 
     WEBKIT_ASSERT ([self controller] != nil);
 
+    WEBKIT_ASSERT ([self _state] == IFWEBFRAMESTATE_PROVISIONAL);
+
     // Set the committed data source on the frame.
     [self _setDataSource: data->provisionalDataSource];
     
@@ -109,9 +112,63 @@
     // Now that the provisional data source is committed, release it.
     [data setProvisionalDataSource: nil];
 
+    [self _setState: IFWEBFRAMESTATE_COMMITTED];
+
     [[self controller] locationChangeCommittedForFrame: self];
 }
 
+- (IFWebFrameState)_state
+{
+    IFWebFramePrivate *data = (IFWebFramePrivate *)_framePrivate;
+    
+    return data->state;
+}
+
+- (void)_setState: (IFWebFrameState)newState
+{
+    IFWebFramePrivate *data = (IFWebFramePrivate *)_framePrivate;
+
+    data->state = newState;
+}
+
+- (BOOL)_checkLoadComplete: (IFError *)error
+{
+    int i, count;
+    
+    WEBKIT_ASSERT ([self controller] != nil);
+
+    if ([self _state] == IFWEBFRAMESTATE_COMPLETE)
+        return YES;
+
+    if (error){
+        [self _setState: IFWEBFRAMESTATE_ERROR];
+        [[self controller] locationChangeDone: error forFrame: self];
+        return YES;
+    }
+        
+    if ([self _state] == IFWEBFRAMESTATE_PROVISIONAL)
+        return NO;
+
+    // Check all children first.
+    count = [[[self dataSource] children] count];
+    for (i = 0; i < count; i++){
+        IFWebFrame *childFrame;
+        
+        childFrame = [[[self dataSource] children] objectAtIndex: i];
+        if ([childFrame _checkLoadComplete: nil] == NO)
+            return NO;
+    }
+
+    if (![[self dataSource] isLoading]){
+        [self _setState: IFWEBFRAMESTATE_COMPLETE];
+        [[self view] setNeedsLayout: YES];
+        [[self view] setNeedsDisplay: YES];
+        [[self controller] locationChangeDone: nil forFrame: self];
+        return YES;
+    }
+    return NO;
+}
+
 
 @end
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list