[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 07:28:40 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 70cd5dc2335d76bef7690ff22c473a8f3cbe1ccb
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Mar 10 18:37:12 2003 +0000
Fixed some download-related leaks. Primarily, we were leaking the data source that started the download. The data source is now immediately released when it becomes a download.
Reviewed by darin.
* Downloads.subproj/WebDownload.m:
(-[WebDownloadPrivate dealloc]): release the WebResourceDelegateProxy
(-[WebDownload _initWithLoadingResource:request:response:delegate:proxy:]): renamed, don't pass a datasource so WebDownload is completely disconnected from the that. Pass the proxy so it transfers ownership from WebMainResourceClient and it doesn't leak when we cancel a download.
(-[WebDownload _setRequest:]): added
(-[WebDownload _setResponse:]): added
(-[WebDownload resource:willSendRequest:]): call _setRequest
(-[WebDownload resource:didReceiveResponse:]): call _setResponse
* Downloads.subproj/WebDownloadPrivate.h:
* WebView.subproj/WebBaseResourceHandleDelegate.h:
* WebView.subproj/WebBaseResourceHandleDelegate.m: removed notifyDelegatesOfInterruptionByPolicyChange, no longer called
* WebView.subproj/WebMainResourceClient.h: made WebResourceDelegateProxy available to other classes
* WebView.subproj/WebMainResourceClient.m:
(-[WebMainResourceClient receivedError:]): moved most error handling code here
(-[WebMainResourceClient cancel]): stop load, call receivedError
(-[WebMainResourceClient interruptForPolicyChange]): renamed, call receivedError with the policy interrupt error
(-[WebMainResourceClient stopLoadingForPolicyChange]): call interruptForPolicyChange
(-[WebMainResourceClient continueAfterContentPolicy:response:]): for WebPolicySave, create the download, call interruptForPolicyChange and return so the response isn't set on the superclass.
(-[WebMainResourceClient resource:didFailLoadingWithError:]): call receivedError
(-[WebResourceDelegateProxy setDelegate:]): don't retain the delegate
(-[WebResourceDelegateProxy resourceDidFinishLoading:]): don't release the delegate
(-[WebResourceDelegateProxy resource:didFailLoadingWithError:]): don't release the delegate
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3790 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index a1502b1..6a1f0a0 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,31 @@
+2003-03-10 Chris Blumenberg <cblu at apple.com>
+
+ Fixed some download-related leaks. Primarily, we were leaking the data source that started the download. The data source is now immediately released when it becomes a download.
+
+ Reviewed by darin.
+
+ * Downloads.subproj/WebDownload.m:
+ (-[WebDownloadPrivate dealloc]): release the WebResourceDelegateProxy
+ (-[WebDownload _initWithLoadingResource:request:response:delegate:proxy:]): renamed, don't pass a datasource so WebDownload is completely disconnected from the that. Pass the proxy so it transfers ownership from WebMainResourceClient and it doesn't leak when we cancel a download.
+ (-[WebDownload _setRequest:]): added
+ (-[WebDownload _setResponse:]): added
+ (-[WebDownload resource:willSendRequest:]): call _setRequest
+ (-[WebDownload resource:didReceiveResponse:]): call _setResponse
+ * Downloads.subproj/WebDownloadPrivate.h:
+ * WebView.subproj/WebBaseResourceHandleDelegate.h:
+ * WebView.subproj/WebBaseResourceHandleDelegate.m: removed notifyDelegatesOfInterruptionByPolicyChange, no longer called
+ * WebView.subproj/WebMainResourceClient.h: made WebResourceDelegateProxy available to other classes
+ * WebView.subproj/WebMainResourceClient.m:
+ (-[WebMainResourceClient receivedError:]): moved most error handling code here
+ (-[WebMainResourceClient cancel]): stop load, call receivedError
+ (-[WebMainResourceClient interruptForPolicyChange]): renamed, call receivedError with the policy interrupt error
+ (-[WebMainResourceClient stopLoadingForPolicyChange]): call interruptForPolicyChange
+ (-[WebMainResourceClient continueAfterContentPolicy:response:]): for WebPolicySave, create the download, call interruptForPolicyChange and return so the response isn't set on the superclass.
+ (-[WebMainResourceClient resource:didFailLoadingWithError:]): call receivedError
+ (-[WebResourceDelegateProxy setDelegate:]): don't retain the delegate
+ (-[WebResourceDelegateProxy resourceDidFinishLoading:]): don't release the delegate
+ (-[WebResourceDelegateProxy resource:didFailLoadingWithError:]): don't release the delegate
+
2003-03-07 Maciej Stachowiak <mjs at apple.com>
Reviewed by Richard.
diff --git a/WebKit/Downloads.subproj/WebDownload.m b/WebKit/Downloads.subproj/WebDownload.m
index b005f4b..b6eeb0a 100644
--- a/WebKit/Downloads.subproj/WebDownload.m
+++ b/WebKit/Downloads.subproj/WebDownload.m
@@ -9,13 +9,12 @@
#import <WebKit/WebDownloadPrivate.h>
#import <WebKit/WebBinHexDecoder.h>
-#import <WebKit/WebController.h>
-#import <WebKit/WebDataSourcePrivate.h>
#import <WebKit/WebDownloadDecoder.h>
#import <WebKit/WebGZipDecoder.h>
#import <WebKit/WebKitErrors.h>
#import <WebKit/WebKitLogging.h>
#import <WebKit/WebMacBinaryDecoder.h>
+#import <WebKit/WebMainResourceClient.h>
#import <WebKit/WebNSWorkspaceExtras.h>
#import <WebKit/WebResourceResponseExtras.h>
@@ -58,6 +57,7 @@ typedef struct WebFSRefParam
WebResource *resource;
WebRequest *request;
WebResponse *response;
+ WebResourceDelegateProxy *proxy;
id delegate;
@@ -77,6 +77,8 @@ static void DeleteCompletionCallback(ParmBlkPtr paramBlock);
#pragma mark LOADING
- (void)_loadStarted;
- (void)_loadEnded;
+- (void)_setRequest:(WebRequest *)request;
+- (void)_setResponse:(WebResponse *)response;
#pragma mark CREATING
- (NSString *)_pathWithUniqueFilenameForPath:(NSString *)path;
- (BOOL)_createFSRefForPath:(NSString *)path;
@@ -147,6 +149,8 @@ static void DeleteCompletionCallback(ParmBlkPtr paramBlock);
[request release];
[resource release];
[response release];
+ [proxy setDelegate:nil];
+ [proxy release];
[path release];
[tempPath release];
[directoryPath release];
@@ -175,15 +179,21 @@ static void DeleteCompletionCallback(ParmBlkPtr paramBlock);
return self;
}
-- _initWithLoadingResource:(WebResource *)resource dataSource:(WebDataSource *)dataSource
+- _initWithLoadingResource:(WebResource *)resource
+ request:(WebRequest *)request
+ response:(WebResponse *)response
+ delegate:(id)delegate
+ proxy:(WebResourceDelegateProxy *)proxy
{
[super init];
_private = [[WebDownloadPrivate alloc] init];
+ _private->request = [request retain];
_private->resource = [resource retain];
- _private->request = [[dataSource request] retain];
- _private->response = [[dataSource response] retain];
- _private->delegate = [[dataSource _controller] downloadDelegate];
+ _private->response = [response retain];
+ _private->delegate = delegate;
+ _private->proxy = [proxy retain];
+ [_private->proxy setDelegate:(id <WebResourceDelegate>)self];
[self _loadStarted];
// Replay the delegate methods that would be called in the standalone download case.
@@ -197,11 +207,16 @@ static void DeleteCompletionCallback(ParmBlkPtr paramBlock);
// If the request is altered, cancel the resource and start a new one.
[self cancel];
if (request) {
+ [self _setRequest:request];
+ [self _setResponse:nil];
+ [_private->resource release];
_private->resource = [[WebResource alloc] initWithRequest:request];
- ASSERT(_private->resource);
+ if (!_private->resource) {
+ [self release];
+ return nil;
+ }
[_private->resource loadWithDelegate:(id <WebResourceDelegate>)self];
- } else {
- [self _loadEnded];
+ [self _loadStarted];
}
return self;
}
@@ -214,6 +229,19 @@ static void DeleteCompletionCallback(ParmBlkPtr paramBlock);
return self;
}
++ _downloadWithLoadingResource:(WebResource *)resource
+ request:(WebRequest *)request
+ response:(WebResponse *)response
+ delegate:(id)delegate
+ proxy:(WebResourceDelegateProxy *)proxy
+{
+ return [[[WebDownload alloc] _initWithLoadingResource:resource
+ request:request
+ response:response
+ delegate:delegate
+ proxy:proxy] autorelease];
+}
+
- (void)dealloc
{
[_private release];
@@ -266,7 +294,7 @@ static void DeleteCompletionCallback(ParmBlkPtr paramBlock);
{
if (_private->isLoading) {
_private->isLoading = NO;
-
+
[_private->resource release];
_private->resource = nil;
@@ -275,6 +303,22 @@ static void DeleteCompletionCallback(ParmBlkPtr paramBlock);
}
}
+- (void)_setRequest:(WebRequest *)request
+{
+ if (_private->request != request) {
+ [_private->request release];
+ _private->request = [request retain];
+ }
+}
+
+- (void)_setResponse:(WebResponse *)response
+{
+ if (_private->response != response) {
+ [_private->response release];
+ _private->response = [response retain];
+ }
+}
+
-(WebRequest *)resource:(WebResource *)resource willSendRequest:(WebRequest *)theRequest
{
WebRequest *request = nil;
@@ -289,19 +333,15 @@ static void DeleteCompletionCallback(ParmBlkPtr paramBlock);
[self _loadEnded];
}
- if (_private->request != request) {
- [_private->request release];
- _private->request = [request retain];
- }
+ [self _setRequest:request];
return request;
}
-(void)resource:(WebResource *)resource didReceiveResponse:(WebResponse *)response
{
- ASSERT(!_private->response);
+ [self _setResponse:response];
- _private->response = [response retain];
if ([_private->delegate respondsToSelector:@selector(download:didReceiveResponse:)]) {
[_private->delegate download:self didReceiveResponse:response];
}
diff --git a/WebKit/Downloads.subproj/WebDownloadPrivate.h b/WebKit/Downloads.subproj/WebDownloadPrivate.h
index 76481c5..3175aa5 100644
--- a/WebKit/Downloads.subproj/WebDownloadPrivate.h
+++ b/WebKit/Downloads.subproj/WebDownloadPrivate.h
@@ -7,10 +7,16 @@
#import <WebKit/WebDownload.h>
- at class WebDataSource;
+ at class WebRequest;
@class WebResource;
+ at class WebResponse;
+ at class WebResourceDelegateProxy;
@interface WebDownload (WebPrivate)
-- _initWithLoadingResource:(WebResource *)resource dataSource:(WebDataSource *)dataSource;
++ _downloadWithLoadingResource:(WebResource *)resource
+ request:(WebRequest *)request
+ response:(WebResponse *)response
+ delegate:(id)delegate
+ proxy:(WebResourceDelegateProxy *)proxy;
- (void)_setDirectoryPath:(NSString *)directoryPath;
@end
diff --git a/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.h b/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.h
index f7f62f4..763fe88 100644
--- a/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.h
+++ b/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.h
@@ -51,8 +51,6 @@
- (WebError *)cancelledError;
-- (void)notifyDelegatesOfInterruptionByPolicyChange;
-
- (void)setIdentifier: ident;
@end
diff --git a/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m b/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m
index b8b50e1..559e247 100644
--- a/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m
+++ b/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m
@@ -257,17 +257,6 @@
failingURL:[[request URL] absoluteString]];
}
-- (void)notifyDelegatesOfInterruptionByPolicyChange
-{
- WebError *error = [WebError errorWithCode:WebKitErrorResourceLoadInterruptedByPolicyChange
- inDomain:WebErrorDomainWebKit
- failingURL:nil];
-
- [[controller _resourceLoadDelegateForwarder] resource:identifier
- didFailLoadingWithError:error
- fromDataSource:dataSource];
-}
-
- (void)setIdentifier: ident
{
if (identifier != ident){
diff --git a/WebKit/WebView.subproj/WebLoader.h b/WebKit/WebView.subproj/WebLoader.h
index f7f62f4..763fe88 100644
--- a/WebKit/WebView.subproj/WebLoader.h
+++ b/WebKit/WebView.subproj/WebLoader.h
@@ -51,8 +51,6 @@
- (WebError *)cancelledError;
-- (void)notifyDelegatesOfInterruptionByPolicyChange;
-
- (void)setIdentifier: ident;
@end
diff --git a/WebKit/WebView.subproj/WebLoader.m b/WebKit/WebView.subproj/WebLoader.m
index b8b50e1..559e247 100644
--- a/WebKit/WebView.subproj/WebLoader.m
+++ b/WebKit/WebView.subproj/WebLoader.m
@@ -257,17 +257,6 @@
failingURL:[[request URL] absoluteString]];
}
-- (void)notifyDelegatesOfInterruptionByPolicyChange
-{
- WebError *error = [WebError errorWithCode:WebKitErrorResourceLoadInterruptedByPolicyChange
- inDomain:WebErrorDomainWebKit
- failingURL:nil];
-
- [[controller _resourceLoadDelegateForwarder] resource:identifier
- didFailLoadingWithError:error
- fromDataSource:dataSource];
-}
-
- (void)setIdentifier: ident
{
if (identifier != ident){
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.h b/WebKit/WebView.subproj/WebMainResourceClient.h
index d5a17f4..099decc 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.h
+++ b/WebKit/WebView.subproj/WebMainResourceClient.h
@@ -9,14 +9,15 @@
#import <Foundation/Foundation.h>
#import <WebKit/WebBaseResourceHandleDelegate.h>
-#import <WebKit/WebControllerPolicyDelegate.h>
- at class WebDownload;
@class WebDataSource;
- at class WebResource;
- at class WebResourceDelegateProxy;
- at class WebRequest;
- at class WebResponse;
+
+ at interface WebResourceDelegateProxy : NSObject <WebResourceDelegate>
+{
+ id <WebResourceDelegate> delegate;
+}
+- (void)setDelegate:(id <WebResourceDelegate>)theDelegate;
+ at end
@interface WebMainResourceClient : WebBaseResourceHandleDelegate
{
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.m b/WebKit/WebView.subproj/WebMainResourceClient.m
index c29e4ad..1384b94 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.m
+++ b/WebKit/WebView.subproj/WebMainResourceClient.m
@@ -34,13 +34,6 @@
// FIXME: More that is in common with WebSubresourceClient should move up into WebBaseResourceHandleDelegate.
- at interface WebResourceDelegateProxy : NSObject <WebResourceDelegate>
-{
- id <WebResourceDelegate> delegate;
-}
-- (void)setDelegate:(id <WebResourceDelegate>)theDelegate;
- at end
-
@implementation WebMainResourceClient
- initWithDataSource:(WebDataSource *)ds
@@ -58,8 +51,9 @@
}
- (void)dealloc
-{
+{
[resourceData release];
+ [proxy setDelegate:nil];
[proxy release];
[super dealloc];
@@ -70,51 +64,35 @@
return resourceData;
}
-- (void)receivedError:(WebError *)error complete:(BOOL)isComplete
+- (void)receivedError:(WebError *)error
{
- [dataSource _receivedError:error complete:isComplete];
+ // Calling _receivedError will likely result in a call to release, so we must retain.
+ [self retain];
+ [dataSource _receivedError:error complete:YES];
+ [super resource:resource didFailLoadingWithError:error];
+ [self release];
}
- (void)cancel
{
LOG(Loading, "URL = %@", [dataSource _URL]);
- // Calling receivedError will likely result in a call to release, so we must retain.
- [self retain];
-
- [self receivedError:[self cancelledError] complete:YES];
- [super cancel];
-
- [self release];
+ [resource cancel];
+ [self receivedError:[self cancelledError]];
}
-- (void)interruptForPolicyChangeAndKeepLoading:(BOOL)keepLoading
+- (void)interruptForPolicyChange
{
// Terminate the locationChangeDelegate correctly.
- WebError *interruptError = [WebError errorWithCode:WebKitErrorLocationChangeInterruptedByPolicyChange inDomain:WebErrorDomainWebKit failingURL:nil];
-
- // Must call receivedError before _clearProvisionalDataSource because
- // if we remove the data source from the frame, we can't get back to the frame any more.
- [self receivedError:interruptError complete:!keepLoading];
-
- [[dataSource webFrame] _clearProvisionalDataSource];
-
- // Deliver the error to the location change delegate.
- // We have to do this explicitly because since we are still loading, WebFrame
- // won't do it for us. Also, we have to do this after the provisional data source
- // is cleared so the delegate will get false if they ask the frame if it's loading.
- // There's probably a better way to do this, but this should do for now.
- if (keepLoading) {
- [[[dataSource _controller] _locationChangeDelegateForwarder]
- locationChangeDone:interruptError forDataSource:dataSource];
- }
-
- [self notifyDelegatesOfInterruptionByPolicyChange];
+ WebError *interruptError = [WebError errorWithCode:WebKitErrorLocationChangeInterruptedByPolicyChange
+ inDomain:WebErrorDomainWebKit
+ failingURL:nil];
+ [self receivedError:interruptError];
}
-(void)stopLoadingForPolicyChange
{
- [self interruptForPolicyChangeAndKeepLoading:NO];
+ [self interruptForPolicyChange];
[self cancelQuietly];
}
@@ -168,16 +146,18 @@
return;
}
break;
-
+
case WebPolicySave:
- {
- WebDownload *download = [[WebDownload alloc] _initWithLoadingResource:resource dataSource:dataSource];
- [proxy setDelegate:(id <WebResourceDelegate>)download];
- [download release];
-
- [self interruptForPolicyChangeAndKeepLoading:YES];
- }
- break;
+ [proxy setDelegate:nil];
+ [WebDownload _downloadWithLoadingResource:resource
+ request:request
+ response:r
+ delegate:[self downloadDelegate]
+ proxy:proxy];
+ [proxy release];
+ proxy = nil;
+ [self interruptForPolicyChange];
+ return;
case WebPolicyIgnore:
[self stopLoadingForPolicyChange];
@@ -281,13 +261,7 @@
LOG(Loading, "URL = %@, error = %@", [error failingURL], [error errorDescription]);
- // Calling receivedError will likely result in a call to release, so we must retain.
- [self retain];
-
- [self receivedError:error complete:YES];
- [super resource:h didFailLoadingWithError:error];
-
- [self release];
+ [self receivedError:error];
}
- (void)startLoading:(WebRequest *)r
@@ -320,37 +294,37 @@
- (void)setDelegate:(id <WebResourceDelegate>)theDelegate
{
- if (delegate != theDelegate) {
- [delegate release];
- delegate = [theDelegate retain];
- }
+ delegate = theDelegate;
}
- (WebRequest *)resource:(WebResource *)resource willSendRequest:(WebRequest *)request
{
+ ASSERT(delegate);
return [delegate resource:resource willSendRequest:request];
}
-(void)resource:(WebResource *)resource didReceiveResponse:(WebResponse *)response
{
+ ASSERT(delegate);
[delegate resource:resource didReceiveResponse:response];
}
-(void)resource:(WebResource *)resource didReceiveData:(NSData *)data
{
+ ASSERT(delegate);
[delegate resource:resource didReceiveData:data];
}
-(void)resourceDidFinishLoading:(WebResource *)resource
{
+ ASSERT(delegate);
[delegate resourceDidFinishLoading:resource];
- [delegate release];
}
-(void)resource:(WebResource *)resource didFailLoadingWithError:(WebError *)error
{
+ ASSERT(delegate);
[delegate resource:resource didFailLoadingWithError:error];
- [delegate release];
}
@end
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.h b/WebKit/WebView.subproj/WebMainResourceLoader.h
index d5a17f4..099decc 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.h
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.h
@@ -9,14 +9,15 @@
#import <Foundation/Foundation.h>
#import <WebKit/WebBaseResourceHandleDelegate.h>
-#import <WebKit/WebControllerPolicyDelegate.h>
- at class WebDownload;
@class WebDataSource;
- at class WebResource;
- at class WebResourceDelegateProxy;
- at class WebRequest;
- at class WebResponse;
+
+ at interface WebResourceDelegateProxy : NSObject <WebResourceDelegate>
+{
+ id <WebResourceDelegate> delegate;
+}
+- (void)setDelegate:(id <WebResourceDelegate>)theDelegate;
+ at end
@interface WebMainResourceClient : WebBaseResourceHandleDelegate
{
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.m b/WebKit/WebView.subproj/WebMainResourceLoader.m
index c29e4ad..1384b94 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.m
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.m
@@ -34,13 +34,6 @@
// FIXME: More that is in common with WebSubresourceClient should move up into WebBaseResourceHandleDelegate.
- at interface WebResourceDelegateProxy : NSObject <WebResourceDelegate>
-{
- id <WebResourceDelegate> delegate;
-}
-- (void)setDelegate:(id <WebResourceDelegate>)theDelegate;
- at end
-
@implementation WebMainResourceClient
- initWithDataSource:(WebDataSource *)ds
@@ -58,8 +51,9 @@
}
- (void)dealloc
-{
+{
[resourceData release];
+ [proxy setDelegate:nil];
[proxy release];
[super dealloc];
@@ -70,51 +64,35 @@
return resourceData;
}
-- (void)receivedError:(WebError *)error complete:(BOOL)isComplete
+- (void)receivedError:(WebError *)error
{
- [dataSource _receivedError:error complete:isComplete];
+ // Calling _receivedError will likely result in a call to release, so we must retain.
+ [self retain];
+ [dataSource _receivedError:error complete:YES];
+ [super resource:resource didFailLoadingWithError:error];
+ [self release];
}
- (void)cancel
{
LOG(Loading, "URL = %@", [dataSource _URL]);
- // Calling receivedError will likely result in a call to release, so we must retain.
- [self retain];
-
- [self receivedError:[self cancelledError] complete:YES];
- [super cancel];
-
- [self release];
+ [resource cancel];
+ [self receivedError:[self cancelledError]];
}
-- (void)interruptForPolicyChangeAndKeepLoading:(BOOL)keepLoading
+- (void)interruptForPolicyChange
{
// Terminate the locationChangeDelegate correctly.
- WebError *interruptError = [WebError errorWithCode:WebKitErrorLocationChangeInterruptedByPolicyChange inDomain:WebErrorDomainWebKit failingURL:nil];
-
- // Must call receivedError before _clearProvisionalDataSource because
- // if we remove the data source from the frame, we can't get back to the frame any more.
- [self receivedError:interruptError complete:!keepLoading];
-
- [[dataSource webFrame] _clearProvisionalDataSource];
-
- // Deliver the error to the location change delegate.
- // We have to do this explicitly because since we are still loading, WebFrame
- // won't do it for us. Also, we have to do this after the provisional data source
- // is cleared so the delegate will get false if they ask the frame if it's loading.
- // There's probably a better way to do this, but this should do for now.
- if (keepLoading) {
- [[[dataSource _controller] _locationChangeDelegateForwarder]
- locationChangeDone:interruptError forDataSource:dataSource];
- }
-
- [self notifyDelegatesOfInterruptionByPolicyChange];
+ WebError *interruptError = [WebError errorWithCode:WebKitErrorLocationChangeInterruptedByPolicyChange
+ inDomain:WebErrorDomainWebKit
+ failingURL:nil];
+ [self receivedError:interruptError];
}
-(void)stopLoadingForPolicyChange
{
- [self interruptForPolicyChangeAndKeepLoading:NO];
+ [self interruptForPolicyChange];
[self cancelQuietly];
}
@@ -168,16 +146,18 @@
return;
}
break;
-
+
case WebPolicySave:
- {
- WebDownload *download = [[WebDownload alloc] _initWithLoadingResource:resource dataSource:dataSource];
- [proxy setDelegate:(id <WebResourceDelegate>)download];
- [download release];
-
- [self interruptForPolicyChangeAndKeepLoading:YES];
- }
- break;
+ [proxy setDelegate:nil];
+ [WebDownload _downloadWithLoadingResource:resource
+ request:request
+ response:r
+ delegate:[self downloadDelegate]
+ proxy:proxy];
+ [proxy release];
+ proxy = nil;
+ [self interruptForPolicyChange];
+ return;
case WebPolicyIgnore:
[self stopLoadingForPolicyChange];
@@ -281,13 +261,7 @@
LOG(Loading, "URL = %@, error = %@", [error failingURL], [error errorDescription]);
- // Calling receivedError will likely result in a call to release, so we must retain.
- [self retain];
-
- [self receivedError:error complete:YES];
- [super resource:h didFailLoadingWithError:error];
-
- [self release];
+ [self receivedError:error];
}
- (void)startLoading:(WebRequest *)r
@@ -320,37 +294,37 @@
- (void)setDelegate:(id <WebResourceDelegate>)theDelegate
{
- if (delegate != theDelegate) {
- [delegate release];
- delegate = [theDelegate retain];
- }
+ delegate = theDelegate;
}
- (WebRequest *)resource:(WebResource *)resource willSendRequest:(WebRequest *)request
{
+ ASSERT(delegate);
return [delegate resource:resource willSendRequest:request];
}
-(void)resource:(WebResource *)resource didReceiveResponse:(WebResponse *)response
{
+ ASSERT(delegate);
[delegate resource:resource didReceiveResponse:response];
}
-(void)resource:(WebResource *)resource didReceiveData:(NSData *)data
{
+ ASSERT(delegate);
[delegate resource:resource didReceiveData:data];
}
-(void)resourceDidFinishLoading:(WebResource *)resource
{
+ ASSERT(delegate);
[delegate resourceDidFinishLoading:resource];
- [delegate release];
}
-(void)resource:(WebResource *)resource didFailLoadingWithError:(WebError *)error
{
+ ASSERT(delegate);
[delegate resource:resource didFailLoadingWithError:error];
- [delegate release];
}
@end
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list