Closed
Bug 832411
Opened 11 years ago
Closed 11 years ago
a> nsIGeolocationProvider::SetHighAccuracy does not get called from nsgeolocation service for all cases.
Categories
(Core :: DOM: Geolocation, defect)
Tracking
()
People
(Reporter: stephenl, Assigned: jdm)
Details
Attachments
(2 files, 3 obsolete files)
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/20100101 Firefox/18.0 Build ID: 20130104151925 Steps to reproduce: In custom nsIGeolocationProvider implementation want to be able to take some decisions based on whether high/low accuracy fix is requested. Actual results: nsIGeolocationProvider::setHighAccuracy does not get called in all cases. At http://mxr.mozilla.org/mozilla-beta/source/dom/src/geolocation/nsGeolocation.cpp#441, nsgeolocationService::SetHigherAccuracy gets called only if enableHighAccuracy is true. Here switching becomes an issue, i.e. if at first you have high accuracy selected and then we switch back to low. Expected results: Need the accuracy call for every session requested be it high/low.
Updated•11 years ago
|
OS: Windows 7 → Gonk (Firefox OS)
Hardware: x86_64 → ARM
Assignee | ||
Comment 1•11 years ago
|
||
Assignee | ||
Comment 2•11 years ago
|
||
Here's the design: in a process, the service is notified of the most recent high accuracy state for each new request. It scans all existing requests to see if any of them require high accuracy, and if there's any change (ie. it's now needed or not needed), it updates the providers. When multiple processes are involved, it's more complicated - the service behaves as before, but passes the required high accuracy status for that process to the parent. The parent process removes any existing geolocation request for that process unconditionally and recreates it with the desired accuracy. This causes the providers to be updated if necessary with the new accuracy status.
Assignee: nobody → josh
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Gonk (Firefox OS) → Windows 7
Hardware: ARM → x86_64
Assignee | ||
Updated•11 years ago
|
Attachment #705435 -
Flags: review?(doug.turner)
Assignee | ||
Comment 3•11 years ago
|
||
Now with fewer copy/paste errors.
Attachment #705440 -
Flags: review?(doug.turner)
Assignee | ||
Updated•11 years ago
|
Attachment #705435 -
Attachment is obsolete: true
Attachment #705435 -
Flags: review?(doug.turner)
Updated•11 years ago
|
tracking-b2g18:
--- → ?
Updated•11 years ago
|
OS: Windows 7 → Gonk (Firefox OS)
Comment 4•11 years ago
|
||
Comment on attachment 705440 [details] [diff] [review] Track geolocation requests' use of high accuracy and ensure the providers are update when necessary. Review of attachment 705440 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/ipc/ContentParent.cpp @@ +2131,5 @@ > +AddGeolocationListener(nsIDOMGeoPositionCallback* watcher, bool highAccuracy) > +{ > + nsCOMPtr<nsIDOMGeoGeolocation> geo = do_GetService("@mozilla.org/geolocation;1"); > + if (!geo) { > + return -1; Is -1 a valid watch id? @@ +2134,5 @@ > + if (!geo) { > + return -1; > + } > + > + nsRefPtr<nsGeolocation> geosvc = static_cast<nsGeolocation*>(geo.get()); You really should have a nsIGeolocation and do the xpcom thing here... and if you did that, you wouldn't have to fuck around with jsval. Just create a new method that fits your need. ::: dom/src/geolocation/nsGeolocation.cpp @@ +1224,5 @@ > return mPendingCallbacks.Length() != 0; > } > > +bool > +nsGeolocation::HighAccuracyRequired() I'd prefer the name HighAccuracyRequested()
Attachment #705440 -
Flags: review?(doug.turner) → review-
Assignee | ||
Comment 5•11 years ago
|
||
Look, here are some tests as well. Also -1 is a value that indicates that we don't have a listener.
Attachment #709649 -
Flags: review?(doug.turner)
Assignee | ||
Updated•11 years ago
|
Attachment #705440 -
Attachment is obsolete: true
Updated•11 years ago
|
Updated•11 years ago
|
blocking-b2g: --- → leo?
Updated•11 years ago
|
blocking-b2g: leo? → leo+
Comment 6•11 years ago
|
||
Comment on attachment 709649 [details] [diff] [review] Track geolocation requests' use of high accuracy and ensure the providers are update when necessary. Review of attachment 709649 [details] [diff] [review]: ----------------------------------------------------------------- lgtm ::: dom/ipc/ContentParent.cpp @@ +2142,5 @@ > +AddGeolocationListener(nsIDOMGeoPositionCallback* watcher, bool highAccuracy) > +{ > + nsCOMPtr<nsIGeolocation> geo = do_GetService("@mozilla.org/geolocation;1"); > + if (!geo) { > + return -1; 4 spaces or 2 in this file? @@ +2145,5 @@ > + if (!geo) { > + return -1; > + } > + > + mozilla::dom::GeoPositionOptions* options = new mozilla::dom::GeoPositionOptions(); Can't you just use GeoPositionOptions here? I think we are using mozilla::dom in this file. @@ +2146,5 @@ > + return -1; > + } > + > + mozilla::dom::GeoPositionOptions* options = new mozilla::dom::GeoPositionOptions(); > + options->enableHighAccuracy = highAccuracy; OOC, Are there setters for these sorts of things, or do we just assign like this? @@ +2147,5 @@ > + } > + > + mozilla::dom::GeoPositionOptions* options = new mozilla::dom::GeoPositionOptions(); > + options->enableHighAccuracy = highAccuracy; > + int32_t retval; set to -1 or.. @@ +2148,5 @@ > + > + mozilla::dom::GeoPositionOptions* options = new mozilla::dom::GeoPositionOptions(); > + options->enableHighAccuracy = highAccuracy; > + int32_t retval; > + geo->WatchPosition(watcher, nullptr, options, &retval); You'll want to test for an error result here.
Attachment #709649 -
Flags: review?(doug.turner) → review+
Assignee | ||
Comment 7•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/6e195e29b4d6 https://hg.mozilla.org/integration/mozilla-inbound/rev/b5ec301ad6c0
Assignee | ||
Comment 8•11 years ago
|
||
b2gv18-applicable patch.
Assignee | ||
Updated•11 years ago
|
Attachment #718501 -
Attachment description: Track geolocation requests' use of high accuracy and ensure the providers are update when necessary. → B2G18 - Track geolocation requests' use of high accuracy and ensure the providers are update when necessary.
Assignee | ||
Updated•11 years ago
|
Keywords: checkin-needed
Assignee | ||
Comment 9•11 years ago
|
||
Now actually building.
Assignee | ||
Updated•11 years ago
|
Attachment #718501 -
Attachment is obsolete: true
Comment 10•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/6e195e29b4d6 https://hg.mozilla.org/mozilla-central/rev/b5ec301ad6c0
Status: NEW → RESOLVED
Closed: 11 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → mozilla22
Comment 11•11 years ago
|
||
https://hg.mozilla.org/releases/mozilla-b2g18/rev/430d15b56dd2
status-b2g18:
--- → fixed
status-b2g18-v1.0.0:
--- → wontfix
status-b2g18-v1.0.1:
--- → wontfix
status-firefox20:
--- → wontfix
status-firefox21:
--- → wontfix
status-firefox22:
--- → fixed
Updated•11 years ago
|
Flags: in-moztrap-
You need to log in
before you can comment on or make changes to this bug.
Description
•