Title: [235346] trunk
Revision
235346
Author
[email protected]
Date
2018-08-26 19:45:52 -0700 (Sun, 26 Aug 2018)

Log Message

Using _WKRemoteObjectInterface with a protocol that inherits from a non-NSObject protocol crashes
https://bugs.webkit.org/show_bug.cgi?id=188958

Patch by Sam Weinig <[email protected]> on 2018-08-26
Reviewed by Anders Carlsson.

Source/WebKit:

* Shared/API/Cocoa/_WKRemoteObjectInterface.mm:
(initializeMethods):
Fix infinite recursion by using the passed in protocol rather
than always using the one from the initial interface.

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/RemoteObjectRegistry.h:
Update test protocol to have inheritance.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (235345 => 235346)


--- trunk/Source/WebKit/ChangeLog	2018-08-27 02:44:15 UTC (rev 235345)
+++ trunk/Source/WebKit/ChangeLog	2018-08-27 02:45:52 UTC (rev 235346)
@@ -1,3 +1,15 @@
+2018-08-26  Sam Weinig  <[email protected]>
+
+        Using _WKRemoteObjectInterface with a protocol that inherits from a non-NSObject protocol crashes
+        https://bugs.webkit.org/show_bug.cgi?id=188958
+
+        Reviewed by Anders Carlsson.
+
+        * Shared/API/Cocoa/_WKRemoteObjectInterface.mm:
+        (initializeMethods):
+        Fix infinite recursion by using the passed in protocol rather
+        than always using the one from the initial interface. 
+
 2018-08-26  Wenson Hsieh  <[email protected]>
 
         [Attachment Support] Dropping and pasting images should insert inline image elements with _WKAttachments

Modified: trunk/Source/WebKit/Shared/API/Cocoa/_WKRemoteObjectInterface.mm (235345 => 235346)


--- trunk/Source/WebKit/Shared/API/Cocoa/_WKRemoteObjectInterface.mm	2018-08-27 02:44:15 UTC (rev 235345)
+++ trunk/Source/WebKit/Shared/API/Cocoa/_WKRemoteObjectInterface.mm	2018-08-27 02:45:52 UTC (rev 235346)
@@ -162,7 +162,7 @@
 static void initializeMethods(_WKRemoteObjectInterface *interface, Protocol *protocol)
 {
     unsigned conformingProtocolCount;
-    auto conformingProtocols = protocol_copyProtocolList(interface->_protocol, &conformingProtocolCount);
+    auto conformingProtocols = protocol_copyProtocolList(protocol, &conformingProtocolCount);
 
     for (unsigned i = 0; i < conformingProtocolCount; ++i) {
         auto conformingProtocol = conformingProtocols[i];

Modified: trunk/Tools/ChangeLog (235345 => 235346)


--- trunk/Tools/ChangeLog	2018-08-27 02:44:15 UTC (rev 235345)
+++ trunk/Tools/ChangeLog	2018-08-27 02:45:52 UTC (rev 235346)
@@ -1,3 +1,13 @@
+2018-08-26  Sam Weinig  <[email protected]>
+
+        Using _WKRemoteObjectInterface with a protocol that inherits from a non-NSObject protocol crashes
+        https://bugs.webkit.org/show_bug.cgi?id=188958
+
+        Reviewed by Anders Carlsson.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/RemoteObjectRegistry.h:
+        Update test protocol to have inheritance.
+
 2018-08-26  Wenson Hsieh  <[email protected]>
 
         [Attachment Support] Dropping and pasting images should insert inline image elements with _WKAttachments

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/RemoteObjectRegistry.h (235345 => 235346)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/RemoteObjectRegistry.h	2018-08-27 02:44:15 UTC (rev 235345)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/RemoteObjectRegistry.h	2018-08-27 02:45:52 UTC (rev 235346)
@@ -29,10 +29,20 @@
 
 #import <WebKit/_WKRemoteObjectInterface.h>
 
-@protocol RemoteObjectProtocol <NSObject>
+@protocol BaseRemoteObjectProtocol <NSObject>
 
 - (void)sayHello:(NSString *)hello;
+
+@end
+
+@protocol OtherBaseRemoteObjectProtocol <NSObject>
+
 - (void)sayHello:(NSString *)hello completionHandler:(void (^)(NSString *))completionHandler;
+
+@end
+
+@protocol RemoteObjectProtocol <BaseRemoteObjectProtocol, OtherBaseRemoteObjectProtocol>
+
 - (void)selectionAndClickInformationForClickAtPoint:(NSValue *)pointValue completionHandler:(void (^)(NSDictionary *))completionHandler;
 - (void)takeRange:(NSRange)range completionHandler:(void (^)(NSUInteger location, NSUInteger length))completionHandler;
 - (void)takeSize:(CGSize)size completionHandler:(void (^)(CGFloat width, CGFloat height))completionHandler;
@@ -48,4 +58,5 @@
 
     return interface;
 }
+
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to