Bug 463040 - Use Position Error Constants. r/sr=jst

This commit is contained in:
Doug Turner 2008-11-12 08:31:25 -08:00
parent fbd45fcd31
commit edb15866cb
3 changed files with 10 additions and 10 deletions

View File

@ -37,9 +37,14 @@
#include "domstubs.idl"
[scriptable, uuid(39928BF8-4466-4A64-BF5F-97114A5CD171)]
[scriptable, uuid(1B493214-4E58-4A40-AA4C-1AB70C6DDBEC)]
interface nsIDOMGeoPositionError : nsISupports
{
const unsigned short UNKNOWN_ERROR = 0;
const unsigned short PERMISSION_DENIED = 1;
const unsigned short POSITION_UNAVAILABLE = 2;
const unsigned short TIMEOUT = 3;
readonly attribute short code;
readonly attribute DOMString message;
};

View File

@ -159,7 +159,7 @@ nsGeolocationRequest::Init()
// check to see if we have a geolocation provider, if not, notify an error and bail.
nsRefPtr<nsGeolocationService> geoService = nsGeolocationService::GetInstance();
if (!geoService->HasGeolocationProvider()) {
NotifyError(NS_GEO_ERROR_CODE_LOCATION_PROVIDER_ERROR);
NotifyError(nsIDOMGeoPositionError::POSITION_UNAVAILABLE);
return NS_ERROR_FAILURE;;
}
@ -196,7 +196,7 @@ nsGeolocationRequest::Notify(nsITimer* aTimer)
// ::Cancel, just a different error
if (!mHasSentData) {
NotifyError(NS_GEO_ERROR_CODE_TIMEOUT);
NotifyError(nsIDOMGeoPositionError::TIMEOUT);
// remove ourselves from the locator's callback lists.
mLocator->RemoveRequest(this);
}
@ -226,7 +226,7 @@ nsGeolocationRequest::GetRequestingWindow(nsIDOMWindow * *aRequestingWindow)
NS_IMETHODIMP
nsGeolocationRequest::Cancel()
{
NotifyError(NS_GEO_ERROR_CODE_PERMISSION_ERROR);
NotifyError(nsIDOMGeoPositionError::PERMISSION_DENIED);
// remove ourselves from the locators callback lists.
mLocator->RemoveRequest(this);
@ -242,7 +242,7 @@ nsGeolocationRequest::Allow()
if (NS_FAILED(rv)) {
// Location provider error
NotifyError(NS_GEO_ERROR_CODE_LOCATION_PROVIDER_ERROR);
NotifyError(nsIDOMGeoPositionError::POSITION_UNAVAILABLE);
return NS_OK;
}

View File

@ -55,11 +55,6 @@
#include "nsIGeolocationProvider.h"
#define NS_GEO_ERROR_CODE_PERMISSION_ERROR 1
#define NS_GEO_ERROR_CODE_LOCATION_PROVIDER_ERROR 2
#define NS_GEO_ERROR_CODE_POSITION_NOT_FOUND 3
#define NS_GEO_ERROR_CODE_TIMEOUT 4
class nsGeolocationService;
class nsGeolocation;