Closed Bug 590030 Opened 14 years ago Closed 14 years ago

Both success and error geolocation callbacks can be called

Categories

(Core :: DOM: Geolocation, defect)

x86
Windows CE
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jdm, Assigned: jdm)

Details

Attachments

(1 file)

Consider a simple testcase:

  navigator.geolocation.getCurrentPosition(function(p) alert("woo!"), function(p) alert("boo!"), {timeout:5, maxAge:1});

When using the wifi location provider, this will cause both callbacks to be executed when the request is allowed. First the error will fire due to the timeout, but only after the geolocation retrieval has been initiated.  The alert spins the event loop, which happens to kick off the wifi monitor which is a sync proxy.  This triggers a geolocation update, so the success callback is triggered.
The easiest fix here is to not trigger the error callbacks until we've removed the request from the list of pending ones that the geolocator can update.
Attached patch PatchSplinter Review
Assignee: nobody → josh
Attachment #468616 - Flags: review?(doug.turner)
Attachment #468616 - Flags: review?(doug.turner) → review+
as always, thanks Josh!
Keywords: checkin-needed
Attachment #468616 - Flags: approval2.0?
This patch has bitrotted a bit, for the record.
OS: Linux → Windows CE
Attachment #468616 - Flags: approval2.0? → approval2.0+
http://hg.mozilla.org/mozilla-central/rev/9fb7937e306d
Status: NEW → RESOLVED
Closed: 14 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: