[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:58:13 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit decd52be5587393a91510e0e67ab39074978b918
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Nov 8 22:35:01 2002 +0000
- separate WebBaseNetscapePluginStream more cleanly from its subclasses
by making most fields private
* Plugins.subproj/WebBaseNetscapePluginStream.m:
(-[WebBaseNetscapePluginStream setResponse:]):
* Plugins.subproj/WebNetscapePluginStream.h:
* Plugins.subproj/WebNetscapePluginStream.m:
(-[WebNetscapePluginStream initWithRequest:pluginPointer:notifyData:]):
(-[WebNetscapePluginStream dealloc]):
(-[WebNetscapePluginStream start]):
(-[WebNetscapePluginStream handle:didReceiveData:]):
(-[WebNetscapePluginStream handle:didFailLoadingWithError:]):
* WebCoreSupport.subproj/WebSubresourceClient.m:
(-[WebSubresourceClient handle:didReceiveResponse:]):
(-[WebSubresourceClient handle:didReceiveData:]):
(-[WebSubresourceClient handleDidFinishLoading:]):
(-[WebSubresourceClient handle:didFailLoadingWithError:]):
(-[WebSubresourceClient cancel]):
* WebView.subproj/WebBaseResourceHandleDelegate.h:
* WebView.subproj/WebBaseResourceHandleDelegate.m:
(-[WebBaseResourceHandleDelegate handle:willSendRequest:]):
(-[WebBaseResourceHandleDelegate handle:didFailLoadingWithError:]):
(-[WebBaseResourceHandleDelegate _cancelWithError:]):
(-[WebBaseResourceHandleDelegate cancel]):
(-[WebBaseResourceHandleDelegate cancelQuietly]):
(-[WebBaseResourceHandleDelegate cancelledError]):
(-[WebBaseResourceHandleDelegate notifyDelegatesOfInterruptionByPolicyChange]):
* WebView.subproj/WebMainResourceClient.h:
* WebView.subproj/WebMainResourceClient.m:
(-[WebMainResourceClient cancel]):
(-[WebMainResourceClient handle:willSendRequest:]):
(-[WebMainResourceClient notifyDelegatesOfInterruptionByPolicyChange]):
(-[WebMainResourceClient handle:didReceiveResponse:]):
(-[WebMainResourceClient handle:didReceiveData:]):
(-[WebMainResourceClient handleDidFinishLoading:]):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2604 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index db86662..c87e31a 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,5 +1,43 @@
2002-11-08 Darin Adler <darin at apple.com>
+ - separate WebBaseNetscapePluginStream more cleanly from its subclasses
+ by making most fields private
+
+ * Plugins.subproj/WebBaseNetscapePluginStream.m:
+ (-[WebBaseNetscapePluginStream setResponse:]):
+ * Plugins.subproj/WebNetscapePluginStream.h:
+ * Plugins.subproj/WebNetscapePluginStream.m:
+ (-[WebNetscapePluginStream initWithRequest:pluginPointer:notifyData:]):
+ (-[WebNetscapePluginStream dealloc]):
+ (-[WebNetscapePluginStream start]):
+ (-[WebNetscapePluginStream handle:didReceiveData:]):
+ (-[WebNetscapePluginStream handle:didFailLoadingWithError:]):
+ * WebCoreSupport.subproj/WebSubresourceClient.m:
+ (-[WebSubresourceClient handle:didReceiveResponse:]):
+ (-[WebSubresourceClient handle:didReceiveData:]):
+ (-[WebSubresourceClient handleDidFinishLoading:]):
+ (-[WebSubresourceClient handle:didFailLoadingWithError:]):
+ (-[WebSubresourceClient cancel]):
+ * WebView.subproj/WebBaseResourceHandleDelegate.h:
+ * WebView.subproj/WebBaseResourceHandleDelegate.m:
+ (-[WebBaseResourceHandleDelegate handle:willSendRequest:]):
+ (-[WebBaseResourceHandleDelegate handle:didFailLoadingWithError:]):
+ (-[WebBaseResourceHandleDelegate _cancelWithError:]):
+ (-[WebBaseResourceHandleDelegate cancel]):
+ (-[WebBaseResourceHandleDelegate cancelQuietly]):
+ (-[WebBaseResourceHandleDelegate cancelledError]):
+ (-[WebBaseResourceHandleDelegate notifyDelegatesOfInterruptionByPolicyChange]):
+ * WebView.subproj/WebMainResourceClient.h:
+ * WebView.subproj/WebMainResourceClient.m:
+ (-[WebMainResourceClient cancel]):
+ (-[WebMainResourceClient handle:willSendRequest:]):
+ (-[WebMainResourceClient notifyDelegatesOfInterruptionByPolicyChange]):
+ (-[WebMainResourceClient handle:didReceiveResponse:]):
+ (-[WebMainResourceClient handle:didReceiveData:]):
+ (-[WebMainResourceClient handleDidFinishLoading:]):
+
+2002-11-08 Darin Adler <darin at apple.com>
+
- changed persistent dictionaries to use NSString instead of NSURL
because of impact on memory footprint
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index db86662..c87e31a 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,5 +1,43 @@
2002-11-08 Darin Adler <darin at apple.com>
+ - separate WebBaseNetscapePluginStream more cleanly from its subclasses
+ by making most fields private
+
+ * Plugins.subproj/WebBaseNetscapePluginStream.m:
+ (-[WebBaseNetscapePluginStream setResponse:]):
+ * Plugins.subproj/WebNetscapePluginStream.h:
+ * Plugins.subproj/WebNetscapePluginStream.m:
+ (-[WebNetscapePluginStream initWithRequest:pluginPointer:notifyData:]):
+ (-[WebNetscapePluginStream dealloc]):
+ (-[WebNetscapePluginStream start]):
+ (-[WebNetscapePluginStream handle:didReceiveData:]):
+ (-[WebNetscapePluginStream handle:didFailLoadingWithError:]):
+ * WebCoreSupport.subproj/WebSubresourceClient.m:
+ (-[WebSubresourceClient handle:didReceiveResponse:]):
+ (-[WebSubresourceClient handle:didReceiveData:]):
+ (-[WebSubresourceClient handleDidFinishLoading:]):
+ (-[WebSubresourceClient handle:didFailLoadingWithError:]):
+ (-[WebSubresourceClient cancel]):
+ * WebView.subproj/WebBaseResourceHandleDelegate.h:
+ * WebView.subproj/WebBaseResourceHandleDelegate.m:
+ (-[WebBaseResourceHandleDelegate handle:willSendRequest:]):
+ (-[WebBaseResourceHandleDelegate handle:didFailLoadingWithError:]):
+ (-[WebBaseResourceHandleDelegate _cancelWithError:]):
+ (-[WebBaseResourceHandleDelegate cancel]):
+ (-[WebBaseResourceHandleDelegate cancelQuietly]):
+ (-[WebBaseResourceHandleDelegate cancelledError]):
+ (-[WebBaseResourceHandleDelegate notifyDelegatesOfInterruptionByPolicyChange]):
+ * WebView.subproj/WebMainResourceClient.h:
+ * WebView.subproj/WebMainResourceClient.m:
+ (-[WebMainResourceClient cancel]):
+ (-[WebMainResourceClient handle:willSendRequest:]):
+ (-[WebMainResourceClient notifyDelegatesOfInterruptionByPolicyChange]):
+ (-[WebMainResourceClient handle:didReceiveResponse:]):
+ (-[WebMainResourceClient handle:didReceiveData:]):
+ (-[WebMainResourceClient handleDidFinishLoading:]):
+
+2002-11-08 Darin Adler <darin at apple.com>
+
- changed persistent dictionaries to use NSString instead of NSURL
because of impact on memory footprint
diff --git a/WebKit/Plugins.subproj/WebBaseNetscapePluginStream.m b/WebKit/Plugins.subproj/WebBaseNetscapePluginStream.m
index efb932b..7547ab1 100644
--- a/WebKit/Plugins.subproj/WebBaseNetscapePluginStream.m
+++ b/WebKit/Plugins.subproj/WebBaseNetscapePluginStream.m
@@ -58,7 +58,7 @@
uint32 lastModified = 0;
- if ([response isKindOfClass:[WebHTTPResourceResponse class]]) {
+ if ([r isKindOfClass:[WebHTTPResourceResponse class]]) {
NSNumber *timeInterval = [[(WebHTTPResourceResponse *)r headers] objectForKey:@"Last-Modified"];
if(timeInterval) {
NSTimeInterval lastModifiedInterval;
diff --git a/WebKit/Plugins.subproj/WebNetscapePluginStream.h b/WebKit/Plugins.subproj/WebNetscapePluginStream.h
index 1a2b9b2..81f3ad7 100644
--- a/WebKit/Plugins.subproj/WebNetscapePluginStream.h
+++ b/WebKit/Plugins.subproj/WebNetscapePluginStream.h
@@ -17,6 +17,7 @@
{
WebNetscapePluginEmbeddedView *view;
NSMutableData *resourceData;
+ WebResourceRequest *_startingRequest;
}
- initWithRequest:(WebResourceRequest *)theRequest
diff --git a/WebKit/Plugins.subproj/WebNetscapePluginStream.m b/WebKit/Plugins.subproj/WebNetscapePluginStream.m
index 0b47fe9..9a6bd61 100644
--- a/WebKit/Plugins.subproj/WebNetscapePluginStream.m
+++ b/WebKit/Plugins.subproj/WebNetscapePluginStream.m
@@ -22,7 +22,7 @@
return nil;
}
- request = [theRequest retain];
+ _startingRequest = [theRequest copy];
[self setPluginPointer:thePluginPointer];
@@ -39,12 +39,16 @@
- (void)dealloc
{
[resourceData release];
+ [_startingRequest release];
[super dealloc];
}
- (void)start
{
- [self loadWithRequest:request];
+ ASSERT(_startingRequest);
+ [self loadWithRequest:_startingRequest];
+ [_startingRequest release];
+ _startingRequest = nil;
}
- (void)stop
@@ -81,7 +85,7 @@
[self receivedData:data];
- [super handle:handle didReceiveData:data];
+ [super handle:h didReceiveData:data];
}
- (void)handleDidFinishLoading:(WebResourceHandle *)h
@@ -99,8 +103,6 @@
- (void)handle:(WebResourceHandle *)h didFailLoadingWithError:(WebError *)result
{
- ASSERT(handle == h);
-
WebController *controller = [view controller];
[controller _receivedError:result fromDataSource:[view dataSource]];
diff --git a/WebKit/WebCoreSupport.subproj/WebSubresourceClient.m b/WebKit/WebCoreSupport.subproj/WebSubresourceClient.m
index 570eae7..233724f 100644
--- a/WebKit/WebCoreSupport.subproj/WebSubresourceClient.m
+++ b/WebKit/WebCoreSupport.subproj/WebSubresourceClient.m
@@ -89,27 +89,19 @@
-(void)handle:(WebResourceHandle *)h didReceiveResponse:(WebResourceResponse *)r
{
- ASSERT(handle == h);
ASSERT(r);
-
[loader receivedResponse:r];
-
- [super handle: handle didReceiveResponse: r];
+ [super handle:h didReceiveResponse:r];
}
- (void)handle:(WebResourceHandle *)h didReceiveData:(NSData *)data
{
- ASSERT(handle == h);
-
[loader addData:data];
-
- [super handle: handle didReceiveData: data];
+ [super handle:h didReceiveData:data];
}
- (void)handleDidFinishLoading:(WebResourceHandle *)h
{
- ASSERT(handle == h);
-
// Calling _removeSubresourceClient will likely result in a call to release, so we must retain.
[self retain];
@@ -117,32 +109,22 @@
[dataSource _removeSubresourceClient:self];
- WebError *nonTerminalError = [response error];
- if (nonTerminalError) {
- [self receivedError:nonTerminalError];
- }
-
[[dataSource controller] _finishedLoadingResourceFromDataSource:dataSource];
[self release];
- [super handleDidFinishLoading: h];
+ [super handleDidFinishLoading:h];
}
- (void)handle:(WebResourceHandle *)h didFailLoadingWithError:(WebError *)error
{
- ASSERT(handle == h);
-
// Calling _removeSubresourceClient will likely result in a call to release, so we must retain.
[self retain];
[loader reportError];
-
[dataSource _removeSubresourceClient:self];
-
[self receivedError:error];
-
- [super handle: handle didFailLoadingWithError: error];
+ [super handle:h didFailLoadingWithError:error];
[self release];
}
@@ -153,14 +135,8 @@
[self retain];
[loader cancel];
-
[dataSource _removeSubresourceClient:self];
-
- WebError *error = [[WebError alloc] initWithErrorCode:WebErrorCodeCancelled
- inDomain:WebErrorDomainWebFoundation failingURL:[[request URL] absoluteString]];
- [self receivedError:error];
- [error release];
-
+ [self receivedError:[self cancelledError]];
[super cancel];
[self release];
diff --git a/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m b/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m
index 570eae7..233724f 100644
--- a/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m
+++ b/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m
@@ -89,27 +89,19 @@
-(void)handle:(WebResourceHandle *)h didReceiveResponse:(WebResourceResponse *)r
{
- ASSERT(handle == h);
ASSERT(r);
-
[loader receivedResponse:r];
-
- [super handle: handle didReceiveResponse: r];
+ [super handle:h didReceiveResponse:r];
}
- (void)handle:(WebResourceHandle *)h didReceiveData:(NSData *)data
{
- ASSERT(handle == h);
-
[loader addData:data];
-
- [super handle: handle didReceiveData: data];
+ [super handle:h didReceiveData:data];
}
- (void)handleDidFinishLoading:(WebResourceHandle *)h
{
- ASSERT(handle == h);
-
// Calling _removeSubresourceClient will likely result in a call to release, so we must retain.
[self retain];
@@ -117,32 +109,22 @@
[dataSource _removeSubresourceClient:self];
- WebError *nonTerminalError = [response error];
- if (nonTerminalError) {
- [self receivedError:nonTerminalError];
- }
-
[[dataSource controller] _finishedLoadingResourceFromDataSource:dataSource];
[self release];
- [super handleDidFinishLoading: h];
+ [super handleDidFinishLoading:h];
}
- (void)handle:(WebResourceHandle *)h didFailLoadingWithError:(WebError *)error
{
- ASSERT(handle == h);
-
// Calling _removeSubresourceClient will likely result in a call to release, so we must retain.
[self retain];
[loader reportError];
-
[dataSource _removeSubresourceClient:self];
-
[self receivedError:error];
-
- [super handle: handle didFailLoadingWithError: error];
+ [super handle:h didFailLoadingWithError:error];
[self release];
}
@@ -153,14 +135,8 @@
[self retain];
[loader cancel];
-
[dataSource _removeSubresourceClient:self];
-
- WebError *error = [[WebError alloc] initWithErrorCode:WebErrorCodeCancelled
- inDomain:WebErrorDomainWebFoundation failingURL:[[request URL] absoluteString]];
- [self receivedError:error];
- [error release];
-
+ [self receivedError:[self cancelledError]];
[super cancel];
[self release];
diff --git a/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.h b/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.h
index 81ebc8b..4197660 100644
--- a/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.h
+++ b/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.h
@@ -6,6 +6,7 @@
#import <Foundation/Foundation.h>
@class WebDataSource;
+ at class WebError;
@class WebResourceHandle;
@class WebResourceRequest;
@class WebResourceResponse;
@@ -15,8 +16,10 @@
@interface WebBaseResourceHandleDelegate : NSObject <WebResourceHandleDelegate>
{
- WebResourceHandle *handle;
+ at protected
WebDataSource *dataSource;
+ at private
+ WebResourceHandle *handle;
WebResourceRequest *request;
WebResourceResponse *response;
id identifier;
@@ -36,8 +39,14 @@
- (id <WebResourceLoadDelegate>)resourceLoadDelegate;
- (id <WebResourceLoadDelegate>)downloadDelegate;
- (void)setIsDownload:(BOOL)f;
+
- (void)cancel;
+- (void)cancelQuietly;
- (void)setDefersCallbacks:(BOOL)defers;
+- (WebError *)cancelledError;
+
+- (void)notifyDelegatesOfInterruptionByPolicyChange;
+
@end
diff --git a/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m b/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m
index eac3896..565ec29 100644
--- a/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m
+++ b/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m
@@ -14,6 +14,7 @@
#import <WebKit/WebController.h>
#import <WebKit/WebDataSource.h>
+#import <WebKit/WebKitErrors.h>
#import <WebKit/WebResourceLoadDelegate.h>
#import <WebKit/WebStandardPanelsPrivate.h>
@@ -122,30 +123,27 @@
ASSERT(handle == h);
ASSERT(!reachedTerminalState);
- NSURL *newURL = [newRequest URL];
-
- [newRequest setUserAgent:[[dataSource controller] userAgentForURL:newURL]];
-
- [request autorelease];
- request = [newRequest copy];
+ [newRequest setUserAgent:[[dataSource controller] userAgentForURL:[newRequest URL]]];
if (identifier == nil) {
// The identifier is released after the last callback, rather than in dealloc
// to avoid potential cycles.
- identifier = [[resourceLoadDelegate identifierForInitialRequest:request fromDataSource:dataSource] retain];
+ identifier = [[resourceLoadDelegate identifierForInitialRequest:newRequest fromDataSource:dataSource] retain];
}
- if (resourceLoadDelegate)
- request = [resourceLoadDelegate resource:identifier willSendRequest:request fromDataSource:dataSource];
+ if (resourceLoadDelegate) {
+ newRequest = [resourceLoadDelegate resource:identifier willSendRequest:newRequest fromDataSource:dataSource];
+ }
+
+ // Store a copy of the request.
+ [request autorelease];
+ request = [newRequest copy];
if (currentURL) {
[[WebStandardPanels sharedStandardPanels] _didStopLoadingURL:currentURL inController:[dataSource controller]];
- }
-
- [newURL retain];
+ }
[currentURL release];
- currentURL = newURL;
-
+ currentURL = [[newRequest URL] retain];
[[WebStandardPanels sharedStandardPanels] _didStartLoadingURL:currentURL inController:[dataSource controller]];
return newRequest;
@@ -198,16 +196,16 @@
ASSERT(!reachedTerminalState);
if ([self isDownload])
- [downloadDelegate resource: identifier didFailLoadingWithError: result fromDataSource: dataSource];
+ [downloadDelegate resource:identifier didFailLoadingWithError:result fromDataSource:dataSource];
else
- [resourceLoadDelegate resource: identifier didFailLoadingWithError: result fromDataSource: dataSource];
+ [resourceLoadDelegate resource:identifier didFailLoadingWithError:result fromDataSource:dataSource];
[[WebStandardPanels sharedStandardPanels] _didStopLoadingURL:currentURL inController:[dataSource controller]];
[self _releaseResources];
}
-- (void)cancel
+- (void)_cancelWithError:(WebError *)error
{
ASSERT(!reachedTerminalState);
@@ -215,13 +213,33 @@
[[WebStandardPanels sharedStandardPanels] _didStopLoadingURL:currentURL inController:[dataSource controller]];
- if (![self isDownload]) {
- WebError *error = [[WebError alloc] initWithErrorCode:WebErrorCodeCancelled
- inDomain:WebErrorDomainWebFoundation failingURL:[[request URL] absoluteString]];
+ if (error) {
[resourceLoadDelegate resource:identifier didFailLoadingWithError:error fromDataSource:dataSource];
}
[self _releaseResources];
}
+- (void)cancel
+{
+ [self _cancelWithError:[self isDownload] ? nil : [self cancelledError]];
+}
+
+- (void)cancelQuietly
+{
+ [self _cancelWithError:nil];
+}
+
+- (WebError *)cancelledError
+{
+ return [WebError errorWithCode:WebErrorCodeCancelled
+ inDomain:WebErrorDomainWebFoundation failingURL:[[request URL] absoluteString]];
+}
+
+- (void)notifyDelegatesOfInterruptionByPolicyChange
+{
+ WebError *error = [WebError errorWithCode:WebErrorResourceLoadInterruptedByPolicyChange inDomain:WebErrorDomainWebKit failingURL:nil];
+ [[self resourceLoadDelegate] resource:identifier didFailLoadingWithError:error fromDataSource:dataSource];
+}
+
@end
diff --git a/WebKit/WebView.subproj/WebLoader.h b/WebKit/WebView.subproj/WebLoader.h
index 81ebc8b..4197660 100644
--- a/WebKit/WebView.subproj/WebLoader.h
+++ b/WebKit/WebView.subproj/WebLoader.h
@@ -6,6 +6,7 @@
#import <Foundation/Foundation.h>
@class WebDataSource;
+ at class WebError;
@class WebResourceHandle;
@class WebResourceRequest;
@class WebResourceResponse;
@@ -15,8 +16,10 @@
@interface WebBaseResourceHandleDelegate : NSObject <WebResourceHandleDelegate>
{
- WebResourceHandle *handle;
+ at protected
WebDataSource *dataSource;
+ at private
+ WebResourceHandle *handle;
WebResourceRequest *request;
WebResourceResponse *response;
id identifier;
@@ -36,8 +39,14 @@
- (id <WebResourceLoadDelegate>)resourceLoadDelegate;
- (id <WebResourceLoadDelegate>)downloadDelegate;
- (void)setIsDownload:(BOOL)f;
+
- (void)cancel;
+- (void)cancelQuietly;
- (void)setDefersCallbacks:(BOOL)defers;
+- (WebError *)cancelledError;
+
+- (void)notifyDelegatesOfInterruptionByPolicyChange;
+
@end
diff --git a/WebKit/WebView.subproj/WebLoader.m b/WebKit/WebView.subproj/WebLoader.m
index eac3896..565ec29 100644
--- a/WebKit/WebView.subproj/WebLoader.m
+++ b/WebKit/WebView.subproj/WebLoader.m
@@ -14,6 +14,7 @@
#import <WebKit/WebController.h>
#import <WebKit/WebDataSource.h>
+#import <WebKit/WebKitErrors.h>
#import <WebKit/WebResourceLoadDelegate.h>
#import <WebKit/WebStandardPanelsPrivate.h>
@@ -122,30 +123,27 @@
ASSERT(handle == h);
ASSERT(!reachedTerminalState);
- NSURL *newURL = [newRequest URL];
-
- [newRequest setUserAgent:[[dataSource controller] userAgentForURL:newURL]];
-
- [request autorelease];
- request = [newRequest copy];
+ [newRequest setUserAgent:[[dataSource controller] userAgentForURL:[newRequest URL]]];
if (identifier == nil) {
// The identifier is released after the last callback, rather than in dealloc
// to avoid potential cycles.
- identifier = [[resourceLoadDelegate identifierForInitialRequest:request fromDataSource:dataSource] retain];
+ identifier = [[resourceLoadDelegate identifierForInitialRequest:newRequest fromDataSource:dataSource] retain];
}
- if (resourceLoadDelegate)
- request = [resourceLoadDelegate resource:identifier willSendRequest:request fromDataSource:dataSource];
+ if (resourceLoadDelegate) {
+ newRequest = [resourceLoadDelegate resource:identifier willSendRequest:newRequest fromDataSource:dataSource];
+ }
+
+ // Store a copy of the request.
+ [request autorelease];
+ request = [newRequest copy];
if (currentURL) {
[[WebStandardPanels sharedStandardPanels] _didStopLoadingURL:currentURL inController:[dataSource controller]];
- }
-
- [newURL retain];
+ }
[currentURL release];
- currentURL = newURL;
-
+ currentURL = [[newRequest URL] retain];
[[WebStandardPanels sharedStandardPanels] _didStartLoadingURL:currentURL inController:[dataSource controller]];
return newRequest;
@@ -198,16 +196,16 @@
ASSERT(!reachedTerminalState);
if ([self isDownload])
- [downloadDelegate resource: identifier didFailLoadingWithError: result fromDataSource: dataSource];
+ [downloadDelegate resource:identifier didFailLoadingWithError:result fromDataSource:dataSource];
else
- [resourceLoadDelegate resource: identifier didFailLoadingWithError: result fromDataSource: dataSource];
+ [resourceLoadDelegate resource:identifier didFailLoadingWithError:result fromDataSource:dataSource];
[[WebStandardPanels sharedStandardPanels] _didStopLoadingURL:currentURL inController:[dataSource controller]];
[self _releaseResources];
}
-- (void)cancel
+- (void)_cancelWithError:(WebError *)error
{
ASSERT(!reachedTerminalState);
@@ -215,13 +213,33 @@
[[WebStandardPanels sharedStandardPanels] _didStopLoadingURL:currentURL inController:[dataSource controller]];
- if (![self isDownload]) {
- WebError *error = [[WebError alloc] initWithErrorCode:WebErrorCodeCancelled
- inDomain:WebErrorDomainWebFoundation failingURL:[[request URL] absoluteString]];
+ if (error) {
[resourceLoadDelegate resource:identifier didFailLoadingWithError:error fromDataSource:dataSource];
}
[self _releaseResources];
}
+- (void)cancel
+{
+ [self _cancelWithError:[self isDownload] ? nil : [self cancelledError]];
+}
+
+- (void)cancelQuietly
+{
+ [self _cancelWithError:nil];
+}
+
+- (WebError *)cancelledError
+{
+ return [WebError errorWithCode:WebErrorCodeCancelled
+ inDomain:WebErrorDomainWebFoundation failingURL:[[request URL] absoluteString]];
+}
+
+- (void)notifyDelegatesOfInterruptionByPolicyChange
+{
+ WebError *error = [WebError errorWithCode:WebErrorResourceLoadInterruptedByPolicyChange inDomain:WebErrorDomainWebKit failingURL:nil];
+ [[self resourceLoadDelegate] resource:identifier didFailLoadingWithError:error fromDataSource:dataSource];
+}
+
@end
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.h b/WebKit/WebView.subproj/WebMainResourceClient.h
index 4354b4a..7cb20d5 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.h
+++ b/WebKit/WebView.subproj/WebMainResourceClient.h
@@ -25,6 +25,8 @@
WebDownloadHandler *downloadHandler;
WebContentAction policyAction;
NSMutableData *resourceData;
+ int _contentLength; // for logging only
+ int _bytesReceived; // for logging only
}
- initWithDataSource:(WebDataSource *)dataSource;
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.m b/WebKit/WebView.subproj/WebMainResourceClient.m
index e1d2e8e..98b750e 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.m
+++ b/WebKit/WebView.subproj/WebMainResourceClient.m
@@ -75,21 +75,12 @@
- (void)cancel
{
- if (currentURL == nil) {
- return;
- }
-
- LOG(Loading, "URL = %@", currentURL);
+ LOG(Loading, "URL = %@", [dataSource URL]);
// Calling receivedError will likely result in a call to release, so we must retain.
[self retain];
- // FIXME: Maybe we should be passing the URL from the handle here, not from the dataSource.
- WebError *error = [[WebError alloc] initWithErrorCode:WebErrorCodeCancelled
- inDomain:WebErrorDomainWebFoundation
- failingURL:[[[dataSource request] URL] absoluteString]];
- [self receivedError:error];
- [error release];
+ [self receivedError:[self cancelledError]];
if (downloadHandler) {
[downloadHandler cancel];
@@ -97,68 +88,55 @@
downloadHandler = nil;
}
- [self release];
-
[super cancel];
+
+ [self release];
}
-(WebResourceRequest *)handle:(WebResourceHandle *)h willSendRequest:(WebResourceRequest *)newRequest
{
- WebResourceRequest *result;
-
- BOOL firstRequest = request == nil;
-
- newRequest = [super handle: h willSendRequest: newRequest];
+ newRequest = [super handle:h willSendRequest:newRequest];
ASSERT(newRequest != nil);
NSURL *URL = [newRequest URL];
- if (![[dataSource webFrame] _shouldShowRequest:request]) {
- [handle cancel];
- [[WebStandardPanels sharedStandardPanels] _didStopLoadingURL:currentURL inController:[dataSource controller]];
+ if (![[dataSource webFrame] _shouldShowRequest:newRequest]) {
+ [self cancelQuietly];
[[dataSource webFrame] _setProvisionalDataSource:nil];
- [[[dataSource controller] locationChangeDelegate] locationChangeDone:[WebError errorWithCode:WebErrorLocationChangeInterruptedByPolicyChange inDomain:WebErrorDomainWebKit failingURL:nil] forDataSource:dataSource];
- result = nil;
+ [[[dataSource controller] locationChangeDelegate] locationChangeDone:
+ [WebError errorWithCode:WebErrorLocationChangeInterruptedByPolicyChange inDomain:WebErrorDomainWebKit failingURL:nil]
+ forDataSource:dataSource];
+ return nil;
}
- else {
- LOG(Redirect, "URL = %@", URL);
- // Update cookie policy base URL as URL changes, except for subframes, which use the
- // URL of the main frame which doesn't change when we redirect.
- if ([dataSource webFrame] == [[dataSource controller] mainFrame]) {
- [newRequest setCookiePolicyBaseURL:URL];
- }
-
- // Don't set this on the first request. It is set
- // when the main load was started.
- if (!firstRequest)
- [dataSource _setRequest:request];
-
- result = newRequest;
+ LOG(Redirect, "URL = %@", URL);
+
+ // Update cookie policy base URL as URL changes, except for subframes, which use the
+ // URL of the main frame which doesn't change when we redirect.
+ if ([dataSource webFrame] == [[dataSource controller] mainFrame]) {
+ [newRequest setCookiePolicyBaseURL:URL];
}
-
- return result;
+
+ // Don't set this on the first request. It is set
+ // when the main load was started.
+ [dataSource _setRequest:newRequest];
+
+ return newRequest;
}
-- (void)_notifyDelegatesOfInterruptionByPolicyChange
+- (void)notifyDelegatesOfInterruptionByPolicyChange
{
- WebError *interruptError;
-
// Terminate the locationChangeDelegate correctly.
- interruptError = [WebError errorWithCode:WebErrorLocationChangeInterruptedByPolicyChange inDomain:WebErrorDomainWebKit failingURL:nil];
- [[[dataSource controller] locationChangeDelegate] locationChangeDone: interruptError forDataSource:dataSource];
+ WebError *interruptError = [WebError errorWithCode:WebErrorLocationChangeInterruptedByPolicyChange inDomain:WebErrorDomainWebKit failingURL:nil];
+ [[[dataSource controller] locationChangeDelegate] locationChangeDone:interruptError forDataSource:dataSource];
- // Terminate the resourceLoadDelegate correctly.
- interruptError = [WebError errorWithCode:WebErrorResourceLoadInterruptedByPolicyChange inDomain:WebErrorDomainWebKit failingURL:nil];
- [resourceLoadDelegate resource: identifier didFailLoadingWithError: interruptError fromDataSource: dataSource];
+ [super notifyDelegatesOfInterruptionByPolicyChange];
}
-(void)handle:(WebResourceHandle *)h didReceiveResponse:(WebResourceResponse *)r
{
- ASSERT (response == nil);
-
[dataSource _setResponse:r];
LOG(Download, "main content type: %@", [r contentType]);
@@ -181,12 +159,12 @@
{
[[dataSource webFrame] _setProvisionalDataSource:nil];
- [self _notifyDelegatesOfInterruptionByPolicyChange];
+ [self notifyDelegatesOfInterruptionByPolicyChange];
// Hand off the dataSource to the download handler. This will cause the remaining
// handle delegate callbacks to go to the controller's download delegate.
downloadHandler = [[WebDownloadHandler alloc] initWithDataSource:dataSource];
- [self setIsDownload: YES];
+ [self setIsDownload:YES];
}
break;
@@ -194,7 +172,7 @@
{
[self cancel];
[[dataSource webFrame] _setProvisionalDataSource:nil];
- [self _notifyDelegatesOfInterruptionByPolicyChange];
+ [self notifyDelegatesOfInterruptionByPolicyChange];
}
break;
@@ -202,19 +180,20 @@
ERROR("contentPolicyForMIMEType:URL:inFrame: returned an invalid content policy.");
}
- [super handle: h didReceiveResponse: r];
+ [super handle:h didReceiveResponse:r];
+
+ _contentLength = [r contentLength];
}
- (void)handle:(WebResourceHandle *)h didReceiveData:(NSData *)data
{
- LOG(Loading, "URL = %@, data = %p, length %d", currentURL, data, [data length]);
+ LOG(Loading, "URL = %@, data = %p, length %d", [dataSource URL], data, [data length]);
if (downloadHandler) {
WebError *downloadError = [downloadHandler receivedData:data];
if (downloadError) {
[self receivedError:downloadError];
- [handle cancel];
- [[WebStandardPanels sharedStandardPanels] _didStopLoadingURL:currentURL inController:[dataSource controller]];
+ [self cancel];
return;
}
} else {
@@ -225,14 +204,16 @@
complete:NO];
}
- [super handle: h didReceiveData: data];
+ [super handle:h didReceiveData:data];
+
+ _bytesReceived += [data length];
- LOG(Download, "%d of %d", [response contentLengthReceived], [response contentLength]);
+ LOG(Download, "%d of %d", _bytesReceived, _contentLength);
}
- (void)handleDidFinishLoading:(WebResourceHandle *)h
{
- LOG(Loading, "URL = %@", currentURL);
+ LOG(Loading, "URL = %@", [dataSource URL]);
// Calling receivedError will likely result in a call to release, so we must retain.
[self retain];
@@ -259,17 +240,9 @@
}
else {
[dataSource _finishedLoading];
-
- // FIXME: Please let Chris know if this is really necessary?
- // Either send a final error message or a final progress message.
- WebError *nonTerminalError = [[dataSource response] error];
- if (nonTerminalError) {
- [self receivedError:nonTerminalError];
- } else {
- [[dataSource controller] _mainReceivedBytesSoFar:[resourceData length]
- fromDataSource:dataSource
- complete:YES];
- }
+ [[dataSource controller] _mainReceivedBytesSoFar:[resourceData length]
+ fromDataSource:dataSource
+ complete:YES];
}
[super handleDidFinishLoading: h];
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.h b/WebKit/WebView.subproj/WebMainResourceLoader.h
index 4354b4a..7cb20d5 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.h
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.h
@@ -25,6 +25,8 @@
WebDownloadHandler *downloadHandler;
WebContentAction policyAction;
NSMutableData *resourceData;
+ int _contentLength; // for logging only
+ int _bytesReceived; // for logging only
}
- initWithDataSource:(WebDataSource *)dataSource;
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.m b/WebKit/WebView.subproj/WebMainResourceLoader.m
index e1d2e8e..98b750e 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.m
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.m
@@ -75,21 +75,12 @@
- (void)cancel
{
- if (currentURL == nil) {
- return;
- }
-
- LOG(Loading, "URL = %@", currentURL);
+ LOG(Loading, "URL = %@", [dataSource URL]);
// Calling receivedError will likely result in a call to release, so we must retain.
[self retain];
- // FIXME: Maybe we should be passing the URL from the handle here, not from the dataSource.
- WebError *error = [[WebError alloc] initWithErrorCode:WebErrorCodeCancelled
- inDomain:WebErrorDomainWebFoundation
- failingURL:[[[dataSource request] URL] absoluteString]];
- [self receivedError:error];
- [error release];
+ [self receivedError:[self cancelledError]];
if (downloadHandler) {
[downloadHandler cancel];
@@ -97,68 +88,55 @@
downloadHandler = nil;
}
- [self release];
-
[super cancel];
+
+ [self release];
}
-(WebResourceRequest *)handle:(WebResourceHandle *)h willSendRequest:(WebResourceRequest *)newRequest
{
- WebResourceRequest *result;
-
- BOOL firstRequest = request == nil;
-
- newRequest = [super handle: h willSendRequest: newRequest];
+ newRequest = [super handle:h willSendRequest:newRequest];
ASSERT(newRequest != nil);
NSURL *URL = [newRequest URL];
- if (![[dataSource webFrame] _shouldShowRequest:request]) {
- [handle cancel];
- [[WebStandardPanels sharedStandardPanels] _didStopLoadingURL:currentURL inController:[dataSource controller]];
+ if (![[dataSource webFrame] _shouldShowRequest:newRequest]) {
+ [self cancelQuietly];
[[dataSource webFrame] _setProvisionalDataSource:nil];
- [[[dataSource controller] locationChangeDelegate] locationChangeDone:[WebError errorWithCode:WebErrorLocationChangeInterruptedByPolicyChange inDomain:WebErrorDomainWebKit failingURL:nil] forDataSource:dataSource];
- result = nil;
+ [[[dataSource controller] locationChangeDelegate] locationChangeDone:
+ [WebError errorWithCode:WebErrorLocationChangeInterruptedByPolicyChange inDomain:WebErrorDomainWebKit failingURL:nil]
+ forDataSource:dataSource];
+ return nil;
}
- else {
- LOG(Redirect, "URL = %@", URL);
- // Update cookie policy base URL as URL changes, except for subframes, which use the
- // URL of the main frame which doesn't change when we redirect.
- if ([dataSource webFrame] == [[dataSource controller] mainFrame]) {
- [newRequest setCookiePolicyBaseURL:URL];
- }
-
- // Don't set this on the first request. It is set
- // when the main load was started.
- if (!firstRequest)
- [dataSource _setRequest:request];
-
- result = newRequest;
+ LOG(Redirect, "URL = %@", URL);
+
+ // Update cookie policy base URL as URL changes, except for subframes, which use the
+ // URL of the main frame which doesn't change when we redirect.
+ if ([dataSource webFrame] == [[dataSource controller] mainFrame]) {
+ [newRequest setCookiePolicyBaseURL:URL];
}
-
- return result;
+
+ // Don't set this on the first request. It is set
+ // when the main load was started.
+ [dataSource _setRequest:newRequest];
+
+ return newRequest;
}
-- (void)_notifyDelegatesOfInterruptionByPolicyChange
+- (void)notifyDelegatesOfInterruptionByPolicyChange
{
- WebError *interruptError;
-
// Terminate the locationChangeDelegate correctly.
- interruptError = [WebError errorWithCode:WebErrorLocationChangeInterruptedByPolicyChange inDomain:WebErrorDomainWebKit failingURL:nil];
- [[[dataSource controller] locationChangeDelegate] locationChangeDone: interruptError forDataSource:dataSource];
+ WebError *interruptError = [WebError errorWithCode:WebErrorLocationChangeInterruptedByPolicyChange inDomain:WebErrorDomainWebKit failingURL:nil];
+ [[[dataSource controller] locationChangeDelegate] locationChangeDone:interruptError forDataSource:dataSource];
- // Terminate the resourceLoadDelegate correctly.
- interruptError = [WebError errorWithCode:WebErrorResourceLoadInterruptedByPolicyChange inDomain:WebErrorDomainWebKit failingURL:nil];
- [resourceLoadDelegate resource: identifier didFailLoadingWithError: interruptError fromDataSource: dataSource];
+ [super notifyDelegatesOfInterruptionByPolicyChange];
}
-(void)handle:(WebResourceHandle *)h didReceiveResponse:(WebResourceResponse *)r
{
- ASSERT (response == nil);
-
[dataSource _setResponse:r];
LOG(Download, "main content type: %@", [r contentType]);
@@ -181,12 +159,12 @@
{
[[dataSource webFrame] _setProvisionalDataSource:nil];
- [self _notifyDelegatesOfInterruptionByPolicyChange];
+ [self notifyDelegatesOfInterruptionByPolicyChange];
// Hand off the dataSource to the download handler. This will cause the remaining
// handle delegate callbacks to go to the controller's download delegate.
downloadHandler = [[WebDownloadHandler alloc] initWithDataSource:dataSource];
- [self setIsDownload: YES];
+ [self setIsDownload:YES];
}
break;
@@ -194,7 +172,7 @@
{
[self cancel];
[[dataSource webFrame] _setProvisionalDataSource:nil];
- [self _notifyDelegatesOfInterruptionByPolicyChange];
+ [self notifyDelegatesOfInterruptionByPolicyChange];
}
break;
@@ -202,19 +180,20 @@
ERROR("contentPolicyForMIMEType:URL:inFrame: returned an invalid content policy.");
}
- [super handle: h didReceiveResponse: r];
+ [super handle:h didReceiveResponse:r];
+
+ _contentLength = [r contentLength];
}
- (void)handle:(WebResourceHandle *)h didReceiveData:(NSData *)data
{
- LOG(Loading, "URL = %@, data = %p, length %d", currentURL, data, [data length]);
+ LOG(Loading, "URL = %@, data = %p, length %d", [dataSource URL], data, [data length]);
if (downloadHandler) {
WebError *downloadError = [downloadHandler receivedData:data];
if (downloadError) {
[self receivedError:downloadError];
- [handle cancel];
- [[WebStandardPanels sharedStandardPanels] _didStopLoadingURL:currentURL inController:[dataSource controller]];
+ [self cancel];
return;
}
} else {
@@ -225,14 +204,16 @@
complete:NO];
}
- [super handle: h didReceiveData: data];
+ [super handle:h didReceiveData:data];
+
+ _bytesReceived += [data length];
- LOG(Download, "%d of %d", [response contentLengthReceived], [response contentLength]);
+ LOG(Download, "%d of %d", _bytesReceived, _contentLength);
}
- (void)handleDidFinishLoading:(WebResourceHandle *)h
{
- LOG(Loading, "URL = %@", currentURL);
+ LOG(Loading, "URL = %@", [dataSource URL]);
// Calling receivedError will likely result in a call to release, so we must retain.
[self retain];
@@ -259,17 +240,9 @@
}
else {
[dataSource _finishedLoading];
-
- // FIXME: Please let Chris know if this is really necessary?
- // Either send a final error message or a final progress message.
- WebError *nonTerminalError = [[dataSource response] error];
- if (nonTerminalError) {
- [self receivedError:nonTerminalError];
- } else {
- [[dataSource controller] _mainReceivedBytesSoFar:[resourceData length]
- fromDataSource:dataSource
- complete:YES];
- }
+ [[dataSource controller] _mainReceivedBytesSoFar:[resourceData length]
+ fromDataSource:dataSource
+ complete:YES];
}
[super handleDidFinishLoading: h];
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list