Closed
Bug 858827
Opened 13 years ago
Closed 10 years ago
Error callback should be called when timeout is zero and there's no cached position for getCurrentLocation
Categories
(Core :: DOM: Geolocation, defect)
Core
DOM: Geolocation
Tracking
()
RESOLVED
FIXED
mozilla47
| Tracking | Status | |
|---|---|---|
| firefox47 | --- | fixed |
People
(Reporter: ggp, Assigned: alchen)
Details
Attachments
(2 files, 1 obsolete file)
|
494 bytes,
text/plain
|
nextor
:
feedback+
|
Details |
|
4.06 KB,
patch
|
Details | Diff | Splinter Review |
The spec says setting timeout to zero in getCurrentLocation should have the error callback be called unless there is a cached version with suitable age (that is, smaller than maximumAge) to be used.
In particular, setting timeout to 0 and maximumAge to a high number (potentially Infinity) should result in a cached position be returned if possible, without ever contacting the geolocation provider.
Our implementation, however, sets no timeout in that case, and if there's no cached position to be used, waits until a new position is obtained from the geolocation provider however long that takes.
Attachment #8693708 -
Flags: feedback+
| Assignee | ||
Comment 2•10 years ago
|
||
Here is a fix for this symptom.
Currently, we don't handle the case when timeout is zero.
However, following the W3C spec, "Error callback" should be called with error code('TIMEOUT') when timeout is zero and there's no cached position for getCurrentLocation.
Attachment #8710817 -
Flags: review?(kchen)
Attachment #8710817 -
Flags: review?(josh)
| Assignee | ||
Comment 3•10 years ago
|
||
For watchPosition, there is no definition in W3C spec.
In my opinion, we can keep the current behavior.
Comment 4•10 years ago
|
||
Comment on attachment 8710817 [details] [diff] [review]
(0122) Add a handling for getCurrentLocation when timeout is zero
Review of attachment 8710817 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/geolocation/nsGeolocation.cpp
@@ +512,5 @@
> Update(lastPosition.position);
> } else {
> + // if it is not a watch request and timeout is 0,
> + // invoke the errorCallback (if present) with TIMEOUT code
> + if ((mOptions && (mOptions->mTimeout == 0) > 0) && !mIsWatchPositionRequest) {
I think this can be simplified to `if (mOptions && mOptions->Timeout == 0 && !mIsWatchPositionRequest) {`
Attachment #8710817 -
Flags: review?(josh) → review+
Comment 5•10 years ago
|
||
Oh, and a test for this would be nice :)
| Assignee | ||
Comment 6•10 years ago
|
||
Updated•10 years ago
|
Attachment #8710817 -
Flags: review?(kchen)
| Assignee | ||
Comment 7•10 years ago
|
||
| Assignee | ||
Comment 8•10 years ago
|
||
| Assignee | ||
Comment 9•10 years ago
|
||
| Assignee | ||
Comment 10•10 years ago
|
||
The following is the try server result.
It looks fine.
https://treeherder.mozilla.org/#/jobs?repo=try&revision=3e53aae466d4
Attachment #8710817 -
Attachment is obsolete: true
| Assignee | ||
Updated•10 years ago
|
Keywords: checkin-needed
Comment 11•10 years ago
|
||
Keywords: checkin-needed
Comment 12•10 years ago
|
||
| bugherder | ||
Status: NEW → RESOLVED
Closed: 10 years ago
status-firefox47:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla47
Comment 13•10 years ago
|
||
| bugherder | ||
Comment 14•10 years ago
|
||
Set owner to Alphan since he worked on and resolved this bug.
Assignee: nobody → alchen
You need to log in
before you can comment on or make changes to this bug.
Description
•