Turned assertion into error message to prevent crash when encountering this bug:
authorcblu <cblu@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 9 May 2005 20:31:04 +0000 (20:31 +0000)
committercblu <cblu@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 9 May 2005 20:31:04 +0000 (20:31 +0000)
<rdar://problem/4067625> connection:willCacheResponse: is called inside of [NSURLConnection initWithRequest:delegate:]

        * WebView.subproj/WebBaseResourceHandleDelegate.h:
        * WebView.subproj/WebBaseResourceHandleDelegate.m:
        (-[WebBaseResourceHandleDelegate loadWithRequest:]): set flag to track when we're initializing the connection
        (-[WebBaseResourceHandleDelegate connection:willCacheResponse:]): log error

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

WebKit/ChangeLog
WebKit/WebView.subproj/WebBaseResourceHandleDelegate.h
WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m
WebKit/WebView.subproj/WebLoader.h
WebKit/WebView.subproj/WebLoader.m

index 18552d83b59c003588fd364cb6fca7c0ef02ceca..3c7eb315ae4981fc704f08b3a21ef8901385761f 100644 (file)
@@ -1,3 +1,13 @@
+2005-05-09  Chris Blumenberg  <cblu@apple.com>
+
+       Turned assertion into error message to prevent crash when encountering this bug:
+       <rdar://problem/4067625> connection:willCacheResponse: is called inside of [NSURLConnection initWithRequest:delegate:]
+       
+        * WebView.subproj/WebBaseResourceHandleDelegate.h:
+        * WebView.subproj/WebBaseResourceHandleDelegate.m:
+        (-[WebBaseResourceHandleDelegate loadWithRequest:]): set flag to track when we're initializing the connection
+        (-[WebBaseResourceHandleDelegate connection:willCacheResponse:]): log error
+
 2005-05-09  Darin Adler  <darin@apple.com>
 
         * Makefile.am: Don't set up PBXIntermediatesDirectory explicitly;
index 6460124ef19f53a469e54964adf5656969bb2f0e..729293eb0e6df45d2f8fb258307a246ad4566468 100644 (file)
@@ -41,6 +41,9 @@
     NSURL *originalURL;
     NSMutableData *resourceData;
     WebResource *resource;
+#ifndef NDEBUG
+    BOOL isInitializingConnection;
+#endif
 }
 
 - (BOOL)loadWithRequest:(NSURLRequest *)request;
index 950ee5c652aca9c8fe2a6925c9671a2d6d1f5383..e20e3866f14993c94bb546e9e662a3e5f4a77d16 100644 (file)
@@ -238,7 +238,13 @@ static BOOL NSURLConnectionSupportsBufferedData;
         }
     }
     
+#ifndef NDEBUG
+    isInitializingConnection = YES;
+#endif
     connection = [[NSURLConnection alloc] initWithRequest:r delegate:self];
+#ifndef NDEBUG
+    isInitializingConnection = NO;
+#endif
     if (defersCallbacks) {
         [connection setDefersCallbacks:YES];
     }
@@ -615,7 +621,11 @@ static BOOL NSURLConnectionSupportsBufferedData;
 
 - (NSCachedURLResponse *)connection:(NSURLConnection *)con willCacheResponse:(NSCachedURLResponse *)cachedResponse
 {
-    ASSERT_WITH_MESSAGE(con == connection, "parameter con (%@) is not equal to instance variable connection (%@)", con, connection);
+#ifndef NDEBUG
+    if (connection == nil && isInitializingConnection) {
+        ERROR("connection:willCacheResponse: was called inside of [NSURLConnection initWithRequest:delegate:] (40676250)");
+    }
+#endif
     return [self willCacheResponse:cachedResponse];
 }
 
index 6460124ef19f53a469e54964adf5656969bb2f0e..729293eb0e6df45d2f8fb258307a246ad4566468 100644 (file)
@@ -41,6 +41,9 @@
     NSURL *originalURL;
     NSMutableData *resourceData;
     WebResource *resource;
+#ifndef NDEBUG
+    BOOL isInitializingConnection;
+#endif
 }
 
 - (BOOL)loadWithRequest:(NSURLRequest *)request;
index 950ee5c652aca9c8fe2a6925c9671a2d6d1f5383..e20e3866f14993c94bb546e9e662a3e5f4a77d16 100644 (file)
@@ -238,7 +238,13 @@ static BOOL NSURLConnectionSupportsBufferedData;
         }
     }
     
+#ifndef NDEBUG
+    isInitializingConnection = YES;
+#endif
     connection = [[NSURLConnection alloc] initWithRequest:r delegate:self];
+#ifndef NDEBUG
+    isInitializingConnection = NO;
+#endif
     if (defersCallbacks) {
         [connection setDefersCallbacks:YES];
     }
@@ -615,7 +621,11 @@ static BOOL NSURLConnectionSupportsBufferedData;
 
 - (NSCachedURLResponse *)connection:(NSURLConnection *)con willCacheResponse:(NSCachedURLResponse *)cachedResponse
 {
-    ASSERT_WITH_MESSAGE(con == connection, "parameter con (%@) is not equal to instance variable connection (%@)", con, connection);
+#ifndef NDEBUG
+    if (connection == nil && isInitializingConnection) {
+        ERROR("connection:willCacheResponse: was called inside of [NSURLConnection initWithRequest:delegate:] (40676250)");
+    }
+#endif
     return [self willCacheResponse:cachedResponse];
 }