Closed Bug 1463287 Opened 6 years ago Closed 6 years ago

Add QueryInterface helper macro for concrete class types

Categories

(Core :: XPCOM, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla62
Tracking Status
firefox62 --- fixed

People

(Reporter: kmag, Assigned: kmag)

References

Details

Attachments

(1 file)

We have a log of QueryInterface methods which implement querying to concrete class types which can't be unambiguously cast to nsISupports, and need to be used with RefPtr/do_QueryObject. Those can't be implemented with existing helper macros, and as a result have several ad-hoc (sometimes slightly dodgy) implementations across the tree.

We should have a helper macro for this, and make sure that the logic that it implements is sane.
Comment on attachment 8979403 [details]
Bug 1463287: Add QueryInterface helper macro for concrete class types.

https://reviewboard.mozilla.org/r/245568/#review251656

r=me

I guess the various URI classes use hardcoded CID values which are not NS_GET_IID on the relevant class, which is why we can't use the macro for those?

I do think we can use it for nsDocLoader, though.
Attachment #8979403 - Flags: review?(bzbarsky) → review+
(In reply to Boris Zbarsky [:bz] (no decent commit message means r-) from comment #2)
> I guess the various URI classes use hardcoded CID values which are not
> NS_GET_IID on the relevant class, which is why we can't use the macro for
> those?

Right. Although we should probably fix that.

> I do think we can use it for nsDocLoader, though.

Yeah, that one didn't show up in my greps.
https://hg.mozilla.org/integration/mozilla-inbound/rev/a1bf5dfd3c00c5e59a59272fb03d0d6684539b82
Bug 1463287: Add QueryInterface helper macro for concrete class types. r=bz
https://hg.mozilla.org/mozilla-central/rev/a1bf5dfd3c00
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla62
Regressions: 1716312
You need to log in before you can comment on or make changes to this bug.