mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backing out 8c3bd23a1567 due to X orange. r=me a=me
This commit is contained in:
parent
ea4c9fbb78
commit
b9d312b02f
@ -1943,49 +1943,8 @@ ContentParent::RecvAsyncMessage(const nsString& aMsg,
|
||||
}
|
||||
|
||||
bool
|
||||
ContentParent::RecvAddGeolocationListener(const IPC::Principal& aPrincipal)
|
||||
ContentParent::RecvAddGeolocationListener()
|
||||
{
|
||||
#ifdef MOZ_PERMISSIONS
|
||||
|
||||
nsIPrincipal* principal = aPrincipal;
|
||||
uint32_t principalAppId;
|
||||
nsresult rv = principal->GetAppId(&principalAppId);
|
||||
if (NS_FAILED(rv)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool found = false;
|
||||
const InfallibleTArray<PBrowserParent*>& browsers = ManagedPBrowserParent();
|
||||
for (uint32_t i = 0; i < browsers.Length(); ++i) {
|
||||
|
||||
TabParent* tab = static_cast<TabParent*>(browsers[i]);
|
||||
nsCOMPtr<mozIApplication> app = tab->GetOwnOrContainingApp();
|
||||
uint32_t appId;
|
||||
app->GetLocalId(&appId);
|
||||
if (appId == principalAppId) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// We need to ensure that this permission has been set.
|
||||
// If it hasn't, just noop
|
||||
nsCOMPtr<nsIPermissionManager> pm = do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||
if (!pm) {
|
||||
return false;
|
||||
}
|
||||
uint32_t permission = nsIPermissionManager::UNKNOWN_ACTION;
|
||||
rv = pm->TestPermissionFromPrincipal(principal, "geolocation", &permission);
|
||||
if (NS_FAILED(rv) || permission != nsIPermissionManager::ALLOW_ACTION) {
|
||||
KillHard();
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (mGeolocationWatchID == -1) {
|
||||
nsCOMPtr<nsIDOMGeoGeolocation> geo = do_GetService("@mozilla.org/geolocation;1");
|
||||
if (!geo) {
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsDataHashtable.h"
|
||||
#include "nsHashKeys.h"
|
||||
#include "PermissionMessageUtils.h"
|
||||
|
||||
#define CHILD_PROCESS_SHUTDOWN_MESSAGE NS_LITERAL_STRING("child-process-shutdown")
|
||||
|
||||
@ -301,7 +300,7 @@ private:
|
||||
virtual bool RecvAsyncMessage(const nsString& aMsg,
|
||||
const ClonedMessageData& aData);
|
||||
|
||||
virtual bool RecvAddGeolocationListener(const IPC::Principal& aPrincipal);
|
||||
virtual bool RecvAddGeolocationListener();
|
||||
virtual bool RecvRemoveGeolocationListener();
|
||||
virtual bool RecvSetGeolocationHigherAccuracy(const bool& aEnable);
|
||||
|
||||
|
@ -23,10 +23,10 @@ include DOMTypes;
|
||||
include URIParams;
|
||||
|
||||
include "mozilla/chrome/RegistryMessageUtils.h";
|
||||
include "mozilla/dom/PermissionMessageUtils.h";
|
||||
include "mozilla/dom/TabMessageUtils.h";
|
||||
include "mozilla/layout/RenderFrameUtils.h";
|
||||
include "mozilla/net/NeckoMessageUtils.h";
|
||||
|
||||
include "nsGeoPositionIPCSerialiser.h";
|
||||
|
||||
using GeoPosition;
|
||||
@ -36,7 +36,6 @@ using ChromePackage;
|
||||
using ResourceMapping;
|
||||
using OverrideMapping;
|
||||
using IPC::Permission;
|
||||
using IPC::Principal;
|
||||
using mozilla::null_t;
|
||||
using mozilla::void_t;
|
||||
using mozilla::dom::AudioChannelType;
|
||||
@ -396,7 +395,7 @@ parent:
|
||||
nsCString aContentDisposition, bool aForceSave,
|
||||
int64_t aContentLength, OptionalURIParams aReferrer);
|
||||
|
||||
AddGeolocationListener(Principal principal);
|
||||
AddGeolocationListener();
|
||||
RemoveGeolocationListener();
|
||||
SetGeolocationHigherAccuracy(bool enable);
|
||||
|
||||
|
@ -424,7 +424,7 @@ nsGeolocationRequest::Allow()
|
||||
|
||||
// Kick off the geo device, if it isn't already running
|
||||
nsRefPtr<nsGeolocationService> gs = nsGeolocationService::GetGeolocationService();
|
||||
nsresult rv = gs->StartDevice(GetPrincipal(), isPrivate);
|
||||
nsresult rv = gs->StartDevice(isPrivate);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
// Location provider error
|
||||
@ -541,15 +541,6 @@ nsGeolocationRequest::SendLocation(nsIDOMGeoPosition* aPosition)
|
||||
}
|
||||
}
|
||||
|
||||
nsIPrincipal*
|
||||
nsGeolocationRequest::GetPrincipal()
|
||||
{
|
||||
if (!mLocator) {
|
||||
return nullptr;
|
||||
}
|
||||
return mLocator->GetPrincipal();
|
||||
}
|
||||
|
||||
bool
|
||||
nsGeolocationRequest::Update(nsIDOMGeoPosition* aPosition, bool aIsBetter)
|
||||
{
|
||||
@ -961,7 +952,7 @@ nsGeolocationService::GetCachedPosition()
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGeolocationService::StartDevice(nsIPrincipal *aPrincipal, bool aRequestPrivate)
|
||||
nsGeolocationService::StartDevice(bool aRequestPrivate)
|
||||
{
|
||||
if (!sGeoEnabled || sGeoInitPending) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
@ -974,7 +965,7 @@ nsGeolocationService::StartDevice(nsIPrincipal *aPrincipal, bool aRequestPrivate
|
||||
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Content) {
|
||||
ContentChild* cpc = ContentChild::GetSingleton();
|
||||
cpc->SendAddGeolocationListener(IPC::Principal(aPrincipal));
|
||||
cpc->SendAddGeolocationListener();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,6 @@ class nsGeolocationRequest
|
||||
bool IsActive() {return !mCleared;}
|
||||
bool Allowed() {return mAllowed;}
|
||||
void SetTimeoutTimer();
|
||||
nsIPrincipal* GetPrincipal();
|
||||
|
||||
~nsGeolocationRequest();
|
||||
|
||||
@ -126,7 +125,7 @@ public:
|
||||
PRBool IsBetterPosition(nsIDOMGeoPosition *aSomewhere);
|
||||
|
||||
// Find and startup a geolocation device (gps, nmea, etc.)
|
||||
nsresult StartDevice(nsIPrincipal* aPrincipal, bool aRequestPrivate);
|
||||
nsresult StartDevice(bool aRequestPrivate);
|
||||
|
||||
// Stop the started geolocation device (gps, nmea, etc.)
|
||||
void StopDevice();
|
||||
|
Loading…
Reference in New Issue
Block a user