Re: Inconsistent definition of timeout / maximumAge in Geo v1

Hi Dom,

I think it's not necessary to use 'Infinity' if a dictionary is used, as
its members can be 'present' or 'not present'.

How about rephrasing step 5 for getCurrentPosition as follows:
"If timeout is present, start a timer that will fire after the number of
milliseconds denoted by the value of the timeout variable. When the timer
fires, cancel any ongoing location acquisition operations associated with
this instance of the steps, invoke the errorCallback (if present) with a
new PositionError object whose code attribute is set to TIMEOUT, and exit
this set of steps."

This avoids mentioning 'Infinity' altogether. Also, as currently phrased
the algorithm is bad anyway, who sets a timer for Infinity? In Blink we
just don't set the timer, and I expect all other implementations do the
same.

Step 2 regarding maximumAge can be rephrased in a similar way:
"If a cached Position object is available, and maximumAge is not present,
or if maximumAge is present and greater than or equal to the age of the
Position object, invoke the successCallback with the cached Position object
as a parameter and exit this set of steps."

All remaining mentions of Infinity could be similarly removed, but there's
quite a few of them spread throughout the spec.

Using [Clamp] for both timeout and maximumAge seems like a sane idea.

Regards,

Michael




On Mon, Feb 3, 2014 at 9:01 PM, Ravi Dandu <ravidandu99@gmail.com> wrote:

> Hi Dom,
>          Good points. Some comments:
>
> 1) 0 cannot be used to represent Infinity in this case, as the value 0 has
> meaning here:
>       1a) timeout =0, it means you can only retreive cached poisition, you
> don't have time to do any new location activity (eg: gps, wifi scanning),
>       1b) maximumAge=0, means don't use any cached position, compute a
> "new" position now.
>
>   Your test case: If timeout is explicitly specified as 0, and no
> maximumAge specified( i.e. it will use default of 0), then you should
> always get timeout error. Since the maximumAge choice of zero forces you to
> get a "new" position, while timeout of zero forces you not to have time to
> do any new activity, except retrieve cached position.
>
> 3) You are right about "long maximumAge" responding to "Infinity" might
> not be consistent with long defn by WebIDL. (
> http://www.w3.org/TR/WebIDL/#idl-long ). I'm very new at this, so we
> should get more experts on WebIDL to comment on this.
>      In Javascript, type is not explicit, so variables like 'var maxAge =
> Infinity' may be getting cast  somewhere along the way to a large number in
> implementation when interpreted as long. (If implementations are working
> properly)
>
> 2) the timeout attribute in the PositionOptions interface is defined as
> "long", with a default value of Infinity. This may still be consistent with
> WebIDL, as the spec states that the IMPLEMENTATION should consider absence
> of this parameter as an INTERNAL value of infinity: it does not explicitly
> state that a value of "Infinity" can be assigned to "timeout". This is a
> terminology argument. My bad. couldn't resist;)
>
> I agree with you. We should get this clarified if long" cannot take value
> "Infinity" in WebIDL.
> Regards
> Ravi Dandu
> Mozilla Corp, Product Management
>
> On Mon, Feb 3, 2014 at 8:34 AM, Dominique Hazael-Massieux <dom@w3.org>wrote:
>
>> Hi,
>>
>> While looking at Ms2ger's error reports [1] suggesting to turn
>> PositionOptions in a dictionary in Geo v1 [2], I discovered the
>> following inconsistency in the specification:
>> * the timeout attribute in the PositionOptions interface is defined as
>> "long", with a default value of Infinity
>> * the maximumAge attribute of that same interface is also of type
>> "long", and described in prose as responding to the Infinity value
>> * yet, the "long" type doesn't accept "Infinity" as a valid value (more
>> specifically, it casts it to "0")
>>
>> As far as I can tell, WebIDL doesn't have the notion of infinite integer
>> values, so I'm not quite sure what the correct way to handle this is.
>>
>> In XHR, timeout = 0 means no timeout, but at least in Chrome, timeout =
>> 0 triggers immediately the timeout error. (for some reason, my Firefox
>> is not cooperating with my testing of this)
>>
>> And the = 0 trick wouldn't do for maximumAge in any case.
>>
>> Thoughts?
>>
>> Dom
>>
>> 1.
>> http://lists.w3.org/Archives/Public/public-geolocation/2012Jan/0001.html
>> 2. http://www.w3.org/TR/geolocation-API/
>>
>>
>>
>>
>

Received on Tuesday, 11 February 2014 18:25:12 UTC