зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1494476 - Part 0: Add the HasUserInteraction function r=baku
Differential Revision: https://phabricator.services.mozilla.com/D8238 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
a67ea2fed4
Коммит
4046ce084e
|
@ -1228,3 +1228,21 @@ AntiTrackingCommon::StoreUserInteractionFor(nsIPrincipal* aPrincipal)
|
|||
_spec), uri);
|
||||
cc->SendStoreUserInteractionAsPermission(IPC::Principal(aPrincipal));
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
AntiTrackingCommon::HasUserInteraction(nsIPrincipal* aPrincipal)
|
||||
{
|
||||
nsCOMPtr<nsIPermissionManager> pm = services::GetPermissionManager();
|
||||
if (NS_WARN_IF(!pm)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t result = 0;
|
||||
nsresult rv =
|
||||
pm->TestPermissionFromPrincipal(aPrincipal, USER_INTERACTION_PERM, &result);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return result == nsIPermissionManager::ALLOW_ACTION;
|
||||
}
|
||||
|
|
|
@ -111,6 +111,9 @@ public:
|
|||
static void
|
||||
StoreUserInteractionFor(nsIPrincipal* aPrincipal);
|
||||
|
||||
static bool
|
||||
HasUserInteraction(nsIPrincipal* aPrincipal);
|
||||
|
||||
// For IPC only.
|
||||
static void
|
||||
SaveFirstPartyStorageAccessGrantedForOriginOnParentProcess(nsIPrincipal* aPrincipal,
|
||||
|
|
Загрузка…
Ссылка в новой задаче