Closed Bug 548937 Opened 15 years ago Closed 15 years ago

Refactor fake services so it's easier to add more

Categories

(Firefox :: Sync, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: zpao, Assigned: zpao)

References

Details

Attachments

(1 file)

Fennec doesn't have some browser specific services, so we need to fake them. Private browsing is already there, but we'll need to add more (e.g. SessionStore). So to prevent Utils.lazySvc from becoming bloated by putting the services there, they should be elsewhere.
Attached patch Patch v0.1Splinter Review
I put fakeServices in Utils, but it can be moved.
Attachment #429239 - Flags: review?(edilee)
Comment on attachment 429239 [details] [diff] [review] Patch v0.1 >+++ b/source/modules/util.js > if (!Cc[cid]) { >+ if (cid in fakeServices) >+ svc = fakeServices[cid]; Eh.. I would just do svc = FakeSvc[cid] > if (svc == null) > log.warn("Component " + cid + " doesn't exist on this platform."); And svc == null would check okay. But then it'll trigger a strict warning :p I suppose the if check is okay. >+ fakeServices: { Just make this a top level FakeSvc object, but don't export it.
Attachment #429239 - Flags: review?(edilee) → review+
(In reply to comment #2) > (From update of attachment 429239 [details] [diff] [review]) > >+++ b/source/modules/util.js > > if (!Cc[cid]) { > >+ if (cid in fakeServices) > >+ svc = fakeServices[cid]; > Eh.. I would just do svc = FakeSvc[cid] I can do that. > > if (svc == null) > > log.warn("Component " + cid + " doesn't exist on this platform."); > And svc == null would check okay. But then it'll trigger a strict warning :p > I suppose the if check is okay. So turns out that strict warnings won't show up during assignment. So I think we could do without any issues. > svc = FakeSvc[cid]; > if (!svc)
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
http://hg.mozilla.org/labs/weave/rev/9e4817ec4791 Revert svc/svc == null change from 87f9860d8e5a.
Component: Firefox Sync: Backend → Sync
Product: Cloud Services → Firefox
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: