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

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:18:08 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 3b45a792dc444e776eb518d62ad53b3a7c035db2
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Jun 11 23:52:35 2002 +0000

    	* WebView.subproj/IFMainURLHandleClient.mm:
    	Add lots of assertions that allowed me to find the "leak the world" bug that Ken
    	fixed in WebFoundation. These are a good idea anyway.
    
    	* Plugins.subproj/IFPluginStream.mm:
    	(-[IFPluginStream initWithURL:pluginPointer:notifyData:attributes:]): Use cStringLength
    	to get the length for the cString rather than assuming that length will be right.
    	(-[IFPluginStream IFURLHandle:didRedirectToURL:]): Add a FIXME.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1337 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 1749433..08e36d2 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,14 @@
+2002-06-11  Darin Adler  <darin at apple.com>
+
+	* WebView.subproj/IFMainURLHandleClient.mm:
+	Add lots of assertions that allowed me to find the "leak the world" bug that Ken
+	fixed in WebFoundation. These are a good idea anyway.
+
+	* Plugins.subproj/IFPluginStream.mm:
+	(-[IFPluginStream initWithURL:pluginPointer:notifyData:attributes:]): Use cStringLength
+	to get the length for the cString rather than assuming that length will be right.
+	(-[IFPluginStream IFURLHandle:didRedirectToURL:]): Add a FIXME.
+
 2002-06-11  John Sullivan  <sullivan at apple.com>
 
 	Made methods that convert bookmarks to and from
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 1749433..08e36d2 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,14 @@
+2002-06-11  Darin Adler  <darin at apple.com>
+
+	* WebView.subproj/IFMainURLHandleClient.mm:
+	Add lots of assertions that allowed me to find the "leak the world" bug that Ken
+	fixed in WebFoundation. These are a good idea anyway.
+
+	* Plugins.subproj/IFPluginStream.mm:
+	(-[IFPluginStream initWithURL:pluginPointer:notifyData:attributes:]): Use cStringLength
+	to get the length for the cString rather than assuming that length will be right.
+	(-[IFPluginStream IFURLHandle:didRedirectToURL:]): Add a FIXME.
+
 2002-06-11  John Sullivan  <sullivan at apple.com>
 
 	Made methods that convert bookmarks to and from
diff --git a/WebKit/Plugins.subproj/IFPluginStream.mm b/WebKit/Plugins.subproj/IFPluginStream.mm
index 2dcc1c6..7b06fa5 100644
--- a/WebKit/Plugins.subproj/IFPluginStream.mm
+++ b/WebKit/Plugins.subproj/IFPluginStream.mm
@@ -50,7 +50,7 @@ static NSString *getCarbonPath(NSString *posixPath);
     NPP_URLNotify = 	[view NPP_URLNotify];
     
     URLString = [theURL absoluteString];
-    cURL = (char *)malloc([URLString length]+1);
+    cURL = (char *)malloc([URLString cStringLength]+1);
     [URLString getCString:cURL];
     
     npStream.ndata = self;
@@ -214,6 +214,7 @@ static NSString *getCarbonPath(NSString *posixPath);
 - (void)IFURLHandle:(IFURLHandle *)sender didRedirectToURL:(NSURL *)url
 {
     [(IFWebController *)[view webController] _didStopLoading:URL];
+    // FIXME: This next line is not going to work. We don't remember the new URL.
     [(IFWebController *)[view webController] _didStartLoading:url];
 }
 
diff --git a/WebKit/Plugins.subproj/WebPluginStream.m b/WebKit/Plugins.subproj/WebPluginStream.m
index 2dcc1c6..7b06fa5 100644
--- a/WebKit/Plugins.subproj/WebPluginStream.m
+++ b/WebKit/Plugins.subproj/WebPluginStream.m
@@ -50,7 +50,7 @@ static NSString *getCarbonPath(NSString *posixPath);
     NPP_URLNotify = 	[view NPP_URLNotify];
     
     URLString = [theURL absoluteString];
-    cURL = (char *)malloc([URLString length]+1);
+    cURL = (char *)malloc([URLString cStringLength]+1);
     [URLString getCString:cURL];
     
     npStream.ndata = self;
