W3C home > Mailing lists > Public > public-geolocation@w3.org > August 2011

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

From: louis-rémi Babé <lrbabe@gmail.com>
Date: Tue, 23 Aug 2011 17:58:04 +0200
Message-ID: <CALXxKfAdBp=aHBrykMvAS2w7RTB2NmoWfdtpyRSG9C1XHMERLw@mail.gmail.com>
To: Doug Turner <doug.turner@gmail.com>
Cc: public-geolocation@w3.org
Yes, this is what I want to do.
This kind of API shouldn't be able to control browser features such as
permission prompt.

Looking at NetworkGeolocationProvider.js in Mozilla central, this
doesn't appear easy to do.
And it is impossible to do in all other browsers.

I'm aware that allowing developers to debug an API is not usually part
of that API design. But most APIs are still easy to debug (it is
possible to generate custom events to debug event based APIs for
instance). Developers are able to create their own tools and do not
have to wait for browser vendors to implement ready to use tools.

The geolocation API can currently be only debugged if you own the
source code of the application and insert "debugging hooks".

I think this situation is not ideal. And I think giving users an easy
way to control the position info sent to websites is important too.


2011/8/17 Doug Turner <doug.turner@gmail.com>:
> So, in general, you want a way to setup a mock position for testing purposes?  Do you also want to be able to control the permission prompt in this case?
> In FF's case, it is trivial to write an add-on that does this - something that you can share with other users.  (In fact, our test infrastructure basically has exactly this without the add-on packaging).
> Doug
> On Aug 17, 2011, at 8:31 AM, louis-rémi Babé wrote:
>> 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 Tuesday, 23 August 2011 15:58:51 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:51:02 UTC