The default bug view has changed. See this FAQ.

Always sharing Geolocation fails to determine location on every other reload

RESOLVED FIXED in mozilla12

Status

()

Core
Geolocation
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: jsmith, Assigned: jdm)

Tracking

9 Branch
mozilla12
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(4 attachments)

(Reporter)

Description

5 years ago
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.
(Assignee)

Comment 1

5 years ago
Created attachment 586871 [details] [diff] [review]
Avoid shutting down geolocation providers if one-shot updates are pending.
Attachment #586871 - Flags: review?(doug.turner)
(Assignee)

Comment 2

5 years ago
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 3

5 years ago
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+
(Assignee)

Comment 4

5 years ago
Created attachment 586894 [details] [diff] [review]
Test for overlapping geolocation provider shutdown and unfulfilled request.

Good call. I did a bit of cleaning up in the geolocation service to make this testable.
Attachment #586894 - Flags: review?(doug.turner)

Comment 5

5 years ago
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+
(Assignee)

Comment 6

5 years ago
http://hg.mozilla.org/integration/mozilla-inbound/rev/e8544d859847
http://hg.mozilla.org/integration/mozilla-inbound/rev/4998e366dd09
https://hg.mozilla.org/mozilla-central/rev/e8544d859847
https://hg.mozilla.org/mozilla-central/rev/4998e366dd09
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla12
(Reporter)

Updated

5 years ago
Duplicate of this bug: 731444
(Reporter)

Comment 9

5 years ago
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 → ---
(Reporter)

Updated

5 years ago
OS: Windows 7 → All
Hardware: x86_64 → All
(Reporter)

Comment 10

5 years ago
Created attachment 601446 [details]
Console Log Wifi Geo Share Location Twice Quickly
(Assignee)

Comment 11

5 years ago
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.
(Assignee)

Comment 12

5 years ago
Created attachment 601505 [details] [diff] [review]
When the network geolocation provider is told to watch for wifi changes, force a change to occur to avoid indefinite waiting.

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)

Updated

5 years ago
Assignee: nobody → josh

Updated

5 years ago
Attachment #601505 - Flags: review?(doug.turner) → review+
(Assignee)

Comment 13

5 years ago
http://hg.mozilla.org/integration/mozilla-inbound/rev/e485c2c74c4d
https://hg.mozilla.org/mozilla-central/rev/e485c2c74c4d
Status: REOPENED → RESOLVED
Last Resolved: 5 years ago5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.