[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
rjw
rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:46:43 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 3a1e02a413dd6f26302faee0f014a4fbaa10857b
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Oct 3 21:53:13 2002 +0000
Changed to reflect new WebResourceLoadDelegate API.
* BrowserWebController.h:
* BrowserWebController.m:
(-[BrowserWebController resourceRequest:willSendRequest:fromDataSource:]):
(-[BrowserWebController resourceRequest:didReceiveContentLength:fromDataSource:]):
(-[BrowserWebController resourceRequest:didReceiveResponse:fromDataSource:]):
(-[BrowserWebController resourceRequest:didFinishLoadingFromDataSource:]):
* DownloadMonitor.h:
* DownloadMonitor.m:
(-[DownloadMonitor _monitorDownload:withBytesLoaded:bytesExpected:error:dataSource:complete:]):
(-[DownloadMonitor resourceRequest:willSendRequest:fromDataSource:]):
(-[DownloadMonitor resourceRequest:didReceiveContentLength:fromDataSource:]):
(-[DownloadMonitor resourceRequest:didReceiveResponse:fromDataSource:]):
(-[DownloadMonitor resourceRequest:didFinishLoadingFromDataSource:]):
(-[DownloadMonitor resourceRequest:didFailLoadingWithError:fromDataSource:]):
* FrameProgressEntry.m:
(-[FrameProgressEntry updateSubresource:ofDataSource:withURLString:bytesLoaded:bytesExpected:error:]):
* LoadProgressMonitor.m:
Changed to reflect new WebResourceLoadDelegate API.
* Misc.subproj/WebIconLoader.m:
* Misc.subproj/WebKit.h:
* Plugins.subproj/WebPluginStream.m:
(-[WebNetscapePluginStream handle:didReceiveData:]):
(-[WebNetscapePluginStream handleDidFinishLoading:]):
(-[WebNetscapePluginStream cancel]):
(-[WebNetscapePluginStream handle:didFailLoadingWithError:]):
* WebCoreSupport.subproj/WebBridge.m:
(-[WebBridge objectLoadedFromCache:size:]):
(-[WebBridge reportBadURL:]):
* WebCoreSupport.subproj/WebSubresourceClient.h:
* WebCoreSupport.subproj/WebSubresourceClient.m:
(-[WebSubresourceClient initWithLoader:dataSource:]):
(-[WebSubresourceClient dealloc]):
(-[WebSubresourceClient receivedProgressWithComplete:]):
(+[WebSubresourceClient startLoadingResource:withURL:referrer:forDataSource:]):
(-[WebSubresourceClient receivedError:]):
(-[WebSubresourceClient handle:willSendRequest:]):
(-[WebSubresourceClient handle:didReceiveResponse:]):
(-[WebSubresourceClient handle:didReceiveData:]):
(-[WebSubresourceClient handleDidFinishLoading:]):
(-[WebSubresourceClient handle:didFailLoadingWithError:]):
(-[WebSubresourceClient cancel]):
* WebKit.exp:
* WebKit.pbproj/project.pbxproj:
* WebView.subproj/WebController.h:
* WebView.subproj/WebController.m:
(-[WebController setResourceProgressDelegate:]):
(-[WebController resourceProgressDelegate]):
(-[WebController setDownloadProgressDelegate:]):
(-[WebController downloadProgressDelegate]):
* WebView.subproj/WebControllerPrivate.h:
* WebView.subproj/WebControllerPrivate.m:
(-[WebController _receivedProgressForResourceHandle:fromDataSource:complete:]):
(-[WebController _mainReceivedProgressForResourceHandle:bytesSoFar:fromDataSource:complete:]):
(-[WebController _receivedError:forResourceHandle:fromDataSource:]):
(-[WebController _mainReceivedError:forResourceHandle:fromDataSource:]):
* WebView.subproj/WebLoadProgress.h: Removed.
* WebView.subproj/WebLoadProgress.m: Removed.
* WebView.subproj/WebMainResourceClient.h:
* WebView.subproj/WebMainResourceClient.m:
(-[WebMainResourceClient initWithDataSource:]):
(-[WebMainResourceClient dealloc]):
(-[WebMainResourceClient receivedProgressWithHandle:complete:]):
(-[WebMainResourceClient receivedError:forHandle:]):
(-[WebMainResourceClient handleDidFinishLoading:]):
(-[WebMainResourceClient handle:willSendRequest:]):
(-[WebMainResourceClient handle:didReceiveResponse:]):
(-[WebMainResourceClient handle:didReceiveData:]):
(-[WebMainResourceClient handle:didFailLoadingWithError:]):
* WebView.subproj/WebResourceProgressDelegate.h:
Always send a handle:willSendRequest: before sending a request,
including first time. This will allow WebKit clients to intervene
on every load should they so choose.
* CacheLoader.subproj/WebResourceHandle.m:
(-[WebResourceHandle loadWithDelegate:]):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2236 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 41244d6..53348d7 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,59 @@
+2002-10-03 Richard Williamson <rjw at apple.com>
+
+ Changed to reflect new WebResourceLoadDelegate API.
+
+ * Misc.subproj/WebIconLoader.m:
+ * Misc.subproj/WebKit.h:
+ * Plugins.subproj/WebPluginStream.m:
+ (-[WebNetscapePluginStream handle:didReceiveData:]):
+ (-[WebNetscapePluginStream handleDidFinishLoading:]):
+ (-[WebNetscapePluginStream cancel]):
+ (-[WebNetscapePluginStream handle:didFailLoadingWithError:]):
+ * WebCoreSupport.subproj/WebBridge.m:
+ (-[WebBridge objectLoadedFromCache:size:]):
+ (-[WebBridge reportBadURL:]):
+ * WebCoreSupport.subproj/WebSubresourceClient.h:
+ * WebCoreSupport.subproj/WebSubresourceClient.m:
+ (-[WebSubresourceClient initWithLoader:dataSource:]):
+ (-[WebSubresourceClient dealloc]):
+ (-[WebSubresourceClient receivedProgressWithComplete:]):
+ (+[WebSubresourceClient startLoadingResource:withURL:referrer:forDataSource:]):
+ (-[WebSubresourceClient receivedError:]):
+ (-[WebSubresourceClient handle:willSendRequest:]):
+ (-[WebSubresourceClient handle:didReceiveResponse:]):
+ (-[WebSubresourceClient handle:didReceiveData:]):
+ (-[WebSubresourceClient handleDidFinishLoading:]):
+ (-[WebSubresourceClient handle:didFailLoadingWithError:]):
+ (-[WebSubresourceClient cancel]):
+ * WebKit.exp:
+ * WebKit.pbproj/project.pbxproj:
+ * WebView.subproj/WebController.h:
+ * WebView.subproj/WebController.m:
+ (-[WebController setResourceProgressDelegate:]):
+ (-[WebController resourceProgressDelegate]):
+ (-[WebController setDownloadProgressDelegate:]):
+ (-[WebController downloadProgressDelegate]):
+ * WebView.subproj/WebControllerPrivate.h:
+ * WebView.subproj/WebControllerPrivate.m:
+ (-[WebController _receivedProgressForResourceHandle:fromDataSource:complete:]):
+ (-[WebController _mainReceivedProgressForResourceHandle:bytesSoFar:fromDataSource:complete:]):
+ (-[WebController _receivedError:forResourceHandle:fromDataSource:]):
+ (-[WebController _mainReceivedError:forResourceHandle:fromDataSource:]):
+ * WebView.subproj/WebLoadProgress.h: Removed.
+ * WebView.subproj/WebLoadProgress.m: Removed.
+ * WebView.subproj/WebMainResourceClient.h:
+ * WebView.subproj/WebMainResourceClient.m:
+ (-[WebMainResourceClient initWithDataSource:]):
+ (-[WebMainResourceClient dealloc]):
+ (-[WebMainResourceClient receivedProgressWithHandle:complete:]):
+ (-[WebMainResourceClient receivedError:forHandle:]):
+ (-[WebMainResourceClient handleDidFinishLoading:]):
+ (-[WebMainResourceClient handle:willSendRequest:]):
+ (-[WebMainResourceClient handle:didReceiveResponse:]):
+ (-[WebMainResourceClient handle:didReceiveData:]):
+ (-[WebMainResourceClient handle:didFailLoadingWithError:]):
+ * WebView.subproj/WebResourceProgressDelegate.h:
+
=== Alexander-26 ===
2002-10-02 Maciej Stachowiak <mjs at apple.com>
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 41244d6..53348d7 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,59 @@
+2002-10-03 Richard Williamson <rjw at apple.com>
+
+ Changed to reflect new WebResourceLoadDelegate API.
+
+ * Misc.subproj/WebIconLoader.m:
+ * Misc.subproj/WebKit.h:
+ * Plugins.subproj/WebPluginStream.m:
+ (-[WebNetscapePluginStream handle:didReceiveData:]):
+ (-[WebNetscapePluginStream handleDidFinishLoading:]):
+ (-[WebNetscapePluginStream cancel]):
+ (-[WebNetscapePluginStream handle:didFailLoadingWithError:]):
+ * WebCoreSupport.subproj/WebBridge.m:
+ (-[WebBridge objectLoadedFromCache:size:]):
+ (-[WebBridge reportBadURL:]):
+ * WebCoreSupport.subproj/WebSubresourceClient.h:
+ * WebCoreSupport.subproj/WebSubresourceClient.m:
+ (-[WebSubresourceClient initWithLoader:dataSource:]):
+ (-[WebSubresourceClient dealloc]):
+ (-[WebSubresourceClient receivedProgressWithComplete:]):
+ (+[WebSubresourceClient startLoadingResource:withURL:referrer:forDataSource:]):
+ (-[WebSubresourceClient receivedError:]):
+ (-[WebSubresourceClient handle:willSendRequest:]):
+ (-[WebSubresourceClient handle:didReceiveResponse:]):
+ (-[WebSubresourceClient handle:didReceiveData:]):
+ (-[WebSubresourceClient handleDidFinishLoading:]):
+ (-[WebSubresourceClient handle:didFailLoadingWithError:]):
+ (-[WebSubresourceClient cancel]):
+ * WebKit.exp:
+ * WebKit.pbproj/project.pbxproj:
+ * WebView.subproj/WebController.h:
+ * WebView.subproj/WebController.m:
+ (-[WebController setResourceProgressDelegate:]):
+ (-[WebController resourceProgressDelegate]):
+ (-[WebController setDownloadProgressDelegate:]):
+ (-[WebController downloadProgressDelegate]):
+ * WebView.subproj/WebControllerPrivate.h:
+ * WebView.subproj/WebControllerPrivate.m:
+ (-[WebController _receivedProgressForResourceHandle:fromDataSource:complete:]):
+ (-[WebController _mainReceivedProgressForResourceHandle:bytesSoFar:fromDataSource:complete:]):
+ (-[WebController _receivedError:forResourceHandle:fromDataSource:]):
+ (-[WebController _mainReceivedError:forResourceHandle:fromDataSource:]):
+ * WebView.subproj/WebLoadProgress.h: Removed.
+ * WebView.subproj/WebLoadProgress.m: Removed.
+ * WebView.subproj/WebMainResourceClient.h:
+ * WebView.subproj/WebMainResourceClient.m:
+ (-[WebMainResourceClient initWithDataSource:]):
+ (-[WebMainResourceClient dealloc]):
+ (-[WebMainResourceClient receivedProgressWithHandle:complete:]):
+ (-[WebMainResourceClient receivedError:forHandle:]):
+ (-[WebMainResourceClient handleDidFinishLoading:]):
+ (-[WebMainResourceClient handle:willSendRequest:]):
+ (-[WebMainResourceClient handle:didReceiveResponse:]):
+ (-[WebMainResourceClient handle:didReceiveData:]):
+ (-[WebMainResourceClient handle:didFailLoadingWithError:]):
+ * WebView.subproj/WebResourceProgressDelegate.h:
+
=== Alexander-26 ===
2002-10-02 Maciej Stachowiak <mjs at apple.com>
diff --git a/WebKit/Misc.subproj/WebIconLoader.m b/WebKit/Misc.subproj/WebIconLoader.m
index 05fcd05..ebdee8e 100644
--- a/WebKit/Misc.subproj/WebIconLoader.m
+++ b/WebKit/Misc.subproj/WebIconLoader.m
@@ -124,8 +124,4 @@
{
}
-- (void)handleDidRedirect:(WebResourceHandle *)sender toURL:(NSURL *)URL
-{
-}
-
@end
diff --git a/WebKit/Misc.subproj/WebKit.h b/WebKit/Misc.subproj/WebKit.h
index 9e1012f..eab0d96 100644
--- a/WebKit/Misc.subproj/WebKit.h
+++ b/WebKit/Misc.subproj/WebKit.h
@@ -17,7 +17,6 @@
#import <WebKit/WebHistoryItem.h>
#import <WebKit/WebHistoryList.h>
#import <WebKit/WebKitErrors.h>
-#import <WebKit/WebLoadProgress.h>
#import <WebKit/WebLocationChangeDelegate.h>
#import <WebKit/WebPreferences.h>
#import <WebKit/WebResourceProgressDelegate.h>
diff --git a/WebKit/Plugins.subproj/WebPluginStream.m b/WebKit/Plugins.subproj/WebPluginStream.m
index 489003e..12795e7 100644
--- a/WebKit/Plugins.subproj/WebPluginStream.m
+++ b/WebKit/Plugins.subproj/WebPluginStream.m
@@ -9,7 +9,6 @@
#import <WebKit/WebDataSourcePrivate.h>
#import <WebKit/WebFrame.h>
#import <WebKit/WebKitLogging.h>
-#import <WebKit/WebLoadProgress.h>
#import <WebKit/WebPlugin.h>
#import <WebKit/WebPluginStream.h>
#import <WebKit/WebView.h>
@@ -309,8 +308,7 @@
[self receivedData:data];
- [[view controller] _receivedProgress:[WebLoadProgress progressWithResourceHandle:handle]
- forResourceHandle: handle fromDataSource: [view dataSource] complete: NO];
+ [[view controller] _receivedProgressForResourceHandle: handle fromDataSource: [view dataSource] complete: NO];
}
- (void)handleDidFinishLoading:(WebResourceHandle *)handle
@@ -322,8 +320,7 @@
WebController *controller = [view controller];
- [controller _receivedProgress:[WebLoadProgress progressWithResourceHandle:handle]
- forResourceHandle: handle fromDataSource: [view dataSource] complete: YES];
+ [controller _receivedProgressForResourceHandle: handle fromDataSource: [view dataSource] complete: YES];
[self finishedLoadingWithData:resourceData];
@@ -343,10 +340,8 @@
WebError *cancelError = [[WebError alloc] initWithErrorCode:WebErrorCodeCancelled
inDomain:WebErrorDomainWebFoundation
failingURL:nil];
- WebLoadProgress *loadProgress = [[WebLoadProgress alloc] initWithResourceHandle:resource];
[controller _receivedError: cancelError forResourceHandle: resource
- partialProgress: loadProgress fromDataSource: [view dataSource]];
- [loadProgress release];
+ fromDataSource: [view dataSource]];
[cancelError release];
@@ -366,24 +361,13 @@
resource = nil;
WebController *controller = [view controller];
-
- WebLoadProgress *loadProgress = [[WebLoadProgress alloc] initWithResourceHandle:handle];
-
+
[controller _receivedError: result forResourceHandle: handle
- partialProgress: loadProgress fromDataSource: [view dataSource]];
- [loadProgress release];
+ fromDataSource: [view dataSource]];
[self receivedError:NPRES_NETWORK_ERR];
[controller _didStopLoading:URL];
}
-- (void)handleDidRedirect:(WebResourceHandle *)handle toURL:(NSURL *)toURL
-{
- WebController *controller = [view controller];
- [controller _didStopLoading:URL];
- // FIXME: This next line is not sufficient. We don't do anything to remember the new URL.
- [controller _didStartLoading:toURL];
-}
-
@end
diff --git a/WebKit/WebCoreSupport.subproj/WebBridge.m b/WebKit/WebCoreSupport.subproj/WebBridge.m
index ae31cf9..acc45e2 100644
--- a/WebKit/WebCoreSupport.subproj/WebBridge.m
+++ b/WebKit/WebCoreSupport.subproj/WebBridge.m
@@ -13,7 +13,6 @@
#import <WebKit/WebHTMLRepresentationPrivate.h>
#import <WebKit/WebHTMLViewPrivate.h>
#import <WebKit/WebKitStatisticsPrivate.h>
-#import <WebKit/WebLoadProgress.h>
#import <WebKit/WebLocationChangeDelegate.h>
#import <WebKit/WebPreferences.h>
#import <WebKit/WebSubresourceClient.h>
@@ -176,9 +175,7 @@
WebResourceRequest *request = [[WebResourceRequest alloc] initWithURL:URL];
WebResourceHandle *handle = [[WebResourceHandle alloc] initWithRequest:request];
[handle loadWithDelegate:nil];
- WebLoadProgress *loadProgress = [[WebLoadProgress alloc] initWithBytesSoFar:bytes totalToLoad:bytes];
- [[frame controller] _receivedProgress:loadProgress forResourceHandle:handle fromDataSource:[self dataSource] complete:YES];
- [loadProgress release];
+ [[frame controller] _receivedProgressForResourceHandle:handle fromDataSource:[self dataSource] complete:YES];
[handle release];
[request release];
}
@@ -323,7 +320,6 @@
failingURL:badURL];
[[frame controller] _receivedError:badURLError
forResourceHandle:nil
- partialProgress:nil
fromDataSource:[self dataSource]];
[badURLError release];
}
diff --git a/WebKit/WebCoreSupport.subproj/WebSubresourceClient.h b/WebKit/WebCoreSupport.subproj/WebSubresourceClient.h
index f4b29e1..009e8cb 100644
--- a/WebKit/WebCoreSupport.subproj/WebSubresourceClient.h
+++ b/WebKit/WebCoreSupport.subproj/WebSubresourceClient.h
@@ -16,10 +16,14 @@
@interface WebSubresourceClient : NSObject <WebResourceHandleDelegate, WebCoreResourceHandle>
{
id <WebCoreResourceLoader> loader;
- WebResourceResponse *response;
WebDataSource *dataSource;
NSURL *currentURL;
WebResourceHandle *handle;
+
+ // Both of these delegates are retained by the client.
+ id <WebResourceLoadDelegate> resourceProgressDelegate;
+ WebResourceRequest *request;
+ WebResourceResponse *response;
}
+ (WebSubresourceClient *)startLoadingResource:(id <WebCoreResourceLoader>)rLoader
diff --git a/WebKit/WebCoreSupport.subproj/WebSubresourceClient.m b/WebKit/WebCoreSupport.subproj/WebSubresourceClient.m
index 51c8e1b..ff5ed1a 100644
--- a/WebKit/WebCoreSupport.subproj/WebSubresourceClient.m
+++ b/WebKit/WebCoreSupport.subproj/WebSubresourceClient.m
@@ -1,27 +1,25 @@
-//
-// WebSubresourceClient.m
-// WebKit
-//
-// Created by Darin Adler on Sat Jun 15 2002.
-// Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
-//
+/*
+ WebSubresourceClient.mm
+ Copyright (c) 2002, Apple Computer, Inc. All rights reserved.
+*/
+#import <WebKit/WebBridge.h>
+#import <WebKit/WebControllerPrivate.h>
+#import <WebKit/WebDataSourcePrivate.h>
+#import <WebKit/WebFrame.h>
+#import <WebKit/WebResourceProgressDelegate.h>
#import <WebKit/WebSubresourceClient.h>
+#import <WebFoundation/WebAssertions.h>
#import <WebFoundation/WebError.h>
#import <WebFoundation/WebResourceHandle.h>
+#import <WebFoundation/WebResourceHandlePrivate.h>
#import <WebFoundation/WebResourceRequest.h>
#import <WebFoundation/WebHTTPResourceRequest.h>
#import <WebFoundation/WebResourceResponse.h>
#import <WebCore/WebCoreResourceLoader.h>
-#import <WebKit/WebLoadProgress.h>
-#import <WebKit/WebControllerPrivate.h>
-#import <WebKit/WebBridge.h>
-#import <WebKit/WebDataSourcePrivate.h>
-#import <WebKit/WebFrame.h>
-#import <WebFoundation/WebAssertions.h>
@implementation WebSubresourceClient
@@ -31,6 +29,8 @@
loader = [l retain];
dataSource = [s retain];
+
+ resourceProgressDelegate = [[[dataSource controller] resourceProgressDelegate] retain];
return self;
}
@@ -42,7 +42,9 @@
[loader release];
[dataSource release];
[handle release];
+ [request release];
[response release];
+ [resourceProgressDelegate release];
[super dealloc];
}
@@ -64,41 +66,40 @@
- (void)receivedProgressWithComplete:(BOOL)isComplete
{
- [[dataSource controller] _receivedProgress:[WebLoadProgress progressWithResourceHandle:handle]
- forResourceHandle:handle fromDataSource:dataSource complete:isComplete];
+ [[dataSource controller] _receivedProgressForResourceHandle:handle fromDataSource:dataSource complete:isComplete];
}
+ (WebSubresourceClient *)startLoadingResource:(id <WebCoreResourceLoader>)rLoader
withURL:(NSURL *)URL referrer:(NSString *)referrer forDataSource:(WebDataSource *)source
{
WebSubresourceClient *client = [[self alloc] initWithLoader:rLoader dataSource:source];
- WebResourceRequest *request = [[WebResourceRequest alloc] initWithURL:URL];
- [request setRequestCachePolicy:[[source request] requestCachePolicy]];
- [request setResponseCachePolicy:[[source request] responseCachePolicy]];
- [request setReferrer:referrer];
- [request setCookiePolicyBaseURL:[[[[source controller] mainFrame] dataSource] URL]];
- [request setUserAgent:[[source controller] userAgentForURL:URL]];
-
- if (![WebResourceHandle canInitWithRequest:request]) {
- [request release];
+ WebResourceRequest *newRequest = [[WebResourceRequest alloc] initWithURL:URL];
+ [newRequest setRequestCachePolicy:[[source request] requestCachePolicy]];
+ [newRequest setResponseCachePolicy:[[source request] responseCachePolicy]];
+ [newRequest setReferrer:referrer];
+ [newRequest setCookiePolicyBaseURL:[[[[source controller] mainFrame] dataSource] URL]];
+ [newRequest setUserAgent:[[source controller] userAgentForURL:URL]];
+
+ if (![WebResourceHandle canInitWithRequest:newRequest]) {
+ [newRequest release];
[rLoader cancel];
WebError *badURLError = [[WebError alloc] initWithErrorCode:WebErrorCodeBadURLError
inDomain:WebErrorDomainWebFoundation
failingURL:[URL absoluteString]];
[[source controller] _receivedError:badURLError forResourceHandle:nil
- partialProgress:nil fromDataSource:source];
+ fromDataSource:source];
[badURLError release];
return nil;
}
- WebResourceHandle *h = [[WebResourceHandle alloc] initWithRequest:request];
+ WebResourceHandle *h = [[WebResourceHandle alloc] initWithRequest:newRequest];
client->handle = h;
[source _addSubresourceClient:client];
- [client didStartLoadingWithURL:[request URL]];
+ [client didStartLoadingWithURL:[newRequest URL]];
[client receivedProgressWithComplete:NO];
[h loadWithDelegate:client];
- [request release];
+ [newRequest release];
return [client autorelease];
}
@@ -106,10 +107,10 @@
- (void)receivedError:(WebError *)error
{
[[dataSource controller] _receivedError:error forResourceHandle:handle
- partialProgress:[WebLoadProgress progressWithResourceHandle:handle] fromDataSource:dataSource];
+ fromDataSource:dataSource];
}
--(WebResourceRequest *)handle:(WebResourceHandle *)h willSendRequest:(WebResourceRequest *)request
+-(WebResourceRequest *)handle:(WebResourceHandle *)h willSendRequest:(WebResourceRequest *)newRequest
{
ASSERT(handle == h);
@@ -127,25 +128,41 @@
WebController *controller = [dataSource controller];
NSURL *URL = [request URL];
- [request setUserAgent:[controller userAgentForURL:URL]];
+ [newRequest setUserAgent:[controller userAgentForURL:URL]];
- [self didStopLoading];
- [self didStartLoadingWithURL:URL];
-
- return request;
+ // Not the first send, so reload.
+ if (request) {
+ [self didStopLoading];
+ [self didStartLoadingWithURL:URL];
+ }
+
+ // Let the resourceProgressDelegate get a crack at modifying the request.
+ newRequest = [resourceProgressDelegate resourceRequest: request willSendRequest: newRequest fromDataSource: dataSource];
+
+ [newRequest retain];
+ [request release];
+ request = newRequest;
+
+ return newRequest;
}
--(void)handle:(WebResourceHandle *)handle didReceiveResponse:(WebResourceResponse *)theResponse
+-(void)handle:(WebResourceHandle *)h didReceiveResponse:(WebResourceResponse *)r
{
- [theResponse retain];
+ ASSERT(handle == h);
+
+ [r retain];
[response release];
- response = theResponse;
+ response = r;
+ [[[dataSource controller] resourceProgressDelegate] resourceRequest: request didReceiveResponse: r fromDataSource: dataSource];
}
- (void)handle:(WebResourceHandle *)h didReceiveData:(NSData *)data
{
ASSERT(handle == h);
+ [[[dataSource controller] resourceProgressDelegate] resourceRequest: request didReceiveContentLength: [data length]
+ fromDataSource: dataSource];
+
[self receivedProgressWithComplete:NO];
[loader addData:data];
}
@@ -172,6 +189,8 @@
[handle release];
handle = nil;
+
+ [[[dataSource controller] resourceProgressDelegate] resourceRequest:request didFinishLoadingFromDataSource:dataSource];
[self release];
}
@@ -186,6 +205,8 @@
[loader cancel];
[dataSource _removeSubresourceClient:self];
+
+ [[[dataSource controller] resourceProgressDelegate] resourceRequest: request didFailLoadingWithError: error fromDataSource: dataSource];
[self receivedError:error];
@@ -209,7 +230,7 @@
[dataSource _removeSubresourceClient:self];
WebError *error = [[WebError alloc] initWithErrorCode:WebErrorCodeCancelled
- inDomain:WebErrorDomainWebFoundation failingURL:[[[dataSource request] URL] absoluteString]];
+ inDomain:WebErrorDomainWebFoundation failingURL:[[request URL] absoluteString]];
[self receivedError:error];
[error release];
diff --git a/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.h b/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.h
index f4b29e1..009e8cb 100644
--- a/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.h
+++ b/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.h
@@ -16,10 +16,14 @@
@interface WebSubresourceClient : NSObject <WebResourceHandleDelegate, WebCoreResourceHandle>
{
id <WebCoreResourceLoader> loader;
- WebResourceResponse *response;
WebDataSource *dataSource;
NSURL *currentURL;
WebResourceHandle *handle;
+
+ // Both of these delegates are retained by the client.
+ id <WebResourceLoadDelegate> resourceProgressDelegate;
+ WebResourceRequest *request;
+ WebResourceResponse *response;
}
+ (WebSubresourceClient *)startLoadingResource:(id <WebCoreResourceLoader>)rLoader
diff --git a/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m b/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m
index 51c8e1b..ff5ed1a 100644
--- a/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m
+++ b/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m
@@ -1,27 +1,25 @@
-//
-// WebSubresourceClient.m
-// WebKit
-//
-// Created by Darin Adler on Sat Jun 15 2002.
-// Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
-//
+/*
+ WebSubresourceClient.mm
+ Copyright (c) 2002, Apple Computer, Inc. All rights reserved.
+*/
+#import <WebKit/WebBridge.h>
+#import <WebKit/WebControllerPrivate.h>
+#import <WebKit/WebDataSourcePrivate.h>
+#import <WebKit/WebFrame.h>
+#import <WebKit/WebResourceProgressDelegate.h>
#import <WebKit/WebSubresourceClient.h>
+#import <WebFoundation/WebAssertions.h>
#import <WebFoundation/WebError.h>
#import <WebFoundation/WebResourceHandle.h>
+#import <WebFoundation/WebResourceHandlePrivate.h>
#import <WebFoundation/WebResourceRequest.h>
#import <WebFoundation/WebHTTPResourceRequest.h>
#import <WebFoundation/WebResourceResponse.h>
#import <WebCore/WebCoreResourceLoader.h>
-#import <WebKit/WebLoadProgress.h>
-#import <WebKit/WebControllerPrivate.h>
-#import <WebKit/WebBridge.h>
-#import <WebKit/WebDataSourcePrivate.h>
-#import <WebKit/WebFrame.h>
-#import <WebFoundation/WebAssertions.h>
@implementation WebSubresourceClient
@@ -31,6 +29,8 @@
loader = [l retain];
dataSource = [s retain];
+
+ resourceProgressDelegate = [[[dataSource controller] resourceProgressDelegate] retain];
return self;
}
@@ -42,7 +42,9 @@
[loader release];
[dataSource release];
[handle release];
+ [request release];
[response release];
+ [resourceProgressDelegate release];
[super dealloc];
}
@@ -64,41 +66,40 @@
- (void)receivedProgressWithComplete:(BOOL)isComplete
{
- [[dataSource controller] _receivedProgress:[WebLoadProgress progressWithResourceHandle:handle]
- forResourceHandle:handle fromDataSource:dataSource complete:isComplete];
+ [[dataSource controller] _receivedProgressForResourceHandle:handle fromDataSource:dataSource complete:isComplete];
}
+ (WebSubresourceClient *)startLoadingResource:(id <WebCoreResourceLoader>)rLoader
withURL:(NSURL *)URL referrer:(NSString *)referrer forDataSource:(WebDataSource *)source
{
WebSubresourceClient *client = [[self alloc] initWithLoader:rLoader dataSource:source];
- WebResourceRequest *request = [[WebResourceRequest alloc] initWithURL:URL];
- [request setRequestCachePolicy:[[source request] requestCachePolicy]];
- [request setResponseCachePolicy:[[source request] responseCachePolicy]];
- [request setReferrer:referrer];
- [request setCookiePolicyBaseURL:[[[[source controller] mainFrame] dataSource] URL]];
- [request setUserAgent:[[source controller] userAgentForURL:URL]];
-
- if (![WebResourceHandle canInitWithRequest:request]) {
- [request release];
+ WebResourceRequest *newRequest = [[WebResourceRequest alloc] initWithURL:URL];
+ [newRequest setRequestCachePolicy:[[source request] requestCachePolicy]];
+ [newRequest setResponseCachePolicy:[[source request] responseCachePolicy]];
+ [newRequest setReferrer:referrer];
+ [newRequest setCookiePolicyBaseURL:[[[[source controller] mainFrame] dataSource] URL]];
+ [newRequest setUserAgent:[[source controller] userAgentForURL:URL]];
+
+ if (![WebResourceHandle canInitWithRequest:newRequest]) {
+ [newRequest release];
[rLoader cancel];
WebError *badURLError = [[WebError alloc] initWithErrorCode:WebErrorCodeBadURLError
inDomain:WebErrorDomainWebFoundation
failingURL:[URL absoluteString]];
[[source controller] _receivedError:badURLError forResourceHandle:nil
- partialProgress:nil fromDataSource:source];
+ fromDataSource:source];
[badURLError release];
return nil;
}
- WebResourceHandle *h = [[WebResourceHandle alloc] initWithRequest:request];
+ WebResourceHandle *h = [[WebResourceHandle alloc] initWithRequest:newRequest];
client->handle = h;
[source _addSubresourceClient:client];
- [client didStartLoadingWithURL:[request URL]];
+ [client didStartLoadingWithURL:[newRequest URL]];
[client receivedProgressWithComplete:NO];
[h loadWithDelegate:client];
- [request release];
+ [newRequest release];
return [client autorelease];
}
@@ -106,10 +107,10 @@
- (void)receivedError:(WebError *)error
{
[[dataSource controller] _receivedError:error forResourceHandle:handle
- partialProgress:[WebLoadProgress progressWithResourceHandle:handle] fromDataSource:dataSource];
+ fromDataSource:dataSource];
}
--(WebResourceRequest *)handle:(WebResourceHandle *)h willSendRequest:(WebResourceRequest *)request
+-(WebResourceRequest *)handle:(WebResourceHandle *)h willSendRequest:(WebResourceRequest *)newRequest
{
ASSERT(handle == h);
@@ -127,25 +128,41 @@
WebController *controller = [dataSource controller];
NSURL *URL = [request URL];
- [request setUserAgent:[controller userAgentForURL:URL]];
+ [newRequest setUserAgent:[controller userAgentForURL:URL]];
- [self didStopLoading];
- [self didStartLoadingWithURL:URL];
-
- return request;
+ // Not the first send, so reload.
+ if (request) {
+ [self didStopLoading];
+ [self didStartLoadingWithURL:URL];
+ }
+
+ // Let the resourceProgressDelegate get a crack at modifying the request.
+ newRequest = [resourceProgressDelegate resourceRequest: request willSendRequest: newRequest fromDataSource: dataSource];
+
+ [newRequest retain];
+ [request release];
+ request = newRequest;
+
+ return newRequest;
}
--(void)handle:(WebResourceHandle *)handle didReceiveResponse:(WebResourceResponse *)theResponse
+-(void)handle:(WebResourceHandle *)h didReceiveResponse:(WebResourceResponse *)r
{
- [theResponse retain];
+ ASSERT(handle == h);
+
+ [r retain];
[response release];
- response = theResponse;
+ response = r;
+ [[[dataSource controller] resourceProgressDelegate] resourceRequest: request didReceiveResponse: r fromDataSource: dataSource];
}
- (void)handle:(WebResourceHandle *)h didReceiveData:(NSData *)data
{
ASSERT(handle == h);
+ [[[dataSource controller] resourceProgressDelegate] resourceRequest: request didReceiveContentLength: [data length]
+ fromDataSource: dataSource];
+
[self receivedProgressWithComplete:NO];
[loader addData:data];
}
@@ -172,6 +189,8 @@
[handle release];
handle = nil;
+
+ [[[dataSource controller] resourceProgressDelegate] resourceRequest:request didFinishLoadingFromDataSource:dataSource];
[self release];
}
@@ -186,6 +205,8 @@
[loader cancel];
[dataSource _removeSubresourceClient:self];
+
+ [[[dataSource controller] resourceProgressDelegate] resourceRequest: request didFailLoadingWithError: error fromDataSource: dataSource];
[self receivedError:error];
@@ -209,7 +230,7 @@
[dataSource _removeSubresourceClient:self];
WebError *error = [[WebError alloc] initWithErrorCode:WebErrorCodeCancelled
- inDomain:WebErrorDomainWebFoundation failingURL:[[[dataSource request] URL] absoluteString]];
+ inDomain:WebErrorDomainWebFoundation failingURL:[[request URL] absoluteString]];
[self receivedError:error];
[error release];
diff --git a/WebKit/WebKit.exp b/WebKit/WebKit.exp
index 7798bdb..14e7469 100644
--- a/WebKit/WebKit.exp
+++ b/WebKit/WebKit.exp
@@ -16,7 +16,6 @@
.objc_class_name_WebIconDatabase
.objc_class_name_WebIconLoader
.objc_class_name_WebKitStatistics
-.objc_class_name_WebLoadProgress
.objc_class_name_WebPreferences
.objc_class_name_WebRenderNode
.objc_class_name_WebStandardPanels
diff --git a/WebKit/WebKit.pbproj/project.pbxproj b/WebKit/WebKit.pbproj/project.pbxproj
index 0dbfb1b..7ea0bad 100644
--- a/WebKit/WebKit.pbproj/project.pbxproj
+++ b/WebKit/WebKit.pbproj/project.pbxproj
@@ -72,6 +72,7 @@
F58C8A07025BD3BC018635CA,
F531DDFF02F0C36F018635CA,
);
+ hasScannedForEncodings = 1;
isa = PBXProject;
knownRegions = (
English,
@@ -210,7 +211,6 @@
9CF0E24B021361B10ECA16EA,
F5B92B840223191D01C1A525,
F5D538EA02441F2601A80181,
- F58BAB3B025036CA01C1A526,
9CAE9D080252A4130ECA16EA,
F59EAE400253C7EE018635CA,
F5883BE2025E5E9D01000102,
@@ -316,7 +316,6 @@
F5B92B850223191D01C1A525,
F5D538ED02441FDD01A80181,
F5AEBB3E024A527601C1A526,
- F58BAB390250363E01C1A526,
F59EAE420253C8DE018635CA,
F5883BE3025E5E9D01000102,
F5A672BC0263866E01000102,
@@ -2136,27 +2135,12 @@
path = WebLoadProgress.m;
refType = 4;
};
- F58BAB390250363E01C1A526 = {
- fileRef = F58BAB380250363E01C1A526;
- isa = PBXBuildFile;
- settings = {
- };
- };
F58BAB3A025036CA01C1A526 = {
fileEncoding = 30;
isa = PBXFileReference;
path = WebLoadProgress.h;
refType = 4;
};
- F58BAB3B025036CA01C1A526 = {
- fileRef = F58BAB3A025036CA01C1A526;
- isa = PBXBuildFile;
- settings = {
- ATTRIBUTES = (
- Public,
- );
- };
- };
F58C8A07025BD3BC018635CA = {
buildRules = (
);
diff --git a/WebKit/WebView.subproj/WebController.h b/WebKit/WebView.subproj/WebController.h
index 018a653..192688a 100644
--- a/WebKit/WebView.subproj/WebController.h
+++ b/WebKit/WebView.subproj/WebController.h
@@ -21,7 +21,7 @@
@protocol WebContextMenuDelegate;
@protocol WebControllerPolicyDelegate;
@protocol WebLocationChangeDelegate;
- at protocol WebResourceProgressDelegate;
+ at protocol WebResourceLoadDelegate;
@protocol WebWindowOperationsDelegate;
// These strings are keys into the element dictionary provided in
@@ -59,14 +59,14 @@ extern NSString *WebElementFrameKey;
</pre>
WebControllers have the following delegates: WebWindowOperationsDelegate,
- WebResourceProgressDelegate, WebContextMenuDelegate, WebLocationChangeDelegate,
+ WebResourceLoadDelegate, WebContextMenuDelegate, WebLocationChangeDelegate,
and WebControllerPolicyDelegate.
WebKit depends on the WebController's WebWindowOperationsDelegate for all window
related management, including opening new windows and controlling the user interface
elements in those windows.
- WebResourceProgressDelegate is used to monitor the progress of resources as they are
+ WebResourceLoadDelegate is used to monitor the progress of resources as they are
loaded. This delegate may be used to present users with a progress monitor.
WebController's WebContextMenuDelegate can customize the context menus that appear
@@ -128,29 +128,29 @@ extern NSString *WebElementFrameKey;
/*!
@method setResourceProgressDelegate:
- @abstract Set the controller's WebResourceProgressDelegate.
- @param delegate The WebResourceProgressDelegate to set as the delegate.
+ @abstract Set the controller's WebResourceLoadDelegate.
+ @param delegate The WebResourceLoadDelegate to set as the delegate.
*/
-- (void)setResourceProgressDelegate: (id<WebResourceProgressDelegate>)delegate;
+- (void)setResourceProgressDelegate: (id<WebResourceLoadDelegate>)delegate;
/*!
@method resourceProgressDelegate
- @result Return the controller's WebResourceProgressDelegate.
+ @result Return the controller's WebResourceLoadDelegate.
*/
-- (id<WebResourceProgressDelegate>)resourceProgressDelegate;
+- (id<WebResourceLoadDelegate>)resourceProgressDelegate;
/*!
@method setDownloadProgressDelegate:
- @abstract Set the controller's WebResourceProgressDelegate download delegate.
- @param delegate The WebResourceProgressDelegate to set as the download delegate.
+ @abstract Set the controller's WebResourceLoadDelegate download delegate.
+ @param delegate The WebResourceLoadDelegate to set as the download delegate.
*/
-- (void)setDownloadProgressDelegate: (id<WebResourceProgressDelegate>)delegate;
+- (void)setDownloadProgressDelegate: (id<WebResourceLoadDelegate>)delegate;
/*!
@method downloadProgressDelegate
- @result Return the controller's WebResourceProgressDelegate download delegate.
+ @result Return the controller's WebResourceLoadDelegate download delegate.
*/
-- (id<WebResourceProgressDelegate>)downloadProgressDelegate;
+- (id<WebResourceLoadDelegate>)downloadProgressDelegate;
/*!
@method setContextMenuDelegate:
diff --git a/WebKit/WebView.subproj/WebController.m b/WebKit/WebView.subproj/WebController.m
index ea00b30..aaf8d84 100644
--- a/WebKit/WebView.subproj/WebController.m
+++ b/WebKit/WebView.subproj/WebController.m
@@ -86,25 +86,25 @@ NSString *WebElementFrameKey = @"WebElementFrame";
return _private->windowContext;
}
-- (void)setResourceProgressDelegate: (id <WebResourceProgressDelegate>)delegate
+- (void)setResourceProgressDelegate: (id <WebResourceLoadDelegate>)delegate
{
_private->resourceProgressDelegate = delegate;
}
-- (id<WebResourceProgressDelegate>)resourceProgressDelegate
+- (id<WebResourceLoadDelegate>)resourceProgressDelegate
{
return _private->resourceProgressDelegate;
}
-- (void)setDownloadProgressDelegate: (id<WebResourceProgressDelegate>)delegate
+- (void)setDownloadProgressDelegate: (id<WebResourceLoadDelegate>)delegate
{
_private->downloadProgressDelegate = delegate;
}
-- (id<WebResourceProgressDelegate>)downloadProgressDelegate
+- (id<WebResourceLoadDelegate>)downloadProgressDelegate
{
return _private->downloadProgressDelegate;
}
diff --git a/WebKit/WebView.subproj/WebControllerPrivate.h b/WebKit/WebView.subproj/WebControllerPrivate.h
index 132d3fe..b97f0b0 100644
--- a/WebKit/WebView.subproj/WebControllerPrivate.h
+++ b/WebKit/WebView.subproj/WebControllerPrivate.h
@@ -6,7 +6,6 @@
#import <WebKit/WebController.h>
@class WebError;
- at class WebLoadProgress;
@class WebFrame;
@interface WebControllerPrivate : NSObject
@@ -15,8 +14,8 @@
WebFrame *mainFrame;
id<WebWindowOperationsDelegate> windowContext;
- id<WebResourceProgressDelegate> resourceProgressDelegate;
- id<WebResourceProgressDelegate> downloadProgressDelegate;
+ id<WebResourceLoadDelegate> resourceProgressDelegate;
+ id<WebResourceLoadDelegate> downloadProgressDelegate;
id<WebContextMenuDelegate> contextMenuDelegate;
id<WebContextMenuDelegate> defaultContextMenuDelegate;
id<WebControllerPolicyDelegate> policyDelegate;
@@ -48,10 +47,10 @@
- (id<WebContextMenuDelegate>)_defaultContextMenuDelegate;
-- (void)_receivedProgress: (WebLoadProgress *)progress forResourceHandle: (WebResourceHandle *)resourceHandle fromDataSource: (WebDataSource *)dataSource complete:(BOOL)isComplete;
-- (void)_receivedError: (WebError *)error forResourceHandle: (WebResourceHandle *)resourceHandle partialProgress: (WebLoadProgress *)progress fromDataSource: (WebDataSource *)dataSource;
-- (void)_mainReceivedProgress: (WebLoadProgress *)progress forResourceHandle: (WebResourceHandle *)resourceHandle fromDataSource: (WebDataSource *)dataSource complete:(BOOL)isComplete;
-- (void)_mainReceivedError: (WebError *)error forResourceHandle: (WebResourceHandle *)resourceHandle partialProgress: (WebLoadProgress *)progress fromDataSource: (WebDataSource *)dataSource;
+- (void)_receivedProgressForResourceHandle: (WebResourceHandle *)resourceHandle fromDataSource: (WebDataSource *)dataSource complete:(BOOL)isComplete;
+- (void)_receivedError: (WebError *)error forResourceHandle: (WebResourceHandle *)resourceHandle fromDataSource: (WebDataSource *)dataSource;
+- (void)_mainReceivedProgressForResourceHandle: (WebResourceHandle *)resourceHandle bytesSoFar:(unsigned)bytesSoFar fromDataSource: (WebDataSource *)dataSource complete:(BOOL)isComplete;
+- (void)_mainReceivedError: (WebError *)error forResourceHandle: (WebResourceHandle *)resourceHandle fromDataSource: (WebDataSource *)dataSource;
- (void)_didStartLoading: (NSURL *)URL;
- (void)_didStopLoading: (NSURL *)URL;
+ (NSString *)_MIMETypeForFile: (NSString *)path;
diff --git a/WebKit/WebView.subproj/WebControllerPrivate.m b/WebKit/WebView.subproj/WebControllerPrivate.m
index 658915e..ee5c9e3 100644
--- a/WebKit/WebView.subproj/WebControllerPrivate.m
+++ b/WebKit/WebView.subproj/WebControllerPrivate.m
@@ -10,7 +10,6 @@
#import <WebKit/WebDataSourcePrivate.h>
#import <WebKit/WebDefaultContextMenuDelegate.h>
#import <WebKit/WebFramePrivate.h>
-#import <WebKit/WebLoadProgress.h>
#import <WebKit/WebPreferencesPrivate.h>
#import <WebKit/WebResourceProgressDelegate.h>
#import <WebKit/WebStandardPanelsPrivate.h>
@@ -108,15 +107,12 @@
return _private->defaultContextMenuDelegate;
}
-- (void)_receivedProgress:(WebLoadProgress *)progress forResourceHandle:(WebResourceHandle *)resourceHandle fromDataSource:(WebDataSource *)dataSource complete:(BOOL)isComplete
+- (void)_receivedProgressForResourceHandle:(WebResourceHandle *)resourceHandle fromDataSource:(WebDataSource *)dataSource complete:(BOOL)isComplete
{
WebFrame *frame = [dataSource webFrame];
ASSERT(dataSource != nil);
- [[self resourceProgressDelegate] receivedProgress: progress forResourceHandle: resourceHandle
- fromDataSource: dataSource complete:isComplete];
-
// This resource has completed, so check if the load is complete for all frames.
if (isComplete) {
if (frame != nil) {
@@ -126,15 +122,12 @@
}
}
-- (void)_mainReceivedProgress: (WebLoadProgress *)progress forResourceHandle: (WebResourceHandle *)resourceHandle fromDataSource: (WebDataSource *)dataSource complete: (BOOL)isComplete
+- (void)_mainReceivedProgressForResourceHandle: (WebResourceHandle *)resourceHandle bytesSoFar: (unsigned)bytesSoFar fromDataSource: (WebDataSource *)dataSource complete: (BOOL)isComplete
{
WebFrame *frame = [dataSource webFrame];
ASSERT(dataSource != nil);
- [[self resourceProgressDelegate] receivedProgress: progress forResourceHandle: resourceHandle
- fromDataSource: dataSource complete:isComplete];
-
// The frame may be nil if a previously cancelled load is still making progress callbacks.
if (frame == nil)
return;
@@ -151,19 +144,17 @@
// Note that transitioning a frame to this state doesn't guarantee a layout, rather it
// just indicates that an early layout can be performed.
int timedLayoutSize = [[WebPreferences standardPreferences] _initialTimedLayoutSize];
- if ([progress bytesSoFar] > timedLayoutSize)
+ if ((int)bytesSoFar > timedLayoutSize)
[frame _transitionToLayoutAcceptable];
}
}
-- (void)_receivedError: (WebError *)error forResourceHandle: (WebResourceHandle *)resourceHandle partialProgress: (WebLoadProgress *)progress fromDataSource: (WebDataSource *)dataSource
+- (void)_receivedError: (WebError *)error forResourceHandle: (WebResourceHandle *)resourceHandle fromDataSource: (WebDataSource *)dataSource
{
WebFrame *frame = [dataSource webFrame];
- [[self resourceProgressDelegate] receivedError: error forResourceHandle: resourceHandle partialProgress: progress fromDataSource: dataSource];
-
NSString *resourceIdentifier = [[[resourceHandle _request] URL] absoluteString];
if (resourceIdentifier == nil) {
resourceIdentifier = [error failingURL];
@@ -176,11 +167,9 @@
}
-- (void)_mainReceivedError: (WebError *)error forResourceHandle: (WebResourceHandle *)resourceHandle partialProgress: (WebLoadProgress *)progress fromDataSource: (WebDataSource *)dataSource
+- (void)_mainReceivedError: (WebError *)error forResourceHandle: (WebResourceHandle *)resourceHandle fromDataSource: (WebDataSource *)dataSource
{
WebFrame *frame = [dataSource webFrame];
-
- [[self resourceProgressDelegate] receivedError: error forResourceHandle: resourceHandle partialProgress: progress fromDataSource: dataSource];
[dataSource _setMainDocumentError: error];
[dataSource _setPrimaryLoadComplete: YES];
diff --git a/WebKit/WebView.subproj/WebLoadProgress.h b/WebKit/WebView.subproj/WebLoadProgress.h
deleted file mode 100644
index 5557637..0000000
--- a/WebKit/WebView.subproj/WebLoadProgress.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- WebLoadProgress.h
- Copyright 2001, 2002, Apple, Inc. All rights reserved.
-
- Public header file.
-*/
-
-#import <Foundation/Foundation.h>
-
- at class WebResourceHandle;
-
-/*!
- @class WebLoadProgress
-*/
- at interface WebLoadProgress : NSObject
-{
- int bytesSoFar; // 0 if this is the start of load
- int totalToLoad; // -1 if this is not known.
- // bytesSoFar == totalLoaded when complete
-}
-
-/*!
- @method initWithBytesSoFar:totalToLoad:
- @param bytes
- @param total
-*/
-- (id)initWithBytesSoFar:(int)bytes totalToLoad:(int)total;
-
-/*!
- @method initWithResourceHandle:
- @param handle
-*/
-- (id)initWithResourceHandle:(WebResourceHandle *)handle;
-
-/*!
- @method progress
-*/
-+ (WebLoadProgress *)progress; // both -1
-
-/*!
- @method progressWithBytesSoFar:totalToLoad:
- @param bytes
- @param total
-*/
-+ (WebLoadProgress *)progressWithBytesSoFar:(int)bytes totalToLoad:(int)total;
-
-/*!
- @method progressWithResourceHandle:
- @param handle
-*/
-+ (WebLoadProgress *)progressWithResourceHandle:(WebResourceHandle *)handle;
-
-/*!
- @method bytesSoFar:
-*/
-- (int)bytesSoFar;
-
-/*!
- @method totalToLoad:
-*/
-- (int)totalToLoad;
-
- at end
diff --git a/WebKit/WebView.subproj/WebLoadProgress.m b/WebKit/WebView.subproj/WebLoadProgress.m
deleted file mode 100644
index ab2922f..0000000
--- a/WebKit/WebView.subproj/WebLoadProgress.m
+++ /dev/null
@@ -1,67 +0,0 @@
-/* WebLoadProgress.mm
-
- Copyright 2001, 2002, Apple, Inc. All rights reserved.
-*/
-
-#import <WebKit/WebLoadProgress.h>
-
-#import <WebFoundation/WebResourceHandle.h>
-#import <WebFoundation/WebResourceHandlePrivate.h>
-#import <WebFoundation/WebResourceResponse.h>
-
- at implementation WebLoadProgress
-
-- (id)init
-{
- return [self initWithBytesSoFar:0 totalToLoad:-1];
-}
-
-- (id)initWithBytesSoFar:(int)bytes totalToLoad:(int)total
-{
- if (![super init]) {
- return nil;
- }
-
- bytesSoFar = bytes;
- totalToLoad = total;
-
- return self;
-}
-
-- (id)initWithResourceHandle:(WebResourceHandle *)handle
-{
- WebResourceResponse *theResponse = [handle _response];
- if (theResponse == nil) {
- return [self init];
- }
- int b = [theResponse contentLengthReceived];
- int t = [handle _statusCode] == WebResourceHandleStatusLoadComplete ? b : [theResponse contentLength];
- return [self initWithBytesSoFar:b totalToLoad:t];
-}
-
-+ (WebLoadProgress *)progress
-{
- return [[[WebLoadProgress alloc] init] autorelease];
-}
-
-+ (WebLoadProgress *)progressWithBytesSoFar:(int)bytes totalToLoad:(int)total
-{
- return [[[WebLoadProgress alloc] initWithBytesSoFar:bytes totalToLoad:total] autorelease];
-}
-
-+ (WebLoadProgress *)progressWithResourceHandle:(WebResourceHandle *)handle
-{
- return [[[WebLoadProgress alloc] initWithResourceHandle:handle] autorelease];
-}
-
-- (int)bytesSoFar
-{
- return bytesSoFar;
-}
-
-- (int)totalToLoad
-{
- return totalToLoad;
-}
-
- at end
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.h b/WebKit/WebView.subproj/WebMainResourceClient.h
index df64f19..26fb99f 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.h
+++ b/WebKit/WebView.subproj/WebMainResourceClient.h
@@ -13,9 +13,11 @@
@class WebDownloadHandler;
@class WebDataSource;
@class WebResourceHandle;
+ at class WebResourceRequest;
@class WebResourceResponse;
+
@protocol WebResourceHandleDelegate;
- at protocol WebResourceProgressDelegate;
+ at protocol WebResourceLoadDelegate;
@interface WebMainResourceClient : NSObject <WebResourceHandleDelegate>
{
@@ -23,9 +25,15 @@
WebDataSource *dataSource;
BOOL suppressErrors;
WebDownloadHandler *downloadHandler;
- id <WebResourceProgressDelegate> downloadProgressDelegate;
+
+ // Both of these delegates are retained by the client.
+ id <WebResourceLoadDelegate> downloadProgressDelegate;
+ id <WebResourceLoadDelegate> resourceProgressDelegate;
+
WebContentAction policyAction;
NSMutableData *resourceData;
+ WebResourceRequest *request;
+ WebResourceResponse *response;
}
- initWithDataSource:(WebDataSource *)dataSource;
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.m b/WebKit/WebView.subproj/WebMainResourceClient.m
index a83c166..007f82c 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.m
+++ b/WebKit/WebView.subproj/WebMainResourceClient.m
@@ -13,7 +13,6 @@
#import <WebKit/WebFrame.h>
#import <WebKit/WebFramePrivate.h>
#import <WebKit/WebKitLogging.h>
-#import <WebKit/WebLoadProgress.h>
#import <WebKit/WebLocationChangeDelegate.h>
#import <WebKit/WebMainResourceClient.h>
#import <WebKit/WebResourceProgressDelegate.h>
@@ -24,6 +23,7 @@
#import <WebFoundation/WebResourceHandle.h>
#import <WebFoundation/WebResourceRequest.h>
#import <WebFoundation/WebHTTPResourceRequest.h>
+#import <WebFoundation/WebResourceHandlePrivate.h>
#import <WebFoundation/WebResourceResponse.h>
#import <WebFoundation/WebCookieConstants.h>
@@ -42,8 +42,9 @@
// set the user agent for the request
// consult the data source's controller
WebController *controller = [dataSource controller];
- WebResourceRequest *request = [dataSource request];
- [request setUserAgent:[controller userAgentForURL:[request URL]]];
+ WebResourceRequest *newRequest = [dataSource request];
+ [newRequest setUserAgent:[controller userAgentForURL:[newRequest URL]]];
+ resourceProgressDelegate = [[controller resourceProgressDelegate] retain];
}
return self;
@@ -70,8 +71,11 @@
ASSERT(downloadHandler == nil);
[downloadProgressDelegate release];
+ [resourceProgressDelegate release];
[resourceData release];
[dataSource release];
+ [response release];
+ [request release];
[super dealloc];
}
@@ -88,18 +92,15 @@
- (void)receivedProgressWithHandle:(WebResourceHandle *)handle complete:(BOOL)isComplete
{
- WebLoadProgress *progress = [WebLoadProgress progressWithResourceHandle:handle];
WebContentAction contentAction = [[dataSource contentPolicy] policyAction];
if (contentAction == WebContentPolicySaveAndOpenExternally || contentAction == WebContentPolicySave) {
if (isComplete) {
[dataSource _setPrimaryLoadComplete:YES];
}
- [downloadProgressDelegate receivedProgress:progress forResourceHandle:handle
- fromDataSource:dataSource complete:isComplete];
} else {
- [[dataSource controller] _mainReceivedProgress:progress forResourceHandle:handle
- fromDataSource:dataSource complete:isComplete];
+ [[dataSource controller] _mainReceivedProgressForResourceHandle:handle
+ bytesSoFar: [resourceData length] fromDataSource:dataSource complete:isComplete];
}
}
@@ -109,15 +110,13 @@
return;
}
- WebLoadProgress *progress = [WebLoadProgress progressWithResourceHandle:handle];
WebContentAction contentAction = [[dataSource contentPolicy] policyAction];
if (contentAction == WebContentPolicySaveAndOpenExternally || contentAction == WebContentPolicySave) {
- [downloadProgressDelegate receivedError:error forResourceHandle:handle
- partialProgress:progress fromDataSource:dataSource];
+ [downloadProgressDelegate resourceRequest: [handle _request] didFailLoadingWithError:error fromDataSource:dataSource];
} else {
[[dataSource controller] _mainReceivedError:error forResourceHandle:handle
- partialProgress:progress fromDataSource:dataSource];
+ fromDataSource:dataSource];
}
}
@@ -186,36 +185,55 @@
}
[downloadHandler release];
downloadHandler = nil;
+ [downloadProgressDelegate resourceRequest:[handle _request] didFinishLoadingFromDataSource:dataSource];
}
+ else
+ [resourceProgressDelegate resourceRequest:[handle _request] didFinishLoadingFromDataSource:dataSource];
[self didStopLoading];
+
[self release];
}
--(WebResourceRequest *)handle:(WebResourceHandle *)handle willSendRequest:(WebResourceRequest *)request
+-(WebResourceRequest *)handle:(WebResourceHandle *)handle willSendRequest:(WebResourceRequest *)newRequest
{
WebController *controller = [dataSource controller];
- NSURL *URL = [request URL];
+ NSURL *URL = [newRequest URL];
LOG(Redirect, "URL = %@", URL);
// FIXME: need to update main document URL here, or cookies set
// via redirects might not work in main document mode
- [request setUserAgent:[controller userAgentForURL:URL]];
- [dataSource _setRequest:request];
+ [newRequest setUserAgent:[controller userAgentForURL:URL]];
- [self didStopLoading];
- [self didStartLoadingWithURL:URL];
-
- return request;
+ [dataSource _setRequest:newRequest];
+
+ // Not the first send, so reload.
+ if (request) {
+ [self didStopLoading];
+ [self didStartLoadingWithURL:URL];
+ }
+
+ // Let the resourceProgressDelegate get a crack at modifying the request.
+ newRequest = [resourceProgressDelegate resourceRequest: request willSendRequest: newRequest fromDataSource: dataSource];
+
+ [newRequest retain];
+ [request release];
+ request = newRequest;
+
+ return newRequest;
}
--(void)handle:(WebResourceHandle *)handle didReceiveResponse:(WebResourceResponse *)response
+-(void)handle:(WebResourceHandle *)handle didReceiveResponse:(WebResourceResponse *)r
{
- NSString *contentType = [response contentType];
+ NSString *contentType = [r contentType];
+ ASSERT (response == nil);
+
+ response = [r retain];
+
[dataSource _setResponse:response];
// Make assumption that if the contentType is the default and there is no extension, this is text/html.
@@ -240,6 +258,7 @@
switch (policyAction) {
case WebContentPolicyShow:
+ [resourceProgressDelegate resourceRequest: request didReceiveResponse: response fromDataSource: dataSource];
break;
case WebContentPolicySave:
case WebContentPolicySaveAndOpenExternally:
@@ -264,11 +283,13 @@
WebError *downloadError = nil;
+
if (downloadHandler) {
downloadError = [downloadHandler receivedData:data];
} else {
[resourceData appendData:data];
[dataSource _receivedData:data];
+ [resourceProgressDelegate resourceRequest: request didReceiveContentLength: [data length] fromDataSource:dataSource];
}
[self receivedProgressWithHandle:handle complete:NO];
@@ -282,13 +303,15 @@
[handle cancel];
}
- LOG(Download, "%d of %d", [[dataSource response] contentLengthReceived], [[dataSource response] contentLength]);
+ LOG(Download, "%d of %d", [response contentLengthReceived], [response contentLength]);
}
- (void)handle:(WebResourceHandle *)handle didFailLoadingWithError:(WebError *)result
{
LOG(Loading, "URL = %@, result = %@", [result failingURL], [result errorDescription]);
+ [resourceProgressDelegate resourceRequest: request didFailLoadingWithError: result fromDataSource: dataSource];
+
// Calling receivedError will likely result in a call to release, so we must retain.
[self retain];
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.h b/WebKit/WebView.subproj/WebMainResourceLoader.h
index df64f19..26fb99f 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.h
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.h
@@ -13,9 +13,11 @@
@class WebDownloadHandler;
@class WebDataSource;
@class WebResourceHandle;
+ at class WebResourceRequest;
@class WebResourceResponse;
+
@protocol WebResourceHandleDelegate;
- at protocol WebResourceProgressDelegate;
+ at protocol WebResourceLoadDelegate;
@interface WebMainResourceClient : NSObject <WebResourceHandleDelegate>
{
@@ -23,9 +25,15 @@
WebDataSource *dataSource;
BOOL suppressErrors;
WebDownloadHandler *downloadHandler;
- id <WebResourceProgressDelegate> downloadProgressDelegate;
+
+ // Both of these delegates are retained by the client.
+ id <WebResourceLoadDelegate> downloadProgressDelegate;
+ id <WebResourceLoadDelegate> resourceProgressDelegate;
+
WebContentAction policyAction;
NSMutableData *resourceData;
+ WebResourceRequest *request;
+ WebResourceResponse *response;
}
- initWithDataSource:(WebDataSource *)dataSource;
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.m b/WebKit/WebView.subproj/WebMainResourceLoader.m
index a83c166..007f82c 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.m
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.m
@@ -13,7 +13,6 @@
#import <WebKit/WebFrame.h>
#import <WebKit/WebFramePrivate.h>
#import <WebKit/WebKitLogging.h>
-#import <WebKit/WebLoadProgress.h>
#import <WebKit/WebLocationChangeDelegate.h>
#import <WebKit/WebMainResourceClient.h>
#import <WebKit/WebResourceProgressDelegate.h>
@@ -24,6 +23,7 @@
#import <WebFoundation/WebResourceHandle.h>
#import <WebFoundation/WebResourceRequest.h>
#import <WebFoundation/WebHTTPResourceRequest.h>
+#import <WebFoundation/WebResourceHandlePrivate.h>
#import <WebFoundation/WebResourceResponse.h>
#import <WebFoundation/WebCookieConstants.h>
@@ -42,8 +42,9 @@
// set the user agent for the request
// consult the data source's controller
WebController *controller = [dataSource controller];
- WebResourceRequest *request = [dataSource request];
- [request setUserAgent:[controller userAgentForURL:[request URL]]];
+ WebResourceRequest *newRequest = [dataSource request];
+ [newRequest setUserAgent:[controller userAgentForURL:[newRequest URL]]];
+ resourceProgressDelegate = [[controller resourceProgressDelegate] retain];
}
return self;
@@ -70,8 +71,11 @@
ASSERT(downloadHandler == nil);
[downloadProgressDelegate release];
+ [resourceProgressDelegate release];
[resourceData release];
[dataSource release];
+ [response release];
+ [request release];
[super dealloc];
}
@@ -88,18 +92,15 @@
- (void)receivedProgressWithHandle:(WebResourceHandle *)handle complete:(BOOL)isComplete
{
- WebLoadProgress *progress = [WebLoadProgress progressWithResourceHandle:handle];
WebContentAction contentAction = [[dataSource contentPolicy] policyAction];
if (contentAction == WebContentPolicySaveAndOpenExternally || contentAction == WebContentPolicySave) {
if (isComplete) {
[dataSource _setPrimaryLoadComplete:YES];
}
- [downloadProgressDelegate receivedProgress:progress forResourceHandle:handle
- fromDataSource:dataSource complete:isComplete];
} else {
- [[dataSource controller] _mainReceivedProgress:progress forResourceHandle:handle
- fromDataSource:dataSource complete:isComplete];
+ [[dataSource controller] _mainReceivedProgressForResourceHandle:handle
+ bytesSoFar: [resourceData length] fromDataSource:dataSource complete:isComplete];
}
}
@@ -109,15 +110,13 @@
return;
}
- WebLoadProgress *progress = [WebLoadProgress progressWithResourceHandle:handle];
WebContentAction contentAction = [[dataSource contentPolicy] policyAction];
if (contentAction == WebContentPolicySaveAndOpenExternally || contentAction == WebContentPolicySave) {
- [downloadProgressDelegate receivedError:error forResourceHandle:handle
- partialProgress:progress fromDataSource:dataSource];
+ [downloadProgressDelegate resourceRequest: [handle _request] didFailLoadingWithError:error fromDataSource:dataSource];
} else {
[[dataSource controller] _mainReceivedError:error forResourceHandle:handle
- partialProgress:progress fromDataSource:dataSource];
+ fromDataSource:dataSource];
}
}
@@ -186,36 +185,55 @@
}
[downloadHandler release];
downloadHandler = nil;
+ [downloadProgressDelegate resourceRequest:[handle _request] didFinishLoadingFromDataSource:dataSource];
}
+ else
+ [resourceProgressDelegate resourceRequest:[handle _request] didFinishLoadingFromDataSource:dataSource];
[self didStopLoading];
+
[self release];
}
--(WebResourceRequest *)handle:(WebResourceHandle *)handle willSendRequest:(WebResourceRequest *)request
+-(WebResourceRequest *)handle:(WebResourceHandle *)handle willSendRequest:(WebResourceRequest *)newRequest
{
WebController *controller = [dataSource controller];
- NSURL *URL = [request URL];
+ NSURL *URL = [newRequest URL];
LOG(Redirect, "URL = %@", URL);
// FIXME: need to update main document URL here, or cookies set
// via redirects might not work in main document mode
- [request setUserAgent:[controller userAgentForURL:URL]];
- [dataSource _setRequest:request];
+ [newRequest setUserAgent:[controller userAgentForURL:URL]];
- [self didStopLoading];
- [self didStartLoadingWithURL:URL];
-
- return request;
+ [dataSource _setRequest:newRequest];
+
+ // Not the first send, so reload.
+ if (request) {
+ [self didStopLoading];
+ [self didStartLoadingWithURL:URL];
+ }
+
+ // Let the resourceProgressDelegate get a crack at modifying the request.
+ newRequest = [resourceProgressDelegate resourceRequest: request willSendRequest: newRequest fromDataSource: dataSource];
+
+ [newRequest retain];
+ [request release];
+ request = newRequest;
+
+ return newRequest;
}
--(void)handle:(WebResourceHandle *)handle didReceiveResponse:(WebResourceResponse *)response
+-(void)handle:(WebResourceHandle *)handle didReceiveResponse:(WebResourceResponse *)r
{
- NSString *contentType = [response contentType];
+ NSString *contentType = [r contentType];
+ ASSERT (response == nil);
+
+ response = [r retain];
+
[dataSource _setResponse:response];
// Make assumption that if the contentType is the default and there is no extension, this is text/html.
@@ -240,6 +258,7 @@
switch (policyAction) {
case WebContentPolicyShow:
+ [resourceProgressDelegate resourceRequest: request didReceiveResponse: response fromDataSource: dataSource];
break;
case WebContentPolicySave:
case WebContentPolicySaveAndOpenExternally:
@@ -264,11 +283,13 @@
WebError *downloadError = nil;
+
if (downloadHandler) {
downloadError = [downloadHandler receivedData:data];
} else {
[resourceData appendData:data];
[dataSource _receivedData:data];
+ [resourceProgressDelegate resourceRequest: request didReceiveContentLength: [data length] fromDataSource:dataSource];
}
[self receivedProgressWithHandle:handle complete:NO];
@@ -282,13 +303,15 @@
[handle cancel];
}
- LOG(Download, "%d of %d", [[dataSource response] contentLengthReceived], [[dataSource response] contentLength]);
+ LOG(Download, "%d of %d", [response contentLengthReceived], [response contentLength]);
}
- (void)handle:(WebResourceHandle *)handle didFailLoadingWithError:(WebError *)result
{
LOG(Loading, "URL = %@, result = %@", [result failingURL], [result errorDescription]);
+ [resourceProgressDelegate resourceRequest: request didFailLoadingWithError: result fromDataSource: dataSource];
+
// Calling receivedError will likely result in a call to release, so we must retain.
[self retain];
diff --git a/WebKit/WebView.subproj/WebResourceLoadDelegate.h b/WebKit/WebView.subproj/WebResourceLoadDelegate.h
index abbc912..6388bd4 100644
--- a/WebKit/WebView.subproj/WebResourceLoadDelegate.h
+++ b/WebKit/WebView.subproj/WebResourceLoadDelegate.h
@@ -4,40 +4,62 @@
Public header file.
*/
-
- at class WebResourceHandle;
+ at class WebResourceResponse;
+ at class WebResourceRequest;
/*!
- @protocol WebResourceProgressDelegate
+ @protocol WebResourceLoadDelegate
@discussion Implementors of this protocol will receive messages indicating
- data has been received for resources loaded by a data source.
+ that a resource is about to be loaded, data has been received for a resource,
+ an error has been received for a resource, and completion of a resource load.
+ Implementors are also given the opportunity to mutate a request before it is sent.
*/
- at protocol WebResourceProgressDelegate <NSObject>
+ at protocol WebResourceLoadDelegate <NSObject>
/*!
- @method receivedProgress:forResourceHandle:fromDataSource:complete:
- @abstract Notify that a new chunk of data has been received for a resource.
- @param progress An object representing the amount of progress so far
- @param resourceHandle The resource handle loading the resource
- @param dataSource The data source containing the resource
- @param isComplete YES if the load is now complete, otherwise NO
- @discussion A new chunk of data has been received. This could be a partial load
- of a URL. It may be useful to do incremental layout, although
- typically for non-base URLs this should be done after a URL (i.e. image)
- has been completely downloaded.
+ @method resourceRequest:willSendRequest:fromDataSource:
+ @discussion This message is sent before a load is initiated. The request may be modified
+ as necessary by the receiver.
+ @param oldRequest The request about to be sent.
+ @param newRequest The request about to be sent.
+ @param dataSource The dataSource that initiated the load.
*/
-- (void)receivedProgress: (WebLoadProgress *)progress forResourceHandle: (WebResourceHandle *)resourceHandle fromDataSource: (WebDataSource *)dataSource complete: (BOOL)isComplete;
+-(WebResourceRequest *)resourceRequest:(WebResourceRequest *)oldRequest willSendRequest: (WebResourceRequest *)newRequest fromDataSource:(WebDataSource *)dataSource;
/*!
- @method receivedError:forResourceHandle:partialProgress:fromDataSource:
- @abstract Notify that an error took place loading a resource.
- @param error An object representing the error that occurred
- @param resourceHandle The resource handle that was loading the resource
- @param progress The amoung of progress made before the error
- @param dataSource The data source responsible for the resource
+ @method resourceRequest:didReceiveResponse:fromDataSource:
+ @discussion This message is sent after a response has been received for this load.
+ @param request The request that triggered the response.
+ @param response The response for the request.
+ @param dataSource The dataSource that initiated the load.
*/
-- (void)receivedError: (WebError *)error forResourceHandle: (WebResourceHandle *)resourceHandle partialProgress: (WebLoadProgress *)progress fromDataSource: (WebDataSource *)dataSource;
+-(void)resourceRequest:(WebResourceRequest *)request didReceiveResponse: (WebResourceResponse *)response fromDataSource:(WebDataSource *)dataSource;
+/*!
+ @method resourceIdentifier:didReceiveContentLength:fromDataSource:
+ @discussion Multiple of these messages may be sent as data arrives.
+ @param request The request that represents the resource receiving data.
+ @param length The amount of new data received. This is not the total amount, just the new amount received.
+ @param dataSource The dataSource that initiated the load.
+*/
+-(void)resourceRequest:(WebResourceRequest *)request didReceiveContentLength: (unsigned)length fromDataSource:(WebDataSource *)dataSource;
+
+/*!
+ @method resourceRequest: didFinishLoadingFromDataSource:
+ @discussion This message is sent after a load has successfully completed.
+ @param request The request that has successfully loaded.
+ @param dataSource The dataSource that initiated the load.
+*/
+-(void)resourceRequest:(WebResourceRequest *)request didFinishLoadingFromDataSource:(WebDataSource *)dataSource;
+
+/*!
+ @method resourceRequest:didFailLoadingWithError:fromDataSource:
+ @discussion This message is sent after a load has successfully completed.
+ @param request The request that failed to load.
+ @param error The error associated with this load.
+ @param dataSource The dataSource that initiated the load.
+*/
+-(void)resourceRequest:(WebResourceRequest *)request didFailLoadingWithError:(WebError *)error fromDataSource:(WebDataSource *)dataSource;
@end
diff --git a/WebKit/WebView.subproj/WebResourceProgressDelegate.h b/WebKit/WebView.subproj/WebResourceProgressDelegate.h
index abbc912..6388bd4 100644
--- a/WebKit/WebView.subproj/WebResourceProgressDelegate.h
+++ b/WebKit/WebView.subproj/WebResourceProgressDelegate.h
@@ -4,40 +4,62 @@
Public header file.
*/
-
- at class WebResourceHandle;
+ at class WebResourceResponse;
+ at class WebResourceRequest;
/*!
- @protocol WebResourceProgressDelegate
+ @protocol WebResourceLoadDelegate
@discussion Implementors of this protocol will receive messages indicating
- data has been received for resources loaded by a data source.
+ that a resource is about to be loaded, data has been received for a resource,
+ an error has been received for a resource, and completion of a resource load.
+ Implementors are also given the opportunity to mutate a request before it is sent.
*/
- at protocol WebResourceProgressDelegate <NSObject>
+ at protocol WebResourceLoadDelegate <NSObject>
/*!
- @method receivedProgress:forResourceHandle:fromDataSource:complete:
- @abstract Notify that a new chunk of data has been received for a resource.
- @param progress An object representing the amount of progress so far
- @param resourceHandle The resource handle loading the resource
- @param dataSource The data source containing the resource
- @param isComplete YES if the load is now complete, otherwise NO
- @discussion A new chunk of data has been received. This could be a partial load
- of a URL. It may be useful to do incremental layout, although
- typically for non-base URLs this should be done after a URL (i.e. image)
- has been completely downloaded.
+ @method resourceRequest:willSendRequest:fromDataSource:
+ @discussion This message is sent before a load is initiated. The request may be modified
+ as necessary by the receiver.
+ @param oldRequest The request about to be sent.
+ @param newRequest The request about to be sent.
+ @param dataSource The dataSource that initiated the load.
*/
-- (void)receivedProgress: (WebLoadProgress *)progress forResourceHandle: (WebResourceHandle *)resourceHandle fromDataSource: (WebDataSource *)dataSource complete: (BOOL)isComplete;
+-(WebResourceRequest *)resourceRequest:(WebResourceRequest *)oldRequest willSendRequest: (WebResourceRequest *)newRequest fromDataSource:(WebDataSource *)dataSource;
/*!
- @method receivedError:forResourceHandle:partialProgress:fromDataSource:
- @abstract Notify that an error took place loading a resource.
- @param error An object representing the error that occurred
- @param resourceHandle The resource handle that was loading the resource
- @param progress The amoung of progress made before the error
- @param dataSource The data source responsible for the resource
+ @method resourceRequest:didReceiveResponse:fromDataSource:
+ @discussion This message is sent after a response has been received for this load.
+ @param request The request that triggered the response.
+ @param response The response for the request.
+ @param dataSource The dataSource that initiated the load.
*/
-- (void)receivedError: (WebError *)error forResourceHandle: (WebResourceHandle *)resourceHandle partialProgress: (WebLoadProgress *)progress fromDataSource: (WebDataSource *)dataSource;
+-(void)resourceRequest:(WebResourceRequest *)request didReceiveResponse: (WebResourceResponse *)response fromDataSource:(WebDataSource *)dataSource;
+/*!
+ @method resourceIdentifier:didReceiveContentLength:fromDataSource:
+ @discussion Multiple of these messages may be sent as data arrives.
+ @param request The request that represents the resource receiving data.
+ @param length The amount of new data received. This is not the total amount, just the new amount received.
+ @param dataSource The dataSource that initiated the load.
+*/
+-(void)resourceRequest:(WebResourceRequest *)request didReceiveContentLength: (unsigned)length fromDataSource:(WebDataSource *)dataSource;
+
+/*!
+ @method resourceRequest: didFinishLoadingFromDataSource:
+ @discussion This message is sent after a load has successfully completed.
+ @param request The request that has successfully loaded.
+ @param dataSource The dataSource that initiated the load.
+*/
+-(void)resourceRequest:(WebResourceRequest *)request didFinishLoadingFromDataSource:(WebDataSource *)dataSource;
+
+/*!
+ @method resourceRequest:didFailLoadingWithError:fromDataSource:
+ @discussion This message is sent after a load has successfully completed.
+ @param request The request that failed to load.
+ @param error The error associated with this load.
+ @param dataSource The dataSource that initiated the load.
+*/
+-(void)resourceRequest:(WebResourceRequest *)request didFailLoadingWithError:(WebError *)error fromDataSource:(WebDataSource *)dataSource;
@end
diff --git a/WebKit/WebView.subproj/WebView.h b/WebKit/WebView.subproj/WebView.h
index 018a653..192688a 100644
--- a/WebKit/WebView.subproj/WebView.h
+++ b/WebKit/WebView.subproj/WebView.h
@@ -21,7 +21,7 @@
@protocol WebContextMenuDelegate;
@protocol WebControllerPolicyDelegate;
@protocol WebLocationChangeDelegate;
- at protocol WebResourceProgressDelegate;
+ at protocol WebResourceLoadDelegate;
@protocol WebWindowOperationsDelegate;
// These strings are keys into the element dictionary provided in
@@ -59,14 +59,14 @@ extern NSString *WebElementFrameKey;
</pre>
WebControllers have the following delegates: WebWindowOperationsDelegate,
- WebResourceProgressDelegate, WebContextMenuDelegate, WebLocationChangeDelegate,
+ WebResourceLoadDelegate, WebContextMenuDelegate, WebLocationChangeDelegate,
and WebControllerPolicyDelegate.
WebKit depends on the WebController's WebWindowOperationsDelegate for all window
related management, including opening new windows and controlling the user interface
elements in those windows.
- WebResourceProgressDelegate is used to monitor the progress of resources as they are
+ WebResourceLoadDelegate is used to monitor the progress of resources as they are
loaded. This delegate may be used to present users with a progress monitor.
WebController's WebContextMenuDelegate can customize the context menus that appear
@@ -128,29 +128,29 @@ extern NSString *WebElementFrameKey;
/*!
@method setResourceProgressDelegate:
- @abstract Set the controller's WebResourceProgressDelegate.
- @param delegate The WebResourceProgressDelegate to set as the delegate.
+ @abstract Set the controller's WebResourceLoadDelegate.
+ @param delegate The WebResourceLoadDelegate to set as the delegate.
*/
-- (void)setResourceProgressDelegate: (id<WebResourceProgressDelegate>)delegate;
+- (void)setResourceProgressDelegate: (id<WebResourceLoadDelegate>)delegate;
/*!
@method resourceProgressDelegate
- @result Return the controller's WebResourceProgressDelegate.
+ @result Return the controller's WebResourceLoadDelegate.
*/
-- (id<WebResourceProgressDelegate>)resourceProgressDelegate;
+- (id<WebResourceLoadDelegate>)resourceProgressDelegate;
/*!
@method setDownloadProgressDelegate:
- @abstract Set the controller's WebResourceProgressDelegate download delegate.
- @param delegate The WebResourceProgressDelegate to set as the download delegate.
+ @abstract Set the controller's WebResourceLoadDelegate download delegate.
+ @param delegate The WebResourceLoadDelegate to set as the download delegate.
*/
-- (void)setDownloadProgressDelegate: (id<WebResourceProgressDelegate>)delegate;
+- (void)setDownloadProgressDelegate: (id<WebResourceLoadDelegate>)delegate;
/*!
@method downloadProgressDelegate
- @result Return the controller's WebResourceProgressDelegate download delegate.
+ @result Return the controller's WebResourceLoadDelegate download delegate.
*/
-- (id<WebResourceProgressDelegate>)downloadProgressDelegate;
+- (id<WebResourceLoadDelegate>)downloadProgressDelegate;
/*!
@method setContextMenuDelegate:
diff --git a/WebKit/WebView.subproj/WebView.m b/WebKit/WebView.subproj/WebView.m
index ea00b30..aaf8d84 100644
--- a/WebKit/WebView.subproj/WebView.m
+++ b/WebKit/WebView.subproj/WebView.m
@@ -86,25 +86,25 @@ NSString *WebElementFrameKey = @"WebElementFrame";
return _private->windowContext;
}
-- (void)setResourceProgressDelegate: (id <WebResourceProgressDelegate>)delegate
+- (void)setResourceProgressDelegate: (id <WebResourceLoadDelegate>)delegate
{
_private->resourceProgressDelegate = delegate;
}
-- (id<WebResourceProgressDelegate>)resourceProgressDelegate
+- (id<WebResourceLoadDelegate>)resourceProgressDelegate
{
return _private->resourceProgressDelegate;
}
-- (void)setDownloadProgressDelegate: (id<WebResourceProgressDelegate>)delegate
+- (void)setDownloadProgressDelegate: (id<WebResourceLoadDelegate>)delegate
{
_private->downloadProgressDelegate = delegate;
}
-- (id<WebResourceProgressDelegate>)downloadProgressDelegate
+- (id<WebResourceLoadDelegate>)downloadProgressDelegate
{
return _private->downloadProgressDelegate;
}
diff --git a/WebKit/WebView.subproj/WebViewPrivate.h b/WebKit/WebView.subproj/WebViewPrivate.h
index 132d3fe..b97f0b0 100644
--- a/WebKit/WebView.subproj/WebViewPrivate.h
+++ b/WebKit/WebView.subproj/WebViewPrivate.h
@@ -6,7 +6,6 @@
#import <WebKit/WebController.h>
@class WebError;
- at class WebLoadProgress;
@class WebFrame;
@interface WebControllerPrivate : NSObject
@@ -15,8 +14,8 @@
WebFrame *mainFrame;
id<WebWindowOperationsDelegate> windowContext;
- id<WebResourceProgressDelegate> resourceProgressDelegate;
- id<WebResourceProgressDelegate> downloadProgressDelegate;
+ id<WebResourceLoadDelegate> resourceProgressDelegate;
+ id<WebResourceLoadDelegate> downloadProgressDelegate;
id<WebContextMenuDelegate> contextMenuDelegate;
id<WebContextMenuDelegate> defaultContextMenuDelegate;
id<WebControllerPolicyDelegate> policyDelegate;
@@ -48,10 +47,10 @@
- (id<WebContextMenuDelegate>)_defaultContextMenuDelegate;
-- (void)_receivedProgress: (WebLoadProgress *)progress forResourceHandle: (WebResourceHandle *)resourceHandle fromDataSource: (WebDataSource *)dataSource complete:(BOOL)isComplete;
-- (void)_receivedError: (WebError *)error forResourceHandle: (WebResourceHandle *)resourceHandle partialProgress: (WebLoadProgress *)progress fromDataSource: (WebDataSource *)dataSource;
-- (void)_mainReceivedProgress: (WebLoadProgress *)progress forResourceHandle: (WebResourceHandle *)resourceHandle fromDataSource: (WebDataSource *)dataSource complete:(BOOL)isComplete;
-- (void)_mainReceivedError: (WebError *)error forResourceHandle: (WebResourceHandle *)resourceHandle partialProgress: (WebLoadProgress *)progress fromDataSource: (WebDataSource *)dataSource;
+- (void)_receivedProgressForResourceHandle: (WebResourceHandle *)resourceHandle fromDataSource: (WebDataSource *)dataSource complete:(BOOL)isComplete;
+- (void)_receivedError: (WebError *)error forResourceHandle: (WebResourceHandle *)resourceHandle fromDataSource: (WebDataSource *)dataSource;
+- (void)_mainReceivedProgressForResourceHandle: (WebResourceHandle *)resourceHandle bytesSoFar:(unsigned)bytesSoFar fromDataSource: (WebDataSource *)dataSource complete:(BOOL)isComplete;
+- (void)_mainReceivedError: (WebError *)error forResourceHandle: (WebResourceHandle *)resourceHandle fromDataSource: (WebDataSource *)dataSource;
- (void)_didStartLoading: (NSURL *)URL;
- (void)_didStopLoading: (NSURL *)URL;
+ (NSString *)_MIMETypeForFile: (NSString *)path;
diff --git a/WebKit/WebView.subproj/WebViewPrivate.m b/WebKit/WebView.subproj/WebViewPrivate.m
index 658915e..ee5c9e3 100644
--- a/WebKit/WebView.subproj/WebViewPrivate.m
+++ b/WebKit/WebView.subproj/WebViewPrivate.m
@@ -10,7 +10,6 @@
#import <WebKit/WebDataSourcePrivate.h>
#import <WebKit/WebDefaultContextMenuDelegate.h>
#import <WebKit/WebFramePrivate.h>
-#import <WebKit/WebLoadProgress.h>
#import <WebKit/WebPreferencesPrivate.h>
#import <WebKit/WebResourceProgressDelegate.h>
#import <WebKit/WebStandardPanelsPrivate.h>
@@ -108,15 +107,12 @@
return _private->defaultContextMenuDelegate;
}
-- (void)_receivedProgress:(WebLoadProgress *)progress forResourceHandle:(WebResourceHandle *)resourceHandle fromDataSource:(WebDataSource *)dataSource complete:(BOOL)isComplete
+- (void)_receivedProgressForResourceHandle:(WebResourceHandle *)resourceHandle fromDataSource:(WebDataSource *)dataSource complete:(BOOL)isComplete
{
WebFrame *frame = [dataSource webFrame];
ASSERT(dataSource != nil);
- [[self resourceProgressDelegate] receivedProgress: progress forResourceHandle: resourceHandle
- fromDataSource: dataSource complete:isComplete];
-
// This resource has completed, so check if the load is complete for all frames.
if (isComplete) {
if (frame != nil) {
@@ -126,15 +122,12 @@
}
}
-- (void)_mainReceivedProgress: (WebLoadProgress *)progress forResourceHandle: (WebResourceHandle *)resourceHandle fromDataSource: (WebDataSource *)dataSource complete: (BOOL)isComplete
+- (void)_mainReceivedProgressForResourceHandle: (WebResourceHandle *)resourceHandle bytesSoFar: (unsigned)bytesSoFar fromDataSource: (WebDataSource *)dataSource complete: (BOOL)isComplete
{
WebFrame *frame = [dataSource webFrame];
ASSERT(dataSource != nil);
- [[self resourceProgressDelegate] receivedProgress: progress forResourceHandle: resourceHandle
- fromDataSource: dataSource complete:isComplete];
-
// The frame may be nil if a previously cancelled load is still making progress callbacks.
if (frame == nil)
return;
@@ -151,19 +144,17 @@
// Note that transitioning a frame to this state doesn't guarantee a layout, rather it
// just indicates that an early layout can be performed.
int timedLayoutSize = [[WebPreferences standardPreferences] _initialTimedLayoutSize];
- if ([progress bytesSoFar] > timedLayoutSize)
+ if ((int)bytesSoFar > timedLayoutSize)
[frame _transitionToLayoutAcceptable];
}
}
-- (void)_receivedError: (WebError *)error forResourceHandle: (WebResourceHandle *)resourceHandle partialProgress: (WebLoadProgress *)progress fromDataSource: (WebDataSource *)dataSource
+- (void)_receivedError: (WebError *)error forResourceHandle: (WebResourceHandle *)resourceHandle fromDataSource: (WebDataSource *)dataSource
{
WebFrame *frame = [dataSource webFrame];
- [[self resourceProgressDelegate] receivedError: error forResourceHandle: resourceHandle partialProgress: progress fromDataSource: dataSource];
-
NSString *resourceIdentifier = [[[resourceHandle _request] URL] absoluteString];
if (resourceIdentifier == nil) {
resourceIdentifier = [error failingURL];
@@ -176,11 +167,9 @@
}
-- (void)_mainReceivedError: (WebError *)error forResourceHandle: (WebResourceHandle *)resourceHandle partialProgress: (WebLoadProgress *)progress fromDataSource: (WebDataSource *)dataSource
+- (void)_mainReceivedError: (WebError *)error forResourceHandle: (WebResourceHandle *)resourceHandle fromDataSource: (WebDataSource *)dataSource
{
WebFrame *frame = [dataSource webFrame];
-
- [[self resourceProgressDelegate] receivedError: error forResourceHandle: resourceHandle partialProgress: progress fromDataSource: dataSource];
[dataSource _setMainDocumentError: error];
[dataSource _setPrimaryLoadComplete: YES];
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list