@@ -214,6 +214,7 @@ static NSString *getCarbonPath(NSString *posixPath);
 - (void)IFURLHandle:(IFURLHandle *)sender didRedirectToURL:(NSURL *)url
 {
     [(IFWebController *)[view webController] _didStopLoading:URL];
+    // FIXME: This next line is not going to work. We don't remember the new URL.
     [(IFWebController *)[view webController] _didStartLoading:url];
 }
 
diff --git a/WebKit/WebView.subproj/IFMainURLHandleClient.mm b/WebKit/WebView.subproj/IFMainURLHandleClient.mm
index 1956999..4b77070 100644
--- a/WebKit/WebView.subproj/IFMainURLHandleClient.mm
+++ b/WebKit/WebView.subproj/IFMainURLHandleClient.mm
@@ -47,11 +47,12 @@
 
 - (void)dealloc
 {
+    WEBKIT_ASSERT(url == nil);
+    
     part->deref();
     [dataSource release];
     [resourceData release];
     [encoding release];
-    [url release];
     [MIMEType release];
     [super dealloc];
 }
@@ -60,6 +61,9 @@
 // Also, this method should never be passed a IFContentPolicyNone.
 - (void)setContentPolicy:(IFContentPolicy)theContentPolicy
 {
+    WEBKIT_ASSERT(contentPolicy == IFContentPolicyNone);
+    WEBKIT_ASSERT(theContentPolicy != IFContentPolicyNone);
+    
     contentPolicy = theContentPolicy;
     
     if(loadFinished)
@@ -68,7 +72,10 @@
 
 - (void)IFURLHandleResourceDidBeginLoading:(IFURLHandle *)sender
 {
-    WEBKITDEBUGLEVEL (WEBKIT_LOG_LOADING, "url = %s\n", [[[sender url] absoluteString] cString]);
+    WEBKITDEBUGLEVEL (WEBKIT_LOG_LOADING, "url = %s\n", DEBUG_OBJECT([sender url]));
+    
+    WEBKIT_ASSERT(url == nil);
+    
     url = [[sender url] retain];
     [(IFWebController *)[dataSource controller] _didStartLoading:url];
 }
@@ -76,7 +83,9 @@
 
 - (void)IFURLHandleResourceDidCancelLoading:(IFURLHandle *)sender
 {
-    WEBKITDEBUGLEVEL (WEBKIT_LOG_LOADING, "url = %s\n", [[[sender url] absoluteString] cString]);
+    WEBKITDEBUGLEVEL (WEBKIT_LOG_LOADING, "url = %s\n", DEBUG_OBJECT([sender url]));
+    
+    WEBKIT_ASSERT([url isEqual:[sender redirectedURL] ? [sender redirectedURL] : [sender url]]);
     
     [downloadHandler release];
     
@@ -87,12 +96,16 @@
         forResource: [[sender url] absoluteString] fromDataSource: dataSource];
     [loadProgress release];
     [(IFWebController *)[dataSource controller] _didStopLoading:url];
+    [url release];
+    url = nil;
 }
 
 
 - (void)IFURLHandleResourceDidFinishLoading:(IFURLHandle *)sender data: (NSData *)data
 {
-    WEBKITDEBUGLEVEL (WEBKIT_LOG_LOADING, "url = %s\n", [[[sender url] absoluteString] cString]);
+    WEBKITDEBUGLEVEL (WEBKIT_LOG_LOADING, "url = %s\n", DEBUG_OBJECT([sender url]));
+    
+    WEBKIT_ASSERT([url isEqual:[sender redirectedURL] ? [sender redirectedURL] : [sender url]]);
     
     loadFinished = YES;
     
@@ -111,20 +124,24 @@
         forResource: [[sender url] absoluteString] fromDataSource: dataSource];
     [loadProgress release];
     [(IFWebController *)[dataSource controller] _didStopLoading:url];
