Closed Bug 833021 Opened 8 years ago Closed 7 years ago

Issue of checking on isBetterPosition

Categories

(Core :: DOM: Geolocation, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

()

RESOLVED INVALID
1.1 CS (11may)
blocking-b2g leo+

People

(Reporter: stephenl, Assigned: dougt)

Details

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/20100101 Firefox/18.0
Build ID: 20130116073211

Steps to reproduce:

Don't move the device, use WatchPosition() to monitor position changes


Actual results:

Sometimes (usually the first iteration), the position will continuously be reported with same position, same accuracy


Expected results:

Position shouldn't be reported if it is same position, according to http://www.w3.org/TR/geolocation-API/#api_description

In step 5.2.2 of the watch process: If the new position differs significantly from the previous position, invoke the successCallback with a new Position object that reflects the result of the acquisition operation. This step may be subject to callback rate limitation (see below).

http://cros-bm-p1.qualcomm.com:8080/source/xref/ics_strawberry/gecko/dom/src/geolocation/nsGeolocation.cpp#932

There is a condition: "oldAccuracy >= newAccuracy". The "=" sign should be removed
I am agreed with the solution suggested in comment 0.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Whiteboard: [mentor=jdm][lang=c++]
OS: Windows 7 → Gonk (Firefox OS)
Hardware: x86_64 → ARM
Actually, Stephen, does the new position have identical long/lat coordinates? I'd be happy to not report a position that shared long/lat/accuracy; I'm less happy about not reporting a position update that happens to share the accuracy of the last one.
The old and new lat/long are not exactly same always, they do differ in decimal value, but doesn’t the delta condition take care of that ?

There is a condition: if (delta > max_accuracy)
    return true;

I think comparing double values for exact match will not be correct.
Hello, will this bug be okay for a beginner? And if so, can I take this up?
Doug, what are your thoughts on comments 3 and 4?
Flags: needinfo?(doug.turner)
we probably want something like:

  if abs(delta - max_accuracy) < some value
    ...
Flags: needinfo?(doug.turner)
More specifically, we probably want to change the existing check:

>if (oldAccuracy >= newAccuracy)

to the following:

>if (abs(delta - max_accuracy) > 1.0)

Since accuracy is measured with metre granularity, we can check whether the difference between the change in position and the worse accuracy value is greater than the minimum accuracy unit.

However, not mentoring until I've thought about this more.
Whiteboard: [mentor=jdm][lang=c++]
needed for the 1.1 geolocation service, doug turner has the precise details
blocking-b2g: --- → leo+
Assignee: nobody → doug.turner
Assignee: doug.turner → mvines
(bouncing back to Doug so he can mark this bug invalid at the right time)
Assignee: mvines → doug.turner
Target Milestone: --- → 1.1 CS (11may)
this has been fixed (by making this bug invalid) by bug 866893.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.