Changeset 163630 in webkit
- Timestamp:
- Feb 7, 2014 10:32:38 AM (10 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r163629 r163630 1 2014-02-07 Dan Bernstein <mitz@apple.com> 2 3 [Cocoa] WKRemoteObjectInterface doesn’t support aribtrary argument classes 4 https://bugs.webkit.org/show_bug.cgi?id=128368 5 6 Reviewed by Anders Carlsson. 7 8 * Shared/API/Cocoa/WKRemoteObjectInterface.h: Declared new methods. 9 * Shared/API/Cocoa/WKRemoteObjectInterface.mm: 10 (propertyListClasses): Removed NSNull, which is not really a property list class. 11 (classesForSelectorArgument): Added helper function. 12 (-[WKRemoteObjectInterface classesForSelector:argumentIndex:]): Added. 13 (-[WKRemoteObjectInterface setClasses:forSelector:argumentIndex:]): Added. 14 1 15 2014-02-07 Dan Bernstein <mitz@apple.com> 2 16 -
trunk/Source/WebKit2/Shared/API/Cocoa/WKRemoteObjectInterface.h
r159788 r163630 33 33 @interface WKRemoteObjectInterface : NSObject 34 34 35 + (instancetype)remoteObjectInterfaceWithProtocol:(Protocol *)protocol; 36 37 - (id)initWithProtocol:(Protocol *)protocol identifier:(NSString *)identifier; 38 35 39 @property (readonly) Protocol *protocol; 36 40 @property (readonly) NSString *identifier; 37 41 38 - (id)initWithProtocol:(Protocol *)protocol identifier:(NSString *)identifier; 39 40 + (instancetype)remoteObjectInterfaceWithProtocol:(Protocol *)protocol; 42 - (NSSet *)classesForSelector:(SEL)selector argumentIndex:(NSUInteger)argumentIndex; 43 - (void)setClasses:(NSSet *)classes forSelector:(SEL)selector argumentIndex:(NSUInteger)argumentIndex; 41 44 42 45 @end -
trunk/Source/WebKit2/Shared/API/Cocoa/WKRemoteObjectInterface.mm
r163470 r163630 56 56 { 57 57 // FIXME: Add more property list classes if needed. 58 static NSSet *propertyListClasses = [[NSSet alloc] initWithObjects:[NSArray class], [NSDictionary class], [NSNu ll class], [NSNumber class], [NSString class], nil];58 static NSSet *propertyListClasses = [[NSSet alloc] initWithObjects:[NSArray class], [NSDictionary class], [NSNumber class], [NSString class], nil]; 59 59 60 60 return propertyListClasses; … … 142 142 } 143 143 144 static RetainPtr<NSSet>& classesForSelectorArgument(WKRemoteObjectInterface *interface, SEL selector, NSUInteger argumentIndex) 145 { 146 auto it = interface->_allowedArgumentClasses.find(selector); 147 if (it == interface->_allowedArgumentClasses.end()) 148 [NSException raise:NSInvalidArgumentException format:@"Interface does not contain selector \"%s\"", sel_getName(selector)]; 149 150 if (argumentIndex >= it->value.size()) 151 [NSException raise:NSInvalidArgumentException format:@"Argument index %ld is out of range for selector \"%s\"", (unsigned long)argumentIndex, sel_getName(selector)]; 152 153 return it->value[argumentIndex]; 154 } 155 156 - (NSSet *)classesForSelector:(SEL)selector argumentIndex:(NSUInteger)argumentIndex 157 { 158 return [[classesForSelectorArgument(self, selector, argumentIndex).get() retain] autorelease]; 159 } 160 161 - (void)setClasses:(NSSet *)classes forSelector:(SEL)selector argumentIndex:(NSUInteger)argumentIndex 162 { 163 classesForSelectorArgument(self, selector, argumentIndex) = adoptNS([classes copy]); 164 } 165 144 166 static const char* methodArgumentTypeEncodingForSelector(Protocol *protocol, SEL selector) 145 167 {
Note: See TracChangeset
for help on using the changeset viewer.