зеркало из https://github.com/mozilla/gecko-dev.git
Bug 883522 - Add a message attribute to nsIDOMGeoPositionError.idl and a GetMessage method to nsGeolocation.cpp. r=jdm
This commit is contained in:
Родитель
a654dd2bd4
Коммит
8e2bc3ceaa
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -296,10 +296,6 @@ public:
|
|||
return mCode;
|
||||
}
|
||||
|
||||
void GetMessage(nsString& aRetVal) const {
|
||||
aRetVal.Truncate();
|
||||
}
|
||||
|
||||
void NotifyCallback(const GeoPositionErrorCallback& callback);
|
||||
private:
|
||||
~PositionError();
|
||||
|
|
Загрузка…
Ссылка в новой задаче