Title: [159887] trunk/Source/WebKit2
- Revision
- 159887
- Author
- [email protected]
- Date
- 2013-11-30 10:49:53 -0800 (Sat, 30 Nov 2013)
Log Message
<rdar://problem/15560240> ResourceError encoding drops NSURL-valued keys in the NSError’s userInfo, including NSErrorFailingURLKey
https://bugs.webkit.org/show_bug.cgi?id=125016
Reviewed by Anders “happy name day” Carlsson.
* Shared/mac/WebCoreArgumentCodersMac.mm:
(CoreIPC::::encodePlatformData): Encode all string- and URL-valued keys as a dictionary.
(CoreIPC::::decodePlatformData): Decode user info as a dictionary.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (159886 => 159887)
--- trunk/Source/WebKit2/ChangeLog 2013-11-30 17:23:32 UTC (rev 159886)
+++ trunk/Source/WebKit2/ChangeLog 2013-11-30 18:49:53 UTC (rev 159887)
@@ -1,3 +1,14 @@
+2013-11-30 Dan Bernstein <[email protected]>
+
+ <rdar://problem/15560240> ResourceError encoding drops NSURL-valued keys in the NSError’s userInfo, including NSErrorFailingURLKey
+ https://bugs.webkit.org/show_bug.cgi?id=125016
+
+ Reviewed by Anders “happy name day” Carlsson.
+
+ * Shared/mac/WebCoreArgumentCodersMac.mm:
+ (CoreIPC::::encodePlatformData): Encode all string- and URL-valued keys as a dictionary.
+ (CoreIPC::::decodePlatformData): Decode user info as a dictionary.
+
2013-11-29 Zan Dobersek <[email protected]>
Unreviewed build fix for EFL and GTK WK2 builds.
Modified: trunk/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm (159886 => 159887)
--- trunk/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm 2013-11-30 17:23:32 UTC (rev 159886)
+++ trunk/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm 2013-11-30 18:49:53 UTC (rev 159887)
@@ -155,19 +155,17 @@
int64_t code = [nsError code];
encoder << code;
- HashMap<String, String> stringUserInfoMap;
+ NSDictionary *userInfo = [nsError userInfo];
- NSDictionary* userInfo = [nsError userInfo];
- for (NSString *key in userInfo) {
- id value = [userInfo objectForKey:key];
- if (![value isKindOfClass:[NSString class]])
- continue;
+ RetainPtr<CFMutableDictionaryRef> filteredUserInfo = adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, userInfo.count, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
- stringUserInfoMap.set(key, (NSString *)value);
- continue;
- }
- encoder << stringUserInfoMap;
+ [userInfo enumerateKeysAndObjectsUsingBlock:^(id key, id value, BOOL*) {
+ if ([value isKindOfClass:[NSString class]] || [value isKindOfClass:[NSURL class]])
+ CFDictionarySetValue(filteredUserInfo.get(), key, value);
+ }];
+ CoreIPC::encode(encoder, filteredUserInfo.get());
+
id peerCertificateChain = [userInfo objectForKey:@"NSErrorPeerCertificateChainKey"];
ASSERT(!peerCertificateChain || [peerCertificateChain isKindOfClass:[NSArray class]]);
encoder << CertificateInfo((CFArrayRef)peerCertificateChain);
@@ -192,30 +190,21 @@
if (!decoder.decode(code))
return false;
- HashMap<String, String> stringUserInfoMap;
- if (!decoder.decode(stringUserInfoMap))
+ RetainPtr<CFDictionaryRef> userInfo;
+ if (!CoreIPC::decode(decoder, userInfo))
return false;
CertificateInfo certificate;
if (!decoder.decode(certificate))
return false;
- NSUInteger userInfoSize = stringUserInfoMap.size();
- if (certificate.certificateChain())
- userInfoSize++;
+ if (certificate.certificateChain()) {
+ userInfo = adoptCF(CFDictionaryCreateMutableCopy(kCFAllocatorDefault, CFDictionaryGetCount(userInfo.get()) + 1, userInfo.get()));
+ CFDictionarySetValue((CFMutableDictionaryRef)userInfo.get(), CFSTR("NSErrorPeerCertificateChainKey"), (CFArrayRef)certificate.certificateChain());
+ }
- NSMutableDictionary* userInfo = [NSMutableDictionary dictionaryWithCapacity:userInfoSize];
-
- HashMap<String, String>::const_iterator it = stringUserInfoMap.begin();
- HashMap<String, String>::const_iterator end = stringUserInfoMap.end();
- for (; it != end; ++it)
- [userInfo setObject:nsString(it->value) forKey:nsString(it->key)];
+ RetainPtr<NSError> nsError = adoptNS([[NSError alloc] initWithDomain:nsString(domain) code:code userInfo:(NSDictionary *)userInfo.get()]);
- if (certificate.certificateChain())
- [userInfo setObject:(NSArray *)certificate.certificateChain() forKey:@"NSErrorPeerCertificateChainKey"];
-
- RetainPtr<NSError> nsError = adoptNS([[NSError alloc] initWithDomain:nsString(domain) code:code userInfo:userInfo]);
-
resourceError = ResourceError(nsError.get());
return true;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes