WebKit:
authorcblu <cblu@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Sep 2004 21:25:44 +0000 (21:25 +0000)
committercblu <cblu@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Sep 2004 21:25:44 +0000 (21:25 +0000)
Fixed:
<rdar://problem/3667301> Frequent crashes in Mail when viewing HTML messages (CFURLGetByteRangeForComponent)
<rdar://problem/3810354> WebResourceLoadDelegate can't refuse requests by returning nil; code asserts/crashes instead

        Reviewed by rjw.

        * WebCoreSupport.subproj/WebSubresourceClient.m:
        (+[WebSubresourceClient startLoadingResource:withRequest:customHeaders:referrer:forDataSource:]): removed broken code that handled loadWithRequest returning NO
        * WebView.subproj/WebBaseResourceHandleDelegate.m:
        (-[WebBaseResourceHandleDelegate loadWithRequest:]): if nil is returned from the client for willSendRequest, report the cancelled error and return

WebBrowser:

        Reviewed by rjw.

        * LoadProgressMonitor.m:
        (-[LoadProgressMonitor webView:resource:willSendRequest:redirectResponse:fromDataSource:]): updated to use "new" API, this wasn't being called!

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@7635 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/ChangeLog
WebKit/WebCoreSupport.subproj/WebSubresourceClient.m
WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m
WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m
WebKit/WebView.subproj/WebLoader.m

index 588ef45290d135e59bb843e4ef14161b52676f75..4e128d5729d91327b961d5ab02e39bd621b32590 100644 (file)
@@ -1,3 +1,16 @@
+2004-09-22  Chris Blumenberg  <cblu@apple.com>
+
+       Fixed:
+       <rdar://problem/3667301> Frequent crashes in Mail when viewing HTML messages (CFURLGetByteRangeForComponent)
+       <rdar://problem/3810354> WebResourceLoadDelegate can't refuse requests by returning nil; code asserts/crashes instead
+
+        Reviewed by rjw.
+
+        * WebCoreSupport.subproj/WebSubresourceClient.m:
+        (+[WebSubresourceClient startLoadingResource:withRequest:customHeaders:referrer:forDataSource:]): removed broken code that handled loadWithRequest returning NO
+        * WebView.subproj/WebBaseResourceHandleDelegate.m:
+        (-[WebBaseResourceHandleDelegate loadWithRequest:]): if nil is returned from the client for willSendRequest, report the cancelled error and return
+
 2004-09-22  Ken Kocienda  <kocienda@apple.com>
 
         Reviewed by Darin
index 467c2a374bb9a5a13990c3d0e57f5dde8579dd74..e0de2b93f920a776d88bf0852039e224afbbe0aa 100644 (file)
     WebView *_webView = [source _webView];
     [newRequest setMainDocumentURL:[[[[_webView mainFrame] dataSource] request] URL]];
     [newRequest setHTTPUserAgent:[_webView userAgentForURL:[newRequest URL]]];
-    
-    BOOL succeeded = [client loadWithRequest:newRequest];
-        
-    if (!succeeded) {
-        [source _removeSubresourceClient:client];
-
-        [rLoader reportError];
-
-        NSError *badURLError = [[NSError alloc] _webKitErrorWithDomain:NSURLErrorDomain 
-                                                                  code:NSURLErrorBadURL
-                                                                   URL:[newRequest URL]];
-        [_webView _receivedError:badURLError fromDataSource:source];
-        [badURLError release];
+            
+    if (![client loadWithRequest:newRequest]) {
         client = nil;
     }
     
     NSURL *oldURL = [request URL];
     NSURLRequest *clientRequest = [super willSendRequest:newRequest redirectResponse:redirectResponse];
     
-    if (![oldURL isEqual:[clientRequest URL]]) {
+    if (clientRequest != nil && ![oldURL isEqual:[clientRequest URL]]) {
        [loader redirectedToURL:[clientRequest URL]];
     }
 
index 467c2a374bb9a5a13990c3d0e57f5dde8579dd74..e0de2b93f920a776d88bf0852039e224afbbe0aa 100644 (file)
     WebView *_webView = [source _webView];
     [newRequest setMainDocumentURL:[[[[_webView mainFrame] dataSource] request] URL]];
     [newRequest setHTTPUserAgent:[_webView userAgentForURL:[newRequest URL]]];
-    
-    BOOL succeeded = [client loadWithRequest:newRequest];
-        
-    if (!succeeded) {
-        [source _removeSubresourceClient:client];
-
-        [rLoader reportError];
-
-        NSError *badURLError = [[NSError alloc] _webKitErrorWithDomain:NSURLErrorDomain 
-                                                                  code:NSURLErrorBadURL
-                                                                   URL:[newRequest URL]];
-        [_webView _receivedError:badURLError fromDataSource:source];
-        [badURLError release];
+            
+    if (![client loadWithRequest:newRequest]) {
         client = nil;
     }
     
     NSURL *oldURL = [request URL];
     NSURLRequest *clientRequest = [super willSendRequest:newRequest redirectResponse:redirectResponse];
     
-    if (![oldURL isEqual:[clientRequest URL]]) {
+    if (clientRequest != nil && ![oldURL isEqual:[clientRequest URL]]) {
        [loader redirectedToURL:[clientRequest URL]];
     }
 
index 3e166fa41bc5d3fe07bd47735a8b55b4eac5ef30..4b9c9045470642fafa39636b9946abada5db99b4 100644 (file)
     deliveredResource = NO;
     waitingToDeliverResource = NO;
 
-    r = [self connection:connection willSendRequest:r redirectResponse:nil];
+    NSURLRequest *clientRequest = [self willSendRequest:r redirectResponse:nil];
+    if (clientRequest == nil) {
+        NSError *badURLError = [NSError _webKitErrorWithDomain:NSURLErrorDomain 
+                                                          code:NSURLErrorCancelled
+                                                           URL:[r URL]];
+        [self didFailWithError:badURLError];
+        return NO;
+    }
+    r = clientRequest;
     
     if ([[r URL] isEqual:originalURL] && [self _canUseResourceForRequest:r]) {
         resource = [dataSource subresourceForURL:originalURL];
index 3e166fa41bc5d3fe07bd47735a8b55b4eac5ef30..4b9c9045470642fafa39636b9946abada5db99b4 100644 (file)
     deliveredResource = NO;
     waitingToDeliverResource = NO;
 
-    r = [self connection:connection willSendRequest:r redirectResponse:nil];
+    NSURLRequest *clientRequest = [self willSendRequest:r redirectResponse:nil];
+    if (clientRequest == nil) {
+        NSError *badURLError = [NSError _webKitErrorWithDomain:NSURLErrorDomain 
+                                                          code:NSURLErrorCancelled
+                                                           URL:[r URL]];
+        [self didFailWithError:badURLError];
+        return NO;
+    }
+    r = clientRequest;
     
     if ([[r URL] isEqual:originalURL] && [self _canUseResourceForRequest:r]) {
         resource = [dataSource subresourceForURL:originalURL];