+    [url release];
+    url = nil;
 }
 
 
 - (void)IFURLHandle:(IFURLHandle *)sender resourceDataDidBecomeAvailable:(NSData *)data
 {
-	int contentLength = [sender contentLength];
-	int contentLengthReceived = [sender contentLengthReceived];
-	
-    WEBKITDEBUGLEVEL(WEBKIT_LOG_LOADING, "url = %s, data = %p, length %d\n", [[[sender url] absoluteString] cString], data, [data length]);
+    int contentLength = [sender contentLength];
+    int contentLengthReceived = [sender contentLengthReceived];
+    
+    WEBKITDEBUGLEVEL(WEBKIT_LOG_LOADING, "url = %s, data = %p, length %d\n", DEBUG_OBJECT([sender url]), data, [data length]);
+    
+    WEBKIT_ASSERT([url isEqual:[sender redirectedURL] ? [sender redirectedURL] : [sender url]]);
     
     // Check the mime type and ask the client for the content policy.
     if(!examinedInitialData){
         MIMEType = [[sender contentType] retain];
-        WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "main content type: %s", [MIMEType cString]);
+        WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "main content type: %s", DEBUG_OBJECT(MIMEType));
         [[dataSource _locationChangeHandler] requestContentPolicyForMIMEType:MIMEType];
         
         // FIXME: Remove/replace IFMIMEHandler stuff
@@ -170,31 +187,39 @@
 
 - (void)IFURLHandle:(IFURLHandle *)sender resourceDidFailLoadingWithResult:(IFError *)result
 {
-    WEBKITDEBUGLEVEL (WEBKIT_LOG_LOADING, "url = %s, result = %s\n", [[[sender url] absoluteString] cString], [[result errorDescription] lossyCString]);
+    WEBKITDEBUGLEVEL (WEBKIT_LOG_LOADING, "url = %s, result = %s\n", DEBUG_OBJECT([sender url]), DEBUG_OBJECT([result errorDescription]));
 
+    WEBKIT_ASSERT([url isEqual:[sender redirectedURL] ? [sender redirectedURL] : [sender url]]);
+    
     [downloadHandler release];
 
     IFLoadProgress *loadProgress = [[IFLoadProgress alloc] init];
     loadProgress->totalToLoad = [sender contentLength];
     loadProgress->bytesSoFar = [sender contentLengthReceived];
 
-    [(IFWebController *)[dataSource controller] _mainReceivedError: result forResource: [[sender url] absoluteString] 	partialProgress: loadProgress fromDataSource: dataSource];
+    [(IFWebController *)[dataSource controller] _mainReceivedError:result forResource:[[sender url] absoluteString] partialProgress:loadProgress fromDataSource:dataSource];
     [(IFWebController *)[dataSource controller] _didStopLoading:url];
+    [url release];
+    url = nil;
 }
 
 
-- (void)IFURLHandle:(IFURLHandle *)sender didRedirectToURL:(NSURL *)URL
+- (void)IFURLHandle:(IFURLHandle *)sender didRedirectToURL:(NSURL *)newURL
 {
-    WEBKITDEBUGLEVEL (WEBKIT_LOG_REDIRECT, "url = %s\n", [[URL absoluteString] cString]);
-    part->impl->setBaseURL([[URL absoluteString] cString]);
+    WEBKITDEBUGLEVEL (WEBKIT_LOG_REDIRECT, "url = %s\n", DEBUG_OBJECT(newURL));
     
-    [dataSource _setFinalURL: URL];
+    WEBKIT_ASSERT(url != nil);
     
-    [[dataSource _locationChangeHandler] serverRedirectTo: URL forDataSource: dataSource];
-    [(IFWebController *)[dataSource controller] _didStopLoading: url];
-    [(IFWebController *)[dataSource controller] _didStartLoading: URL];
+    [(IFWebController *)[dataSource controller] _didStopLoading:url];
+    [newURL retain];
     [url release];
-    url = [URL retain];
+    url = newURL;
+    [(IFWebController *)[dataSource controller] _didStartLoading:url];
+
+    part->impl->setBaseURL([[url absoluteString] cString]);
+    [dataSource _setFinalURL:url];
+    
+    [[dataSource _locationChangeHandler] serverRedirectTo:url forDataSource:dataSource];
 }
 
 
@@ -205,6 +230,8 @@
     IFContentHandler *contentHandler;
     IFWebFrame *frame;
         
