Open Bug 1223177 Opened 6 years ago Updated 7 months ago
Improve the "Query
Interface needed" assertion message
In bug 1222202 comment 4, mccr8 wrote: Also, this assertion should really be fatal, and have a more obvious failure message. In bug 1222202 comment 6, erahm wrote: Helpful is relative here. I suppose it just comes down to how much institutional knowledge you have: 1) You have to know what QueryInterface means 2) You have to know that "QueryInterface needed" means "You are missing an interface entry for the interface you are currently trying to use. Go to the concrete implementation's NS_IMPL_ISUPPORTS* macro and add it" 3) As mccr8 mentioned it's non-fatal, so like all non-fatal log output it's generally ignored As a follow up maybe [we] could make this message more explicit (detailing how to fix the problem rather than stating there is a problem) and make it a fatal assertion. Or we could create a MDN page with some details about what to do when you see this particular assertion.
Could the failure message say which concrete class is missing which interface? Or could we use a more global (static?) analysis to find classes that inherit from interfaces they don't QI to?
Assignee: nobody → continuation
QA Contact: nfroyd
I use __PRETTY_FUNCTION__ to print out the type T because it seemed like the simplest way to do that. It does include some extra information that is not actually needed.
Nathan pointed out that __PRETTY_FUNCTION__ isn't supported everywhere (not on MSVC), and __func__ doesn't seem to include the template type, so I'll have to come up with another approach. I also want to wait until bug 1455637 is fixed, because changing what the assert looks like will interfere with starring oranges, and kmag already has a fix.
You need to log in before you can comment on or make changes to this bug.