mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 813758 - Ensure permission for geolocation is tested in the parent process. r=bent
This commit is contained in:
parent
e74ae7978e
commit
8dc5deda97
@ -1833,6 +1833,9 @@ ContentParent::RecvAsyncMessage(const nsString& aMsg,
|
|||||||
bool
|
bool
|
||||||
ContentParent::RecvAddGeolocationListener()
|
ContentParent::RecvAddGeolocationListener()
|
||||||
{
|
{
|
||||||
|
if (!AssertAppProcessPermission(this, "geolocation")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (mGeolocationWatchID == -1) {
|
if (mGeolocationWatchID == -1) {
|
||||||
nsCOMPtr<nsIDOMGeoGeolocation> geo = do_GetService("@mozilla.org/geolocation;1");
|
nsCOMPtr<nsIDOMGeoGeolocation> geo = do_GetService("@mozilla.org/geolocation;1");
|
||||||
if (!geo) {
|
if (!geo) {
|
||||||
@ -1847,20 +1850,28 @@ ContentParent::RecvAddGeolocationListener()
|
|||||||
bool
|
bool
|
||||||
ContentParent::RecvRemoveGeolocationListener()
|
ContentParent::RecvRemoveGeolocationListener()
|
||||||
{
|
{
|
||||||
if (mGeolocationWatchID != -1) {
|
if (mGeolocationWatchID == -1) {
|
||||||
nsCOMPtr<nsIDOMGeoGeolocation> geo = do_GetService("@mozilla.org/geolocation;1");
|
return true;
|
||||||
if (!geo) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
geo->ClearWatch(mGeolocationWatchID);
|
|
||||||
mGeolocationWatchID = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
ContentParent::HandleEvent(nsIDOMGeoPosition* postion)
|
ContentParent::HandleEvent(nsIDOMGeoPosition* postion)
|
||||||
{
|
{
|
||||||
|
if (!AssertAppProcessPermission(this, "geolocation")) {
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
}
|
||||||
unused << SendGeolocationUpdate(GeoPosition(postion));
|
unused << SendGeolocationUpdate(GeoPosition(postion));
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user