Closed Bug 1588876 Opened Last month Closed 25 days ago

Change instances of using getService to Services.jsm where possible in SeaMonkey

Categories

(SeaMonkey :: General, enhancement)

All
macOS
enhancement
Not set

Tracking

(seamonkey2.49esr wontfix, seamonkey2.53 affected, seamonkey2.57esr fixed, seamonkey2.63 wontfix)

RESOLVED FIXED
seamonkey2.68
Tracking Status
seamonkey2.49esr --- wontfix
seamonkey2.53 --- affected
seamonkey2.57esr --- fixed
seamonkey2.63 --- wontfix

People

(Reporter: frg, Assigned: frg)

References

Details

Attachments

(3 files)

Summary says it all. Switching to Services makes the code more readable and usually uses a js variable or two less.
As an example see Bug 1412893

Use Services obs and prefs.

Attachment #9101361 - Flags: review?(iann_bugzilla)
Attachment #9101361 - Flags: approval-comm-release?
Attachment #9101361 - Flags: approval-comm-esr60?

Use Services.io in SeaMonkey if possible

Attachment #9101362 - Flags: review?(iann_bugzilla)
Attachment #9101362 - Flags: approval-comm-release?
Attachment #9101362 - Flags: approval-comm-esr60?

Use Services.dirsvc whenever possible in SeaMonkey.

Attachment #9101363 - Flags: review?(iann_bugzilla)
Attachment #9101363 - Flags: approval-comm-release?
Attachment #9101363 - Flags: approval-comm-esr60?
Comment on attachment 9101361 [details] [diff] [review]
1588876-1-servicescleanup.patch

>+++ b/suite/components/places/tests/unit/test_browserGlue_prefs.js

>   // nsSuiteGlue stops observing topics after first notification,
>   // so we add back the observer to test additional runs.
>-  os.addObserver(bg.QueryInterface(Ci.nsIObserver),
>+  Services.obs.addObserver(bg.QueryInterface(Ci.nsIObserver),
>                  PlacesUtils.TOPIC_INIT_COMPLETE);
Nit: indent to match start of bg.
>-  os.addObserver(bg.QueryInterface(Ci.nsIObserver),
>+  Services.obs.addObserver(bg.QueryInterface(Ci.nsIObserver),
>                  PlacesUtils.TOPIC_DATABASE_LOCKED);
Nit: indent to match start of bg.

r/a=me with that addressed.
Attachment #9101361 - Flags: review?(iann_bugzilla)
Attachment #9101361 - Flags: review+
Attachment #9101361 - Flags: approval-comm-release?
Attachment #9101361 - Flags: approval-comm-release+
Attachment #9101361 - Flags: approval-comm-esr60?
Attachment #9101361 - Flags: approval-comm-esr60+
Comment on attachment 9101362 [details] [diff] [review]
1588876-2-ioservice.patch

[Triage Comment]
r/a=me
Attachment #9101362 - Flags: review?(iann_bugzilla)
Attachment #9101362 - Flags: review+
Attachment #9101362 - Flags: approval-comm-release?
Attachment #9101362 - Flags: approval-comm-release+
Attachment #9101362 - Flags: approval-comm-esr60?
Attachment #9101362 - Flags: approval-comm-esr60+
Comment on attachment 9101363 [details] [diff] [review]
1588876-3-dirservice.patch

>+++ b/suite/base/content/safeMode.js
>-    var prefOverridesDir = fileLocator.get(NS_APP_PREFS_OVERRIDE_DIR,
>+    var prefOverridesDir = Services.dirsvc.get("PrefDOverride",
>                                            Ci.nsIFile);
Nit: indentation or just add to the line above as total would be less than 80 characters.

r/a=me with that addressed.
Attachment #9101363 - Flags: review?(iann_bugzilla)
Attachment #9101363 - Flags: review+
Attachment #9101363 - Flags: approval-comm-release?
Attachment #9101363 - Flags: approval-comm-release+
Attachment #9101363 - Flags: approval-comm-esr60?
Attachment #9101363 - Flags: approval-comm-esr60+
Blocks: 479006

Pushed by frgrahl@gmx.net:
https://hg.mozilla.org/comm-central/rev/dcdf7978e831
Part 1: Use Services obs and prefs if possible in SeaMonkey. r=IanN
https://hg.mozilla.org/comm-central/rev/b7054ece2174
Part 2: Use Services.io in SeaMonkey if possible. r=IanN
https://hg.mozilla.org/comm-central/rev/ad3a7eb5e874
Part 3: Use Services.dirsvc whenever possible in SeaMonkey. r=IanN

Status: ASSIGNED → RESOLVED
Closed: 25 days ago
Resolution: --- → FIXED

Above comm-central Part 2 needed some extensive rebasing.

https://hg.mozilla.org/releases/comm-esr60/rev/20276b433adcacecf56fae1b94c8a0e35c543179
Bug 1588876 - Part 1: Use Services obs and prefs if possible in SeaMonkey. r=IanN a=IanN
https://hg.mozilla.org/releases/comm-esr60/rev/34e2a828cd03ace95030a8f29c157800081b445b
Bug 1588876 - Part 2: Use Services.io in SeaMonkey if possible. r=IanN a=IanN
https://hg.mozilla.org/releases/comm-esr60/rev/011d4278532394e5181b390189148a12e54d7278
Bug 1588876 - Part 3: Use Services.dirsvc whenever possible in SeaMonkey. r=IanN a=IanN

Target Milestone: --- → seamonkey2.68
You need to log in before you can comment on or make changes to this bug.