No way to do "a instanceof b" using the JS API.

RESOLVED FIXED

Status

()

Core
JavaScript Engine
RESOLVED FIXED
13 years ago
13 years ago

People

(Reporter: jst, Assigned: shaver)

Tracking

Trunk
Points:
---
Bug Flags:
in-testsuite -

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

13 years ago
I've got two objects and I want to find out if one's an instance of the other.
There's a JSClass hook that helps you implement this for your own classes, but
there's no JS engine API to do that check.
Created attachment 183102 [details] [diff] [review]
the obvious, trivial patch

Comme ca?  It wants a doc-comment explaining that it is the equivalent of the
language |instanceof| construct, albeit with reversed operands, and that
JS_InstanceOf trades in native classes only.  We don't always get what we want,
though.
Attachment #183102 - Flags: superreview?(brendan)
Attachment #183102 - Flags: review?(jst)
Comment on attachment 183102 [details] [diff] [review]
the obvious, trivial patch

r/sr/a=me.  No doc comment, instead add to js/docs/jsref.xml.

/be
Attachment #183102 - Flags: superreview?(brendan)
Attachment #183102 - Flags: superreview+
Attachment #183102 - Flags: review?(jst)
Attachment #183102 - Flags: review+
Attachment #183102 - Flags: approval1.8b2+
(Reporter)

Comment 3

13 years ago
Oh, and this does indeed do exactly what I wanted. Thanks for the quick fix!
(Reporter)

Comment 4

13 years ago
This was already checked in. Marking FIXED.
Status: NEW → RESOLVED
Last Resolved: 13 years ago
Resolution: --- → FIXED

Updated

13 years ago
Flags: testcase-
You need to log in before you can comment on or make changes to this bug.