зеркало из https://github.com/mozilla/gecko-dev.git
Bug 813758 - Ensure permission for geolocation is tested in the parent process. r=bent
This commit is contained in:
Родитель
81aa9b4c66
Коммит
4704960aa6
|
@ -1833,6 +1833,9 @@ ContentParent::RecvAsyncMessage(const nsString& aMsg,
|
|||
bool
|
||||
ContentParent::RecvAddGeolocationListener()
|
||||
{
|
||||
if (!AssertAppProcessPermission(this, "geolocation")) {
|
||||
return false;
|
||||
}
|
||||
if (mGeolocationWatchID == -1) {
|
||||
nsCOMPtr<nsIDOMGeoGeolocation> geo = do_GetService("@mozilla.org/geolocation;1");
|
||||
if (!geo) {
|
||||
|
@ -1847,20 +1850,28 @@ ContentParent::RecvAddGeolocationListener()
|
|||
bool
|
||||
ContentParent::RecvRemoveGeolocationListener()
|
||||
{
|
||||
if (mGeolocationWatchID != -1) {
|
||||
nsCOMPtr<nsIDOMGeoGeolocation> geo = do_GetService("@mozilla.org/geolocation;1");
|
||||
if (!geo) {
|
||||
return true;
|
||||
}
|
||||
geo->ClearWatch(mGeolocationWatchID);
|
||||
mGeolocationWatchID = -1;
|
||||
if (mGeolocationWatchID == -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!AssertAppProcessPermission(this, "geolocation")) {
|
||||
return false;
|
||||
}
|
||||
nsCOMPtr<nsIDOMGeoGeolocation> geo = do_GetService("@mozilla.org/geolocation;1");
|
||||
if (!geo) {
|
||||
return true;
|
||||
}
|
||||
geo->ClearWatch(mGeolocationWatchID);
|
||||
mGeolocationWatchID = -1;
|
||||
return true;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ContentParent::HandleEvent(nsIDOMGeoPosition* postion)
|
||||
{
|
||||
if (!AssertAppProcessPermission(this, "geolocation")) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
unused << SendGeolocationUpdate(GeoPosition(postion));
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче