Bug 126670 - Constructors for Objective-C classes do not work properly with instanceof
Summary: Constructors for Objective-C classes do not work properly with instanceof
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mark Hahnenberg
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-08 16:02 PST by Mark Hahnenberg
Modified: 2014-01-09 11:10 PST (History)
1 user (show)

See Also:


Attachments
Patch (2.87 KB, patch)
2014-01-08 16:11 PST, Mark Hahnenberg
no flags Details | Formatted Diff | Diff
Patch (5.15 KB, patch)
2014-01-08 16:30 PST, Mark Hahnenberg
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.