REGRESSION(r204565): WKObject is broken
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 22 Jul 2017 17:31:57 +0000 (17:31 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 22 Jul 2017 17:31:57 +0000 (17:31 +0000)
commit0e70cf85f1e146fe7ae6536966655fcadc8e5fa7
tree6d2ace673fac317ec45f4425f0d831cbb9c7ea92
parentac12a7e5187b9ec6ebeee570972b6c91335254fe
REGRESSION(r204565): WKObject is broken
https://bugs.webkit.org/show_bug.cgi?id=174736
<rdar://problem/33246169>

Reviewed by Dan Bernstein.

Source/WebKit:

Revert r204565 as making WKObject a root class caused unexpected crashes.
Instead, we now have WKObject inherit from NSProxy (instead of previously
NSObject) and we forward calls to the target.

We also need to provide an implementation for private methods such as
isNSString__ to address the issue with NSStrings that r204565 was trying
to fix.

* Shared/Cocoa/APIObject.mm:
(API::Object::unwrap):
* Shared/Cocoa/WKObject.h:
* Shared/Cocoa/WKObject.mm:
(-[WKObject dealloc]):
(-[WKObject hash]):
(-[WKObject isKindOfClass:]):
(-[WKObject isMemberOfClass:]):
(-[WKObject respondsToSelector:]):
(-[WKObject conformsToProtocol:]):
(-[WKObject forwardingTargetForSelector:]):
(-[WKObject description]):
(-[WKObject debugDescription]):
(-[WKObject classForCoder]):
(-[WKObject classForKeyedArchiver]):
(-[WKObject _web_createTarget]):
(-[WKObject forwardInvocation:]):
(-[WKObject methodSignatureForSelector:]):
(-[WKObject isNSObject__]):
(-[WKObject isNSArray__]):
(-[WKObject isNSCFConstantString__]):
(-[WKObject isNSData__]):
(-[WKObject isNSDate__]):
(-[WKObject isNSDictionary__]):
(-[WKObject isNSNumber__]):
(-[WKObject isNSOrderedSet__]):
(-[WKObject isNSSet__]):
(-[WKObject isNSString__]):
(-[WKObject isNSTimeZone__]):
(-[WKObject isNSValue__]):

Tools:

Add API test that used to crash.

* TestWebKitAPI/Tests/WebKit2Cocoa/WKObject.mm:
(TestWebKitAPI::TEST):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@219764 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit/ChangeLog
Source/WebKit/Shared/Cocoa/APIObject.mm
Source/WebKit/Shared/Cocoa/WKObject.h
Source/WebKit/Shared/Cocoa/WKObject.mm
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKObject.mm