[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
darin
darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:58:33 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit fe7bfc7b0f1347029c777d8e81400b6ffb3d6865
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sat Nov 9 23:45:08 2002 +0000
- fixed 3095156 -- reproducible leak of WebDataSource due to bad URL in stylesheet
* WebCoreSupport.subproj/WebSubresourceClient.m:
(+[WebSubresourceClient startLoadingResource:withURL:referrer:forDataSource:]):
Check for errors by looking at the return value from loadWithRequest: rather than
making a separate call to canInitWithRequest.
* WebView.subproj/WebBaseResourceHandleDelegate.h: Add boolean success/failure result
loadWithRequest:.
* WebView.subproj/WebBaseResourceHandleDelegate.m:
(-[WebBaseResourceHandleDelegate loadWithRequest:]): Return NO if we fail to make a handle.
* WebView.subproj/WebDataSourcePrivate.m: (-[WebDataSource _startLoading]):
Check result of loadWithRequest: and complain if it's NO.
* WebView.subproj/WebMainResourceClient.m: Tweak whitespace.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2615 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index bd13d99..88fdef3 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,22 @@
+2002-11-09 Darin Adler <darin at apple.com>
+
+ - fixed 3095156 -- reproducible leak of WebDataSource due to bad URL in stylesheet
+
+ * WebCoreSupport.subproj/WebSubresourceClient.m:
+ (+[WebSubresourceClient startLoadingResource:withURL:referrer:forDataSource:]):
+ Check for errors by looking at the return value from loadWithRequest: rather than
+ making a separate call to canInitWithRequest.
+
+ * WebView.subproj/WebBaseResourceHandleDelegate.h: Add boolean success/failure result
+ loadWithRequest:.
+ * WebView.subproj/WebBaseResourceHandleDelegate.m:
+ (-[WebBaseResourceHandleDelegate loadWithRequest:]): Return NO if we fail to make a handle.
+
+ * WebView.subproj/WebDataSourcePrivate.m: (-[WebDataSource _startLoading]):
+ Check result of loadWithRequest: and complain if it's NO.
+
+ * WebView.subproj/WebMainResourceClient.m: Tweak whitespace.
+
2002-11-09 Chris Blumenberg <cblu at apple.com>
Fixed: 2991610 - Alexander should support services, including Speech
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index bd13d99..88fdef3 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,22 @@
+2002-11-09 Darin Adler <darin at apple.com>
+
+ - fixed 3095156 -- reproducible leak of WebDataSource due to bad URL in stylesheet
+
+ * WebCoreSupport.subproj/WebSubresourceClient.m:
+ (+[WebSubresourceClient startLoadingResource:withURL:referrer:forDataSource:]):
+ Check for errors by looking at the return value from loadWithRequest: rather than
+ making a separate call to canInitWithRequest.
+
+ * WebView.subproj/WebBaseResourceHandleDelegate.h: Add boolean success/failure result
+ loadWithRequest:.
+ * WebView.subproj/WebBaseResourceHandleDelegate.m:
+ (-[WebBaseResourceHandleDelegate loadWithRequest:]): Return NO if we fail to make a handle.
+
+ * WebView.subproj/WebDataSourcePrivate.m: (-[WebDataSource _startLoading]):
+ Check result of loadWithRequest: and complain if it's NO.
+
+ * WebView.subproj/WebMainResourceClient.m: Tweak whitespace.
+
2002-11-09 Chris Blumenberg <cblu at apple.com>
Fixed: 2991610 - Alexander should support services, including Speech
diff --git a/WebKit/WebCoreSupport.subproj/WebSubresourceClient.m b/WebKit/WebCoreSupport.subproj/WebSubresourceClient.m
index 233724f..fdbd185 100644
--- a/WebKit/WebCoreSupport.subproj/WebSubresourceClient.m
+++ b/WebKit/WebCoreSupport.subproj/WebSubresourceClient.m
@@ -13,7 +13,7 @@
#import <WebFoundation/WebAssertions.h>
#import <WebFoundation/WebError.h>
-#import <WebFoundation/WebResourceHandle.h>
+#import <WebFoundation/WebResourceHandleDelegate.h>
#import <WebFoundation/WebResourceRequest.h>
#import <WebFoundation/WebHTTPResourceRequest.h>
#import <WebFoundation/WebResourceResponse.h>
@@ -42,7 +42,10 @@
+ (WebSubresourceClient *)startLoadingResource:(id <WebCoreResourceLoader>)rLoader
withURL:(NSURL *)URL referrer:(NSString *)referrer forDataSource:(WebDataSource *)source
{
- WebSubresourceClient *client = [[self alloc] initWithLoader:rLoader dataSource:source];
+ WebSubresourceClient *client = [[[self alloc] initWithLoader:rLoader dataSource:source] autorelease];
+
+ [source _addSubresourceClient:client];
+
WebResourceRequest *newRequest = [[WebResourceRequest alloc] initWithURL:URL];
[newRequest setRequestCachePolicy:[[source request] requestCachePolicy]];
[newRequest setResponseCachePolicy:[[source request] responseCachePolicy]];
@@ -50,8 +53,12 @@
[newRequest setCookiePolicyBaseURL:[[[[source controller] mainFrame] dataSource] URL]];
[newRequest setUserAgent:[[source controller] userAgentForURL:URL]];
- if (![WebResourceHandle canInitWithRequest:newRequest]) {
- [newRequest release];
+ BOOL succeeded = [client loadWithRequest:newRequest];
+ [newRequest release];
+
+ if (!succeeded) {
+ [source _removeSubresourceClient:client];
+
[rLoader reportError];
WebError *badURLError = [[WebError alloc] initWithErrorCode:WebErrorCodeBadURLError
@@ -59,14 +66,10 @@
failingURL:[URL absoluteString]];
[[source controller] _receivedError:badURLError fromDataSource:source];
[badURLError release];
- return nil;
+ client = nil;
}
- [source _addSubresourceClient:client];
- [client loadWithRequest:newRequest];
- [newRequest release];
-
- return [client autorelease];
+ return client;
}
- (void)receivedError:(WebError *)error
diff --git a/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m b/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m
index 233724f..fdbd185 100644
--- a/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m
+++ b/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m
@@ -13,7 +13,7 @@
#import <WebFoundation/WebAssertions.h>
#import <WebFoundation/WebError.h>
-#import <WebFoundation/WebResourceHandle.h>
+#import <WebFoundation/WebResourceHandleDelegate.h>
#import <WebFoundation/WebResourceRequest.h>
#import <WebFoundation/WebHTTPResourceRequest.h>
#import <WebFoundation/WebResourceResponse.h>
@@ -42,7 +42,10 @@
+ (WebSubresourceClient *)startLoadingResource:(id <WebCoreResourceLoader>)rLoader
withURL:(NSURL *)URL referrer:(NSString *)referrer forDataSource:(WebDataSource *)source
{
- WebSubresourceClient *client = [[self alloc] initWithLoader:rLoader dataSource:source];
+ WebSubresourceClient *client = [[[self alloc] initWithLoader:rLoader dataSource:source] autorelease];
+
+ [source _addSubresourceClient:client];
+
WebResourceRequest *newRequest = [[WebResourceRequest alloc] initWithURL:URL];
[newRequest setRequestCachePolicy:[[source request] requestCachePolicy]];
[newRequest setResponseCachePolicy:[[source request] responseCachePolicy]];
@@ -50,8 +53,12 @@
[newRequest setCookiePolicyBaseURL:[[[[source controller] mainFrame] dataSource] URL]];
[newRequest setUserAgent:[[source controller] userAgentForURL:URL]];
- if (![WebResourceHandle canInitWithRequest:newRequest]) {
- [newRequest release];
+ BOOL succeeded = [client loadWithRequest:newRequest];
+ [newRequest release];
+
+ if (!succeeded) {
+ [source _removeSubresourceClient:client];
+
[rLoader reportError];
WebError *badURLError = [[WebError alloc] initWithErrorCode:WebErrorCodeBadURLError
@@ -59,14 +66,10 @@
failingURL:[URL absoluteString]];
[[source controller] _receivedError:badURLError fromDataSource:source];
[badURLError release];
- return nil;
+ client = nil;
}
- [source _addSubresourceClient:client];
- [client loadWithRequest:newRequest];
- [newRequest release];
-
- return [client autorelease];
+ return client;
}
- (void)receivedError:(WebError *)error
diff --git a/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.h b/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.h
index 4197660..c4a5bf8 100644
--- a/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.h
+++ b/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.h
@@ -31,7 +31,7 @@
BOOL defersCallbacks;
}
-- (void)loadWithRequest:(WebResourceRequest *)request;
+- (BOOL)loadWithRequest:(WebResourceRequest *)request;
- (void)setDataSource:(WebDataSource *)d;
- (WebDataSource *)dataSource;
diff --git a/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m b/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m
index 565ec29..a14ef22 100644
--- a/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m
+++ b/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m
@@ -58,15 +58,19 @@
[super dealloc];
}
-- (void)loadWithRequest:(WebResourceRequest *)r
+- (BOOL)loadWithRequest:(WebResourceRequest *)r
{
ASSERT(handle == nil);
handle = [[WebResourceHandle alloc] initWithRequest:r];
+ if (!handle) {
+ return NO;
+ }
if (defersCallbacks) {
[handle _setDefersCallbacks:YES];
}
[handle loadWithDelegate:self];
+ return YES;
}
- (void)setDefersCallbacks:(BOOL)defers
@@ -75,22 +79,17 @@
[handle _setDefersCallbacks:defers];
}
-- (void)setDataSource: (WebDataSource *)d
+- (void)setDataSource:(WebDataSource *)d
{
- if (d != dataSource){
- [dataSource release];
- dataSource = [d retain];
- }
+ [d retain];
+ [dataSource release];
+ dataSource = d;
- if (resourceLoadDelegate != [[dataSource controller] resourceLoadDelegate]){
- [resourceLoadDelegate release];
- resourceLoadDelegate = [[[dataSource controller] resourceLoadDelegate] retain];
- }
+ [resourceLoadDelegate release];
+ resourceLoadDelegate = [[[dataSource controller] resourceLoadDelegate] retain];
- if (downloadDelegate != [[dataSource controller] downloadDelegate]){
- [downloadDelegate release];
- downloadDelegate = [[[dataSource controller] downloadDelegate] retain];
- }
+ [downloadDelegate release];
+ downloadDelegate = [[[dataSource controller] downloadDelegate] retain];
}
- (WebDataSource *)dataSource
@@ -108,7 +107,7 @@
return downloadDelegate;
}
-- (void)setIsDownload: (BOOL)f
+- (void)setIsDownload:(BOOL)f
{
isDownload = f;
}
@@ -159,9 +158,9 @@
response = r;
if (isDownload)
- [downloadDelegate resource:identifier didReceiveResponse:r fromDataSource: dataSource];
+ [downloadDelegate resource:identifier didReceiveResponse:r fromDataSource:dataSource];
else
- [resourceLoadDelegate resource:identifier didReceiveResponse:r fromDataSource: dataSource];
+ [resourceLoadDelegate resource:identifier didReceiveResponse:r fromDataSource:dataSource];
}
- (void)handle:(WebResourceHandle *)h didReceiveData:(NSData *)data
@@ -170,9 +169,9 @@
ASSERT(!reachedTerminalState);
if ([self isDownload])
- [downloadDelegate resource: identifier didReceiveContentLength: [data length] fromDataSource: dataSource];
+ [downloadDelegate resource:identifier didReceiveContentLength:[data length] fromDataSource:dataSource];
else
- [resourceLoadDelegate resource: identifier didReceiveContentLength: [data length] fromDataSource: dataSource];
+ [resourceLoadDelegate resource:identifier didReceiveContentLength:[data length] fromDataSource:dataSource];
}
- (void)handleDidFinishLoading:(WebResourceHandle *)h
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.m b/WebKit/WebView.subproj/WebDataSourcePrivate.m
index 192580e..c490eb3 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.m
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.m
@@ -154,15 +154,20 @@
[[_private->controller locationChangeDelegate] locationChangeStartedForDataSource:self];
if (!_private->mainClient) {
- _private->mainClient = [[WebMainResourceClient alloc] initWithDataSource:self];
-
if ([self webFrame] == [[self controller] mainFrame]) {
[_private->request setCookiePolicyBaseURL:[self URL]];
} else {
[_private->request setCookiePolicyBaseURL:[[[_private->controller mainFrame] dataSource] URL]];
}
- [_private->mainClient loadWithRequest:_private->request];
+ _private->mainClient = [[WebMainResourceClient alloc] initWithDataSource:self];
+ if (![_private->mainClient loadWithRequest:_private->request]) {
+ ERROR("could not create WebResourceHandle for URL %@ -- should be caught by policy handler level",
+ [_private->request URL]);
+ [_private->mainClient release];
+ _private->mainClient = nil;
+ [self _updateLoading];
+ }
}
}
diff --git a/WebKit/WebView.subproj/WebLoader.h b/WebKit/WebView.subproj/WebLoader.h
index 4197660..c4a5bf8 100644
--- a/WebKit/WebView.subproj/WebLoader.h
+++ b/WebKit/WebView.subproj/WebLoader.h
@@ -31,7 +31,7 @@
BOOL defersCallbacks;
}
-- (void)loadWithRequest:(WebResourceRequest *)request;
+- (BOOL)loadWithRequest:(WebResourceRequest *)request;
- (void)setDataSource:(WebDataSource *)d;
- (WebDataSource *)dataSource;
diff --git a/WebKit/WebView.subproj/WebLoader.m b/WebKit/WebView.subproj/WebLoader.m
index 565ec29..a14ef22 100644
--- a/WebKit/WebView.subproj/WebLoader.m
+++ b/WebKit/WebView.subproj/WebLoader.m
@@ -58,15 +58,19 @@
[super dealloc];
}
-- (void)loadWithRequest:(WebResourceRequest *)r
+- (BOOL)loadWithRequest:(WebResourceRequest *)r
{
ASSERT(handle == nil);
handle = [[WebResourceHandle alloc] initWithRequest:r];
+ if (!handle) {
+ return NO;
+ }
if (defersCallbacks) {
[handle _setDefersCallbacks:YES];
}
[handle loadWithDelegate:self];
+ return YES;
}
- (void)setDefersCallbacks:(BOOL)defers
@@ -75,22 +79,17 @@
[handle _setDefersCallbacks:defers];
}
-- (void)setDataSource: (WebDataSource *)d
+- (void)setDataSource:(WebDataSource *)d
{
- if (d != dataSource){
- [dataSource release];
- dataSource = [d retain];
- }
+ [d retain];
+ [dataSource release];
+ dataSource = d;
- if (resourceLoadDelegate != [[dataSource controller] resourceLoadDelegate]){
- [resourceLoadDelegate release];
- resourceLoadDelegate = [[[dataSource controller] resourceLoadDelegate] retain];
- }
+ [resourceLoadDelegate release];
+ resourceLoadDelegate = [[[dataSource controller] resourceLoadDelegate] retain];
- if (downloadDelegate != [[dataSource controller] downloadDelegate]){
- [downloadDelegate release];
- downloadDelegate = [[[dataSource controller] downloadDelegate] retain];
- }
+ [downloadDelegate release];
+ downloadDelegate = [[[dataSource controller] downloadDelegate] retain];
}
- (WebDataSource *)dataSource
@@ -108,7 +107,7 @@
return downloadDelegate;
}
-- (void)setIsDownload: (BOOL)f
+- (void)setIsDownload:(BOOL)f
{
isDownload = f;
}
@@ -159,9 +158,9 @@
response = r;
if (isDownload)
- [downloadDelegate resource:identifier didReceiveResponse:r fromDataSource: dataSource];
+ [downloadDelegate resource:identifier didReceiveResponse:r fromDataSource:dataSource];
else
- [resourceLoadDelegate resource:identifier didReceiveResponse:r fromDataSource: dataSource];
+ [resourceLoadDelegate resource:identifier didReceiveResponse:r fromDataSource:dataSource];
}
- (void)handle:(WebResourceHandle *)h didReceiveData:(NSData *)data
@@ -170,9 +169,9 @@
ASSERT(!reachedTerminalState);
if ([self isDownload])
- [downloadDelegate resource: identifier didReceiveContentLength: [data length] fromDataSource: dataSource];
+ [downloadDelegate resource:identifier didReceiveContentLength:[data length] fromDataSource:dataSource];
else
- [resourceLoadDelegate resource: identifier didReceiveContentLength: [data length] fromDataSource: dataSource];
+ [resourceLoadDelegate resource:identifier didReceiveContentLength:[data length] fromDataSource:dataSource];
}
- (void)handleDidFinishLoading:(WebResourceHandle *)h
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.m b/WebKit/WebView.subproj/WebMainResourceClient.m
index 98b750e..32557f0 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.m
+++ b/WebKit/WebView.subproj/WebMainResourceClient.m
@@ -29,7 +29,7 @@
#import <WebKit/WebStandardPanelsPrivate.h>
#import <WebKit/WebView.h>
-// FIXME: This is quite similar to WebSubresourceClient; they should share code.
+// FIXME: More that is in common with WebSubresourceClient should move up into WebBaseResourceHandleDelegate.
@implementation WebMainResourceClient
@@ -39,7 +39,7 @@
if (self) {
resourceData = [[NSMutableData alloc] init];
- [self setDataSource: ds];
+ [self setDataSource:ds];
}
return self;
@@ -168,7 +168,7 @@
}
break;
- case WebContentPolicyIgnore:
+ case WebContentPolicyIgnore:
{
[self cancel];
[[dataSource webFrame] _setProvisionalDataSource:nil];
@@ -245,7 +245,7 @@
complete:YES];
}
- [super handleDidFinishLoading: h];
+ [super handleDidFinishLoading:h];
[self release];
}
@@ -265,7 +265,7 @@
downloadHandler = nil;
}
- [super handle: h didFailLoadingWithError: result];
+ [super handle:h didFailLoadingWithError:result];
[self release];
}
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.m b/WebKit/WebView.subproj/WebMainResourceLoader.m
index 98b750e..32557f0 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.m
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.m
@@ -29,7 +29,7 @@
#import <WebKit/WebStandardPanelsPrivate.h>
#import <WebKit/WebView.h>
-// FIXME: This is quite similar to WebSubresourceClient; they should share code.
+// FIXME: More that is in common with WebSubresourceClient should move up into WebBaseResourceHandleDelegate.
@implementation WebMainResourceClient
@@ -39,7 +39,7 @@
if (self) {
resourceData = [[NSMutableData alloc] init];
- [self setDataSource: ds];
+ [self setDataSource:ds];
}
return self;
@@ -168,7 +168,7 @@
}
break;
- case WebContentPolicyIgnore:
+ case WebContentPolicyIgnore:
{
[self cancel];
[[dataSource webFrame] _setProvisionalDataSource:nil];
@@ -245,7 +245,7 @@
complete:YES];
}
- [super handleDidFinishLoading: h];
+ [super handleDidFinishLoading:h];
[self release];
}
@@ -265,7 +265,7 @@
downloadHandler = nil;
}
- [super handle: h didFailLoadingWithError: result];
+ [super handle:h didFailLoadingWithError:result];
[self release];
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list