+    WEBKIT_ASSERT(url != nil);
+    
     if(contentPolicy == IFContentPolicyShow){
         
         if(handlerType == IFMIMEHANDLERTYPE_NIL || handlerType == IFMIMEHANDLERTYPE_HTML) {
@@ -258,6 +285,8 @@
     const char *fakeHTMLDocumentBytes;
     IFContentHandler *contentHandler;
     
+    WEBKIT_ASSERT(url != nil);
+    
     if(contentPolicy == IFContentPolicyShow){
         if(handlerType == IFMIMEHANDLERTYPE_TEXT) {
             contentHandler = [[IFContentHandler alloc] initWithURL:url MIMEType:MIMEType MIMEHandlerType:IFMIMEHANDLERTYPE_TEXT];
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.m b/WebKit/WebView.subproj/WebMainResourceClient.m
index 1956999..4b77070 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.m
+++ b/WebKit/WebView.subproj/WebMainResourceClient.m
@@ -47,11 +47,12 @@
 
 - (void)dealloc
 {
+    WEBKIT_ASSERT(url == nil);
+    
     part->deref();
     [dataSource release];
     [resourceData release];
     [encoding release];
-    [url release];
     [MIMEType release];
     [super dealloc];
 }
@@ -60,6 +61,9 @@
 // Also, this method should never be passed a IFContentPolicyNone.
 - (void)setContentPolicy:(IFContentPolicy)theContentPolicy
 {
+    WEBKIT_ASSERT(contentPolicy == IFContentPolicyNone);
+    WEBKIT_ASSERT(theContentPolicy != IFContentPolicyNone);
+    
     contentPolicy = theContentPolicy;
     
     if(loadFinished)
@@ -68,7 +72,10 @@
 
 - (void)IFURLHandleResourceDidBeginLoading:(IFURLHandle *)sender
 {
-    WEBKITDEBUGLEVEL (WEBKIT_LOG_LOADING, "url = %s\n", [[[sender url] absoluteString] cString]);
+    WEBKITDEBUGLEVEL (WEBKIT_LOG_LOADING, "url = %s\n", DEBUG_OBJECT([sender url]));
+    
+    WEBKIT_ASSERT(url == nil);
+    
     url = [[sender url] retain];
     [(IFWebController *)[dataSource controller] _didStartLoading:url];
 }
@@ -76,7 +83,9 @@
 
 - (void)IFURLHandleResourceDidCancelLoading:(IFURLHandle *)sender
 {
-    WEBKITDEBUGLEVEL (WEBKIT_LOG_LOADING, "url = %s\n", [[[sender url] absoluteString] cString]);
+    WEBKITDEBUGLEVEL (WEBKIT_LOG_LOADING, "url = %s\n", DEBUG_OBJECT([sender url]));
+    
+    WEBKIT_ASSERT([url isEqual:[sender redirectedURL] ? [sender redirectedURL] : [sender url]]);
     
     [downloadHandler release];
     
@@ -87,12 +96,16 @@
         forResource: [[sender url] absoluteString] fromDataSource: dataSource];
     [loadProgress release];
     [(IFWebController *)[dataSource controller] _didStopLoading:url];
+    [url release];
+    url = nil;
 }
 
 
 - (void)IFURLHandleResourceDidFinishLoading:(IFURLHandle *)sender data: (NSData *)data
 {
-    WEBKITDEBUGLEVEL (WEBKIT_LOG_LOADING, "url = %s\n", [[[sender url] absoluteString] cString]);
+    WEBKITDEBUGLEVEL (WEBKIT_LOG_LOADING, "url = %s\n", DEBUG_OBJECT([sender url]));
+    
+    WEBKIT_ASSERT([url isEqual:[sender redirectedURL] ? [sender redirectedURL] : [sender url]]);
     
     loadFinished = YES;
     
@@ -111,20 +124,24 @@
         forResource: [[sender url] absoluteString] fromDataSource: dataSource];
     [loadProgress release];
     [(IFWebController *)[dataSource controller] _didStopLoading:url];
+    [url release];
+    url = nil;
 }
 
 
 - (void)IFURLHandle:(IFURLHandle *)sender resourceDataDidBecomeAvailable:(NSData *)data
 {
-	int contentLength = [sender contentLength];
-	int contentLengthReceived = [sender contentLengthReceived];
-	
-    WEBKITDEBUGLEVEL(WEBKIT_LOG_LOADING, "url = %s, data = %p, length %d\n", [[[sender url] absoluteString] cString], data, [data length]);
+    int contentLength = [sender contentLength];
+    int contentLengthReceived = [sender contentLengthReceived];
+    
+    WEBKITDEBUGLEVEL(WEBKIT_LOG_LOADING, "url = %s, data = %p, length %d\n", DEBUG_OBJECT([sender url]), data, [data length]);
+    
+    WEBKIT_ASSERT([url isEqual:[sender redirectedURL] ? [sender redirectedURL] : [sender url]]);
     
     // Check the mime type and ask the client for the content policy.
     if(!examinedInitialData){
         MIMEType = [[sender contentType] retain];
-        WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "main content type: %s", [MIMEType cString]);
+        WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "main content type: %s", DEBUG_OBJECT(MIMEType));
         [[dataSource _locationChangeHandler] requestContentPolicyForMIMEType:MIMEType];
         
         // FIXME: Remove/replace IFMIMEHandler stuff
@@ -170,31 +187,39 @@
 
 - (void)IFURLHandle:(IFURLHandle *)sender resourceDidFailLoadingWithResult:(IFError *)result
 {
-    WEBKITDEBUGLEVEL (WEBKIT_LOG_LOADING, "url = %s, result = %s\n", [[[sender url] absoluteString] cString], [[result errorDescription] lossyCString]);
+    WEBKITDEBUGLEVEL (WEBKIT_LOG_LOADING, "url = %s, result = %s\n", DEBUG_OBJECT([sender url]), DEBUG_OBJECT([result errorDescription]));
 
+    WEBKIT_ASSERT([url isEqual:[sender redirectedURL] ? [sender redirectedURL] : [sender url]]);
+    
     [downloadHandler release];
 
     IFLoadProgress *loadProgress = [[IFLoadProgress alloc] init];
     loadProgress->totalToLoad = [sender contentLength];
     loadProgress->bytesSoFar = [sender contentLengthReceived];
 
-    [(IFWebController *)[dataSource controller] _mainReceivedError: result forResource: [[sender url] absoluteString] 	partialProgress: loadProgress fromDataSource: dataSource];
+    [(IFWebController *)[dataSource controller] _mainReceivedError:result forResource:[[sender url] absoluteString] partialProgress:loadProgress fromDataSource:dataSource];
     [(IFWebController *)[dataSource controller] _didStopLoading:url];
+    [url release];
+    url = nil;
 }
 
 
-- (void)IFURLHandle:(IFURLHandle *)sender didRedirectToURL:(NSURL *)URL
+- (void)IFURLHandle:(IFURLHandle *)sender didRedirectToURL:(NSURL *)newURL
 {
-    WEBKITDEBUGLEVEL (WEBKIT_LOG_REDIRECT, "url = %s\n", [[URL absoluteString] cString]);
-    part->impl->setBaseURL([[URL absoluteString] cString]);
+    WEBKITDEBUGLEVEL (WEBKIT_LOG_REDIRECT, "url = %s\n", DEBUG_OBJECT(newURL));
     
-    [dataSource _setFinalURL: URL];
+    WEBKIT_ASSERT(url != nil);
     
-    [[dataSource _locationChangeHandler] serverRedirectTo: URL forDataSource: dataSource];
-    [(IFWebController *)[dataSource controller] _didStopLoading: url];
-    [(IFWebController *)[dataSource controller] _didStartLoading: URL];
+    [(IFWebController *)[dataSource controller] _didStopLoading:url];
+    [newURL retain];
     [url release];
-    url = [URL retain];
+    url = newURL;
+    [(IFWebController *)[dataSource controller] _didStartLoading:url];
+
+    part->impl->setBaseURL([[url absoluteString] cString]);
+    [dataSource _setFinalURL:url];
+    
+    [[dataSource _locationChangeHandler] serverRedirectTo:url forDataSource:dataSource];
 }
 
 
@@ -205,6 +230,8 @@
     IFContentHandler *contentHandler;
     IFWebFrame *frame;
         
+    WEBKIT_ASSERT(url != nil);
+    
     if(contentPolicy == IFContentPolicyShow){
         
         if(handlerType == IFMIMEHANDLERTYPE_NIL || handlerType == IFMIMEHANDLERTYPE_HTML) {
@@ -258,6 +285,8 @@
     const char *fakeHTMLDocumentBytes;
     IFContentHandler *contentHandler;
     
+    WEBKIT_ASSERT(url != nil);
+    
     if(contentPolicy == IFContentPolicyShow){
         if(handlerType == IFMIMEHANDLERTYPE_TEXT) {
             contentHandler = [[IFContentHandler alloc] initWithURL:url MIMEType:MIMEType MIMEHandlerType:IFMIMEHANDLERTYPE_TEXT];
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.m b/WebKit/WebView.subproj/WebMainResourceLoader.m
index 1956999..4b77070 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.m
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.m
@@ -47,11 +47,12 @@
 
 - (void)dealloc
 {
+    WEBKIT_ASSERT(url == nil);
+    
     part->deref();
     [dataSource release];
     [resourceData release];
     [encoding release];
-    [url release];
     [MIMEType release];
     [super dealloc];
 }
@@ -60,6 +61,9 @@
 // Also, this method should never be passed a IFContentPolicyNone.
 - (void)setContentPolicy:(IFContentPolicy)theContentPolicy
 {
+    WEBKIT_ASSERT(contentPolicy == IFContentPolicyNone);
+    WEBKIT_ASSERT(theContentPolicy != IFContentPolicyNone);
+    
     contentPolicy = theContentPolicy;
     
     if(loadFinished)
@@ -68,7 +72,10 @@
 
 - (void)IFURLHandleResourceDidBeginLoading:(IFURLHandle *)sender
 {
-    WEBKITDEBUGLEVEL (WEBKIT_LOG_LOADING, "url = %s\n", [[[sender url] absoluteString] cString]);
+    WEBKITDEBUGLEVEL (WEBKIT_LOG_LOADING, "url = %s\n", DEBUG_OBJECT([sender url]));
+    
+    WEBKIT_ASSERT(url == nil);
+    
     url = [[sender url] retain];
     [(IFWebController *)[dataSource controller] _didStartLoading:url];
 }
@@ -76,7 +83,9 @@
 
 - (void)IFURLHandleResourceDidCancelLoading:(IFURLHandle *)sender
 {
-    WEBKITDEBUGLEVEL (WEBKIT_LOG_LOADING, "url = %s\n", [[[sender url] absoluteString] cString]);
+    WEBKITDEBUGLEVEL (WEBKIT_LOG_LOADING, "url = %s\n", DEBUG_OBJECT([sender url]));
+    
+    WEBKIT_ASSERT([url isEqual:[sender redirectedURL] ? [sender redirectedURL] : [sender url]]);
     
     [downloadHandler release];
     
@@ -87,12 +96,16 @@
         forResource: [[sender url] absoluteString] fromDataSource: dataSource];
     [loadProgress release];
     [(IFWebController *)[dataSource controller] _didStopLoading:url];
+    [url release];
+    url = nil;
 }
 
 
 - (void)IFURLHandleResourceDidFinishLoading:(IFURLHandle *)sender data: (NSData *)data
 {
-    WEBKITDEBUGLEVEL (WEBKIT_LOG_LOADING, "url = %s\n", [[[sender url] absoluteString] cString]);
+    WEBKITDEBUGLEVEL (WEBKIT_LOG_LOADING, "url = %s\n", DEBUG_OBJECT([sender url]));
+    
+    WEBKIT_ASSERT([url isEqual:[sender redirectedURL] ? [sender redirectedURL] : [sender url]]);
     
     loadFinished = YES;
     
@@ -111,20 +124,24 @@
         forResource: [[sender url] absoluteString] fromDataSource: dataSource];
     [loadProgress release];
     [(IFWebController *)[dataSource controller] _didStopLoading:url];
+    [url release];
+    url = nil;
 }
 
 
 - (void)IFURLHandle:(IFURLHandle *)sender resourceDataDidBecomeAvailable:(NSData *)data
 {
-	int contentLength = [sender contentLength];
-	int contentLengthReceived = [sender contentLengthReceived];
-	
-    WEBKITDEBUGLEVEL(WEBKIT_LOG_LOADING, "url = %s, data = %p, length %d\n", [[[sender url] absoluteString] cString], data, [data length]);
+    int contentLength = [sender contentLength];
+    int contentLengthReceived = [sender contentLengthReceived];
+    
+    WEBKITDEBUGLEVEL(WEBKIT_LOG_LOADING, "url = %s, data = %p, length %d\n", DEBUG_OBJECT([sender url]), data, [data length]);
+    
+    WEBKIT_ASSERT([url isEqual:[sender redirectedURL] ? [sender redirectedURL] : [sender url]]);
     
     // Check the mime type and ask the client for the content policy.
     if(!examinedInitialData){
         MIMEType = [[sender contentType] retain];
-        WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "main content type: %s", [MIMEType cString]);
+        WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "main content type: %s", DEBUG_OBJECT(MIMEType));
         [[dataSource _locationChangeHandler] requestContentPolicyForMIMEType:MIMEType];
         
         // FIXME: Remove/replace IFMIMEHandler stuff
@@ -170,31 +187,39 @@
 
 - (void)IFURLHandle:(IFURLHandle *)sender resourceDidFailLoadingWithResult:(IFError *)result
 {
-    WEBKITDEBUGLEVEL (WEBKIT_LOG_LOADING, "url = %s, result = %s\n", [[[sender url] absoluteString] cString], [[result errorDescription] lossyCString]);
+    WEBKITDEBUGLEVEL (WEBKIT_LOG_LOADING, "url = %s, result = %s\n", DEBUG_OBJECT([sender url]), DEBUG_OBJECT([result errorDescription]));
 
+    WEBKIT_ASSERT([url isEqual:[sender redirectedURL] ? [sender redirectedURL] : [sender url]]);
+    
     [downloadHandler release];
 
     IFLoadProgress *loadProgress = [[IFLoadProgress alloc] init];
     loadProgress->totalToLoad = [sender contentLength];
     loadProgress->bytesSoFar = [sender contentLengthReceived];
 
-    [(IFWebController *)[dataSource controller] _mainReceivedError: result forResource: [[sender url] absoluteString] 	partialProgress: loadProgress fromDataSource: dataSource];
+    [(IFWebController *)[dataSource controller] _mainReceivedError:result forResource:[[sender url] absoluteString] partialProgress:loadProgress fromDataSource:dataSource];
     [(IFWebController *)[dataSource controller] _didStopLoading:url];
+    [url release];
+    url = nil;
 }
 
 
-- (void)IFURLHandle:(IFURLHandle *)sender didRedirectToURL:(NSURL *)URL
+- (void)IFURLHandle:(IFURLHandle *)sender didRedirectToURL:(NSURL *)newURL
 {
-    WEBKITDEBUGLEVEL (WEBKIT_LOG_REDIRECT, "url = %s\n", [[URL absoluteString] cString]);
-    part->impl->setBaseURL([[URL absoluteString] cString]);
+    WEBKITDEBUGLEVEL (WEBKIT_LOG_REDIRECT, "url = %s\n", DEBUG_OBJECT(newURL));
     
-    [dataSource _setFinalURL: URL];
+    WEBKIT_ASSERT(url != nil);
     
-    [[dataSource _locationChangeHandler] serverRedirectTo: URL forDataSource: dataSource];
-    [(IFWebController *)[dataSource controller] _didStopLoading: url];
-    [(IFWebController *)[dataSource controller] _didStartLoading: URL];
+    [(IFWebController *)[dataSource controller] _didStopLoading:url];
+    [newURL retain];
     [url release];
-    url = [URL retain];
+    url = newURL;
+    [(IFWebController *)[dataSource controller] _didStartLoading:url];
+
+    part->impl->setBaseURL([[url absoluteString] cString]);
+    [dataSource _setFinalURL:url];
+    
+    [[dataSource _locationChangeHandler] serverRedirectTo:url forDataSource:dataSource];
 }
 
 
@@ -205,6 +230,8 @@
     IFContentHandler *contentHandler;
     IFWebFrame *frame;
         
+    WEBKIT_ASSERT(url != nil);
+    
     if(contentPolicy == IFContentPolicyShow){
         
         if(handlerType == IFMIMEHANDLERTYPE_NIL || handlerType == IFMIMEHANDLERTYPE_HTML) {
@@ -258,6 +285,8 @@
     const char *fakeHTMLDocumentBytes;
     IFContentHandler *contentHandler;
     
+    WEBKIT_ASSERT(url != nil);
+    
     if(contentPolicy == IFContentPolicyShow){
         if(handlerType == IFMIMEHANDLERTYPE_TEXT) {
             contentHandler = [[IFContentHandler alloc] initWithURL:url MIMEType:MIMEType MIMEHandlerType:IFMIMEHANDLERTYPE_TEXT];

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list