geolocation.setCurrentPosition({...}): a way to debug geolocation and give more power to users.

Hi all,

I'm currently frustrated by the lack of debuging tools regarding the
geolocation API, as opposed to other event based device APIs such as
deviceorientation.

To debug deviceorientation, I can simply generate a custom event right
from my js console using create/init/dispatchEvent.
And I can do so on any website listening to deviceorientation events
(I don't need to be the author).

It is impossible to do the same thing with the geolocation API. To
debug it I need the following kind of code:

    // can't use inline handler
    function positionHandler( event ) {
        ...
    }
    navigator.geolocation.watchPosition( positionHandler );
    // need to create a global "debug object" to make the
    // positionHandler available from my js console
    window.updatePosition = positionHandler;

It requires to add one extra line to my code for debugging purpose,
and I need to be the author of the website.
I can alternatively write a geolocation provider for my Web browser,
but that requires a far larger amount of work, a kind of knowledge
that Web developers do not necessarily have, and it isn't a cross
browser solution.

geolocation.setCurrentPosition() would allow to create a fake position
in the flow of "real" position updates.
Users could simply ignore the "permission prompt" on a website and use
setCurrentPosition() to have complete control over the position
updates provided to a website.

Thank you in advance for your feedback,
louisremi@mozilla.com

Received on Wednesday, 17 August 2011 15:32:02 UTC