Bug 126670

Summary: Constructors for Objective-C classes do not work properly with instanceof
Product: WebKit Reporter: Mark Hahnenberg <mhahnenberg>
Component: JavaScriptCoreAssignee: Mark Hahnenberg <mhahnenberg>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Description Mark Hahnenberg 2014-01-08 16:02:06 PST
This is due to the fact that the JS constructors created for Objective-C classes via the JSC API inherit from JSCallbackObject, which overrides hasInstance with its own customHasInstance. JSCallbackObject::customHasInstance only checks the JSClassRefs for hasInstance callbacks. If it doesn't find any callbacks, it returns false.

One way to fix this would be to change JSCallbackObject::customHasInstance to return JSObject::defaultHasInstance in the case where no hasInstance callbacks are found.
Comment 1 Mark Hahnenberg 2014-01-08 16:02:47 PST
<rdar://problem/15710527>
Comment 2 Mark Hahnenberg 2014-01-08 16:11:01 PST
Created attachment 220672 [details]
Patch
Comment 3 Geoffrey Garen 2014-01-08 16:21:02 PST
Comment on attachment 220672 [details]
Patch

r=me
Comment 4 Mark Hahnenberg 2014-01-08 16:30:17 PST
Created attachment 220674 [details]
Patch
Comment 5 WebKit Commit Bot 2014-01-09 11:10:56 PST
Comment on attachment 220674 [details]
Patch

Clearing flags on attachment: 220674

Committed r161564: <http://trac.webkit.org/changeset/161564>
Comment 6 WebKit Commit Bot 2014-01-09 11:10:58 PST
All reviewed patches have been landed.  Closing bug.