Bug 883522 - Add a message attribute to nsIDOMGeoPositionError.idl and a GetMessage method to nsGeolocation.cpp. r=jdm

This commit is contained in:
Maria Grazia Alastra 2013-07-16 09:11:29 -04:00
parent f9d83485ab
commit 9112d46f2c
3 changed files with 22 additions and 5 deletions

View File

@ -5,7 +5,7 @@
#include "domstubs.idl"
[scriptable, uuid(AD9FA4C8-EC71-4B2D-8294-9ADF06DDEC32)]
[scriptable, uuid(85255CC3-07BA-49FD-BC9B-18D2963DAF7F)]
interface nsIDOMGeoPositionError : nsISupports
{
const unsigned short PERMISSION_DENIED = 1;
@ -13,4 +13,5 @@ interface nsIDOMGeoPositionError : nsISupports
const unsigned short TIMEOUT = 3;
readonly attribute short code;
readonly attribute AString message;
};

View File

@ -255,6 +255,26 @@ PositionError::GetCode(int16_t *aCode)
return NS_OK;
}
NS_IMETHODIMP
PositionError::GetMessage(nsAString& aMessage)
{
switch (mCode)
{
case nsIDOMGeoPositionError::PERMISSION_DENIED:
aMessage = NS_LITERAL_STRING("User denied geolocation prompt");
break;
case nsIDOMGeoPositionError::POSITION_UNAVAILABLE:
aMessage = NS_LITERAL_STRING("Unknown error acquiring position");
break;
case nsIDOMGeoPositionError::TIMEOUT:
aMessage = NS_LITERAL_STRING("Position acquisition timed out");
break;
default:
break;
}
return NS_OK;
}
Geolocation*
PositionError::GetParentObject() const
{

View File

@ -296,10 +296,6 @@ public:
return mCode;
}
void GetMessage(nsString& aRetVal) const {
aRetVal.Truncate();
}
void NotifyCallback(const GeoPositionErrorCallback& callback);
private:
~PositionError();