зеркало из https://github.com/mozilla/gecko-dev.git
Bug 824432 - Don't cancel request if it's a watch request. r=jdm
This commit is contained in:
Родитель
e520841464
Коммит
7179dd84bd
|
@ -340,15 +340,22 @@ nsGeolocationRequest::NotifyError(int16_t errorCode)
|
|||
NS_IMETHODIMP
|
||||
nsGeolocationRequest::Notify(nsITimer* aTimer)
|
||||
{
|
||||
// If we haven't gotten an answer from the geolocation
|
||||
// provider yet, cancel the request. Same logic as
|
||||
// ::Cancel, just a different error
|
||||
if (mCleared) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// remove ourselves from the locator's callback lists.
|
||||
// If we haven't gotten an answer from the geolocation
|
||||
// provider yet, fire a TIMEOUT error and reset the timer.
|
||||
if (!mIsWatchPositionRequest) {
|
||||
mLocator->RemoveRequest(this);
|
||||
}
|
||||
|
||||
NotifyError(nsIDOMGeoPositionError::TIMEOUT);
|
||||
|
||||
mTimeoutTimer = nullptr;
|
||||
if (mIsWatchPositionRequest) {
|
||||
SetTimeoutTimer();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,13 +26,20 @@ resume_geolocationProvider();
|
|||
force_prompt(true);
|
||||
|
||||
var watchID;
|
||||
var times = 0;
|
||||
|
||||
function errorCallback(err) {
|
||||
ok(err.code == err.TIMEOUT, "ensure error is a timeout.");
|
||||
times++;
|
||||
|
||||
// make sure we got at least 3 times errorCallback
|
||||
if (times >= 3) {
|
||||
navigator.geolocation.clearWatch(watchID);
|
||||
resume_geolocationProvider();
|
||||
reset_prompt();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
|
||||
function successCallback(position) {
|
||||
// Now that we got a success callback, lets try to ensure
|
||||
|
|
Загрузка…
Ссылка в новой задаче