Closed Bug 1217047 Opened 4 years ago Closed 4 years ago

make nsComponentManagerImpl::IsContractIDRegistered lie less

Categories

(Core :: XPCOM, defect)

43 Branch
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla45
Tracking Status
firefox42 --- affected
firefox43 --- fixed
firefox44 --- fixed
firefox45 --- fixed
b2g-v2.5 --- fixed

People

(Reporter: froydnj, Assigned: froydnj)

References

Details

Attachments

(1 file)

Yury and Michael were running into some issues with the component manager.  The following sequence of steps:

* RegisterFactory $CID, $CONTRACT_ID
* UnregisterFactory $CID
* IsContractIDRegistered $CONTRACT_ID

can return true, which seems nonsensical.  It makes a certain amount of sense, since UnregisterFactory doesn't know what contract ID corresponds to $CID.  But we can do better.  I know I've been bitten by this before and wasted a good amount of time figuring out what was going on.

I think we can do better, and a try push with an experimental patch seems to not break anything horribly.  I'll toss that up in a second.
We can have a valid nsFactoryEntry in the following cases:

* We registered a known module;
* We registered a factory (mModule will be null in this case);
* We created a service via the factory.

So one of these members must be valid if we still have a entry in the
contract ID table that actually does interesting things.
Attachment #8676950 - Flags: review?(benjamin)
Attachment #8676950 - Flags: feedback?(ydelendik)
Comment on attachment 8676950 [details] [diff] [review]
try harder in IsContractIDRegistered to return a reasonable answer

Worth checking whether this fixes bug 1193155.
Comment on attachment 8676950 [details] [diff] [review]
try harder in IsContractIDRegistered to return a reasonable answer

Review of attachment 8676950 [details] [diff] [review]:
-----------------------------------------------------------------

Fixed bug 1193155 for me. (As well as bug 1193088, but it hard to tell if this or bug 1179262 fixed it)
Attachment #8676950 - Flags: feedback?(ydelendik) → feedback+
Comment on attachment 8676950 [details] [diff] [review]
try harder in IsContractIDRegistered to return a reasonable answer

We should remove this API, but as long as we've got it it might as well do something useful.
Attachment #8676950 - Flags: review?(benjamin) → review+
Assignee: nobody → nfroyd
https://hg.mozilla.org/mozilla-central/rev/d34f0bd09295
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla45
Comment on attachment 8676950 [details] [diff] [review]
try harder in IsContractIDRegistered to return a reasonable answer

Approval Request Comment
[Feature/regressing bug #]: bug 1179262
[User impact if declined]: can't toggle PDF.js on and off without restart (see bug 1193155)
[Describe test coverage new/current, TreeHerder]: We have a few tests in-tree that exercise code around here, though not the specific additions that were made.
[Risks and why]: Low risk.
[String/UUID change made/needed]: None.
Attachment #8676950 - Flags: approval-mozilla-beta?
Attachment #8676950 - Flags: approval-mozilla-aurora?
Comment on attachment 8676950 [details] [diff] [review]
try harder in IsContractIDRegistered to return a reasonable answer

Restarting is annoying for users; let's uplift this small fix to aurora and beta.
Attachment #8676950 - Flags: approval-mozilla-beta?
Attachment #8676950 - Flags: approval-mozilla-beta+
Attachment #8676950 - Flags: approval-mozilla-aurora?
Attachment #8676950 - Flags: approval-mozilla-aurora+
Marking as affected for 42+ since this seems to have been a problem since at least 40.
You need to log in before you can comment on or make changes to this bug.