[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
cblu
cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:23:42 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 9e5e0904feee7fa02280086b19ab032f31be2d5a
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Jul 10 22:08:29 2002 +0000
WebKit:
Fix for:
2976311 - Download fails if you close the window that started the download
2976308 - Can't navigate in window while download started in that window is in progress
* WebView.subproj/IFMainURLHandleClient.h:
* WebView.subproj/IFMainURLHandleClient.mm:
(-[IFMainURLHandleClient dealloc]):
(-[IFMainURLHandleClient _receivedProgress:forResourceHandle:fromDataSource:complete:]): added, sends progress to correct handler
(-[IFMainURLHandleClient _receivedError:forResourceHandle:partialProgress:fromDataSource:]): added, sends progress to correct handler
(-[IFMainURLHandleClient IFURLHandleResourceDidCancelLoading:]): calls _receivedProgress
(-[IFMainURLHandleClient IFURLHandleResourceDidFinishLoading:data:]): calls _receivedProgress
(-[IFMainURLHandleClient IFURLHandle:resourceDataDidBecomeAvailable:]): calls _receivedProgress
(-[IFMainURLHandleClient IFURLHandle:resourceDidFailLoadingWithResult:]): calls _receivedError
* WebView.subproj/IFWebController.h:
* WebView.subproj/IFWebController.mm:
(-[IFWebController setDownloadProgressHandler:]): added
(-[IFWebController downloadProgressHandler]): added
* WebView.subproj/IFWebControllerPrivate.h:
* WebView.subproj/IFWebControllerPrivate.mm:
(-[IFWebController _mainReceivedProgress:forResourceHandle:fromDataSource:complete:]): removed download special-casing
WebBrowser:
Fix for:
2976311 - Download fails if you close the window that started the download
2976308 - Can't navigate in window while download started in that window is in progress
* BrowserDocument.m:
(-[BrowserDocument init]): set the downloadProgressHandler to the download monitor
(-[BrowserDocument close]): set the downloadProgressHandler to nil
* DownloadMonitor.h:
* DownloadMonitor.m:
(-[DownloadMonitor _monitorDownload:withProgress:error:dataSource:complete:]): renamed, made private
(-[DownloadMonitor receivedProgress:forResourceHandle:fromDataSource:complete:]): added, calls _monitorDownload
(-[DownloadMonitor receivedError:forResourceHandle:partialProgress:fromDataSource:]): added, calls _monitorDownload
* WebController.m:
(-[BrowserWebController receivedProgress:forResourceHandle:fromDataSource:complete:]): removed download special-casing
(-[BrowserWebController receivedError:forResourceHandle:partialProgress:fromDataSource:]): removed download special-casing
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1526 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index b04a98d..fd71b40 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,26 @@
+2002-07-10 Chris Blumenberg <cblu at apple.com>
+
+ Fix for:
+ 2976311 - Download fails if you close the window that started the download
+ 2976308 - Can't navigate in window while download started in that window is in progress
+
+ * WebView.subproj/IFMainURLHandleClient.h:
+ * WebView.subproj/IFMainURLHandleClient.mm:
+ (-[IFMainURLHandleClient dealloc]):
+ (-[IFMainURLHandleClient _receivedProgress:forResourceHandle:fromDataSource:complete:]): added, sends progress to correct handler
+ (-[IFMainURLHandleClient _receivedError:forResourceHandle:partialProgress:fromDataSource:]): added, sends progress to correct handler
+ (-[IFMainURLHandleClient IFURLHandleResourceDidCancelLoading:]): calls _receivedProgress
+ (-[IFMainURLHandleClient IFURLHandleResourceDidFinishLoading:data:]): calls _receivedProgress
+ (-[IFMainURLHandleClient IFURLHandle:resourceDataDidBecomeAvailable:]): calls _receivedProgress
+ (-[IFMainURLHandleClient IFURLHandle:resourceDidFailLoadingWithResult:]): calls _receivedError
+ * WebView.subproj/IFWebController.h:
+ * WebView.subproj/IFWebController.mm:
+ (-[IFWebController setDownloadProgressHandler:]): added
+ (-[IFWebController downloadProgressHandler]): added
+ * WebView.subproj/IFWebControllerPrivate.h:
+ * WebView.subproj/IFWebControllerPrivate.mm:
+ (-[IFWebController _mainReceivedProgress:forResourceHandle:fromDataSource:complete:]): removed download special-casing
+
2002-07-10 Maciej Stachowiak <mjs at apple.com>
* WebView.subproj/IFGrabBag.h: Removed.
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index b04a98d..fd71b40 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,26 @@
+2002-07-10 Chris Blumenberg <cblu at apple.com>
+
+ Fix for:
+ 2976311 - Download fails if you close the window that started the download
+ 2976308 - Can't navigate in window while download started in that window is in progress
+
+ * WebView.subproj/IFMainURLHandleClient.h:
+ * WebView.subproj/IFMainURLHandleClient.mm:
+ (-[IFMainURLHandleClient dealloc]):
+ (-[IFMainURLHandleClient _receivedProgress:forResourceHandle:fromDataSource:complete:]): added, sends progress to correct handler
+ (-[IFMainURLHandleClient _receivedError:forResourceHandle:partialProgress:fromDataSource:]): added, sends progress to correct handler
+ (-[IFMainURLHandleClient IFURLHandleResourceDidCancelLoading:]): calls _receivedProgress
+ (-[IFMainURLHandleClient IFURLHandleResourceDidFinishLoading:data:]): calls _receivedProgress
+ (-[IFMainURLHandleClient IFURLHandle:resourceDataDidBecomeAvailable:]): calls _receivedProgress
+ (-[IFMainURLHandleClient IFURLHandle:resourceDidFailLoadingWithResult:]): calls _receivedError
+ * WebView.subproj/IFWebController.h:
+ * WebView.subproj/IFWebController.mm:
+ (-[IFWebController setDownloadProgressHandler:]): added
+ (-[IFWebController downloadProgressHandler]): added
+ * WebView.subproj/IFWebControllerPrivate.h:
+ * WebView.subproj/IFWebControllerPrivate.mm:
+ (-[IFWebController _mainReceivedProgress:forResourceHandle:fromDataSource:complete:]): removed download special-casing
+
2002-07-10 Maciej Stachowiak <mjs at apple.com>
* WebView.subproj/IFGrabBag.h: Removed.
diff --git a/WebKit/WebView.subproj/IFMainURLHandleClient.h b/WebKit/WebView.subproj/IFMainURLHandleClient.h
index 9600b7f..420fa25 100644
--- a/WebKit/WebView.subproj/IFMainURLHandleClient.h
+++ b/WebKit/WebView.subproj/IFMainURLHandleClient.h
@@ -8,11 +8,13 @@
#import <WebKit/IFLocationChangeHandler.h>
+#import <WebKit/IFWebControllerPolicyHandler.h>
#import <WebFoundation/IFURLHandle.h>
@class IFDownloadHandler;
@class IFWebDataSource;
@protocol IFURLHandleClient;
+ at protocol IFResourceProgressHandler;
@interface IFMainURLHandleClient : NSObject <IFURLHandleClient>
{
@@ -21,6 +23,7 @@
BOOL processedBufferedData;
BOOL isFirstChunk;
IFDownloadHandler *downloadHandler;
+ id <IFResourceProgressHandler> downloadProgressHandler;
}
- initWithDataSource: (IFWebDataSource *)ds;
- (IFDownloadHandler *) downloadHandler;
diff --git a/WebKit/WebView.subproj/IFMainURLHandleClient.mm b/WebKit/WebView.subproj/IFMainURLHandleClient.mm
index 909481a..4e1a20c 100644
--- a/WebKit/WebView.subproj/IFMainURLHandleClient.mm
+++ b/WebKit/WebView.subproj/IFMainURLHandleClient.mm
@@ -41,6 +41,7 @@
- (void)dealloc
{
WEBKIT_ASSERT(url == nil);
+ [downloadProgressHandler release];
[dataSource release];
[super dealloc];
}
@@ -50,6 +51,40 @@
return downloadHandler;
}
+- (void)_receivedProgress: (IFLoadProgress *)progress forResourceHandle: (IFURLHandle *)resourceHandle fromDataSource: (IFWebDataSource *)theDataSource complete: (BOOL)isComplete
+{
+ if([dataSource contentPolicy] == IFContentPolicySaveAndOpenExternally || [dataSource contentPolicy] == IFContentPolicySave){
+ if(isComplete)
+ [dataSource _setPrimaryLoadComplete: YES];
+
+ if (progress->bytesSoFar == -1 && progress->totalToLoad == -1){
+ IFError *error = [[IFError alloc] initWithErrorCode: IFURLHandleResultCancelled
+ inDomain:IFErrorCodeDomainWebFoundation failingURL: [dataSource inputURL]];
+ [dataSource _setMainDocumentError: error];
+ [downloadProgressHandler receivedError: error forResourceHandle: resourceHandle partialProgress: progress fromDataSource: dataSource];
+ [error release];
+ }
+
+ [downloadProgressHandler receivedProgress:progress forResourceHandle:resourceHandle
+ fromDataSource:theDataSource complete:isComplete];
+ }else{
+ [[dataSource controller] _mainReceivedProgress:progress forResourceHandle:resourceHandle
+ fromDataSource:theDataSource complete:isComplete];
+ }
+}
+
+- (void)_receivedError: (IFError *)error forResourceHandle: (IFURLHandle *)resourceHandle partialProgress: (IFLoadProgress *)progress fromDataSource: (IFWebDataSource *)theDataSource
+{
+ if([dataSource contentPolicy] == IFContentPolicySaveAndOpenExternally || [dataSource contentPolicy] == IFContentPolicySave){
+ [downloadProgressHandler receivedError:error forResourceHandle:resourceHandle
+ partialProgress:progress fromDataSource:theDataSource];
+ }else{
+ [[dataSource controller] _mainReceivedError:error forResourceHandle:resourceHandle
+ partialProgress:progress fromDataSource:theDataSource];
+ }
+}
+
+
- (void)IFURLHandleResourceDidBeginLoading:(IFURLHandle *)sender
{
WEBKITDEBUGLEVEL (WEBKIT_LOG_LOADING, "url = %s\n", DEBUG_OBJECT([sender url]));
@@ -67,9 +102,10 @@
WEBKIT_ASSERT([url isEqual:[sender redirectedURL] ? [sender redirectedURL] : [sender url]]);
- [[dataSource controller] _mainReceivedProgress:[IFLoadProgress progress]
- forResourceHandle:sender fromDataSource: dataSource complete: YES];
+ [self _receivedProgress:[IFLoadProgress progress] forResourceHandle:sender fromDataSource: dataSource complete: YES];
+
[[dataSource controller] _didStopLoading:url];
+
[url release];
url = nil;
@@ -84,7 +120,7 @@
WEBKIT_ASSERT([url isEqual:[sender redirectedURL] ? [sender redirectedURL] : [sender url]]);
- // Don't retain download data
+ // Don't retain data for downloaded files
if([dataSource contentPolicy] != IFContentPolicySave &&
[dataSource contentPolicy] != IFContentPolicySaveAndOpenExternally){
[dataSource _setResourceData:data];
@@ -96,13 +132,15 @@
// Either send a final error message or a final progress message.
IFError *nonTerminalError = [sender error];
if (nonTerminalError){
- [[dataSource controller] _mainReceivedError:nonTerminalError forResourceHandle:sender partialProgress:[IFLoadProgress progressWithURLHandle:sender] fromDataSource:dataSource];
+ [self _receivedError:nonTerminalError forResourceHandle:sender
+ partialProgress:[IFLoadProgress progressWithURLHandle:sender] fromDataSource:dataSource];
}
else {
// update progress
- [[dataSource controller] _mainReceivedProgress:[IFLoadProgress progressWithURLHandle:sender]
- forResourceHandle:sender fromDataSource:dataSource complete:YES];
+ [self _receivedProgress:[IFLoadProgress progressWithURLHandle:sender]
+ forResourceHandle:sender fromDataSource: dataSource complete: YES];
}
+
[[dataSource controller] _didStopLoading:url];
[url release];
@@ -120,7 +158,7 @@
NSString *contentType = [sender contentType];
IFWebFrame *frame = [dataSource webFrame];
IFWebView *view = [frame webView];
- IFContentPolicy contentPolicy;
+
NSData *data = nil;
WEBKITDEBUGLEVEL(WEBKIT_LOG_LOADING, "url = %s, data = %p, length %d\n", DEBUG_OBJECT([sender url]), incomingData, [incomingData length]);
@@ -142,7 +180,7 @@
WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "main content type: %s", DEBUG_OBJECT(contentType));
}
- contentPolicy = [dataSource contentPolicy];
+ IFContentPolicy contentPolicy = [dataSource contentPolicy];
if(contentPolicy != IFContentPolicyNone){
if(!processedBufferedData){
@@ -162,26 +200,31 @@
if(contentPolicy == IFContentPolicyShow){
[[dataSource representation] receivedData:data withDataSource:dataSource];
[[view documentView] dataSourceUpdated:dataSource];
-
- }else if(contentPolicy == IFContentPolicySave || contentPolicy == IFContentPolicySaveAndOpenExternally){
+ }
+ else if(contentPolicy == IFContentPolicySave || contentPolicy == IFContentPolicySaveAndOpenExternally){
if(!downloadHandler){
+ downloadProgressHandler = [[[dataSource controller] downloadProgressHandler] retain];
[frame->_private setProvisionalDataSource:nil];
[[dataSource _locationChangeHandler] locationChangeDone:nil forDataSource:dataSource];
downloadHandler = [[IFDownloadHandler alloc] initWithDataSource:dataSource];
}
[downloadHandler receivedData:data];
-
- }else if(contentPolicy == IFContentPolicyIgnore){
+ }
+ else if(contentPolicy == IFContentPolicyIgnore){
[sender cancelLoadInBackground];
- return;
+ [frame->_private setProvisionalDataSource:nil];
+ [[dataSource _locationChangeHandler] locationChangeDone:nil forDataSource:dataSource];
+ }
+ else{
+ [NSException raise:NSInvalidArgumentException format:
+ @"haveContentPolicy: andPath:path forDataSource: set an invalid content policy."];
}
- WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "%d of %d", [sender contentLengthReceived], [sender contentLength]);
-
- // update progress
- [[dataSource controller] _mainReceivedProgress:[IFLoadProgress progressWithURLHandle:sender]
- forResourceHandle:sender fromDataSource:dataSource complete: NO];
+ //update progress
+ [self _receivedProgress:[IFLoadProgress progressWithURLHandle:sender]
+ forResourceHandle:sender fromDataSource: dataSource complete: NO];
+ WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "%d of %d", [sender contentLengthReceived], [sender contentLength]);
isFirstChunk = NO;
}
@@ -192,7 +235,9 @@
WEBKIT_ASSERT([url isEqual:[sender redirectedURL] ? [sender redirectedURL] : [sender url]]);
- [[dataSource controller] _mainReceivedError:result forResourceHandle:sender partialProgress:[IFLoadProgress progressWithURLHandle:sender] fromDataSource:dataSource];
+ [self _receivedError:result forResourceHandle:sender
+ partialProgress:[IFLoadProgress progressWithURLHandle:sender] fromDataSource:dataSource];
+
[[dataSource controller] _didStopLoading:url];
[url release];
url = nil;
diff --git a/WebKit/WebView.subproj/IFWebController.h b/WebKit/WebView.subproj/IFWebController.h
index 3f2711b..1b2d465 100644
--- a/WebKit/WebView.subproj/IFWebController.h
+++ b/WebKit/WebView.subproj/IFWebController.h
@@ -140,6 +140,9 @@
- (void)setResourceProgressHandler: (id<IFResourceProgressHandler>)handler;
- (id<IFResourceProgressHandler>)resourceProgressHandler;
+- (void)setDownloadProgressHandler: (id<IFResourceProgressHandler>)handler;
+- (id<IFResourceProgressHandler>)downloadProgressHandler;
+
+ (IFURLPolicy)defaultURLPolicyForURL: (NSURL *)url;
- (void)setPolicyHandler: (id<IFWebControllerPolicyHandler>)handler;
diff --git a/WebKit/WebView.subproj/IFWebController.mm b/WebKit/WebView.subproj/IFWebController.mm
index cfb9428..3d2a138 100644
--- a/WebKit/WebView.subproj/IFWebController.mm
+++ b/WebKit/WebView.subproj/IFWebController.mm
@@ -98,6 +98,19 @@
}
+- (void)setDownloadProgressHandler: (id<IFResourceProgressHandler>)handler
+{
+ [_private->downloadProgressHandler autorelease];
+ _private->downloadProgressHandler = [handler retain];
+}
+
+
+- (id<IFResourceProgressHandler>)downloadProgressHandler
+{
+ return _private->downloadProgressHandler;
+}
+
+
- (void)setPolicyHandler: (id<IFWebControllerPolicyHandler>)handler
{
[_private->policyHandler autorelease];
diff --git a/WebKit/WebView.subproj/IFWebControllerPrivate.h b/WebKit/WebView.subproj/IFWebControllerPrivate.h
index f4f8314..e1cfd80 100644
--- a/WebKit/WebView.subproj/IFWebControllerPrivate.h
+++ b/WebKit/WebView.subproj/IFWebControllerPrivate.h
@@ -14,6 +14,7 @@
IFWebFrame *mainFrame;
id<IFWindowContext> windowContext;
id<IFResourceProgressHandler> resourceProgressHandler;
+ id<IFResourceProgressHandler> downloadProgressHandler;
id<IFWebControllerPolicyHandler> policyHandler;
BOOL openedByScript;
}
diff --git a/WebKit/WebView.subproj/IFWebControllerPrivate.mm b/WebKit/WebView.subproj/IFWebControllerPrivate.mm
index 8403a94..e4f7159 100644
--- a/WebKit/WebView.subproj/IFWebControllerPrivate.mm
+++ b/WebKit/WebView.subproj/IFWebControllerPrivate.mm
@@ -106,7 +106,6 @@
- (void)_mainReceivedProgress: (IFLoadProgress *)progress forResourceHandle: (IFURLHandle *)resourceHandle fromDataSource: (IFWebDataSource *)dataSource complete: (BOOL)isComplete
{
IFWebFrame *frame = [dataSource webFrame];
- IFContentPolicy contentPolicy = [dataSource contentPolicy];
WEBKIT_ASSERT (dataSource != nil);
@@ -123,11 +122,6 @@
[[self resourceProgressHandler] receivedProgress: progress forResourceHandle: resourceHandle
fromDataSource: dataSource complete:isComplete];
-
- if(isComplete){
- if(contentPolicy == IFContentPolicySaveAndOpenExternally || contentPolicy == IFContentPolicySave)
- [dataSource _setPrimaryLoadComplete: YES];
- }
// The frame may be nil if a previously cancelled load is still making progress callbacks.
if (frame == nil)
diff --git a/WebKit/WebView.subproj/WebController.h b/WebKit/WebView.subproj/WebController.h
index 3f2711b..1b2d465 100644
--- a/WebKit/WebView.subproj/WebController.h
+++ b/WebKit/WebView.subproj/WebController.h
@@ -140,6 +140,9 @@
- (void)setResourceProgressHandler: (id<IFResourceProgressHandler>)handler;
- (id<IFResourceProgressHandler>)resourceProgressHandler;
+- (void)setDownloadProgressHandler: (id<IFResourceProgressHandler>)handler;
+- (id<IFResourceProgressHandler>)downloadProgressHandler;
+
+ (IFURLPolicy)defaultURLPolicyForURL: (NSURL *)url;
- (void)setPolicyHandler: (id<IFWebControllerPolicyHandler>)handler;
diff --git a/WebKit/WebView.subproj/WebController.m b/WebKit/WebView.subproj/WebController.m
index cfb9428..3d2a138 100644
--- a/WebKit/WebView.subproj/WebController.m
+++ b/WebKit/WebView.subproj/WebController.m
@@ -98,6 +98,19 @@
}
+- (void)setDownloadProgressHandler: (id<IFResourceProgressHandler>)handler
+{
+ [_private->downloadProgressHandler autorelease];
+ _private->downloadProgressHandler = [handler retain];
+}
+
+
+- (id<IFResourceProgressHandler>)downloadProgressHandler
+{
+ return _private->downloadProgressHandler;
+}
+
+
- (void)setPolicyHandler: (id<IFWebControllerPolicyHandler>)handler
{
[_private->policyHandler autorelease];
diff --git a/WebKit/WebView.subproj/WebControllerPrivate.h b/WebKit/WebView.subproj/WebControllerPrivate.h
index f4f8314..e1cfd80 100644
--- a/WebKit/WebView.subproj/WebControllerPrivate.h
+++ b/WebKit/WebView.subproj/WebControllerPrivate.h
@@ -14,6 +14,7 @@
IFWebFrame *mainFrame;
id<IFWindowContext> windowContext;
id<IFResourceProgressHandler> resourceProgressHandler;
+ id<IFResourceProgressHandler> downloadProgressHandler;
id<IFWebControllerPolicyHandler> policyHandler;
BOOL openedByScript;
}
diff --git a/WebKit/WebView.subproj/WebControllerPrivate.m b/WebKit/WebView.subproj/WebControllerPrivate.m
index 8403a94..e4f7159 100644
--- a/WebKit/WebView.subproj/WebControllerPrivate.m
+++ b/WebKit/WebView.subproj/WebControllerPrivate.m
@@ -106,7 +106,6 @@
- (void)_mainReceivedProgress: (IFLoadProgress *)progress forResourceHandle: (IFURLHandle *)resourceHandle fromDataSource: (IFWebDataSource *)dataSource complete: (BOOL)isComplete
{
IFWebFrame *frame = [dataSource webFrame];
- IFContentPolicy contentPolicy = [dataSource contentPolicy];
WEBKIT_ASSERT (dataSource != nil);
@@ -123,11 +122,6 @@
[[self resourceProgressHandler] receivedProgress: progress forResourceHandle: resourceHandle
fromDataSource: dataSource complete:isComplete];
-
- if(isComplete){
- if(contentPolicy == IFContentPolicySaveAndOpenExternally || contentPolicy == IFContentPolicySave)
- [dataSource _setPrimaryLoadComplete: YES];
- }
// The frame may be nil if a previously cancelled load is still making progress callbacks.
if (frame == nil)
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.h b/WebKit/WebView.subproj/WebMainResourceClient.h
index 9600b7f..420fa25 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.h
+++ b/WebKit/WebView.subproj/WebMainResourceClient.h
@@ -8,11 +8,13 @@
#import <WebKit/IFLocationChangeHandler.h>
+#import <WebKit/IFWebControllerPolicyHandler.h>
#import <WebFoundation/IFURLHandle.h>
@class IFDownloadHandler;
@class IFWebDataSource;
@protocol IFURLHandleClient;
+ at protocol IFResourceProgressHandler;
@interface IFMainURLHandleClient : NSObject <IFURLHandleClient>
{
@@ -21,6 +23,7 @@
BOOL processedBufferedData;
BOOL isFirstChunk;
IFDownloadHandler *downloadHandler;
+ id <IFResourceProgressHandler> downloadProgressHandler;
}
- initWithDataSource: (IFWebDataSource *)ds;
- (IFDownloadHandler *) downloadHandler;
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.m b/WebKit/WebView.subproj/WebMainResourceClient.m
index 909481a..4e1a20c 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.m
+++ b/WebKit/WebView.subproj/WebMainResourceClient.m
@@ -41,6 +41,7 @@
- (void)dealloc
{
WEBKIT_ASSERT(url == nil);
+ [downloadProgressHandler release];
[dataSource release];
[super dealloc];
}
@@ -50,6 +51,40 @@
return downloadHandler;
}
+- (void)_receivedProgress: (IFLoadProgress *)progress forResourceHandle: (IFURLHandle *)resourceHandle fromDataSource: (IFWebDataSource *)theDataSource complete: (BOOL)isComplete
+{
+ if([dataSource contentPolicy] == IFContentPolicySaveAndOpenExternally || [dataSource contentPolicy] == IFContentPolicySave){
+ if(isComplete)
+ [dataSource _setPrimaryLoadComplete: YES];
+
+ if (progress->bytesSoFar == -1 && progress->totalToLoad == -1){
+ IFError *error = [[IFError alloc] initWithErrorCode: IFURLHandleResultCancelled
+ inDomain:IFErrorCodeDomainWebFoundation failingURL: [dataSource inputURL]];
+ [dataSource _setMainDocumentError: error];
+ [downloadProgressHandler receivedError: error forResourceHandle: resourceHandle partialProgress: progress fromDataSource: dataSource];
+ [error release];
+ }
+
+ [downloadProgressHandler receivedProgress:progress forResourceHandle:resourceHandle
+ fromDataSource:theDataSource complete:isComplete];
+ }else{
+ [[dataSource controller] _mainReceivedProgress:progress forResourceHandle:resourceHandle
+ fromDataSource:theDataSource complete:isComplete];
+ }
+}
+
+- (void)_receivedError: (IFError *)error forResourceHandle: (IFURLHandle *)resourceHandle partialProgress: (IFLoadProgress *)progress fromDataSource: (IFWebDataSource *)theDataSource
+{
+ if([dataSource contentPolicy] == IFContentPolicySaveAndOpenExternally || [dataSource contentPolicy] == IFContentPolicySave){
+ [downloadProgressHandler receivedError:error forResourceHandle:resourceHandle
+ partialProgress:progress fromDataSource:theDataSource];
+ }else{
+ [[dataSource controller] _mainReceivedError:error forResourceHandle:resourceHandle
+ partialProgress:progress fromDataSource:theDataSource];
+ }
+}
+
+
- (void)IFURLHandleResourceDidBeginLoading:(IFURLHandle *)sender
{
WEBKITDEBUGLEVEL (WEBKIT_LOG_LOADING, "url = %s\n", DEBUG_OBJECT([sender url]));
@@ -67,9 +102,10 @@
WEBKIT_ASSERT([url isEqual:[sender redirectedURL] ? [sender redirectedURL] : [sender url]]);
- [[dataSource controller] _mainReceivedProgress:[IFLoadProgress progress]
- forResourceHandle:sender fromDataSource: dataSource complete: YES];
+ [self _receivedProgress:[IFLoadProgress progress] forResourceHandle:sender fromDataSource: dataSource complete: YES];
+
[[dataSource controller] _didStopLoading:url];
+
[url release];
url = nil;
@@ -84,7 +120,7 @@
WEBKIT_ASSERT([url isEqual:[sender redirectedURL] ? [sender redirectedURL] : [sender url]]);
- // Don't retain download data
+ // Don't retain data for downloaded files
if([dataSource contentPolicy] != IFContentPolicySave &&
[dataSource contentPolicy] != IFContentPolicySaveAndOpenExternally){
[dataSource _setResourceData:data];
@@ -96,13 +132,15 @@
// Either send a final error message or a final progress message.
IFError *nonTerminalError = [sender error];
if (nonTerminalError){
- [[dataSource controller] _mainReceivedError:nonTerminalError forResourceHandle:sender partialProgress:[IFLoadProgress progressWithURLHandle:sender] fromDataSource:dataSource];
+ [self _receivedError:nonTerminalError forResourceHandle:sender
+ partialProgress:[IFLoadProgress progressWithURLHandle:sender] fromDataSource:dataSource];
}
else {
// update progress
- [[dataSource controller] _mainReceivedProgress:[IFLoadProgress progressWithURLHandle:sender]
- forResourceHandle:sender fromDataSource:dataSource complete:YES];
+ [self _receivedProgress:[IFLoadProgress progressWithURLHandle:sender]
+ forResourceHandle:sender fromDataSource: dataSource complete: YES];
}
+
[[dataSource controller] _didStopLoading:url];
[url release];
@@ -120,7 +158,7 @@
NSString *contentType = [sender contentType];
IFWebFrame *frame = [dataSource webFrame];
IFWebView *view = [frame webView];
- IFContentPolicy contentPolicy;
+
NSData *data = nil;
WEBKITDEBUGLEVEL(WEBKIT_LOG_LOADING, "url = %s, data = %p, length %d\n", DEBUG_OBJECT([sender url]), incomingData, [incomingData length]);
@@ -142,7 +180,7 @@
WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "main content type: %s", DEBUG_OBJECT(contentType));
}
- contentPolicy = [dataSource contentPolicy];
+ IFContentPolicy contentPolicy = [dataSource contentPolicy];
if(contentPolicy != IFContentPolicyNone){
if(!processedBufferedData){
@@ -162,26 +200,31 @@
if(contentPolicy == IFContentPolicyShow){
[[dataSource representation] receivedData:data withDataSource:dataSource];
[[view documentView] dataSourceUpdated:dataSource];
-
- }else if(contentPolicy == IFContentPolicySave || contentPolicy == IFContentPolicySaveAndOpenExternally){
+ }
+ else if(contentPolicy == IFContentPolicySave || contentPolicy == IFContentPolicySaveAndOpenExternally){
if(!downloadHandler){
+ downloadProgressHandler = [[[dataSource controller] downloadProgressHandler] retain];
[frame->_private setProvisionalDataSource:nil];
[[dataSource _locationChangeHandler] locationChangeDone:nil forDataSource:dataSource];
downloadHandler = [[IFDownloadHandler alloc] initWithDataSource:dataSource];
}
[downloadHandler receivedData:data];
-
- }else if(contentPolicy == IFContentPolicyIgnore){
+ }
+ else if(contentPolicy == IFContentPolicyIgnore){
[sender cancelLoadInBackground];
- return;
+ [frame->_private setProvisionalDataSource:nil];
+ [[dataSource _locationChangeHandler] locationChangeDone:nil forDataSource:dataSource];
+ }
+ else{
+ [NSException raise:NSInvalidArgumentException format:
+ @"haveContentPolicy: andPath:path forDataSource: set an invalid content policy."];
}
- WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "%d of %d", [sender contentLengthReceived], [sender contentLength]);
-
- // update progress
- [[dataSource controller] _mainReceivedProgress:[IFLoadProgress progressWithURLHandle:sender]
- forResourceHandle:sender fromDataSource:dataSource complete: NO];
+ //update progress
+ [self _receivedProgress:[IFLoadProgress progressWithURLHandle:sender]
+ forResourceHandle:sender fromDataSource: dataSource complete: NO];
+ WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "%d of %d", [sender contentLengthReceived], [sender contentLength]);
isFirstChunk = NO;
}
@@ -192,7 +235,9 @@
WEBKIT_ASSERT([url isEqual:[sender redirectedURL] ? [sender redirectedURL] : [sender url]]);
- [[dataSource controller] _mainReceivedError:result forResourceHandle:sender partialProgress:[IFLoadProgress progressWithURLHandle:sender] fromDataSource:dataSource];
+ [self _receivedError:result forResourceHandle:sender
+ partialProgress:[IFLoadProgress progressWithURLHandle:sender] fromDataSource:dataSource];
+
[[dataSource controller] _didStopLoading:url];
[url release];
url = nil;
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.h b/WebKit/WebView.subproj/WebMainResourceLoader.h
index 9600b7f..420fa25 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.h
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.h
@@ -8,11 +8,13 @@
#import <WebKit/IFLocationChangeHandler.h>
+#import <WebKit/IFWebControllerPolicyHandler.h>
#import <WebFoundation/IFURLHandle.h>
@class IFDownloadHandler;
@class IFWebDataSource;
@protocol IFURLHandleClient;
+ at protocol IFResourceProgressHandler;
@interface IFMainURLHandleClient : NSObject <IFURLHandleClient>
{
@@ -21,6 +23,7 @@
BOOL processedBufferedData;
BOOL isFirstChunk;
IFDownloadHandler *downloadHandler;
+ id <IFResourceProgressHandler> downloadProgressHandler;
}
- initWithDataSource: (IFWebDataSource *)ds;
- (IFDownloadHandler *) downloadHandler;
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.m b/WebKit/WebView.subproj/WebMainResourceLoader.m
index 909481a..4e1a20c 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.m
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.m
@@ -41,6 +41,7 @@
- (void)dealloc
{
WEBKIT_ASSERT(url == nil);
+ [downloadProgressHandler release];
[dataSource release];
[super dealloc];
}
@@ -50,6 +51,40 @@
return downloadHandler;
}
+- (void)_receivedProgress: (IFLoadProgress *)progress forResourceHandle: (IFURLHandle *)resourceHandle fromDataSource: (IFWebDataSource *)theDataSource complete: (BOOL)isComplete
+{
+ if([dataSource contentPolicy] == IFContentPolicySaveAndOpenExternally || [dataSource contentPolicy] == IFContentPolicySave){
+ if(isComplete)
+ [dataSource _setPrimaryLoadComplete: YES];
+
+ if (progress->bytesSoFar == -1 && progress->totalToLoad == -1){
+ IFError *error = [[IFError alloc] initWithErrorCode: IFURLHandleResultCancelled
+ inDomain:IFErrorCodeDomainWebFoundation failingURL: [dataSource inputURL]];
+ [dataSource _setMainDocumentError: error];
+ [downloadProgressHandler receivedError: error forResourceHandle: resourceHandle partialProgress: progress fromDataSource: dataSource];
+ [error release];
+ }
+
+ [downloadProgressHandler receivedProgress:progress forResourceHandle:resourceHandle
+ fromDataSource:theDataSource complete:isComplete];
+ }else{
+ [[dataSource controller] _mainReceivedProgress:progress forResourceHandle:resourceHandle
+ fromDataSource:theDataSource complete:isComplete];
+ }
+}
+
+- (void)_receivedError: (IFError *)error forResourceHandle: (IFURLHandle *)resourceHandle partialProgress: (IFLoadProgress *)progress fromDataSource: (IFWebDataSource *)theDataSource
+{
+ if([dataSource contentPolicy] == IFContentPolicySaveAndOpenExternally || [dataSource contentPolicy] == IFContentPolicySave){
+ [downloadProgressHandler receivedError:error forResourceHandle:resourceHandle
+ partialProgress:progress fromDataSource:theDataSource];
+ }else{
+ [[dataSource controller] _mainReceivedError:error forResourceHandle:resourceHandle
+ partialProgress:progress fromDataSource:theDataSource];
+ }
+}
+
+
- (void)IFURLHandleResourceDidBeginLoading:(IFURLHandle *)sender
{
WEBKITDEBUGLEVEL (WEBKIT_LOG_LOADING, "url = %s\n", DEBUG_OBJECT([sender url]));
@@ -67,9 +102,10 @@
WEBKIT_ASSERT([url isEqual:[sender redirectedURL] ? [sender redirectedURL] : [sender url]]);
- [[dataSource controller] _mainReceivedProgress:[IFLoadProgress progress]
- forResourceHandle:sender fromDataSource: dataSource complete: YES];
+ [self _receivedProgress:[IFLoadProgress progress] forResourceHandle:sender fromDataSource: dataSource complete: YES];
+
[[dataSource controller] _didStopLoading:url];
+
[url release];
url = nil;
@@ -84,7 +120,7 @@
WEBKIT_ASSERT([url isEqual:[sender redirectedURL] ? [sender redirectedURL] : [sender url]]);
- // Don't retain download data
+ // Don't retain data for downloaded files
if([dataSource contentPolicy] != IFContentPolicySave &&
[dataSource contentPolicy] != IFContentPolicySaveAndOpenExternally){
[dataSource _setResourceData:data];
@@ -96,13 +132,15 @@
// Either send a final error message or a final progress message.
IFError *nonTerminalError = [sender error];
if (nonTerminalError){
- [[dataSource controller] _mainReceivedError:nonTerminalError forResourceHandle:sender partialProgress:[IFLoadProgress progressWithURLHandle:sender] fromDataSource:dataSource];
+ [self _receivedError:nonTerminalError forResourceHandle:sender
+ partialProgress:[IFLoadProgress progressWithURLHandle:sender] fromDataSource:dataSource];
}
else {
// update progress
- [[dataSource controller] _mainReceivedProgress:[IFLoadProgress progressWithURLHandle:sender]
- forResourceHandle:sender fromDataSource:dataSource complete:YES];
+ [self _receivedProgress:[IFLoadProgress progressWithURLHandle:sender]
+ forResourceHandle:sender fromDataSource: dataSource complete: YES];
}
+
[[dataSource controller] _didStopLoading:url];
[url release];
@@ -120,7 +158,7 @@
NSString *contentType = [sender contentType];
IFWebFrame *frame = [dataSource webFrame];
IFWebView *view = [frame webView];
- IFContentPolicy contentPolicy;
+
NSData *data = nil;
WEBKITDEBUGLEVEL(WEBKIT_LOG_LOADING, "url = %s, data = %p, length %d\n", DEBUG_OBJECT([sender url]), incomingData, [incomingData length]);
@@ -142,7 +180,7 @@
WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "main content type: %s", DEBUG_OBJECT(contentType));
}
- contentPolicy = [dataSource contentPolicy];
+ IFContentPolicy contentPolicy = [dataSource contentPolicy];
if(contentPolicy != IFContentPolicyNone){
if(!processedBufferedData){
@@ -162,26 +200,31 @@
if(contentPolicy == IFContentPolicyShow){
[[dataSource representation] receivedData:data withDataSource:dataSource];
[[view documentView] dataSourceUpdated:dataSource];
-
- }else if(contentPolicy == IFContentPolicySave || contentPolicy == IFContentPolicySaveAndOpenExternally){
+ }
+ else if(contentPolicy == IFContentPolicySave || contentPolicy == IFContentPolicySaveAndOpenExternally){
if(!downloadHandler){
+ downloadProgressHandler = [[[dataSource controller] downloadProgressHandler] retain];
[frame->_private setProvisionalDataSource:nil];
[[dataSource _locationChangeHandler] locationChangeDone:nil forDataSource:dataSource];
downloadHandler = [[IFDownloadHandler alloc] initWithDataSource:dataSource];
}
[downloadHandler receivedData:data];
-
- }else if(contentPolicy == IFContentPolicyIgnore){
+ }
+ else if(contentPolicy == IFContentPolicyIgnore){
[sender cancelLoadInBackground];
- return;
+ [frame->_private setProvisionalDataSource:nil];
+ [[dataSource _locationChangeHandler] locationChangeDone:nil forDataSource:dataSource];
+ }
+ else{
+ [NSException raise:NSInvalidArgumentException format:
+ @"haveContentPolicy: andPath:path forDataSource: set an invalid content policy."];
}
- WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "%d of %d", [sender contentLengthReceived], [sender contentLength]);
-
- // update progress
- [[dataSource controller] _mainReceivedProgress:[IFLoadProgress progressWithURLHandle:sender]
- forResourceHandle:sender fromDataSource:dataSource complete: NO];
+ //update progress
+ [self _receivedProgress:[IFLoadProgress progressWithURLHandle:sender]
+ forResourceHandle:sender fromDataSource: dataSource complete: NO];
+ WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "%d of %d", [sender contentLengthReceived], [sender contentLength]);
isFirstChunk = NO;
}
@@ -192,7 +235,9 @@
WEBKIT_ASSERT([url isEqual:[sender redirectedURL] ? [sender redirectedURL] : [sender url]]);
- [[dataSource controller] _mainReceivedError:result forResourceHandle:sender partialProgress:[IFLoadProgress progressWithURLHandle:sender] fromDataSource:dataSource];
+ [self _receivedError:result forResourceHandle:sender
+ partialProgress:[IFLoadProgress progressWithURLHandle:sender] fromDataSource:dataSource];
+
[[dataSource controller] _didStopLoading:url];
[url release];
url = nil;
diff --git a/WebKit/WebView.subproj/WebView.h b/WebKit/WebView.subproj/WebView.h
index 3f2711b..1b2d465 100644
--- a/WebKit/WebView.subproj/WebView.h
+++ b/WebKit/WebView.subproj/WebView.h
@@ -140,6 +140,9 @@
- (void)setResourceProgressHandler: (id<IFResourceProgressHandler>)handler;
- (id<IFResourceProgressHandler>)resourceProgressHandler;
+- (void)setDownloadProgressHandler: (id<IFResourceProgressHandler>)handler;
+- (id<IFResourceProgressHandler>)downloadProgressHandler;
+
+ (IFURLPolicy)defaultURLPolicyForURL: (NSURL *)url;
- (void)setPolicyHandler: (id<IFWebControllerPolicyHandler>)handler;
diff --git a/WebKit/WebView.subproj/WebView.m b/WebKit/WebView.subproj/WebView.m
index cfb9428..3d2a138 100644
--- a/WebKit/WebView.subproj/WebView.m
+++ b/WebKit/WebView.subproj/WebView.m
@@ -98,6 +98,19 @@
}
+- (void)setDownloadProgressHandler: (id<IFResourceProgressHandler>)handler
+{
+ [_private->downloadProgressHandler autorelease];
+ _private->downloadProgressHandler = [handler retain];
+}
+
+
+- (id<IFResourceProgressHandler>)downloadProgressHandler
+{
+ return _private->downloadProgressHandler;
+}
+
+
- (void)setPolicyHandler: (id<IFWebControllerPolicyHandler>)handler
{
[_private->policyHandler autorelease];
diff --git a/WebKit/WebView.subproj/WebViewPrivate.h b/WebKit/WebView.subproj/WebViewPrivate.h
index f4f8314..e1cfd80 100644
--- a/WebKit/WebView.subproj/WebViewPrivate.h
+++ b/WebKit/WebView.subproj/WebViewPrivate.h
@@ -14,6 +14,7 @@
IFWebFrame *mainFrame;
id<IFWindowContext> windowContext;
id<IFResourceProgressHandler> resourceProgressHandler;
+ id<IFResourceProgressHandler> downloadProgressHandler;
id<IFWebControllerPolicyHandler> policyHandler;
BOOL openedByScript;
}
diff --git a/WebKit/WebView.subproj/WebViewPrivate.m b/WebKit/WebView.subproj/WebViewPrivate.m
index 8403a94..e4f7159 100644
--- a/WebKit/WebView.subproj/WebViewPrivate.m
+++ b/WebKit/WebView.subproj/WebViewPrivate.m
@@ -106,7 +106,6 @@
- (void)_mainReceivedProgress: (IFLoadProgress *)progress forResourceHandle: (IFURLHandle *)resourceHandle fromDataSource: (IFWebDataSource *)dataSource complete: (BOOL)isComplete
{
IFWebFrame *frame = [dataSource webFrame];
- IFContentPolicy contentPolicy = [dataSource contentPolicy];
WEBKIT_ASSERT (dataSource != nil);
@@ -123,11 +122,6 @@
[[self resourceProgressHandler] receivedProgress: progress forResourceHandle: resourceHandle
fromDataSource: dataSource complete:isComplete];
-
- if(isComplete){
- if(contentPolicy == IFContentPolicySaveAndOpenExternally || contentPolicy == IFContentPolicySave)
- [dataSource _setPrimaryLoadComplete: YES];
- }
// The frame may be nil if a previously cancelled load is still making progress callbacks.
if (frame == nil)
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list