Title: [158797] trunk/Source/WebKit2
Revision
158797
Author
[email protected]
Date
2013-11-06 15:04:39 -0800 (Wed, 06 Nov 2013)

Log Message

Move allowed classes handling to decodeObject
https://bugs.webkit.org/show_bug.cgi?id=123930

Reviewed by Andreas Kling.

* Shared/API/Cocoa/WKRemoteObjectCoder.mm:
(decodeObjectFromObjectStream):
Pass allowed classes through to decodeObject.

(decodeObject):
Update to take an NSSet of allowed classes. If the set is nil, use the current set.

(-[WKRemoteObjectDecoder decodeObjectOfClasses:forKey:]):
Pass classes to decodeObject.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (158796 => 158797)


--- trunk/Source/WebKit2/ChangeLog	2013-11-06 22:44:23 UTC (rev 158796)
+++ trunk/Source/WebKit2/ChangeLog	2013-11-06 23:04:39 UTC (rev 158797)
@@ -1,3 +1,20 @@
+2013-11-06  Anders Carlsson  <[email protected]>
+
+        Move allowed classes handling to decodeObject
+        https://bugs.webkit.org/show_bug.cgi?id=123930
+
+        Reviewed by Andreas Kling.
+
+        * Shared/API/Cocoa/WKRemoteObjectCoder.mm:
+        (decodeObjectFromObjectStream):
+        Pass allowed classes through to decodeObject.
+
+        (decodeObject):
+        Update to take an NSSet of allowed classes. If the set is nil, use the current set.
+
+        (-[WKRemoteObjectDecoder decodeObjectOfClasses:forKey:]):
+        Pass classes to decodeObject.
+
 2013-11-06  Sergio Correia  <[email protected]>
 
         Fix EFL build after r158753

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


--- trunk/Source/WebKit2/Shared/API/Cocoa/WKRemoteObjectCoder.mm	2013-11-06 22:44:23 UTC (rev 158796)
+++ trunk/Source/WebKit2/Shared/API/Cocoa/WKRemoteObjectCoder.mm	2013-11-06 23:04:39 UTC (rev 158797)
@@ -294,7 +294,7 @@
     return [self decodeObjectOfClasses:nil forKey:key];
 }
 
-static id decodeObject(WKRemoteObjectDecoder *decoder, const ImmutableDictionary*);
+static id decodeObject(WKRemoteObjectDecoder *, const ImmutableDictionary*, NSSet *allowedClasses);
 
 static id decodeObjectFromObjectStream(WKRemoteObjectDecoder *decoder, NSSet *allowedClasses)
 {
@@ -304,11 +304,9 @@
     if (decoder->_objectStreamPosition == decoder->_objectStream->size())
         return nil;
 
-    TemporaryChange<NSSet *> allowedClassesChange(decoder->_allowedClasses, allowedClasses);
-
     const ImmutableDictionary* dictionary = decoder->_objectStream->at<ImmutableDictionary>(decoder->_objectStreamPosition++);
 
-    return decodeObject(decoder, dictionary);
+    return decodeObject(decoder, dictionary, allowedClasses);
 }
 
 static void checkIfClassIsAllowed(WKRemoteObjectDecoder *decoder, Class objectClass)
@@ -443,13 +441,18 @@
     return [result.leakRef() autorelease];
 }
 
-static id decodeObject(WKRemoteObjectDecoder *decoder, const ImmutableDictionary* dictionary)
+static id decodeObject(WKRemoteObjectDecoder *decoder, const ImmutableDictionary* dictionary, NSSet *allowedClasses)
 {
     if (!dictionary)
         return nil;
 
     TemporaryChange<const ImmutableDictionary*> dictionaryChange(decoder->_currentDictionary, dictionary);
 
+    // If no allowed classes were listed, just use the currently allowed classes.
+    if (!allowedClasses)
+        return decodeObject(decoder);
+
+    TemporaryChange<NSSet *> allowedClassesChange(decoder->_allowedClasses, allowedClasses);
     return decodeObject(decoder);
 }
 
@@ -486,9 +489,7 @@
 
 - (id)decodeObjectOfClasses:(NSSet *)classes forKey:(NSString *)key
 {
-    TemporaryChange<NSSet *> allowedClassesChange(_allowedClasses, classes);
-
-    return decodeObject(self, _currentDictionary->get<ImmutableDictionary>(escapeKey(key)));
+    return decodeObject(self, _currentDictionary->get<ImmutableDictionary>(escapeKey(key)), classes);
 }
 
 - (NSSet *)allowedClasses
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to