Closed Bug 492684 Opened 15 years ago Closed 15 years ago

use preference to control logging in NetworkGeolocationProvider

Categories

(Core :: DOM: Geolocation, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla1.9.2a1

People

(Reporter: dougt, Assigned: dougt)

Details

Attachments

(1 file, 3 obsolete files)

right now, to debug problems, we need to ask users to modify a file in the installation. It is better if we use a preference to enable/disable this logging functionality. http://mxr.mozilla.org/mozilla-central/source/dom/src/geolocation/NetworkGeolocationProvider.js
Version: unspecified → Trunk
Attached patch patch v.1 (obsolete) — Splinter Review
Assignee: nobody → doug.turner
Attachment #383794 - Flags: review?
Attachment #383794 - Flags: review? → review?(gavin.sharp)
Comment on attachment 383794 [details] [diff] [review] patch v.1 >--- a/dom/src/geolocation/NetworkGeolocationProvider.js >+++ b/dom/src/geolocation/NetworkGeolocationProvider.js ... >+ if (prefService.getBoolPref("geo.wifi.enableLog")) ... How about adding this pref to all.js (firefox.js) so it would show up in about:config?
I don't think that it should be added. It's a hidden one like app.update.log.all which is only used for logging purposes.
(In reply to comment #1) > Created an attachment (id=383794) [details] > patch v.1 Doug, you should remove the commented out code in the patch.
Comment on attachment 383794 [details] [diff] [review] patch v.1 Does this really need to be live? Could just check the pref once at component initialization... maybe the difference doesn't matter.
it really doesn't matter. as far as perf goes, we are hitting the network and that really is the bottle neck.
Attachment #383794 - Flags: review?(gavin.sharp) → review+
Comment on attachment 383794 [details] [diff] [review] patch v.1 Still kind of bothers me that we'll end up unnecessarily calling getService/getBoolPref multiple times per geolocation call, but it's not in the startup path and not particularly perf-sensitive so I guess I can live with it... If you're not going to add a default value, you'll have to add a try/catch to avoid this throwing in the pref-unset case. r=me with that.
Attached patch how about... (obsolete) — Splinter Review
Attachment #383960 - Flags: review?(gavin.sharp)
Could store a reference to the console service in startup(), too. And maybe dump() in addition to logStringMessage?
The LOGs in startup won't ever work with that afaict...
Comment on attachment 383960 [details] [diff] [review] how about... indeed
Attachment #383960 - Flags: review?(gavin.sharp)
Attached patch patch v.1 (obsolete) — Splinter Review
Attachment #383794 - Attachment is obsolete: true
Attachment #383960 - Attachment is obsolete: true
Attachment #386567 - Flags: review?(gavin.sharp)
Attachment #386567 - Flags: review?(gavin.sharp) → review-
Attached patch patch v.2Splinter Review
Attachment #386567 - Attachment is obsolete: true
Attachment #386582 - Flags: review?(gavin.sharp)
Comment on attachment 386582 [details] [diff] [review] patch v.2 > Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleService).logStringMessage(aMsg); Somewhat off topic, but I think you'd be better off just dump()'ing the string + '\n', makes it easier to copy and paste and is cleaner...
Comment on attachment 386582 [details] [diff] [review] patch v.2 >diff --git a/dom/src/geolocation/NetworkGeolocationProvider.js b/dom/src/geolocation/NetworkGeolocationProvider.js > function LOG(aMsg) { >+ if (gLoggingEnabled) >+ { >+ aMsg = ("*** WIFI GEO: " + aMsg); >+ Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleService).logStringMessage(aMsg); > } Do we want to dump() too? Can make it easier to collect full logs. >+function WifiGeoPositionProvider() { >+ try { >+ this.prefService = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch); >+ gLoggingEnabled = this.prefService.getBoolPref("geo.wifi.logging.enabled"); >+ } catch (e) {} Leave the prefService initialization outside of the try/catch? >+ let branch = this.prefService.getBranch("geo.wifi.access_token."); This call requires a QI to nsIPrefService. Just add it to the initialization in the constructor? (Is there a test that would have failed for that?) r=me with those addressed.
Attachment #386582 - Flags: review?(gavin.sharp) → review+
Comment on attachment 386582 [details] [diff] [review] patch v.2 there is a litmus test. we probably could add a mochitest, but I will just do that in another bug (493122)
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Attachment #386582 - Flags: approval1.9.1.1?
Verified fixed on trunk with Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2a1pre) Gecko/20090716 Minefield/3.6a1pre ID:20090716032001
Status: RESOLVED → VERIFIED
Target Milestone: --- → mozilla1.9.2a1
Attachment #386582 - Flags: approval1.9.1.1? → approval1.9.1.4?
Attachment #386582 - Flags: approval1.9.1.4? → approval1.9.1.4-
Comment on attachment 386582 [details] [diff] [review] patch v.2 minus for 1.9.1.4 since a workaround apparently exists (and 3.6 comes soon enough).
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: