Changeset 158806 in webkit


Ignore:
Timestamp:
Nov 6, 2013 5:20:14 PM (10 years ago)
Author:
andersca@apple.com
Message:

Implement enough functionality so that NSURLRequest objects can be decoded
https://bugs.webkit.org/show_bug.cgi?id=123942

Reviewed by Andreas Kling.

  • Shared/API/Cocoa/WKRemoteObjectCoder.mm:

(-[WKRemoteObjectEncoder requiresSecureCoding]):
Add new method. Return YES.

(-[WKRemoteObjectDecoder decodeValueOfObjCType:at:]):
Add new method. This currently only handles 'i', but we'll add more variants as needed.

(-[WKRemoteObjectDecoder decodeBoolForKey:]):
Get a WebBoolean from the dictionary and return its value.

Location:
trunk/Source/WebKit2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r158805 r158806  
     12013-11-06  Anders Carlsson  <andersca@apple.com>
     2
     3        Implement enough functionality so that NSURLRequest objects can be decoded
     4        https://bugs.webkit.org/show_bug.cgi?id=123942
     5
     6        Reviewed by Andreas Kling.
     7
     8        * Shared/API/Cocoa/WKRemoteObjectCoder.mm:
     9        (-[WKRemoteObjectEncoder requiresSecureCoding]):
     10        Add new method. Return YES.
     11
     12        (-[WKRemoteObjectDecoder decodeValueOfObjCType:at:]):
     13        Add new method. This currently only handles 'i', but we'll add more variants as needed.
     14
     15        (-[WKRemoteObjectDecoder decodeBoolForKey:]):
     16        Get a WebBoolean from the dictionary and return its value.
     17
    1182013-11-06  Anders Carlsson  <andersca@apple.com>
    219
  • trunk/Source/WebKit2/Shared/API/Cocoa/WKRemoteObjectCoder.mm

    r158805 r158806  
    256256}
    257257
     258- (BOOL)requiresSecureCoding
     259{
     260    return YES;
     261}
     262
    258263@end
    259264
     
    283288
    284289    return self;
     290}
     291
     292- (void)decodeValueOfObjCType:(const char *)type at:(void *)data
     293{
     294    switch (*type) {
     295    // int
     296    case 'i':
     297        *static_cast<int*>(data) = [decodeObjectFromObjectStream(self, [NSSet setWithObject:[NSNumber class]]) intValue];
     298        break;
     299
     300    default:
     301        [NSException raise:NSInvalidUnarchiveOperationException format:@"Unsupported type '%s'", type];
     302    }
    285303}
    286304
     
    462480}
    463481
     482- (BOOL)decodeBoolForKey:(NSString *)key
     483{
     484    const WebBoolean* value = _currentDictionary->get<WebBoolean>(escapeKey(key));
     485    if (!value)
     486        return false;
     487    return value->value();
     488}
     489
    464490- (int64_t)decodeInt64ForKey:(NSString *)key
    465491{
Note: See TracChangeset for help on using the changeset viewer.