Reviewed by Harrison.
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Feb 2005 23:50:51 +0000 (23:50 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Feb 2005 23:50:51 +0000 (23:50 +0000)
        - fixed <rdar://problem/4002084> Setting ResourceLoadDelegate to nil can cause a crash

        * WebView.subproj/WebView.m: (-[WebView _cacheResourceLoadDelegateImplementations]):
        Set booleans to either YES or NO, rather than setting them only in the YES case.

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

WebKit/ChangeLog
WebKit/WebView.subproj/WebView.m

index fd78b64f175041f6e218bfb50ba4f3f6e9803d42..88523498a549f6c3140f719c75ef2c4cd8abccde 100644 (file)
@@ -1,3 +1,12 @@
+2005-02-10  Darin Adler  <darin@apple.com>
+
+        Reviewed by Harrison.
+
+        - fixed <rdar://problem/4002084> Setting ResourceLoadDelegate to nil can cause a crash
+
+        * WebView.subproj/WebView.m: (-[WebView _cacheResourceLoadDelegateImplementations]):
+        Set booleans to either YES or NO, rather than setting them only in the YES case.
+
 2005-02-10  Darin Adler  <darin@apple.com>
 
         Reviewed by Harrison.
index 7c0997b50875a8ae39c24b5d7801adef47bfcf31..f1273cdce5f75c887b5a6e6550f07ce0aacdca5e 100644 (file)
@@ -757,22 +757,16 @@ static bool debugWidget = false;
 
 - (void)_cacheResourceLoadDelegateImplementations
 {
-    if ([[self resourceLoadDelegate] respondsToSelector:@selector(webView:resource:didCancelAuthenticationChallenge:fromDataSource:)])
-        _private->resourceLoadDelegateImplementations.delegateImplementsDidCancelAuthenticationChallenge = YES;
-
-    if ([[self resourceLoadDelegate] respondsToSelector:@selector(webView:resource:didReceiveAuthenticationChallenge:fromDataSource:)])
-        _private->resourceLoadDelegateImplementations.delegateImplementsDidReceiveAuthenticationChallenge = YES;
-
-    if ([[self resourceLoadDelegate] respondsToSelector:@selector(webView:resource:didFinishLoadingFromDataSource:)])
-        _private->resourceLoadDelegateImplementations.delegateImplementsDidFinishLoadingFromDataSource = YES;
-    if ([[self resourceLoadDelegate] respondsToSelector:@selector(webView:resource:didReceiveContentLength:fromDataSource:)])
-        _private->resourceLoadDelegateImplementations.delegateImplementsDidReceiveContentLength = YES;
-    if ([[self resourceLoadDelegate] respondsToSelector:@selector(webView:resource:didReceiveResponse:fromDataSource:)])
-        _private->resourceLoadDelegateImplementations.delegateImplementsDidReceiveResponse = YES;
-    if ([[self resourceLoadDelegate] respondsToSelector:@selector(webView:resource:willSendRequest:redirectResponse:fromDataSource:)])
-        _private->resourceLoadDelegateImplementations.delegateImplementsWillSendRequest = YES;
-    if ([[self resourceLoadDelegate] respondsToSelector: @selector(webView:identifierForInitialRequest:fromDataSource:)])
-        _private->resourceLoadDelegateImplementations.delegateImplementsIdentifierForRequest = YES;
+    WebResourceDelegateImplementationCache *cache = &_private->resourceLoadDelegateImplementations;
+    id delegate = [self resourceLoadDelegate];
+
+    cache->delegateImplementsDidCancelAuthenticationChallenge = [delegate respondsToSelector:@selector(webView:resource:didCancelAuthenticationChallenge:fromDataSource:)];
+    cache->delegateImplementsDidReceiveAuthenticationChallenge = [delegate respondsToSelector:@selector(webView:resource:didReceiveAuthenticationChallenge:fromDataSource:)];
+    cache->delegateImplementsDidFinishLoadingFromDataSource = [delegate respondsToSelector:@selector(webView:resource:didFinishLoadingFromDataSource:)];
+    cache->delegateImplementsDidReceiveContentLength = [delegate respondsToSelector:@selector(webView:resource:didReceiveContentLength:fromDataSource:)];
+    cache->delegateImplementsDidReceiveResponse = [delegate respondsToSelector:@selector(webView:resource:didReceiveResponse:fromDataSource:)];
+    cache->delegateImplementsWillSendRequest = [delegate respondsToSelector:@selector(webView:resource:willSendRequest:redirectResponse:fromDataSource:)];
+    cache->delegateImplementsIdentifierForRequest = [delegate respondsToSelector:@selector(webView:identifierForInitialRequest:fromDataSource:)];
 }
 
 - (WebResourceDelegateImplementationCache)_resourceLoadDelegateImplementations