Bug 1238873 - Handle the bug that if we take cached data, we might not get any update later. r=kchen. r=jdm.

This commit is contained in:
ywu 2016-02-15 17:56:00 +01:00
parent 4a0d4d375c
commit 9c64c6fe78

View File

@ -526,6 +526,12 @@ nsGeolocationRequest::Allow(JS::HandleValue aChoices)
// getCurrentPosition requests serviced by the cache
// will now be owned by the RequestSendLocationEvent
Update(lastPosition.position);
// After Update is called, getCurrentPosition finishes it's job.
if (!mIsWatchPositionRequest) {
return NS_OK;
}
} else {
// if it is not a watch request and timeout is 0,
// invoke the errorCallback (if present) with TIMEOUT code
@ -534,14 +540,15 @@ nsGeolocationRequest::Allow(JS::HandleValue aChoices)
return NS_OK;
}
// Kick off the geo device, if it isn't already running
nsresult rv = gs->StartDevice(GetPrincipal());
}
if (NS_FAILED(rv)) {
// Location provider error
NotifyError(nsIDOMGeoPositionError::POSITION_UNAVAILABLE);
return NS_OK;
}
// Kick off the geo device, if it isn't already running
nsresult rv = gs->StartDevice(GetPrincipal());
if (NS_FAILED(rv)) {
// Location provider error
NotifyError(nsIDOMGeoPositionError::POSITION_UNAVAILABLE);
return NS_OK;
}
if (mLocator->ContainsRequest(this)) {