Closed Bug 11742 Opened 21 years ago Closed 19 years ago

xpconnect needs instanceof for classes

Categories

(Core :: XPConnect, defect, P3)

x86
Windows NT
defect

Tracking

()

RESOLVED FIXED
mozilla0.9.1

People

(Reporter: cbegle, Assigned: jband_mozilla)

References

Details

so are XPC objects hooked up to work with instanceof?

js> CLASS = Components.classes["nsEcho"]
nsEcho
js> IFACE = Components.interfaces["nsIEcho"]
nsIEcho
// seems like these should be true
js> o = CLASS.createInstance()
[xpconnect wrapped nsISupports]
js> o instanceof CLASS
false
js> o instanceof IFACE
false

// just for curiousity's sake
js> O = o.QueryInterface(IFACE)
[xpconnect wrapped nsIEcho]
js> O instanceof CLASS
false
js> O instanceof IFACE
false
QA Contact: desale → cbegle
Status: NEW → ASSIGNED
I had already been thinking about this. It is not yet obvious what the best
strategy would be.
instanceof now works for Components.interfaces.*

It will not work for Components.classes.* untill interface flattening is
working. xpconnect does not store info on what CLSID was used to create the
object. Even if it did so it would not work the same with objects that had been
wrapped automatically; i.e. as the result of being passed in as an argument.
When flattening is working and objects support an interface by which they can be
queried for their CLSID then instanceof will be made to work for
Components.classes.* and Components.classesByID.*
Moving all XPConnect QA contact to rginda
QA Contact: cbegle → rginda
Depends on: 13422
Summary: inheritance and instanceof with XPC objects → xpconnect needs instanceof for classes
Target Milestone: --- → Future
Target Milestone: Future → mozilla0.9.1
fixed by XPCDOM_20010329_BRANCH landing
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.