<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
+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;
NSURL *originalURL;
NSMutableData *resourceData;
WebResource *resource;
+#ifndef NDEBUG
+ BOOL isInitializingConnection;
+#endif
}
- (BOOL)loadWithRequest:(NSURLRequest *)request;
}
}
+#ifndef NDEBUG
+ isInitializingConnection = YES;
+#endif
connection = [[NSURLConnection alloc] initWithRequest:r delegate:self];
+#ifndef NDEBUG
+ isInitializingConnection = NO;
+#endif
if (defersCallbacks) {
[connection setDefersCallbacks:YES];
}
- (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];
}
NSURL *originalURL;
NSMutableData *resourceData;
WebResource *resource;
+#ifndef NDEBUG
+ BOOL isInitializingConnection;
+#endif
}
- (BOOL)loadWithRequest:(NSURLRequest *)request;
}
}
+#ifndef NDEBUG
+ isInitializingConnection = YES;
+#endif
connection = [[NSURLConnection alloc] initWithRequest:r delegate:self];
+#ifndef NDEBUG
+ isInitializingConnection = NO;
+#endif
if (defersCallbacks) {
[connection setDefersCallbacks:YES];
}
- (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];
}