[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:52:01 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit ee61d1c230548e90f44718aea3fb0f805c886770
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Oct 21 23:09:44 2002 +0000
Modernized the activity window a little bit. Fixed
a slew of activity related bugs.
* BrowserWebController.m:
(-[BrowserWebController identifierForInitialRequest:fromDataSource:]):
(-[BrowserWebController resource:willSendRequest:fromDataSource:]):
(-[BrowserWebController resource:didReceiveResponse:fromDataSource:]):
(-[BrowserWebController resource:didReceiveContentLength:fromDataSource:]):
(-[BrowserWebController resource:didFinishLoadingFromDataSource:]):
* FrameProgressEntry.h:
* FrameProgressEntry.m:
(-[FrameProgressEntry _initWithFrame:]):
(-[FrameProgressEntry provisionalDataSourceWasCommitted]):
(-[FrameProgressEntry activeSubresourcesForDataSource:]):
(-[FrameProgressEntry trackSubresource:forDataSource:]):
(-[FrameProgressEntry completedEntry:fromDataSource:]):
(-[FrameProgressEntry trackSubframe:fromDataSource:]):
(-[FrameProgressEntry resetProvisionalLoad]):
* LoadProgressMonitor.h:
* LoadProgressMonitor.m:
(-[LoadProgressMonitor _monitorProvisionalDataSourceForFrame:]):
(-[LoadProgressMonitor _incrementProgressBarWithOldBytes:newBytes:oldTotal:newTotal:isMainResource:]):
(-[LoadProgressMonitor createProgressEntryWithRequest:dataSource:]):
(-[LoadProgressMonitor completedEntry:fromDataSource:]):
(-[LoadProgressMonitor receivedError:forEntry:fromDataSource:]):
(-[LoadProgressMonitor receivedUpdateForEntry:URLString:bytesLoaded:bytesExpected:error:dataSource:]):
* ResourceProgressEntry.h:
* ResourceProgressEntry.m:
Changed WebResourceLoadDelegate methods to include an identifier
as first parameter. This will help clients track callbacks relating
to a particular resource. Added identifierForInitialRequest:fromDataSource:
so clients can create their own identifier.
* WebCoreSupport.subproj/WebBridge.m:
(-[WebBridge objectLoadedFromCache:response:size:]):
* WebCoreSupport.subproj/WebSubresourceClient.h:
* WebCoreSupport.subproj/WebSubresourceClient.m:
(-[WebSubresourceClient handle:willSendRequest:]):
(-[WebSubresourceClient handle:didReceiveResponse:]):
(-[WebSubresourceClient handle:didReceiveData:]):
(-[WebSubresourceClient handleDidFinishLoading:]):
(-[WebSubresourceClient handle:didFailLoadingWithError:]):
* WebView.subproj/WebController.m:
(-[WebResourceLoadDelegate identifierForInitialRequest:fromDataSource:]):
(-[WebResourceLoadDelegate resource:willSendRequest:fromDataSource:]):
(-[WebResourceLoadDelegate resource:didReceiveResponse:fromDataSource:]):
(-[WebResourceLoadDelegate resource:didReceiveContentLength:fromDataSource:]):
(-[WebResourceLoadDelegate resource:didFinishLoadingFromDataSource:]):
(-[WebResourceLoadDelegate resource:didFailLoadingWithError:fromDataSource:]):
* WebView.subproj/WebMainResourceClient.h:
* WebView.subproj/WebMainResourceClient.m:
(-[WebMainResourceClient receivedError:forHandle:]):
(-[WebMainResourceClient handleDidFinishLoading:]):
(-[WebMainResourceClient handle:willSendRequest:]):
(-[WebMainResourceClient handle:didReceiveResponse:]):
(-[WebMainResourceClient handle:didReceiveData:]):
(-[WebMainResourceClient handle:didFailLoadingWithError:]):
* WebView.subproj/WebResourceLoadDelegate.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2402 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index a540ded..a91f0af 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,36 @@
+2002-10-21 Richard Williamson <rjw at apple.com>
+
+ Changed WebResourceLoadDelegate methods to include an identifier
+ as first parameter. This will help clients track callbacks relating
+ to a particular resource. Added identifierForInitialRequest:fromDataSource:
+ so clients can create their own identifier.
+
+ * WebCoreSupport.subproj/WebBridge.m:
+ (-[WebBridge objectLoadedFromCache:response:size:]):
+ * WebCoreSupport.subproj/WebSubresourceClient.h:
+ * WebCoreSupport.subproj/WebSubresourceClient.m:
+ (-[WebSubresourceClient handle:willSendRequest:]):
+ (-[WebSubresourceClient handle:didReceiveResponse:]):
+ (-[WebSubresourceClient handle:didReceiveData:]):
+ (-[WebSubresourceClient handleDidFinishLoading:]):
+ (-[WebSubresourceClient handle:didFailLoadingWithError:]):
+ * WebView.subproj/WebController.m:
+ (-[WebResourceLoadDelegate identifierForInitialRequest:fromDataSource:]):
+ (-[WebResourceLoadDelegate resource:willSendRequest:fromDataSource:]):
+ (-[WebResourceLoadDelegate resource:didReceiveResponse:fromDataSource:]):
+ (-[WebResourceLoadDelegate resource:didReceiveContentLength:fromDataSource:]):
+ (-[WebResourceLoadDelegate resource:didFinishLoadingFromDataSource:]):
+ (-[WebResourceLoadDelegate resource:didFailLoadingWithError:fromDataSource:]):
+ * WebView.subproj/WebMainResourceClient.h:
+ * WebView.subproj/WebMainResourceClient.m:
+ (-[WebMainResourceClient receivedError:forHandle:]):
+ (-[WebMainResourceClient handleDidFinishLoading:]):
+ (-[WebMainResourceClient handle:willSendRequest:]):
+ (-[WebMainResourceClient handle:didReceiveResponse:]):
+ (-[WebMainResourceClient handle:didReceiveData:]):
+ (-[WebMainResourceClient handle:didFailLoadingWithError:]):
+ * WebView.subproj/WebResourceLoadDelegate.h:
+
2002-10-21 Chris Blumenberg <cblu at apple.com>
Changed content policy API to pass a response instead of MIME type so client can get the mime type and filename from one class.
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index a540ded..a91f0af 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,36 @@
+2002-10-21 Richard Williamson <rjw at apple.com>
+
+ Changed WebResourceLoadDelegate methods to include an identifier
+ as first parameter. This will help clients track callbacks relating
+ to a particular resource. Added identifierForInitialRequest:fromDataSource:
+ so clients can create their own identifier.
+
+ * WebCoreSupport.subproj/WebBridge.m:
+ (-[WebBridge objectLoadedFromCache:response:size:]):
+ * WebCoreSupport.subproj/WebSubresourceClient.h:
+ * WebCoreSupport.subproj/WebSubresourceClient.m:
+ (-[WebSubresourceClient handle:willSendRequest:]):
+ (-[WebSubresourceClient handle:didReceiveResponse:]):
+ (-[WebSubresourceClient handle:didReceiveData:]):
+ (-[WebSubresourceClient handleDidFinishLoading:]):
+ (-[WebSubresourceClient handle:didFailLoadingWithError:]):
+ * WebView.subproj/WebController.m:
+ (-[WebResourceLoadDelegate identifierForInitialRequest:fromDataSource:]):
+ (-[WebResourceLoadDelegate resource:willSendRequest:fromDataSource:]):
+ (-[WebResourceLoadDelegate resource:didReceiveResponse:fromDataSource:]):
+ (-[WebResourceLoadDelegate resource:didReceiveContentLength:fromDataSource:]):
+ (-[WebResourceLoadDelegate resource:didFinishLoadingFromDataSource:]):
+ (-[WebResourceLoadDelegate resource:didFailLoadingWithError:fromDataSource:]):
+ * WebView.subproj/WebMainResourceClient.h:
+ * WebView.subproj/WebMainResourceClient.m:
+ (-[WebMainResourceClient receivedError:forHandle:]):
+ (-[WebMainResourceClient handleDidFinishLoading:]):
+ (-[WebMainResourceClient handle:willSendRequest:]):
+ (-[WebMainResourceClient handle:didReceiveResponse:]):
+ (-[WebMainResourceClient handle:didReceiveData:]):
+ (-[WebMainResourceClient handle:didFailLoadingWithError:]):
+ * WebView.subproj/WebResourceLoadDelegate.h:
+
2002-10-21 Chris Blumenberg <cblu at apple.com>
Changed content policy API to pass a response instead of MIME type so client can get the mime type and filename from one class.
diff --git a/WebKit/WebCoreSupport.subproj/WebBridge.m b/WebKit/WebCoreSupport.subproj/WebBridge.m
index 87f8fe1..b3f4461 100644
--- a/WebKit/WebCoreSupport.subproj/WebBridge.m
+++ b/WebKit/WebCoreSupport.subproj/WebBridge.m
@@ -180,11 +180,13 @@
WebResourceRequest *request = [[WebResourceRequest alloc] initWithURL:URL];
id <WebResourceLoadDelegate> delegate = [[frame controller] resourceLoadDelegate];
+ id identifier;
// No chance for delegate to modify request, so we don't send a willSendRequest: message.
- [delegate resourceRequest: request didReceiveResponse: response fromDataSource: [self dataSource]];
- [delegate resourceRequest: request didReceiveContentLength: bytes fromDataSource: [self dataSource]];
- [delegate resourceRequest: request didFinishLoadingFromDataSource: [self dataSource]];
+ identifier = [delegate identifierForInitialRequest: request fromDataSource: [self dataSource]];
+ [delegate resource: identifier didReceiveResponse: response fromDataSource: [self dataSource]];
+ [delegate resource: identifier didReceiveContentLength: bytes fromDataSource: [self dataSource]];
+ [delegate resource: identifier didFinishLoadingFromDataSource: [self dataSource]];
[[frame controller] _receivedProgressForResourceHandle:nil fromDataSource:[self dataSource] complete:YES];
[request release];
diff --git a/WebKit/WebCoreSupport.subproj/WebSubresourceClient.h b/WebKit/WebCoreSupport.subproj/WebSubresourceClient.h
index 009e8cb..355183e 100644
--- a/WebKit/WebCoreSupport.subproj/WebSubresourceClient.h
+++ b/WebKit/WebCoreSupport.subproj/WebSubresourceClient.h
@@ -24,6 +24,8 @@
id <WebResourceLoadDelegate> resourceProgressDelegate;
WebResourceRequest *request;
WebResourceResponse *response;
+
+ id identifier;
}
+ (WebSubresourceClient *)startLoadingResource:(id <WebCoreResourceLoader>)rLoader
diff --git a/WebKit/WebCoreSupport.subproj/WebSubresourceClient.m b/WebKit/WebCoreSupport.subproj/WebSubresourceClient.m
index be03c75..4aa0c83 100644
--- a/WebKit/WebCoreSupport.subproj/WebSubresourceClient.m
+++ b/WebKit/WebCoreSupport.subproj/WebSubresourceClient.m
@@ -134,8 +134,14 @@
}
// Let the resourceProgressDelegate get a crack at modifying the request.
- if (resourceProgressDelegate)
- newRequest = [resourceProgressDelegate resourceRequest: request willSendRequest: newRequest fromDataSource: dataSource];
+ if (resourceProgressDelegate){
+ if (identifier == nil){
+ // The identifier is released after the last callback, rather than in dealloc
+ // to avoid potential cycles.
+ identifier = [[resourceProgressDelegate identifierForInitialRequest: newRequest fromDataSource: dataSource] retain];
+ }
+ newRequest = [resourceProgressDelegate resource: identifier willSendRequest: newRequest fromDataSource: dataSource];
+ }
ASSERT (newRequest != nil);
@@ -153,7 +159,7 @@
[r retain];
[response release];
response = r;
- [resourceProgressDelegate resourceRequest: request didReceiveResponse: r fromDataSource: dataSource];
+ [resourceProgressDelegate resource: identifier didReceiveResponse: r fromDataSource: dataSource];
[loader receivedResponse:r];
}
@@ -162,7 +168,7 @@
{
ASSERT(handle == h);
- [resourceProgressDelegate resourceRequest: request didReceiveContentLength: [data length]
+ [resourceProgressDelegate resource: identifier didReceiveContentLength: [data length]
fromDataSource: dataSource];
[self receivedProgressWithComplete:NO];
@@ -185,7 +191,7 @@
[self receivedError:nonTerminalError];
}
- [resourceProgressDelegate resourceRequest:request didFinishLoadingFromDataSource:dataSource];
+ [resourceProgressDelegate resource:identifier didFinishLoadingFromDataSource:dataSource];
[self receivedProgressWithComplete:YES];
@@ -193,7 +199,10 @@
[handle release];
handle = nil;
-
+
+ [identifier release];
+ identifier = nil;
+
[self release];
}
@@ -208,7 +217,7 @@
[dataSource _removeSubresourceClient:self];
- [resourceProgressDelegate resourceRequest: request didFailLoadingWithError: error fromDataSource: dataSource];
+ [resourceProgressDelegate resource: identifier didFailLoadingWithError: error fromDataSource: dataSource];
[self receivedError:error];
@@ -216,7 +225,10 @@
[handle release];
handle = nil;
-
+
+ [identifier release];
+ identifier = nil;
+
[self release];
}
diff --git a/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.h b/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.h
index 009e8cb..355183e 100644
--- a/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.h
+++ b/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.h
@@ -24,6 +24,8 @@
id <WebResourceLoadDelegate> resourceProgressDelegate;
WebResourceRequest *request;
WebResourceResponse *response;
+
+ id identifier;
}
+ (WebSubresourceClient *)startLoadingResource:(id <WebCoreResourceLoader>)rLoader
diff --git a/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m b/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m
index be03c75..4aa0c83 100644
--- a/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m
+++ b/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m
@@ -134,8 +134,14 @@
}
// Let the resourceProgressDelegate get a crack at modifying the request.
- if (resourceProgressDelegate)
- newRequest = [resourceProgressDelegate resourceRequest: request willSendRequest: newRequest fromDataSource: dataSource];
+ if (resourceProgressDelegate){
+ if (identifier == nil){
+ // The identifier is released after the last callback, rather than in dealloc
+ // to avoid potential cycles.
+ identifier = [[resourceProgressDelegate identifierForInitialRequest: newRequest fromDataSource: dataSource] retain];
+ }
+ newRequest = [resourceProgressDelegate resource: identifier willSendRequest: newRequest fromDataSource: dataSource];
+ }
ASSERT (newRequest != nil);
@@ -153,7 +159,7 @@
[r retain];
[response release];
response = r;
- [resourceProgressDelegate resourceRequest: request didReceiveResponse: r fromDataSource: dataSource];
+ [resourceProgressDelegate resource: identifier didReceiveResponse: r fromDataSource: dataSource];
[loader receivedResponse:r];
}
@@ -162,7 +168,7 @@
{
ASSERT(handle == h);
- [resourceProgressDelegate resourceRequest: request didReceiveContentLength: [data length]
+ [resourceProgressDelegate resource: identifier didReceiveContentLength: [data length]
fromDataSource: dataSource];
[self receivedProgressWithComplete:NO];
@@ -185,7 +191,7 @@
[self receivedError:nonTerminalError];
}
- [resourceProgressDelegate resourceRequest:request didFinishLoadingFromDataSource:dataSource];
+ [resourceProgressDelegate resource:identifier didFinishLoadingFromDataSource:dataSource];
[self receivedProgressWithComplete:YES];
@@ -193,7 +199,10 @@
[handle release];
handle = nil;
-
+
+ [identifier release];
+ identifier = nil;
+
[self release];
}
@@ -208,7 +217,7 @@
[dataSource _removeSubresourceClient:self];
- [resourceProgressDelegate resourceRequest: request didFailLoadingWithError: error fromDataSource: dataSource];
+ [resourceProgressDelegate resource: identifier didFailLoadingWithError: error fromDataSource: dataSource];
[self receivedError:error];
@@ -216,7 +225,10 @@
[handle release];
handle = nil;
-
+
+ [identifier release];
+ identifier = nil;
+
[self release];
}
diff --git a/WebKit/WebView.subproj/WebController.m b/WebKit/WebView.subproj/WebController.m
index db28a7e..b157f49 100644
--- a/WebKit/WebView.subproj/WebController.m
+++ b/WebKit/WebView.subproj/WebController.m
@@ -466,24 +466,29 @@ NSString *WebElementFrameKey = @"WebElementFrame";
@implementation WebResourceLoadDelegate
--(WebResourceRequest *)resourceRequest:(WebResourceRequest *)oldRequest willSendRequest: (WebResourceRequest *)newRequest fromDataSource:(WebDataSource *)dataSource
+- identifierForInitialRequest: (WebResourceRequest *)request fromDataSource: (WebDataSource *)dataSource
+{
+ return [[[NSObject alloc] init] autorelease];
+}
+
+-(WebResourceRequest *)resource:identifier willSendRequest: (WebResourceRequest *)newRequest fromDataSource:(WebDataSource *)dataSource
{
return newRequest;
}
--(void)resourceRequest:(WebResourceRequest *)request didReceiveResponse: (WebResourceResponse *)response fromDataSource:(WebDataSource *)dataSource
+-(void)resource:identifier didReceiveResponse: (WebResourceResponse *)response fromDataSource:(WebDataSource *)dataSource
{
}
--(void)resourceRequest:(WebResourceRequest *)request didReceiveContentLength: (unsigned)length fromDataSource:(WebDataSource *)dataSource
+-(void)resource:identifier didReceiveContentLength: (unsigned)length fromDataSource:(WebDataSource *)dataSource
{
}
--(void)resourceRequest:(WebResourceRequest *)request didFinishLoadingFromDataSource:(WebDataSource *)dataSource
+-(void)resource:identifier didFinishLoadingFromDataSource:(WebDataSource *)dataSource
{
}
--(void)resourceRequest:(WebResourceRequest *)request didFailLoadingWithError:(WebError *)error fromDataSource:(WebDataSource *)dataSource
+-(void)resource:identifier didFailLoadingWithError:(WebError *)error fromDataSource:(WebDataSource *)dataSource
{
}
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.h b/WebKit/WebView.subproj/WebMainResourceClient.h
index 912b4c4..18857df 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.h
+++ b/WebKit/WebView.subproj/WebMainResourceClient.h
@@ -33,6 +33,8 @@
NSMutableData *resourceData;
WebResourceRequest *request;
WebResourceResponse *response;
+
+ id identifier;
}
- initWithDataSource:(WebDataSource *)dataSource;
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.m b/WebKit/WebView.subproj/WebMainResourceClient.m
index ce5e13f..b963d32 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.m
+++ b/WebKit/WebView.subproj/WebMainResourceClient.m
@@ -93,7 +93,7 @@
WebContentAction contentAction = [[dataSource contentPolicy] policyAction];
if (contentAction == WebContentPolicySaveAndOpenExternally || contentAction == WebContentPolicySave) {
- [downloadProgressDelegate resourceRequest: [handle _request] didFailLoadingWithError:error fromDataSource:dataSource];
+ [downloadProgressDelegate resource: identifier didFailLoadingWithError:error fromDataSource:dataSource];
} else {
[[dataSource controller] _mainReceivedError:error forResourceHandle:handle
fromDataSource:dataSource];
@@ -152,7 +152,7 @@
if (downloadError) {
[self receivedError:downloadError forHandle:handle];
}else{
- [downloadProgressDelegate resourceRequest:[handle _request] didFinishLoadingFromDataSource:dataSource];
+ [downloadProgressDelegate resource:identifier didFinishLoadingFromDataSource:dataSource];
}
[dataSource _setPrimaryLoadComplete:YES];
[downloadHandler release];
@@ -160,7 +160,7 @@
}
else {
[dataSource _finishedLoading];
- [resourceProgressDelegate resourceRequest:[handle _request] didFinishLoadingFromDataSource:dataSource];
+ [resourceProgressDelegate resource:identifier didFinishLoadingFromDataSource:dataSource];
// FIXME: Please let Chris know if this is really necessary?
// Either send a final error message or a final progress message.
@@ -174,7 +174,10 @@
complete:YES];
}
}
-
+
+ [identifier release];
+ identifier = nil;
+
[self didStopLoading];
[self release];
@@ -185,8 +188,14 @@
[newRequest setUserAgent:[[dataSource controller] userAgentForURL:[newRequest URL]]];
// Let the resourceProgressDelegate get a crack at modifying the request.
- if (resourceProgressDelegate)
- newRequest = [resourceProgressDelegate resourceRequest: request willSendRequest: newRequest fromDataSource: dataSource];
+ if (resourceProgressDelegate) {
+ if (identifier == nil){
+ // The identifier is released after the last callback, rather than in dealloc
+ // to avoid potential cycles.
+ identifier = [[resourceProgressDelegate identifierForInitialRequest: newRequest fromDataSource: dataSource] retain];
+ }
+ newRequest = [resourceProgressDelegate resource: identifier willSendRequest: newRequest fromDataSource: dataSource];
+ }
ASSERT(newRequest != nil);
@@ -246,7 +255,7 @@
switch (policyAction) {
case WebContentPolicyShow:
- [resourceProgressDelegate resourceRequest: request didReceiveResponse: response fromDataSource: dataSource];
+ [resourceProgressDelegate resource: identifier didReceiveResponse: response fromDataSource: dataSource];
break;
case WebContentPolicySave:
case WebContentPolicySaveAndOpenExternally:
@@ -254,7 +263,7 @@
[[[dataSource controller] locationChangeDelegate] locationChangeDone:nil forDataSource:dataSource];
downloadHandler = [[WebDownloadHandler alloc] initWithDataSource:dataSource];
WebError *downloadError = [downloadHandler receivedResponse:response];
- [downloadProgressDelegate resourceRequest: request didReceiveResponse: response fromDataSource: dataSource];
+ [downloadProgressDelegate resource: identifier didReceiveResponse: response fromDataSource: dataSource];
if (downloadError) {
[self receivedError:downloadError forHandle:handle];
@@ -278,11 +287,11 @@
if (downloadHandler) {
[downloadHandler receivedData:data];
- [downloadProgressDelegate resourceRequest: request didReceiveContentLength: [data length] fromDataSource:dataSource];
+ [downloadProgressDelegate resource: identifier didReceiveContentLength: [data length] fromDataSource:dataSource];
} else {
[resourceData appendData:data];
[dataSource _receivedData:data];
- [resourceProgressDelegate resourceRequest: request didReceiveContentLength: [data length] fromDataSource:dataSource];
+ [resourceProgressDelegate resource: identifier didReceiveContentLength: [data length] fromDataSource:dataSource];
[[dataSource controller] _mainReceivedProgressForResourceHandle:handle
bytesSoFar:[resourceData length]
fromDataSource:dataSource
@@ -297,7 +306,7 @@
LOG(Loading, "URL = %@, result = %@", [result failingURL], [result errorDescription]);
if (!downloadHandler)
- [resourceProgressDelegate resourceRequest: request didFailLoadingWithError: result fromDataSource: dataSource];
+ [resourceProgressDelegate resource: identifier didFailLoadingWithError: result fromDataSource: dataSource];
// Calling receivedError will likely result in a call to release, so we must retain.
[self retain];
@@ -310,6 +319,9 @@
downloadHandler = nil;
}
+ [identifier release];
+ identifier = nil;
+
[self didStopLoading];
[self release];
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.h b/WebKit/WebView.subproj/WebMainResourceLoader.h
index 912b4c4..18857df 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.h
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.h
@@ -33,6 +33,8 @@
NSMutableData *resourceData;
WebResourceRequest *request;
WebResourceResponse *response;
+
+ id identifier;
}
- initWithDataSource:(WebDataSource *)dataSource;
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.m b/WebKit/WebView.subproj/WebMainResourceLoader.m
index ce5e13f..b963d32 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.m
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.m
@@ -93,7 +93,7 @@
WebContentAction contentAction = [[dataSource contentPolicy] policyAction];
if (contentAction == WebContentPolicySaveAndOpenExternally || contentAction == WebContentPolicySave) {
- [downloadProgressDelegate resourceRequest: [handle _request] didFailLoadingWithError:error fromDataSource:dataSource];
+ [downloadProgressDelegate resource: identifier didFailLoadingWithError:error fromDataSource:dataSource];
} else {
[[dataSource controller] _mainReceivedError:error forResourceHandle:handle
fromDataSource:dataSource];
@@ -152,7 +152,7 @@
if (downloadError) {
[self receivedError:downloadError forHandle:handle];
}else{
- [downloadProgressDelegate resourceRequest:[handle _request] didFinishLoadingFromDataSource:dataSource];
+ [downloadProgressDelegate resource:identifier didFinishLoadingFromDataSource:dataSource];
}
[dataSource _setPrimaryLoadComplete:YES];
[downloadHandler release];
@@ -160,7 +160,7 @@
}
else {
[dataSource _finishedLoading];
- [resourceProgressDelegate resourceRequest:[handle _request] didFinishLoadingFromDataSource:dataSource];
+ [resourceProgressDelegate resource:identifier didFinishLoadingFromDataSource:dataSource];
// FIXME: Please let Chris know if this is really necessary?
// Either send a final error message or a final progress message.
@@ -174,7 +174,10 @@
complete:YES];
}
}
-
+
+ [identifier release];
+ identifier = nil;
+
[self didStopLoading];
[self release];
@@ -185,8 +188,14 @@
[newRequest setUserAgent:[[dataSource controller] userAgentForURL:[newRequest URL]]];
// Let the resourceProgressDelegate get a crack at modifying the request.
- if (resourceProgressDelegate)
- newRequest = [resourceProgressDelegate resourceRequest: request willSendRequest: newRequest fromDataSource: dataSource];
+ if (resourceProgressDelegate) {
+ if (identifier == nil){
+ // The identifier is released after the last callback, rather than in dealloc
+ // to avoid potential cycles.
+ identifier = [[resourceProgressDelegate identifierForInitialRequest: newRequest fromDataSource: dataSource] retain];
+ }
+ newRequest = [resourceProgressDelegate resource: identifier willSendRequest: newRequest fromDataSource: dataSource];
+ }
ASSERT(newRequest != nil);
@@ -246,7 +255,7 @@
switch (policyAction) {
case WebContentPolicyShow:
- [resourceProgressDelegate resourceRequest: request didReceiveResponse: response fromDataSource: dataSource];
+ [resourceProgressDelegate resource: identifier didReceiveResponse: response fromDataSource: dataSource];
break;
case WebContentPolicySave:
case WebContentPolicySaveAndOpenExternally:
@@ -254,7 +263,7 @@
[[[dataSource controller] locationChangeDelegate] locationChangeDone:nil forDataSource:dataSource];
downloadHandler = [[WebDownloadHandler alloc] initWithDataSource:dataSource];
WebError *downloadError = [downloadHandler receivedResponse:response];
- [downloadProgressDelegate resourceRequest: request didReceiveResponse: response fromDataSource: dataSource];
+ [downloadProgressDelegate resource: identifier didReceiveResponse: response fromDataSource: dataSource];
if (downloadError) {
[self receivedError:downloadError forHandle:handle];
@@ -278,11 +287,11 @@
if (downloadHandler) {
[downloadHandler receivedData:data];
- [downloadProgressDelegate resourceRequest: request didReceiveContentLength: [data length] fromDataSource:dataSource];
+ [downloadProgressDelegate resource: identifier didReceiveContentLength: [data length] fromDataSource:dataSource];
} else {
[resourceData appendData:data];
[dataSource _receivedData:data];
- [resourceProgressDelegate resourceRequest: request didReceiveContentLength: [data length] fromDataSource:dataSource];
+ [resourceProgressDelegate resource: identifier didReceiveContentLength: [data length] fromDataSource:dataSource];
[[dataSource controller] _mainReceivedProgressForResourceHandle:handle
bytesSoFar:[resourceData length]
fromDataSource:dataSource
@@ -297,7 +306,7 @@
LOG(Loading, "URL = %@, result = %@", [result failingURL], [result errorDescription]);
if (!downloadHandler)
- [resourceProgressDelegate resourceRequest: request didFailLoadingWithError: result fromDataSource: dataSource];
+ [resourceProgressDelegate resource: identifier didFailLoadingWithError: result fromDataSource: dataSource];
// Calling receivedError will likely result in a call to release, so we must retain.
[self retain];
@@ -310,6 +319,9 @@
downloadHandler = nil;
}
+ [identifier release];
+ identifier = nil;
+
[self didStopLoading];
[self release];
diff --git a/WebKit/WebView.subproj/WebResourceLoadDelegate.h b/WebKit/WebView.subproj/WebResourceLoadDelegate.h
index 065c1ff..8e5ceb6 100644
--- a/WebKit/WebView.subproj/WebResourceLoadDelegate.h
+++ b/WebKit/WebView.subproj/WebResourceLoadDelegate.h
@@ -12,54 +12,77 @@
@discussion Implementors of this protocol will receive messages indicating
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.
+ Implementors are also given the opportunity to mutate requests before they are sent.
+ The various progrss methods of this protocol all receive an identifier as the
+ parameter. This identifier can be used to track messages associated with a single
+ resource. For example, a single resource may generate multiple
+ resource:willSendRequest:fromDataSource messages as it's URL is redirected.
*/
@protocol WebResourceLoadDelegate <NSObject>
/*!
+ @method provideIdentifierForInitialRequest:
+ @discussion An implementor of WebResourceLoadDelegate should provide an identifier
+ that can be used to track the load of a single resource. This identifier will be
+ passed as the first argument for all of the other WebResourceLoadDelegate. The
+ identifier is useful to track changes to a resources request, which will be
+ provided by one or more calls to resource:willSendRequest:fromDataSource:.
+ @result A identifier that will be passed back to the implementor for each callback.
+ The identifier will be retained.
+*/
+- identifierForInitialRequest: (WebResourceRequest *)request fromDataSource: (WebDataSource *)dataSource;
+
+/*!
@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 identifier An identifier that can be used to track the progress of a resource load across
+ multiple call backs.
+ @param request The request about to be sent.
@param dataSource The dataSource that initiated the load.
+ @result Returns the request, which may be mutated by the implementor, although typically
+ will be request.
*/
--(WebResourceRequest *)resourceRequest:(WebResourceRequest *)oldRequest willSendRequest: (WebResourceRequest *)newRequest fromDataSource:(WebDataSource *)dataSource;
+-(WebResourceRequest *)resource:identifier willSendRequest: (WebResourceRequest *)request fromDataSource:(WebDataSource *)dataSource;
/*!
@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 identifier An identifier that can be used to track the progress of a resource load across
+ multiple call backs.
@param response The response for the request.
@param dataSource The dataSource that initiated the load.
*/
--(void)resourceRequest:(WebResourceRequest *)request didReceiveResponse: (WebResourceResponse *)response fromDataSource:(WebDataSource *)dataSource;
+-(void)resource:identifier 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 identifier An identifier that can be used to track the progress of a resource load across
+ multiple call backs.
@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;
+-(void)resource:identifier 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 identifier An identifier that can be used to track the progress of a resource load across
+ multiple call backs.
@param dataSource The dataSource that initiated the load.
*/
--(void)resourceRequest:(WebResourceRequest *)request didFinishLoadingFromDataSource:(WebDataSource *)dataSource;
+-(void)resource:identifier 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 identifier An identifier that can be used to track the progress of a resource load across
+ multiple call backs.
@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;
+-(void)resource:identifier didFailLoadingWithError:(WebError *)error fromDataSource:(WebDataSource *)dataSource;
@end
diff --git a/WebKit/WebView.subproj/WebView.m b/WebKit/WebView.subproj/WebView.m
index db28a7e..b157f49 100644
--- a/WebKit/WebView.subproj/WebView.m
+++ b/WebKit/WebView.subproj/WebView.m
@@ -466,24 +466,29 @@ NSString *WebElementFrameKey = @"WebElementFrame";
@implementation WebResourceLoadDelegate
--(WebResourceRequest *)resourceRequest:(WebResourceRequest *)oldRequest willSendRequest: (WebResourceRequest *)newRequest fromDataSource:(WebDataSource *)dataSource
+- identifierForInitialRequest: (WebResourceRequest *)request fromDataSource: (WebDataSource *)dataSource
+{
+ return [[[NSObject alloc] init] autorelease];
+}
+
+-(WebResourceRequest *)resource:identifier willSendRequest: (WebResourceRequest *)newRequest fromDataSource:(WebDataSource *)dataSource
{
return newRequest;
}
--(void)resourceRequest:(WebResourceRequest *)request didReceiveResponse: (WebResourceResponse *)response fromDataSource:(WebDataSource *)dataSource
+-(void)resource:identifier didReceiveResponse: (WebResourceResponse *)response fromDataSource:(WebDataSource *)dataSource
{
}
--(void)resourceRequest:(WebResourceRequest *)request didReceiveContentLength: (unsigned)length fromDataSource:(WebDataSource *)dataSource
+-(void)resource:identifier didReceiveContentLength: (unsigned)length fromDataSource:(WebDataSource *)dataSource
{
}
--(void)resourceRequest:(WebResourceRequest *)request didFinishLoadingFromDataSource:(WebDataSource *)dataSource
+-(void)resource:identifier didFinishLoadingFromDataSource:(WebDataSource *)dataSource
{
}
--(void)resourceRequest:(WebResourceRequest *)request didFailLoadingWithError:(WebError *)error fromDataSource:(WebDataSource *)dataSource
+-(void)resource:identifier didFailLoadingWithError:(WebError *)error fromDataSource:(WebDataSource *)dataSource
{
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list