Closed Bug 334558 Opened 14 years ago Closed 6 years ago

nsIServiceManager::isServiceInstantiated* methods throw, but are not documented to do so

Categories

(Core :: XPCOM, defect, P5)

defect

Tracking

()

RESOLVED FIXED
mozilla25

People

(Reporter: dbaron, Assigned: Cykesiopka)

Details

Attachments

(1 file)

The implementations on nsComponentManager of nsIServiceManager::isServiceInstantiated and nsIServiceManager::isServiceInstantiatedByContractID throw more often than the interface documentation says they should.  Essentially, they're methods that return a boolean, but in reality either:
 * succeed and return true, or
 * throw.

See bug 331120 comment 4 for more details.  Probably they should propagate return values a good bit less, and perhaps never throw at all.

But if it's decided to leave the behavior as is, the interface documentation should at least be corrected.
Priority: -- → P5
Would making the two implementations not throw at all be OK?

As far as I can tell only /mail/components/about-support/content/a11y.js and /toolkit/modules/Troubleshoot.jsm use either method, and both have to work around the issue...
Flags: needinfo?(benjamin)
Given that the behavior since 2006 has been to throw, we should keep throwing and update the documentation.
Flags: needinfo?(benjamin)
I'm not sure if the NS_ERROR_UNEXPECTED case is relevant / NS_ERROR_UNEXPECTED is thrown at all, so I've left it out for now...

I will also update the MDN docs afterwards.
Assignee: nobody → cykesiopka.bmo
Status: NEW → ASSIGNED
Attachment #772918 - Flags: review?(benjamin)
Attachment #772918 - Flags: review?(benjamin) → review+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/c9601e26caff
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
You need to log in before you can comment on or make changes to this bug.