Closed Bug 716127 Opened 13 years ago Closed 13 years ago

Always sharing Geolocation fails to determine location on every other reload

Categories

(Core :: DOM: Geolocation, defect)

9 Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla12

People

(Reporter: jsmith, Assigned: jdm)

References

Details

Attachments

(4 files)

Litmus test: [geolocation] always allow sharing location Steps: 1. Go to http://mozqa.com/data/firefox/geolocation/position.html 2. When prompted to share location, select "always" 3. Reload the page Expected: The latitude and longitude for your current geographic location is shown. Actual: undefined is outputted to the web page Additional notes: Continuous reloads of the page after output will show the geolocation determined every other time. On other times, undefined is outputted.
Thank you for filing this bug, Jason! The testcase does not actually show any incorrect behaviour, it turns out - the geolocation request includes a timeout, and the "undefined" appears when the request times out and attempts to display an undefined error message (I don't believe the message property is actually in the spec). However, if you remove the timeout, the behaviour is still seen - it turns out that the geolocation service shuts down after 6 seconds unless there are outstanding requests, but it only considers watchPosition requests when making that decision.
Comment on attachment 586871 [details] [diff] [review] Avoid shutting down geolocation providers if one-shot updates are pending. Review of attachment 586871 [details] [diff] [review]: ----------------------------------------------------------------- This makes sense. bonus points for adding a mochitest.
Attachment #586871 - Flags: review?(doug.turner) → review+
Good call. I did a bit of cleaning up in the geolocation service to make this testable.
Attachment #586894 - Flags: review?(doug.turner)
Comment on attachment 586894 [details] [diff] [review] Test for overlapping geolocation provider shutdown and unfulfilled request. Review of attachment 586894 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/src/geolocation/nsGeolocation.cpp @@ +512,4 @@ > > nsresult nsGeolocationService::Init() > { > + Preferences::AddIntVarCache(&sProviderTimeout, "geo.timeout", 6000); use sProviderTimeout instead of 6000.
Attachment #586894 - Flags: review?(doug.turner) → review+
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla12
Currently broken on Firefox 12 and Nightly 13 with the following test case: Steps: 1. Go to 1. Go to http://mozqa.com/data/firefox/geolocation/position.html 2. When prompted to share location, select "share" 3. Reload the page 4. When prompted to share location, select "share" Expected: The coordinates of my position should be shown. Actual: undefined is returned. See attached log.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
OS: Windows 7 → All
Hardware: x86_64 → All
Oh, harumph. The automated test works because we just hammer at the URL without waiting for access point data. In real life, however, the patch here did not change the status quo (much). The problem is that we now don't shutdown the service, but we also don't trigger any further network requests until new access point data is received. If the timeout is removed from the testcase, the correct location is eventually displayed, but we should find a better solution.
This works for me, and makes sense. If we've previously seen a result, there's no reason to expect another one in the near future.
Attachment #601505 - Flags: review?(doug.turner)
Assignee: nobody → josh
Attachment #601505 - Flags: review?(doug.turner) → review+
Status: REOPENED → RESOLVED
Closed: 13 years ago13 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: