[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:37:56 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 6ab82d45519f9a18ce2f13921349a00d644d243e
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Sep 11 00:24:05 2002 +0000
WebFoundation:
initialize WebError class in all class methods
* Misc.subproj/WebError.m:
(+[WebError classInitialize]): added, calls classInitialize()
(-[WebError initWithErrorCode:inDomain:failingURL:isTerminal:]): call +classInitialize
(+[WebError addErrorsFromDictionary:]): call +classInitialize
WebKit:
Report download handler errors
Renamed error constants
Added new errors
* Misc.subproj/WebDownloadHandler.h:
* Misc.subproj/WebDownloadHandler.m:
(-[WebDownloadHandler errorWithCode:]): added
(-[WebDownloadHandler receivedData:]): return an error
(-[WebDownloadHandler finishedLoading]): return an error
(-[WebDownloadHandler cancel]): return an error
* Misc.subproj/WebKitErrors.h: added new errors
* WebView.subproj/WebFramePrivate.m:
(-[WebFrame _shouldShowURL:]): use renamed error constants
* WebView.subproj/WebMainResourceClient.h:
* WebView.subproj/WebMainResourceClient.m:
(-[WebMainResourceClient receivedError:forHandle:]): don't send an error when errors are suppressed
(-[WebMainResourceClient didCancelWithHandle:]): report download handler errors
(-[WebMainResourceClient handleDidFinishLoading:]): report download handler errors
(-[WebMainResourceClient handleDidReceiveData:data:]): report download handler errors
(-[WebMainResourceClient handleDidFailLoading:withError:]): report download handler errors
* WebView.subproj/WebView.m:
(+[WebView initialize]): add new errors to WebError
WebBrowser:
Renamed error constants
* BrowserWebController.m:
(-[BrowserWebController unableToImplementPolicy:error:forURL:inFrame:]): use renamed error constants
* DownloadMonitor.m:
(-[DownloadMonitor _monitorDownload:withProgress:error:dataSource:complete:]): clean-up
* DownloadProgressEntry.m:
(-[DownloadProgressEntry setError:]): handle errors in succession
(-[DownloadProgressEntry setProgress:]): handle errors in succession
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2025 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 69a7cd3..3307be5 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,28 @@
+2002-09-10 Chris Blumenberg <cblu at apple.com>
+
+ Report download handler errors
+ Renamed error constants
+ Added new errors
+
+ * Misc.subproj/WebDownloadHandler.h:
+ * Misc.subproj/WebDownloadHandler.m:
+ (-[WebDownloadHandler errorWithCode:]): added
+ (-[WebDownloadHandler receivedData:]): return an error
+ (-[WebDownloadHandler finishedLoading]): return an error
+ (-[WebDownloadHandler cancel]): return an error
+ * Misc.subproj/WebKitErrors.h: added new errors
+ * WebView.subproj/WebFramePrivate.m:
+ (-[WebFrame _shouldShowURL:]): use renamed error constants
+ * WebView.subproj/WebMainResourceClient.h:
+ * WebView.subproj/WebMainResourceClient.m:
+ (-[WebMainResourceClient receivedError:forHandle:]): don't send an error when errors are suppressed
+ (-[WebMainResourceClient didCancelWithHandle:]): report download handler errors
+ (-[WebMainResourceClient handleDidFinishLoading:]): report download handler errors
+ (-[WebMainResourceClient handleDidReceiveData:data:]): report download handler errors
+ (-[WebMainResourceClient handleDidFailLoading:withError:]): report download handler errors
+ * WebView.subproj/WebView.m:
+ (+[WebView initialize]): add new errors to WebError
+
2002-09-10 John Sullivan <sullivan at apple.com>
* History.subproj/WebHistoryPrivate.m:
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 69a7cd3..3307be5 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,28 @@
+2002-09-10 Chris Blumenberg <cblu at apple.com>
+
+ Report download handler errors
+ Renamed error constants
+ Added new errors
+
+ * Misc.subproj/WebDownloadHandler.h:
+ * Misc.subproj/WebDownloadHandler.m:
+ (-[WebDownloadHandler errorWithCode:]): added
+ (-[WebDownloadHandler receivedData:]): return an error
+ (-[WebDownloadHandler finishedLoading]): return an error
+ (-[WebDownloadHandler cancel]): return an error
+ * Misc.subproj/WebKitErrors.h: added new errors
+ * WebView.subproj/WebFramePrivate.m:
+ (-[WebFrame _shouldShowURL:]): use renamed error constants
+ * WebView.subproj/WebMainResourceClient.h:
+ * WebView.subproj/WebMainResourceClient.m:
+ (-[WebMainResourceClient receivedError:forHandle:]): don't send an error when errors are suppressed
+ (-[WebMainResourceClient didCancelWithHandle:]): report download handler errors
+ (-[WebMainResourceClient handleDidFinishLoading:]): report download handler errors
+ (-[WebMainResourceClient handleDidReceiveData:data:]): report download handler errors
+ (-[WebMainResourceClient handleDidFailLoading:withError:]): report download handler errors
+ * WebView.subproj/WebView.m:
+ (+[WebView initialize]): add new errors to WebError
+
2002-09-10 John Sullivan <sullivan at apple.com>
* History.subproj/WebHistoryPrivate.m:
diff --git a/WebKit/Misc.subproj/WebDownloadHandler.h b/WebKit/Misc.subproj/WebDownloadHandler.h
index fefa820..ba1b434 100644
--- a/WebKit/Misc.subproj/WebDownloadHandler.h
+++ b/WebKit/Misc.subproj/WebDownloadHandler.h
@@ -9,6 +9,7 @@
#import <Foundation/Foundation.h>
@class WebDataSource;
+ at class WebError;
@interface WebDownloadHandler : NSObject
{
@@ -17,7 +18,7 @@
}
- initWithDataSource:(WebDataSource *)dSource;
-- (void)receivedData:(NSData *)data;
-- (void)finishedLoading;
-- (void)cancel;
+- (WebError *)receivedData:(NSData *)data;
+- (WebError *)finishedLoading;
+- (WebError *)cancel;
@end
diff --git a/WebKit/Misc.subproj/WebDownloadHandler.m b/WebKit/Misc.subproj/WebDownloadHandler.m
index f217541..9a5daeb 100644
--- a/WebKit/Misc.subproj/WebDownloadHandler.m
+++ b/WebKit/Misc.subproj/WebDownloadHandler.m
@@ -6,12 +6,14 @@
// Copyright (c) 2002 Apple Computer, Inc.
//
-#import <WebKit/WebDownloadHandler.h>
-
#import <WebKit/WebControllerPolicyHandlerPrivate.h>
#import <WebKit/WebDataSourcePrivate.h>
+#import <WebKit/WebDownloadHandler.h>
+#import <WebKit/WebKitErrors.h>
#import <WebKit/WebKitLogging.h>
+#import <WebFoundation/WebFoundation.h>
+
@implementation WebDownloadHandler
- initWithDataSource:(WebDataSource *)dSource
@@ -31,7 +33,12 @@
[super dealloc];
}
-- (void)receivedData:(NSData *)data
+- (WebError *)errorWithCode:(int)code
+{
+ return [WebError errorWithCode:code inDomain:WebErrorDomainWebKit failingURL:[[dataSource URL] absoluteString]];
+}
+
+- (WebError *)receivedData:(NSData *)data
{
NSString *path = [[dataSource contentPolicy] path];
NSString *pathWithoutExtension, *newPathWithoutExtension, *extension;
@@ -57,42 +64,52 @@
}
if(![fileManager createFileAtPath:path contents:nil attributes:nil]){
- [dataSource stopLoading];
- // FIXME: send error
- return;
+ return [self errorWithCode:WebErrorCannotCreateFile];
}
fileHandle = [[NSFileHandle fileHandleForWritingAtPath:path] retain];
+ if(!fileHandle){
+ return [self errorWithCode:WebErrorCannotOpenFile];
+ }
workspace = [NSWorkspace sharedWorkspace];
[workspace noteFileSystemChanged:path];
}
[fileHandle writeData:data];
+
+ return nil;
}
-- (void)finishedLoading
+- (WebError *)finishedLoading
{
NSString *path = [[dataSource contentPolicy] path];
- NSWorkspace *workspace = [NSWorkspace sharedWorkspace];
[fileHandle closeFile];
+
LOG(Download, "Download complete. Saved to: %s", [path cString]);
if([[dataSource contentPolicy] policyAction] == WebContentPolicySaveAndOpenExternally){
- [workspace openFile:path];
+ if(![[NSWorkspace sharedWorkspace] openFile:path]){
+ return [self errorWithCode:WebErrorCannotFindApplicationForFile];
+ }
}
+
+ return nil;
}
-- (void)cancel
+- (WebError *)cancel
{
- NSFileManager *fileManager = [NSFileManager defaultManager];
- NSWorkspace *workspace = [NSWorkspace sharedWorkspace];
NSString *path = [[dataSource contentPolicy] path];
[fileHandle closeFile];
- [fileManager removeFileAtPath:path handler:nil];
- [workspace noteFileSystemChanged:path];
+ if(![[NSFileManager defaultManager] removeFileAtPath:path handler:nil]){
+ return [self errorWithCode:WebErrorCannotRemoveFile];
+ }else{
+ [[NSWorkspace sharedWorkspace] noteFileSystemChanged:path];
+ }
+
+ return nil;
}
diff --git a/WebKit/Misc.subproj/WebKitErrors.h b/WebKit/Misc.subproj/WebKitErrors.h
index 4f5fdc1..33ff709 100644
--- a/WebKit/Misc.subproj/WebKitErrors.h
+++ b/WebKit/Misc.subproj/WebKitErrors.h
@@ -7,28 +7,44 @@
typedef enum {
WebErrorNoError = 0,
- WebErrorCannotShowMIMEType = 10000,
- WebErrorFileDoesNotExist = 10001,
- WebErrorCouldNotFindApplicationForFile = 10002,
- WebErrorCouldNotFindApplicationForURL = 10003,
- WebErrorFileNotReadable = 10004,
- WebErrorFinderCouldNotOpenDirectory = 10005,
- WebErrorCannotShowDirectory = 10006,
- WebErrorCannotShowURL = 10007,
+ WebErrorCannotFindFile = 10000,
+ WebErrorCannotCreateFile = 10001,
+ WebErrorCannotOpenFile = 10002,
+ WebErrorCannotReadFile = 10003,
+ WebErrorCannotWriteToFile = 10004,
+ WebErrorCannotRemoveFile = 10005,
+ WebErrorCannotFindApplicationForFile = 10006,
+ WebErrorFinderCannotOpenDirectory = 10007,
+ WebErrorCannotShowDirectory = 10008,
+ WebErrorCannotShowMIMEType = 10009,
+ WebErrorCannotShowURL = 10010,
+ WebErrorCannotNotFindApplicationForURL = 10011
} WebErrorCode;
-#define WebErrorDescriptionCannotShowMIMEType NSLocalizedStringFromTable (@"Can't show content with specified mime type", @"WebError", @"WebErrorCannotShowMIMEType description")
+#define WebErrorDescriptionCannotFindFile NSLocalizedStringFromTable (@"Cannot find file", @"WebError", @"WebErrorCannotFindFile description")
-#define WebErrorDescriptionCouldNotFindApplicationForFile NSLocalizedStringFromTable (@"Could not find application for specified file", @"WebError", @"WebErrorCouldNotFindApplicationForFile description")
+#define WebErrorDescriptionCannotCreateFile NSLocalizedStringFromTable (@"Cannot create file", @"WebError", @"WebErrorCannotCreateFile description")
+
+#define WebErrorDescriptionCannotOpenFile NSLocalizedStringFromTable (@"Cannot open file", @"WebError", @"WebErrorCannotOpenFile description")
+
+#define WebErrorDescriptionCannotReadFile NSLocalizedStringFromTable (@"Cannot read file", @"WebError", @"WebErrorCannotReadFile description")
+
+#define WebErrorDescriptionCannotWriteToFile NSLocalizedStringFromTable (@"Cannot write file", @"WebError", @"WebErrorCannotWriteToFile description")
+
+#define WebErrorDescriptionCannotRemoveFile NSLocalizedStringFromTable (@"Cannot remove file", @"WebError", @"WebErrorCannotRemoveFile description")
+
+#define WebErrorDescriptionCannotFindApplicationForFile NSLocalizedStringFromTable (@"Cannot find application for file", @"WebError", @"WebErrorCannotFindApplicationForFile description")
+
+#define WebErrorDescriptionFinderCannotOpenDirectory NSLocalizedStringFromTable (@"Finder cannot open directory", @"WebError", @"WebErrorFinderCannotOpenDirectory description")
+
+#define WebErrorDescriptionCannotShowDirectory NSLocalizedStringFromTable (@"Cannot show a file directory", @"WebError", @"WebErrorCannotShowDirectory description")
+
+#define WebErrorDescriptionCannotShowMIMEType NSLocalizedStringFromTable (@"Cannot show content with specified mime type", @"WebError", @"WebErrorCannotShowMIMEType description")
+
+#define WebErrorDescriptionCannotShowURL NSLocalizedStringFromTable (@"Cannot show URL", @"WebError", @"WebErrorCannotShowURL description")
+
+#define WebErrorDescriptionCannotFindApplicationForURL NSLocalizedStringFromTable (@"Cannot find application for URL", @"WebError", @"WebErrorCannotNotFindApplicationForURL description")
-#define WebErrorDescriptionCouldNotFindApplicationForURL NSLocalizedStringFromTable (@"Could not find application for specified URL", @"WebError", @"WebErrorCouldNotFindApplicationForURL description")
-#define WebErrorDescriptionFileDoesNotExist NSLocalizedStringFromTable (@"Could not find file", @"WebError", @"WebErrorFileDoesNotExist description")
-
-#define WebErrorDescriptionFileNotReadable NSLocalizedStringFromTable (@"Could not read file", @"WebError", @"WebErrorFileNotReadable description")
-#define WebErrorDescriptionFinderCouldNotOpenDirectory NSLocalizedStringFromTable (@"Finder could not open directory", @"WebError", @"WebErrorFinderCouldNotOpenDirectory description")
-
-#define WebErrorDescriptionCannotShowDirectory NSLocalizedStringFromTable (@"Can't show a file directory", @"WebError", @"WebErrorCannotShowDirectory description")
-#define WebErrorDescriptionCannotShowURL NSLocalizedStringFromTable (@"Can't show the specified URL", @"WebError", @"WebErrorCannotShowURL description")
\ No newline at end of file
diff --git a/WebKit/WebView.subproj/WebFramePrivate.m b/WebKit/WebView.subproj/WebFramePrivate.m
index 9135448..0dbbbe8 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.m
+++ b/WebKit/WebView.subproj/WebFramePrivate.m
@@ -568,7 +568,7 @@ static const char * const stateNames[] = {
case WebURLPolicyOpenExternally:
if(![[NSWorkspace sharedWorkspace] openURL:URL]){
- [self handleUnimplementablePolicy:URLPolicy errorCode:WebErrorCouldNotFindApplicationForURL forURL:URL];
+ [self handleUnimplementablePolicy:URLPolicy errorCode:WebErrorCannotNotFindApplicationForURL forURL:URL];
}
return NO;
@@ -593,12 +593,12 @@ static const char * const stateNames[] = {
return NO;
if(!fileExists){
- [self handleUnimplementablePolicy:fileURLPolicy errorCode:WebErrorFileDoesNotExist forURL:URL];
+ [self handleUnimplementablePolicy:fileURLPolicy errorCode:WebErrorCannotFindFile forURL:URL];
return NO;
}
if(![fileManager isReadableFileAtPath:path]){
- [self handleUnimplementablePolicy:fileURLPolicy errorCode:WebErrorFileNotReadable forURL:URL];
+ [self handleUnimplementablePolicy:fileURLPolicy errorCode:WebErrorCannotReadFile forURL:URL];
return NO;
}
@@ -615,13 +615,13 @@ static const char * const stateNames[] = {
case WebFileURLPolicyOpenExternally:
if(![[NSWorkspace sharedWorkspace] openFile:path]){
- [self handleUnimplementablePolicy:fileURLPolicy errorCode:WebErrorCouldNotFindApplicationForFile forURL:URL];
+ [self handleUnimplementablePolicy:fileURLPolicy errorCode:WebErrorCannotFindApplicationForFile forURL:URL];
}
return NO;
case WebFileURLPolicyRevealInFinder:
if(![[NSWorkspace sharedWorkspace] selectFile:path inFileViewerRootedAtPath:@""]){
- [self handleUnimplementablePolicy:fileURLPolicy errorCode:WebErrorFinderCouldNotOpenDirectory forURL:URL];
+ [self handleUnimplementablePolicy:fileURLPolicy errorCode:WebErrorFinderCannotOpenDirectory forURL:URL];
}
return NO;
diff --git a/WebKit/WebView.subproj/WebFrameView.m b/WebKit/WebView.subproj/WebFrameView.m
index 2269875..d36f244 100644
--- a/WebKit/WebView.subproj/WebFrameView.m
+++ b/WebKit/WebView.subproj/WebFrameView.m
@@ -35,15 +35,18 @@ enum {
+ (void)initialize
{
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
-
- WebErrorDescriptionCannotShowMIMEType, [NSNumber numberWithInt: WebErrorCannotShowMIMEType],
- WebErrorDescriptionCouldNotFindApplicationForFile, [NSNumber numberWithInt: WebErrorCouldNotFindApplicationForFile],
- WebErrorDescriptionCouldNotFindApplicationForURL, [NSNumber numberWithInt: WebErrorCouldNotFindApplicationForURL],
- WebErrorDescriptionFileDoesNotExist, [NSNumber numberWithInt: WebErrorFileDoesNotExist],
- WebErrorDescriptionFileNotReadable, [NSNumber numberWithInt: WebErrorFileNotReadable],
- WebErrorDescriptionFinderCouldNotOpenDirectory, [NSNumber numberWithInt: WebErrorFinderCouldNotOpenDirectory],
- WebErrorDescriptionCannotShowDirectory, [NSNumber numberWithInt: WebErrorCannotShowDirectory],
- WebErrorDescriptionCannotShowURL, [NSNumber numberWithInt: WebErrorCannotShowURL],
+ WebErrorDescriptionCannotFindFile, [NSNumber numberWithInt: WebErrorCannotFindFile],
+ WebErrorDescriptionCannotCreateFile, [NSNumber numberWithInt: WebErrorCannotCreateFile],
+ WebErrorDescriptionCannotOpenFile, [NSNumber numberWithInt: WebErrorCannotOpenFile],
+ WebErrorDescriptionCannotReadFile, [NSNumber numberWithInt: WebErrorCannotReadFile],
+ WebErrorDescriptionCannotWriteToFile, [NSNumber numberWithInt: WebErrorCannotWriteToFile],
+ WebErrorDescriptionCannotRemoveFile, [NSNumber numberWithInt: WebErrorCannotRemoveFile],
+ WebErrorDescriptionCannotFindApplicationForFile, [NSNumber numberWithInt: WebErrorCannotFindApplicationForFile],
+ WebErrorDescriptionFinderCannotOpenDirectory, [NSNumber numberWithInt: WebErrorFinderCannotOpenDirectory],
+ WebErrorDescriptionCannotShowDirectory, [NSNumber numberWithInt: WebErrorCannotShowDirectory],
+ WebErrorDescriptionCannotShowMIMEType, [NSNumber numberWithInt: WebErrorCannotShowMIMEType],
+ WebErrorDescriptionCannotShowURL, [NSNumber numberWithInt: WebErrorCannotShowURL],
+ WebErrorDescriptionCannotFindApplicationForURL, [NSNumber numberWithInt: WebErrorCannotNotFindApplicationForURL],
nil];
[WebError addErrorsFromDictionary:dict];
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.h b/WebKit/WebView.subproj/WebMainResourceClient.h
index 8a38769..33ceccf 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.h
+++ b/WebKit/WebView.subproj/WebMainResourceClient.h
@@ -21,6 +21,7 @@
NSURL *currentURL;
WebDataSource *dataSource;
BOOL isFirstChunk;
+ BOOL suppressErrors;
WebDownloadHandler *downloadHandler;
id <WebResourceProgressHandler> downloadProgressHandler;
WebContentAction policyAction;
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.m b/WebKit/WebView.subproj/WebMainResourceClient.m
index 5db3351..076640b 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.m
+++ b/WebKit/WebView.subproj/WebMainResourceClient.m
@@ -96,6 +96,10 @@
- (void)receivedError:(WebError *)error forHandle:(WebResourceHandle *)handle
{
+ if(suppressErrors){
+ return;
+ }
+
WebLoadProgress *progress = [WebLoadProgress progressWithResourceHandle:handle];
WebContentAction contentAction = [[dataSource contentPolicy] policyAction];
@@ -126,15 +130,22 @@
[self retain];
// FIXME: Maybe we should be passing the URL from the handle here, not from the dataSource.
- WebError *error = [[WebError alloc] initWithErrorCode:WebResultCancelled
- inDomain:WebErrorDomainWebFoundation failingURL:[[dataSource originalURL] absoluteString]];
+ WebError *error = [WebError errorWithCode:WebResultCancelled
+ inDomain:WebErrorDomainWebFoundation
+ failingURL:[[dataSource originalURL] absoluteString]];
+
[self receivedError:error forHandle:handle];
[error release];
-
- [downloadHandler cancel];
- [downloadHandler release];
- downloadHandler = nil;
+ if(downloadHandler){
+ WebError *downloadError = [downloadHandler cancel];
+ if(downloadError){
+ [self receivedError:downloadError forHandle:handle];
+ }
+ [downloadHandler release];
+ downloadHandler = nil;
+ }
+
[self didStopLoading];
[self release];
@@ -168,10 +179,15 @@
} else {
[self receivedProgressWithHandle:handle complete:YES];
}
-
- [downloadHandler finishedLoading];
- [downloadHandler release];
- downloadHandler = nil;
+
+ if(downloadHandler){
+ WebError *downloadError = [downloadHandler finishedLoading];
+ if(downloadError){
+ [self receivedError:downloadError forHandle:handle];
+ }
+ [downloadHandler release];
+ downloadHandler = nil;
+ }
[self didStopLoading];
@@ -183,6 +199,7 @@
WebController *controller = [dataSource controller];
NSString *contentType = [[handle response] contentType];
WebFrame *frame = [dataSource webFrame];
+ WebError *downloadError = nil;
LOG(Loading, "URL = %@, data = %p, length %d", [handle URL], data, [data length]);
@@ -205,7 +222,7 @@
WebContentPolicy *contentPolicy = [dataSource contentPolicy];
if(contentPolicy == nil){
- contentPolicy = [[controller policyHandler] contentPolicyForMIMEType: contentType URL:currentURL inFrame:frame];
+ contentPolicy = [[controller policyHandler] contentPolicyForMIMEType:contentType URL:currentURL inFrame:frame];
[dataSource _setContentPolicy:contentPolicy];
}
policyAction = [contentPolicy policyAction];
@@ -226,7 +243,7 @@
[[[dataSource controller] locationChangeHandler] locationChangeDone:nil forDataSource:dataSource];
downloadHandler = [[WebDownloadHandler alloc] initWithDataSource:dataSource];
}
- [downloadHandler receivedData:data];
+ downloadError = [downloadHandler receivedData:data];
break;
case WebContentPolicyIgnore:
[handle cancelLoadInBackground];
@@ -239,6 +256,15 @@
}
[self receivedProgressWithHandle:handle complete:NO];
+
+ if(downloadError){
+ [self receivedError:downloadError forHandle:handle];
+
+ // Supress errors because we don't want to confuse the client with
+ // the cancel error that will follow after cancelLoadInBackground.
+ suppressErrors = YES;
+ [handle cancelLoadInBackground];
+ }
LOG(Download, "%d of %d", [[handle response] contentLengthReceived], [[handle response] contentLength]);
isFirstChunk = NO;
@@ -254,10 +280,15 @@
[self retain];
[self receivedError:result forHandle:handle];
-
- [downloadHandler cancel];
- [downloadHandler release];
- downloadHandler = nil;
+
+ if(downloadHandler){
+ WebError *downloadError = [downloadHandler cancel];
+ if(downloadError){
+ [self receivedError:downloadError forHandle:handle];
+ }
+ [downloadHandler release];
+ downloadHandler = nil;
+ }
[self didStopLoading];
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.h b/WebKit/WebView.subproj/WebMainResourceLoader.h
index 8a38769..33ceccf 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.h
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.h
@@ -21,6 +21,7 @@
NSURL *currentURL;
WebDataSource *dataSource;
BOOL isFirstChunk;
+ BOOL suppressErrors;
WebDownloadHandler *downloadHandler;
id <WebResourceProgressHandler> downloadProgressHandler;
WebContentAction policyAction;
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.m b/WebKit/WebView.subproj/WebMainResourceLoader.m
index 5db3351..076640b 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.m
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.m
@@ -96,6 +96,10 @@
- (void)receivedError:(WebError *)error forHandle:(WebResourceHandle *)handle
{
+ if(suppressErrors){
+ return;
+ }
+
WebLoadProgress *progress = [WebLoadProgress progressWithResourceHandle:handle];
WebContentAction contentAction = [[dataSource contentPolicy] policyAction];
@@ -126,15 +130,22 @@
[self retain];
// FIXME: Maybe we should be passing the URL from the handle here, not from the dataSource.
- WebError *error = [[WebError alloc] initWithErrorCode:WebResultCancelled
- inDomain:WebErrorDomainWebFoundation failingURL:[[dataSource originalURL] absoluteString]];
+ WebError *error = [WebError errorWithCode:WebResultCancelled
+ inDomain:WebErrorDomainWebFoundation
+ failingURL:[[dataSource originalURL] absoluteString]];
+
[self receivedError:error forHandle:handle];
[error release];
-
- [downloadHandler cancel];
- [downloadHandler release];
- downloadHandler = nil;
+ if(downloadHandler){
+ WebError *downloadError = [downloadHandler cancel];
+ if(downloadError){
+ [self receivedError:downloadError forHandle:handle];
+ }
+ [downloadHandler release];
+ downloadHandler = nil;
+ }
+
[self didStopLoading];
[self release];
@@ -168,10 +179,15 @@
} else {
[self receivedProgressWithHandle:handle complete:YES];
}
-
- [downloadHandler finishedLoading];
- [downloadHandler release];
- downloadHandler = nil;
+
+ if(downloadHandler){
+ WebError *downloadError = [downloadHandler finishedLoading];
+ if(downloadError){
+ [self receivedError:downloadError forHandle:handle];
+ }
+ [downloadHandler release];
+ downloadHandler = nil;
+ }
[self didStopLoading];
@@ -183,6 +199,7 @@
WebController *controller = [dataSource controller];
NSString *contentType = [[handle response] contentType];
WebFrame *frame = [dataSource webFrame];
+ WebError *downloadError = nil;
LOG(Loading, "URL = %@, data = %p, length %d", [handle URL], data, [data length]);
@@ -205,7 +222,7 @@
WebContentPolicy *contentPolicy = [dataSource contentPolicy];
if(contentPolicy == nil){
- contentPolicy = [[controller policyHandler] contentPolicyForMIMEType: contentType URL:currentURL inFrame:frame];
+ contentPolicy = [[controller policyHandler] contentPolicyForMIMEType:contentType URL:currentURL inFrame:frame];
[dataSource _setContentPolicy:contentPolicy];
}
policyAction = [contentPolicy policyAction];
@@ -226,7 +243,7 @@
[[[dataSource controller] locationChangeHandler] locationChangeDone:nil forDataSource:dataSource];
downloadHandler = [[WebDownloadHandler alloc] initWithDataSource:dataSource];
}
- [downloadHandler receivedData:data];
+ downloadError = [downloadHandler receivedData:data];
break;
case WebContentPolicyIgnore:
[handle cancelLoadInBackground];
@@ -239,6 +256,15 @@
}
[self receivedProgressWithHandle:handle complete:NO];
+
+ if(downloadError){
+ [self receivedError:downloadError forHandle:handle];
+
+ // Supress errors because we don't want to confuse the client with
+ // the cancel error that will follow after cancelLoadInBackground.
+ suppressErrors = YES;
+ [handle cancelLoadInBackground];
+ }
LOG(Download, "%d of %d", [[handle response] contentLengthReceived], [[handle response] contentLength]);
isFirstChunk = NO;
@@ -254,10 +280,15 @@
[self retain];
[self receivedError:result forHandle:handle];
-
- [downloadHandler cancel];
- [downloadHandler release];
- downloadHandler = nil;
+
+ if(downloadHandler){
+ WebError *downloadError = [downloadHandler cancel];
+ if(downloadError){
+ [self receivedError:downloadError forHandle:handle];
+ }
+ [downloadHandler release];
+ downloadHandler = nil;
+ }
[self didStopLoading];
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list