Changeset 158895 in webkit
- Timestamp:
- Nov 7, 2013 6:47:20 PM (11 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r158892 r158895 1 2013-11-07 Anders Carlsson <andersca@apple.com> 2 3 Encode and decode NSURLResponse objects using NSCoder 4 https://bugs.webkit.org/show_bug.cgi?id=124028 5 6 Reviewed by Andreas Kling. 7 8 * Shared/mac/WebCoreArgumentCodersMac.mm: 9 (CoreIPC::::encodePlatformData): 10 (CoreIPC::::decodePlatformData): 11 1 12 2013-11-07 Anders Carlsson <andersca@apple.com> 2 13 -
trunk/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm
r157842 r158895 28 28 29 29 #import "ArgumentCodersCF.h" 30 #import "DataReference.h" 30 31 #import "PlatformCertificateInfo.h" 31 32 #import "WebKitSystemInterface.h" … … 106 107 return; 107 108 109 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 110 RetainPtr<NSMutableData> data = adoptNS([[NSMutableData alloc] init]); 111 RetainPtr<NSKeyedArchiver> archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]); 112 113 [archiver setRequiresSecureCoding:YES]; 114 [archiver.get() encodeObject:resourceResponse.nsURLResponse() forKey:@"response"]; 115 [archiver finishEncoding]; 116 117 encoder << CoreIPC::DataReference(static_cast<const uint8_t*>([data bytes]), [data length]); 118 #else 108 119 RetainPtr<CFDictionaryRef> dictionary = adoptCF(WKNSURLResponseCreateSerializableRepresentation(resourceResponse.nsURLResponse(), CoreIPC::tokenNullTypeRef())); 109 120 CoreIPC::encode(encoder, dictionary.get()); 121 #endif 110 122 } 111 123 … … 121 133 } 122 134 135 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 136 CoreIPC::DataReference dataReference; 137 if (!decoder.decode(dataReference)) 138 return false; 139 140 RetainPtr<NSData> data = adoptNS([[NSData alloc] initWithBytesNoCopy:const_cast<uint8_t*>(dataReference.data()) length:dataReference.size() freeWhenDone:NO]); 141 RetainPtr<NSKeyedUnarchiver> unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:data.get()]); 142 143 [unarchiver setRequiresSecureCoding:YES]; 144 NSURLResponse *nsURLResponse = [unarchiver.get() decodeObjectOfClass:[NSURLResponse class] forKey:@"response"]; 145 #else 123 146 RetainPtr<CFDictionaryRef> dictionary; 124 147 if (!CoreIPC::decode(decoder, dictionary)) 125 148 return false; 126 149 127 NSURLResponse* nsURLResponse = WKNSURLResponseFromSerializableRepresentation(dictionary.get(), CoreIPC::tokenNullTypeRef()); 150 NSURLResponse *nsURLResponse = WKNSURLResponseFromSerializableRepresentation(dictionary.get(), CoreIPC::tokenNullTypeRef()); 151 #endif 152 128 153 if (!nsURLResponse) 129 154 return false;
Note: See TracChangeset
for help on using the changeset viewer.