Closed Bug 726279 Opened 13 years ago Closed 13 years ago

Generalize use of Services.jsm in nsSearchService

Categories

(Firefox :: Search, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 15

People

(Reporter: Yoric, Assigned: raymondlee)

References

Details

(Whiteboard: [mentor=Yoric][lang=js])

Attachments

(1 file, 1 obsolete file)

nsSearchService.js was written before Services.jsm . Now that we have Services.jsm, we can simplify code in a few places.
Whiteboard: [mentor=Yoric][lang=js]
Assignee: nobody → raymond
Status: NEW → ASSIGNED
Attached patch v1 (obsolete) (deleted) — Splinter Review
Attachment #619017 - Flags: review?(dteller)
Comment on attachment 619017 [details] [diff] [review] v1 > let _dirSvc = null; > function getDir(aKey, aIFace) { > if (!aKey) > FAIL("getDir requires a directory key!"); > > if (!_dirSvc) >- _dirSvc = Cc["@mozilla.org/file/directory_service;1"]. >- getService(Ci.nsIProperties); >+ _dirSvc = Services.dirsvc; > return _dirSvc.get(aKey, aIFace || Ci.nsIFile); > } >+ var sbs = Services.strings; > > var brandBundle = sbs.createBundle(BRAND_BUNDLE); > var brandName = brandBundle.GetStringFromName("brandShortName"); > > var searchBundle = sbs.createBundle(SEARCH_BUNDLE); >+ var ss = Services.search; > if (ss.getEngineByName(aEngine.name)) { > if (aEngine._confirm) > onError("error_duplicate_engine_msg", "error_invalid_engine_title"); > > LOG("_onLoad: duplicate engine found, bailing"); > return; > } _dirSvc, sbs and ss are unnecessary.
Attached patch v2 (deleted) — Splinter Review
Removed _dirSvc, sbs and ss.
Attachment #619017 - Attachment is obsolete: true
Attachment #619017 - Flags: review?(dteller)
Attachment #619046 - Flags: review?(dteller)
Comment on attachment 619046 [details] [diff] [review] v2 Review of attachment 619046 [details] [diff] [review]: ----------------------------------------------------------------- Looks good to me. If this passes tests, you have my r+, but I defer to gavin for the final word.
Attachment #619046 - Flags: review?(gavin.sharp)
Attachment #619046 - Flags: review?(dteller)
Attachment #619046 - Flags: review+
Comment on attachment 619046 [details] [diff] [review] v2 stealing... four reviewing eyes should be sufficient for this
Attachment #619046 - Flags: review?(gavin.sharp) → review+
Keywords: checkin-needed
OS: Mac OS X → All
Hardware: x86 → All
Flags: in-testsuite-
Keywords: checkin-needed
Target Milestone: --- → Firefox 15
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: