Closed Bug 985295 Opened 10 years ago Closed 10 years ago

make update timer contract ID unique

Categories

(Firefox for Android Graveyard :: Web Apps (PWAs), enhancement, P3)

29 Branch
ARM
Android
enhancement

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 31

People

(Reporter: myk, Assigned: myk)

Details

Attachments

(1 file)

Over in bug 985195, mfinkle wondered if it matters that the contract ID for the WebappsUpdateTimer component is "@mozilla.org/b2g/webapps-update-timer;1", which the equivalent component in B2G also implements.

A contract ID "is not bound to any specific implementation, as the CID is, and is thus more general.  Instead, a contract ID only specifies a given set of interfaces that it wants implemented, and any number of different CIDs may step in and fill that request.  This difference between a contract ID and a CID is what makes it possible to override components." <https://developer.mozilla.org/en-US/docs/Creating_XPCOM_Components/An_Overview_of_XPCOM>.

But it isn't clear which component you get if you query Components.classes when multiple components implement the same contract.  So if someone were to build a project that was a hybrid of Fennec and B2G, then there would be a collision, the result of which is unclear.  Of course building such a project is unlikely, but it would still be safer to give WebappsUpdateTimer its own contract ID.

It's also more correct, since "the format of the contract ID is the domain of the component, the module, the component name, and the version number, separated by slashes."  And whatever module this component belongs to, it isn't "b2g".

Browsing MobileComponents.manifest, a bunch of older contract IDs use modules like "browser" and "network", f.e. "@mozilla.org/browser/directory-provider;1" and "@mozilla.org/network/protocol/about;1?what=".  Newer ones tend to leave out the module, like "@mozilla.org/filepicker;1" and "@mozilla.org/snippets;1".

If I thought we'd make a bunch of components for the runtime, I might suggest we change it to something like "@mozilla.org/web-runtime/update-timer;1" so we have a namespace for runtime-specific components.

But since we aren't likely to do that, let's change it to the module-less "@mozilla.org/webapps-update-timer;1", which is consistent with modern usage and doesn't already exist.

Here's a patch that does that.  Unlike the patches in bug 985184 and bug 985195, there's no reason to uplift this, as the current contract ID is unlikely to cause any problems (unless it's somehow a problem that the same component stops implementing one contract and starts implementing another one across versions of Fennec).
Attachment #8393319 - Flags: review?(mark.finkle)
Comment on attachment 8393319 [details] [diff] [review]
patch v1: changes contract ID

Your rationale makes sense to me.
Attachment #8393319 - Flags: review?(mark.finkle) → review+
https://hg.mozilla.org/mozilla-central/rev/08e8810ea47c
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: