Title: [158610] trunk/Source/WebKit2
- Revision
- 158610
- Author
- [email protected]
- Date
- 2013-11-04 16:09:03 -0800 (Mon, 04 Nov 2013)
Log Message
WKRemoteObjectEncoder should escape keys
https://bugs.webkit.org/show_bug.cgi?id=123761
Reviewed by Tim Horton.
Keys that start with $ will be reserved for use by the coder, so prepend an extra
$ to keys that already start with $ to avoid clashes.
* Shared/API/Cocoa/WKRemoteObjectCoder.mm:
(escapeKey):
(-[WKRemoteObjectEncoder encodeBytes:length:forKey:]):
(-[WKRemoteObjectEncoder _encodeObjectForKey:usingBlock:]):
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (158609 => 158610)
--- trunk/Source/WebKit2/ChangeLog 2013-11-05 00:05:51 UTC (rev 158609)
+++ trunk/Source/WebKit2/ChangeLog 2013-11-05 00:09:03 UTC (rev 158610)
@@ -1,3 +1,18 @@
+2013-11-04 Anders Carlsson <[email protected]>
+
+ WKRemoteObjectEncoder should escape keys
+ https://bugs.webkit.org/show_bug.cgi?id=123761
+
+ Reviewed by Tim Horton.
+
+ Keys that start with $ will be reserved for use by the coder, so prepend an extra
+ $ to keys that already start with $ to avoid clashes.
+
+ * Shared/API/Cocoa/WKRemoteObjectCoder.mm:
+ (escapeKey):
+ (-[WKRemoteObjectEncoder encodeBytes:length:forKey:]):
+ (-[WKRemoteObjectEncoder _encodeObjectForKey:usingBlock:]):
+
2013-11-04 Benjamin Poulain <[email protected]>
[WK2] Update WebGeolocationManager to support multiple WebContent processes
Modified: trunk/Source/WebKit2/Shared/API/Cocoa/WKRemoteObjectCoder.mm (158609 => 158610)
--- trunk/Source/WebKit2/Shared/API/Cocoa/WKRemoteObjectCoder.mm 2013-11-05 00:05:51 UTC (rev 158609)
+++ trunk/Source/WebKit2/Shared/API/Cocoa/WKRemoteObjectCoder.mm 2013-11-05 00:09:03 UTC (rev 158610)
@@ -91,6 +91,14 @@
}];
}
+static NSString *escapeKey(NSString *key)
+{
+ if (key.length && [key characterAtIndex:0] == '$')
+ return [@"$" stringByAppendingString:key];
+
+ return key;
+}
+
- (void)_encodeInvocation:(NSInvocation *)invocation forKey:(NSString *)key
{
[self _encodeObjectForKey:key usingBlock:^{
@@ -150,7 +158,7 @@
- (void)encodeBytes:(const uint8_t *)bytes length:(NSUInteger)length forKey:(NSString *)key
{
- _currentDictionary->set(key, WebData::create(bytes, length));
+ _currentDictionary->set(escapeKey(key), WebData::create(bytes, length));
}
- (RefPtr<MutableDictionary>)_encodedObjectUsingBlock:(void (^)())block
@@ -165,7 +173,7 @@
- (void)_encodeObjectForKey:(NSString *)key usingBlock:(void (^)())block
{
- _currentDictionary->set(key, [self _encodedObjectUsingBlock:block]);
+ _currentDictionary->set(escapeKey(key), [self _encodedObjectUsingBlock:block]);
}
@end
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes