Bug 1733556 - Perform Permissions Policy check in navigator.permissions.query for "storage-access" - r=anti-tracking-reviewers,pbz

Differential Revision: https://phabricator.services.mozilla.com/D182374
This commit is contained in:
Benjamin VanderSloot 2023-07-19 14:51:13 +00:00
parent 7b05b40061
commit bd24eefece

View File

@ -9,6 +9,7 @@
#include "mozilla/AntiTrackingUtils.h"
#include "mozilla/dom/WindowGlobalChild.h"
#include "mozilla/dom/BrowsingContext.h"
#include "mozilla/dom/FeaturePolicyUtils.h"
#include "mozilla/dom/PermissionStatus.h"
#include "mozilla/dom/PermissionStatusBinding.h"
@ -48,6 +49,13 @@ StorageAccessPermissionStatus::UpdateState() {
return SimplePromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
}
// Perform a Permission Policy Request
if (!FeaturePolicyUtils::IsFeatureAllowed(window->GetExtantDoc(),
u"storage-access"_ns)) {
mState = PermissionState::Prompt;
return SimplePromise::CreateAndResolve(NS_OK, __func__);
}
RefPtr<StorageAccessPermissionStatus> self(this);
return wgc->SendHasStorageAccessPermission()->Then(
GetMainThreadSerialEventTarget(), __func__,