[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
sullivan
sullivan at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:44:13 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit aaa55bac896d464a591811ce837d71f9bb289e20
Author: sullivan <sullivan at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Jun 5 18:23:02 2003 +0000
- fixed 3266216 -- repro crash in
-[WebBaseResourceHandleDelegate connection:didReceiveData:]
in GIA Application
The problem was that an NSURLConnection delegate object (in this
case a WebMainResourceClient) was being dealloc'ed during one of
its connection delegate methods. To prevent this kind of problem,
I added [self retain]/[self release] guards around the meat of
all of the connection delegate methods in which arbitrary code
could be run. Another approach would be to do this retain/release
pair in NSURLConnection, but Darin deemed it wiser not to muck with
Foundation at this point for this issue.
Reviewed by Darin
* Plugins.subproj/WebNetscapePluginStream.m:
(-[WebNetscapePluginConnectionDelegate connection:didReceiveResponse:]):
guard with [self retain]/[self release]
(-[WebNetscapePluginConnectionDelegate connection:didReceiveData:]):
ditto
(-[WebNetscapePluginConnectionDelegate connection:didFailWithError:]):
ditto
* WebCoreSupport.subproj/WebSubresourceClient.m:
(-[WebSubresourceClient connection:didReceiveResponse:]):
ditto
(-[WebSubresourceClient connection:didReceiveData:]):
ditto
* WebView.subproj/WebBaseResourceHandleDelegate.m:
(-[WebBaseResourceHandleDelegate connection:willSendRequest:redirectResponse:]):
ditto
(-[WebBaseResourceHandleDelegate connection:didReceiveAuthenticationChallenge:]):
ditto
(-[WebBaseResourceHandleDelegate connection:didCancelAuthenticationChallenge:]):
ditto
(-[WebBaseResourceHandleDelegate connection:didReceiveResponse:]):
ditto
(-[WebBaseResourceHandleDelegate connection:didReceiveData:]):
ditto. Also, commented out two assertions that fire illegitimately in the steps in
this bug report.
(-[WebBaseResourceHandleDelegate connection:didFailWithError:]):
ditto
* WebView.subproj/WebMainResourceClient.m:
(-[WebMainResourceClient connection:willSendRequest:redirectResponse:]):
ditto
(-[WebMainResourceClient connection:didReceiveResponse:]):
ditto
(-[WebMainResourceClient connection:didReceiveData:]):
ditto
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@4486 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index b1b4613..de84118 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,57 @@
+2003-06-05 John Sullivan <sullivan at apple.com>
+
+ - fixed 3266216 -- repro crash in
+ -[WebBaseResourceHandleDelegate connection:didReceiveData:]
+ in GIA Application
+
+ The problem was that an NSURLConnection delegate object (in this
+ case a WebMainResourceClient) was being dealloc'ed during one of
+ its connection delegate methods. To prevent this kind of problem,
+ I added [self retain]/[self release] guards around the meat of
+ all of the connection delegate methods in which arbitrary code
+ could be run. Another approach would be to do this retain/release
+ pair in NSURLConnection, but Darin deemed it wiser not to muck with
+ Foundation at this point for this issue.
+
+ Reviewed by Darin
+
+ * Plugins.subproj/WebNetscapePluginStream.m:
+ (-[WebNetscapePluginConnectionDelegate connection:didReceiveResponse:]):
+ guard with [self retain]/[self release]
+ (-[WebNetscapePluginConnectionDelegate connection:didReceiveData:]):
+ ditto
+ (-[WebNetscapePluginConnectionDelegate connection:didFailWithError:]):
+ ditto
+
+ * WebCoreSupport.subproj/WebSubresourceClient.m:
+ (-[WebSubresourceClient connection:didReceiveResponse:]):
+ ditto
+ (-[WebSubresourceClient connection:didReceiveData:]):
+ ditto
+
+ * WebView.subproj/WebBaseResourceHandleDelegate.m:
+ (-[WebBaseResourceHandleDelegate connection:willSendRequest:redirectResponse:]):
+ ditto
+ (-[WebBaseResourceHandleDelegate connection:didReceiveAuthenticationChallenge:]):
+ ditto
+ (-[WebBaseResourceHandleDelegate connection:didCancelAuthenticationChallenge:]):
+ ditto
+ (-[WebBaseResourceHandleDelegate connection:didReceiveResponse:]):
+ ditto
+ (-[WebBaseResourceHandleDelegate connection:didReceiveData:]):
+ ditto. Also, commented out two assertions that fire illegitimately in the steps in
+ this bug report.
+ (-[WebBaseResourceHandleDelegate connection:didFailWithError:]):
+ ditto
+
+ * WebView.subproj/WebMainResourceClient.m:
+ (-[WebMainResourceClient connection:willSendRequest:redirectResponse:]):
+ ditto
+ (-[WebMainResourceClient connection:didReceiveResponse:]):
+ ditto
+ (-[WebMainResourceClient connection:didReceiveData:]):
+ ditto
+
2003-06-04 Richard Williamson <rjw at apple.com>
Fixed 3277775. Send less notifications. Notifcations suck!
diff --git a/WebKit/Plugins.subproj/WebNetscapePluginStream.m b/WebKit/Plugins.subproj/WebNetscapePluginStream.m
index 3ea5cbd..148fdb8 100644
--- a/WebKit/Plugins.subproj/WebNetscapePluginStream.m
+++ b/WebKit/Plugins.subproj/WebNetscapePluginStream.m
@@ -94,18 +94,26 @@
- (void)connection:(NSURLConnection *)con didReceiveResponse:(NSURLResponse *)theResponse
{
+ // retain/release self in this delegate method since the additional processing can do
+ // anything including possibly releasing self; one example of this is 3266216
+ [self retain];
[stream setResponse:theResponse];
[super connection:con didReceiveResponse:theResponse];
+ [self release];
}
- (void)connection:(NSURLConnection *)con didReceiveData:(NSData *)data
{
+ // retain/release self in this delegate method since the additional processing can do
+ // anything including possibly releasing self; one example of this is 3266216
+ [self retain];
if ([stream transferMode] == NP_ASFILE || [stream transferMode] == NP_ASFILEONLY) {
[resourceData appendData:data];
}
[stream receivedData:data];
[super connection:con didReceiveData:data];
+ [self release];
}
- (void)connectionDidFinishLoading:(NSURLConnection *)con
@@ -117,9 +125,13 @@
- (void)connection:(NSURLConnection *)con didFailWithError:(NSError *)result
{
+ // retain/release self in this delegate method since the additional processing can do
+ // anything including possibly releasing self; one example of this is 3266216
+ [self retain];
[[view webView] _receivedError:result fromDataSource:[view dataSource]];
[stream receivedError:NPRES_NETWORK_ERR];
[super connection:con didFailWithError:result];
+ [self release];
}
- (void)cancel
diff --git a/WebKit/WebCoreSupport.subproj/WebSubresourceClient.m b/WebKit/WebCoreSupport.subproj/WebSubresourceClient.m
index 33f5269..e7f6ff7 100644
--- a/WebKit/WebCoreSupport.subproj/WebSubresourceClient.m
+++ b/WebKit/WebCoreSupport.subproj/WebSubresourceClient.m
@@ -97,14 +97,22 @@
- (void)connection:(NSURLConnection *)con didReceiveResponse:(NSURLResponse *)r
{
ASSERT(r);
+ // retain/release self in this delegate method since the additional processing can do
+ // anything including possibly releasing self; one example of this is 3266216
+ [self retain];
[loader receivedResponse:r];
[super connection:con didReceiveResponse:r];
+ [self release];
}
- (void)connection:(NSURLConnection *)con didReceiveData:(NSData *)data
{
+ // retain/release self in this delegate method since the additional processing can do
+ // anything including possibly releasing self; one example of this is 3266216
+ [self retain];
[loader addData:data];
[super connection:con didReceiveData:data];
+ [self release];
}
- (void)connectionDidFinishLoading:(NSURLConnection *)con
diff --git a/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m b/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m
index 33f5269..e7f6ff7 100644
--- a/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m
+++ b/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m
@@ -97,14 +97,22 @@
- (void)connection:(NSURLConnection *)con didReceiveResponse:(NSURLResponse *)r
{
ASSERT(r);
+ // retain/release self in this delegate method since the additional processing can do
+ // anything including possibly releasing self; one example of this is 3266216
+ [self retain];
[loader receivedResponse:r];
[super connection:con didReceiveResponse:r];
+ [self release];
}
- (void)connection:(NSURLConnection *)con didReceiveData:(NSData *)data
{
+ // retain/release self in this delegate method since the additional processing can do
+ // anything including possibly releasing self; one example of this is 3266216
+ [self retain];
[loader addData:data];
[super connection:con didReceiveData:data];
+ [self release];
}
- (void)connectionDidFinishLoading:(NSURLConnection *)con
diff --git a/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m b/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m
index d15504d..247cea3 100644
--- a/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m
+++ b/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m
@@ -179,6 +179,10 @@
NSURLRequest *clientRequest, *updatedRequest;
BOOL haveDataSchemeRequest = NO;
+ // retain/release self in this delegate method since the additional processing can do
+ // anything including possibly releasing self; one example of this is 3266216
+ [self retain];
+
[mutableRequest setHTTPUserAgent:[webView userAgentForURL:[newRequest URL]]];
newRequest = [mutableRequest autorelease];
@@ -223,7 +227,8 @@
else {
request = nil;
}
-
+
+ [self release];
return request;
}
@@ -235,6 +240,9 @@
ASSERT(!currentConnectionChallenge);
ASSERT(!currentWebChallenge);
+ // retain/release self in this delegate method since the additional processing can do
+ // anything including possibly releasing self; one example of this is 3266216
+ [self retain];
currentConnectionChallenge = [challenge retain];;
currentWebChallenge = [[NSURLAuthenticationChallenge alloc] initWithAuthenticationChallenge:challenge sender:self];
@@ -243,6 +251,7 @@
} else {
[[WebDefaultResourceLoadDelegate sharedResourceLoadDelegate] webView:webView resource:identifier didReceiveAuthenticationChallenge:currentWebChallenge fromDataSource:dataSource];
}
+ [self release];
}
-(void)connection:(NSURLConnection *)con didCancelAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
@@ -254,11 +263,15 @@
ASSERT(currentWebChallenge);
ASSERT(currentConnectionChallenge = challenge);
+ // retain/release self in this delegate method since the additional processing can do
+ // anything including possibly releasing self; one example of this is 3266216
+ [self retain];
if (implementations.delegateImplementsDidCancelAuthenticationChallenge) {
[resourceLoadDelegate webView:webView resource:identifier didCancelAuthenticationChallenge:currentWebChallenge fromDataSource:dataSource];
} else {
[[WebDefaultResourceLoadDelegate sharedResourceLoadDelegate] webView:webView resource:identifier didCancelAuthenticationChallenge:currentWebChallenge fromDataSource:dataSource];
}
+ [self release];
}
- (void)connection:(NSURLConnection *)con didReceiveResponse:(NSURLResponse *)r
@@ -266,6 +279,10 @@
ASSERT(con == connection);
ASSERT(!reachedTerminalState);
+ // retain/release self in this delegate method since the additional processing can do
+ // anything including possibly releasing self; one example of this is 3266216
+ [self retain];
+
// If the URL is one of our whacky applewebdata URLs that
// fake up a substitute URL to present to the delegate.
if([WebDataProtocol _webIsDataProtocolURL:[r URL]]) {
@@ -288,19 +305,27 @@
[resourceLoadDelegate webView:webView resource:identifier didReceiveResponse:r fromDataSource:dataSource];
else
[[WebDefaultResourceLoadDelegate sharedResourceLoadDelegate] webView:webView resource:identifier didReceiveResponse:r fromDataSource:dataSource];
+ [self release];
}
- (void)connection:(NSURLConnection *)con didReceiveData:(NSData *)data
{
- ASSERT(con == connection);
- ASSERT(!reachedTerminalState);
-
+ // The following assertions are not quite valid here, since a subclass
+ // might override didReceiveData: in a way that invalidates them. This
+ // happens with the steps listed in 3266216
+ // ASSERT(con == connection);
+ // ASSERT(!reachedTerminalState);
+
+ // retain/release self in this delegate method since the additional processing can do
+ // anything including possibly releasing self; one example of this is 3266216
+ [self retain];
[webView _incrementProgressForConnection:con data:data];
if (implementations.delegateImplementsDidReceiveContentLength)
[resourceLoadDelegate webView:webView resource:identifier didReceiveContentLength:[data length] fromDataSource:dataSource];
else
[[WebDefaultResourceLoadDelegate sharedResourceLoadDelegate] webView:webView resource:identifier didReceiveContentLength:[data length] fromDataSource:dataSource];
+ [self release];
}
- (void)connectionDidFinishLoading:(NSURLConnection *)con
@@ -329,11 +354,15 @@
ASSERT(con == connection);
ASSERT(!reachedTerminalState);
+ // retain/release self in this delegate method since the additional processing can do
+ // anything including possibly releasing self; one example of this is 3266216
+ [self retain];
[webView _completeProgressForConnection:con];
[[webView _resourceLoadDelegateForwarder] webView:webView resource:identifier didFailLoadingWithError:result fromDataSource:dataSource];
[self releaseResources];
+ [self release];
}
- (void)cancelWithError:(NSError *)error
diff --git a/WebKit/WebView.subproj/WebLoader.m b/WebKit/WebView.subproj/WebLoader.m
index d15504d..247cea3 100644
--- a/WebKit/WebView.subproj/WebLoader.m
+++ b/WebKit/WebView.subproj/WebLoader.m
@@ -179,6 +179,10 @@
NSURLRequest *clientRequest, *updatedRequest;
BOOL haveDataSchemeRequest = NO;
+ // retain/release self in this delegate method since the additional processing can do
+ // anything including possibly releasing self; one example of this is 3266216
+ [self retain];
+
[mutableRequest setHTTPUserAgent:[webView userAgentForURL:[newRequest URL]]];
newRequest = [mutableRequest autorelease];
@@ -223,7 +227,8 @@
else {
request = nil;
}
-
+
+ [self release];
return request;
}
@@ -235,6 +240,9 @@
ASSERT(!currentConnectionChallenge);
ASSERT(!currentWebChallenge);
+ // retain/release self in this delegate method since the additional processing can do
+ // anything including possibly releasing self; one example of this is 3266216
+ [self retain];
currentConnectionChallenge = [challenge retain];;
currentWebChallenge = [[NSURLAuthenticationChallenge alloc] initWithAuthenticationChallenge:challenge sender:self];
@@ -243,6 +251,7 @@
} else {
[[WebDefaultResourceLoadDelegate sharedResourceLoadDelegate] webView:webView resource:identifier didReceiveAuthenticationChallenge:currentWebChallenge fromDataSource:dataSource];
}
+ [self release];
}
-(void)connection:(NSURLConnection *)con didCancelAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
@@ -254,11 +263,15 @@
ASSERT(currentWebChallenge);
ASSERT(currentConnectionChallenge = challenge);
+ // retain/release self in this delegate method since the additional processing can do
+ // anything including possibly releasing self; one example of this is 3266216
+ [self retain];
if (implementations.delegateImplementsDidCancelAuthenticationChallenge) {
[resourceLoadDelegate webView:webView resource:identifier didCancelAuthenticationChallenge:currentWebChallenge fromDataSource:dataSource];
} else {
[[WebDefaultResourceLoadDelegate sharedResourceLoadDelegate] webView:webView resource:identifier didCancelAuthenticationChallenge:currentWebChallenge fromDataSource:dataSource];
}
+ [self release];
}
- (void)connection:(NSURLConnection *)con didReceiveResponse:(NSURLResponse *)r
@@ -266,6 +279,10 @@
ASSERT(con == connection);
ASSERT(!reachedTerminalState);
+ // retain/release self in this delegate method since the additional processing can do
+ // anything including possibly releasing self; one example of this is 3266216
+ [self retain];
+
// If the URL is one of our whacky applewebdata URLs that
// fake up a substitute URL to present to the delegate.
if([WebDataProtocol _webIsDataProtocolURL:[r URL]]) {
@@ -288,19 +305,27 @@
[resourceLoadDelegate webView:webView resource:identifier didReceiveResponse:r fromDataSource:dataSource];
else
[[WebDefaultResourceLoadDelegate sharedResourceLoadDelegate] webView:webView resource:identifier didReceiveResponse:r fromDataSource:dataSource];
+ [self release];
}
- (void)connection:(NSURLConnection *)con didReceiveData:(NSData *)data
{
- ASSERT(con == connection);
- ASSERT(!reachedTerminalState);
-
+ // The following assertions are not quite valid here, since a subclass
+ // might override didReceiveData: in a way that invalidates them. This
+ // happens with the steps listed in 3266216
+ // ASSERT(con == connection);
+ // ASSERT(!reachedTerminalState);
+
+ // retain/release self in this delegate method since the additional processing can do
+ // anything including possibly releasing self; one example of this is 3266216
+ [self retain];
[webView _incrementProgressForConnection:con data:data];
if (implementations.delegateImplementsDidReceiveContentLength)
[resourceLoadDelegate webView:webView resource:identifier didReceiveContentLength:[data length] fromDataSource:dataSource];
else
[[WebDefaultResourceLoadDelegate sharedResourceLoadDelegate] webView:webView resource:identifier didReceiveContentLength:[data length] fromDataSource:dataSource];
+ [self release];
}
- (void)connectionDidFinishLoading:(NSURLConnection *)con
@@ -329,11 +354,15 @@
ASSERT(con == connection);
ASSERT(!reachedTerminalState);
+ // retain/release self in this delegate method since the additional processing can do
+ // anything including possibly releasing self; one example of this is 3266216
+ [self retain];
[webView _completeProgressForConnection:con];
[[webView _resourceLoadDelegateForwarder] webView:webView resource:identifier didFailLoadingWithError:result fromDataSource:dataSource];
[self releaseResources];
+ [self release];
}
- (void)cancelWithError:(NSError *)error
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.m b/WebKit/WebView.subproj/WebMainResourceClient.m
index 95a9d9b..efc4371 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.m
+++ b/WebKit/WebView.subproj/WebMainResourceClient.m
@@ -110,6 +110,10 @@
// callbacks is meant to prevent.
ASSERT(newRequest != nil);
+ // retain/release self in this delegate method since the additional processing can do
+ // anything including possibly releasing self; one example of this is 3266216
+ [self retain];
+
NSURL *URL = [newRequest URL];
LOG(Redirect, "URL = %@", URL);
@@ -154,6 +158,7 @@
andCall:self
withSelector:@selector(continueAfterNavigationPolicy:formState:)];
+ [self release];
return newRequest;
}
@@ -238,10 +243,14 @@
LOG(Loading, "main content type: %@", [r MIMEType]);
+ // retain/release self in this delegate method since the additional processing can do
+ // anything including possibly releasing self; one example of this is 3266216
+ [self retain];
[dataSource _setResponse:r];
_contentLength = [r expectedContentLength];
[self checkContentPolicyForResponse:r];
+ [self release];
}
- (void)connection:(NSURLConnection *)con didReceiveData:(NSData *)data
@@ -254,6 +263,9 @@
LOG(Loading, "URL = %@, data = %p, length %d", [dataSource _URL], data, [data length]);
+ // retain/release self in this delegate method since the additional processing can do
+ // anything including possibly releasing self; one example of this is 3266216
+ [self retain];
[dataSource _receivedData:data];
[[dataSource _webView] _mainReceivedBytesSoFar:[[dataSource data] length]
fromDataSource:dataSource
@@ -263,6 +275,7 @@
_bytesReceived += [data length];
LOG(Loading, "%d of %d", _bytesReceived, _contentLength);
+ [self release];
}
- (void)connectionDidFinishLoading:(NSURLConnection *)con
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.m b/WebKit/WebView.subproj/WebMainResourceLoader.m
index 95a9d9b..efc4371 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.m
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.m
@@ -110,6 +110,10 @@
// callbacks is meant to prevent.
ASSERT(newRequest != nil);
+ // retain/release self in this delegate method since the additional processing can do
+ // anything including possibly releasing self; one example of this is 3266216
+ [self retain];
+
NSURL *URL = [newRequest URL];
LOG(Redirect, "URL = %@", URL);
@@ -154,6 +158,7 @@
andCall:self
withSelector:@selector(continueAfterNavigationPolicy:formState:)];
+ [self release];
return newRequest;
}
@@ -238,10 +243,14 @@
LOG(Loading, "main content type: %@", [r MIMEType]);
+ // retain/release self in this delegate method since the additional processing can do
+ // anything including possibly releasing self; one example of this is 3266216
+ [self retain];
[dataSource _setResponse:r];
_contentLength = [r expectedContentLength];
[self checkContentPolicyForResponse:r];
+ [self release];
}
- (void)connection:(NSURLConnection *)con didReceiveData:(NSData *)data
@@ -254,6 +263,9 @@
LOG(Loading, "URL = %@, data = %p, length %d", [dataSource _URL], data, [data length]);
+ // retain/release self in this delegate method since the additional processing can do
+ // anything including possibly releasing self; one example of this is 3266216
+ [self retain];
[dataSource _receivedData:data];
[[dataSource _webView] _mainReceivedBytesSoFar:[[dataSource data] length]
fromDataSource:dataSource
@@ -263,6 +275,7 @@
_bytesReceived += [data length];
LOG(Loading, "%d of %d", _bytesReceived, _contentLength);
+ [self release];
}
- (void)connectionDidFinishLoading:(NSURLConnection *)con
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list