- fixed <rdar://problem/
4023337> Safari stops loading any page (-[NSCFDictionary setObject:forKey:]:
attempt to insert nil key)
It is very likely that the exception being hit is caused by the same problem as WebFoundation
bug
4018486. This change makes the code robust against this kind of problem regardless.
* WebView.subproj/WebBaseResourceHandleDelegate.m:
(-[WebBaseResourceHandleDelegate saveResource]):
Don't call addSubresource if newly-created resource is nil (but do assert on debug builds).
Also assert that originalURL and MIMEType are not nil.
* WebView.subproj/WebDataSource.m:
(-[WebDataSource addSubresource:]):
Don't add nil subresource to dictionary, but do assert on debug builds.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@8755
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2005-03-02 John Sullivan <sullivan@apple.com>
+
+ Reviewed by Adele.
+
+ - fixed <rdar://problem/4023337> Safari stops loading any page (-[NSCFDictionary setObject:forKey:]:
+ attempt to insert nil key)
+
+ It is very likely that the exception being hit is caused by the same problem as WebFoundation
+ bug 4018486. This change makes the code robust against this kind of problem regardless.
+
+ * WebView.subproj/WebBaseResourceHandleDelegate.m:
+ (-[WebBaseResourceHandleDelegate saveResource]):
+ Don't call addSubresource if newly-created resource is nil (but do assert on debug builds).
+ Also assert that originalURL and MIMEType are not nil.
+
+ * WebView.subproj/WebDataSource.m:
+ (-[WebDataSource addSubresource:]):
+ Don't add nil subresource to dictionary, but do assert on debug builds.
+
=== Safari-401 ===
2005-03-01 John Sullivan <sullivan@apple.com>
NSData *data = [self resourceData];
if ([data length] > 0) {
// Don't have WebResource copy the data since the data is a NSMutableData that we know won't get modified.
+ ASSERT(originalURL);
+ ASSERT([response MIMEType]);
WebResource *newResource = [[WebResource alloc] _initWithData:data
URL:originalURL
MIMEType:[response MIMEType]
textEncodingName:[response textEncodingName]
frameName:nil
copyData:NO];
- [dataSource addSubresource:newResource];
- [newResource release];
+ if (newResource != nil) {
+ [dataSource addSubresource:newResource];
+ [newResource release];
+ } else {
+ ASSERT_NOT_REACHED();
+ }
}
}
}
- (void)addSubresource:(WebResource *)subresource
{
- [_private->subresources setObject:subresource forKey:[[subresource URL] _web_originalDataAsString]];
+ if (subresource) {
+ [_private->subresources setObject:subresource forKey:[[subresource URL] _web_originalDataAsString]];
+ } else {
+ ASSERT_NOT_REACHED();
+ }
}
@end
NSData *data = [self resourceData];
if ([data length] > 0) {
// Don't have WebResource copy the data since the data is a NSMutableData that we know won't get modified.
+ ASSERT(originalURL);
+ ASSERT([response MIMEType]);
WebResource *newResource = [[WebResource alloc] _initWithData:data
URL:originalURL
MIMEType:[response MIMEType]
textEncodingName:[response textEncodingName]
frameName:nil
copyData:NO];
- [dataSource addSubresource:newResource];
- [newResource release];
+ if (newResource != nil) {
+ [dataSource addSubresource:newResource];
+ [newResource release];
+ } else {
+ ASSERT_NOT_REACHED();
+ }
}
}
}