Closed Bug 578122 Opened 14 years ago Closed 14 years ago

Use Services.jsm in Fennec

Categories

(Firefox for Android Graveyard :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mbrubeck, Assigned: mbrubeck)

References

Details

Attachments

(1 file, 1 obsolete file)

Attached patch patch (obsolete) — Splinter Review
This patch updates Fennec to use the lazy getters from Services.jsm <http://www.gavinsharp.com/blog/2010/02/25/services-jsm/> where appropriate.  This allows us to remove ~170 LOC, and should reduce service instantiation overhead in a few places where we weren't using our own lazy getters.
Attachment #456898 - Flags: review?(mark.finkle)
Comment on attachment 456898 [details] [diff] [review]
patch

There are some errors caused by this, new version coming.
Attachment #456898 - Flags: review?(mark.finkle)
Attached patch patchSplinter Review
Fix warning in sanitize.js and error in config.js.
Assignee: nobody → mbrubeck
Attachment #456898 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #456964 - Flags: review?(mark.finkle)
Comment on attachment 456964 [details] [diff] [review]
patch

>diff -r 4e38010bf28a chrome/content/sanitize.js

>   sanitize: function ()
>   {
>-    var psvc = Components.classes["@mozilla.org/preferences-service;1"]
>-                         .getService(Components.interfaces.nsIPrefService);
>+    var psvc = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefService);
>     var branch = psvc.getBranch(this._prefDomain);

Change to | var branch = Services.prefs.getBranch(this._prefDomain); |
and remove the line above it

>     geolocation: {

>         // clear any network geolocation provider sessions
>-        var psvc = Components.classes["@mozilla.org/preferences-service;1"]
>-                             .getService(Components.interfaces.nsIPrefService);
>+        var psvc = Cc["@mozilla.org/preferences-service;1"]
>+                     .getService(Components.interfaces.nsIPrefService);
>         try {
>           var branch = psvc.getBranch("geo.wifi.access_token.");
>           branch.deleteBranch("");
>           
>           branch = psvc.getBranch("geo.request.remember.");
>           branch.deleteBranch("");

Same...

r+ with those changes. I'll make the changes before landing
Attachment #456964 - Flags: review?(mark.finkle) → review+
pushed:
http://hg.mozilla.org/mobile-browser/rev/23a684e04341
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.