Title: [158806] trunk/Source/WebKit2
Revision
158806
Author
[email protected]
Date
2013-11-06 17:20:14 -0800 (Wed, 06 Nov 2013)

Log 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.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (158805 => 158806)


--- trunk/Source/WebKit2/ChangeLog	2013-11-07 01:12:29 UTC (rev 158805)
+++ trunk/Source/WebKit2/ChangeLog	2013-11-07 01:20:14 UTC (rev 158806)
@@ -1,5 +1,22 @@
 2013-11-06  Anders Carlsson  <[email protected]>
 
+        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.
+
+2013-11-06  Anders Carlsson  <[email protected]>
+
         Encoded object stream should be sequential
         https://bugs.webkit.org/show_bug.cgi?id=123939
 

Modified: trunk/Source/WebKit2/Shared/API/Cocoa/WKRemoteObjectCoder.mm (158805 => 158806)


--- trunk/Source/WebKit2/Shared/API/Cocoa/WKRemoteObjectCoder.mm	2013-11-07 01:12:29 UTC (rev 158805)
+++ trunk/Source/WebKit2/Shared/API/Cocoa/WKRemoteObjectCoder.mm	2013-11-07 01:20:14 UTC (rev 158806)
@@ -255,6 +255,11 @@
     _currentDictionary->set(escapeKey(key), WebDouble::create(value));
 }
 
+- (BOOL)requiresSecureCoding
+{
+    return YES;
+}
+
 @end
 
 @implementation WKRemoteObjectDecoder {
@@ -284,6 +289,19 @@
     return self;
 }
 
+- (void)decodeValueOfObjCType:(const char *)type at:(void *)data
+{
+    switch (*type) {
+    // int
+    case 'i':
+        *static_cast<int*>(data) = [decodeObjectFromObjectStream(self, [NSSet setWithObject:[NSNumber class]]) intValue];
+        break;
+
+    default:
+        [NSException raise:NSInvalidUnarchiveOperationException format:@"Unsupported type '%s'", type];
+    }
+}
+
 - (BOOL)allowsKeyedCoding
 {
     return YES;
@@ -461,6 +479,14 @@
     return decodeObject(decoder);
 }
 
+- (BOOL)decodeBoolForKey:(NSString *)key
+{
+    const WebBoolean* value = _currentDictionary->get<WebBoolean>(escapeKey(key));
+    if (!value)
+        return false;
+    return value->value();
+}
+
 - (int64_t)decodeInt64ForKey:(NSString *)key
 {
     const WebUInt64* value = _currentDictionary->get<WebUInt64>(escapeKey(key));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to