Changeset 184026 in webkit
- Timestamp:
- May 8, 2015 4:13:36 PM (9 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r184024 r184026 1 2015-05-08 Dan Bernstein <mitz@apple.com> 2 3 <rdar://problem/20757196> NSInternalInconsistencyException raised in -[NSString encodeWithCoder:] beneath createEncodedObject when using WKRemoteObjectEncoder for Safari AutoFill 4 https://bugs.webkit.org/show_bug.cgi?id=144818 5 6 Reviewed by Anders Carlsson. 7 8 Allow NSString instances that contain unpaired surrogates to be encoded by 9 WKRemoteObjectCoder by encoding them directly rather than using 10 -[NSString encodeWithCoder:]. 11 12 * Shared/API/Cocoa/WKRemoteObjectCoder.mm: 13 (encodeString): Added. Sets an API::String as the object to encode. 14 (encodeObject): Changed to use encodeString for NSString instances. 15 (decodeString): Added. Gets an API::String from the dictionary and returns it as an 16 NSString. 17 (decodeObject): Changed to use decodeString for NSString instances. 18 1 19 2015-05-08 Timothy Horton <timothy_horton@apple.com> 2 20 -
trunk/Source/WebKit2/Shared/API/Cocoa/WKRemoteObjectCoder.mm
r183412 r184026 42 42 static const char* const classNameKey = "$class"; 43 43 static const char* const objectStreamKey = "$objectStream"; 44 static const char* const stringKey = "$string"; 44 45 45 46 static NSString * const selectorKey = @"selector"; … … 212 213 } 213 214 } 215 } 216 217 static void encodeString(WKRemoteObjectEncoder *encoder, NSString *string) 218 { 219 encoder->_currentDictionary->set(stringKey, API::String::create(string)); 214 220 } 215 221 … … 236 242 } 237 243 244 if ([object isKindOfClass:[NSString class]]) { 245 encodeString(encoder, object); 246 return; 247 } 248 238 249 [object encodeWithCoder:encoder]; 239 250 } … … 547 558 } 548 559 560 static NSString *decodeString(WKRemoteObjectDecoder *decoder) 561 { 562 API::String* string = decoder->_currentDictionary->get<API::String>(stringKey); 563 if (!string) 564 [NSException raise:NSInvalidUnarchiveOperationException format:@"String missing"]; 565 566 return string->string(); 567 } 568 549 569 static id decodeObject(WKRemoteObjectDecoder *decoder) 550 570 { … … 563 583 if (objectClass == [NSInvocation class]) 564 584 return decodeInvocation(decoder); 585 586 if (objectClass == [NSString class]) 587 return decodeString(decoder); 565 588 566 589 id result = [objectClass allocWithZone:decoder.zone];
Note: See TracChangeset
for help on using the changeset viewer.