Bug 1612376 - P1. Add UpdateStorageAccessGranted ipc method to PWindowGlobal r=timhuang,baku

This API will be used when we need to udpate a granted stroage
permission to child processes.

Differential Revision: https://phabricator.services.mozilla.com/D72303
This commit is contained in:
Dimi Lee 2020-04-29 14:48:13 +00:00
Родитель 3c4dedd5d4
Коммит 2d7734d9bb
3 изменённых файлов: 28 добавлений и 0 удалений

Просмотреть файл

@ -67,6 +67,8 @@ child:
async DispatchSecurityPolicyViolation(nsString aViolationEventJSON);
async SaveStorageAccessGranted(nsCString aPermissionKey);
both:
async RawMessage(JSWindowActorMessageMeta aMetadata, ClonedMessageData aData,
ClonedMessageData aStack);

Просмотреть файл

@ -6,6 +6,7 @@
#include "mozilla/dom/WindowGlobalChild.h"
#include "mozilla/AntiTrackingUtils.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/dom/WindowGlobalParent.h"
#include "mozilla/dom/BrowsingContext.h"
@ -392,6 +393,28 @@ mozilla::ipc::IPCResult WindowGlobalChild::RecvGetSecurityInfo(
return IPC_OK();
}
mozilla::ipc::IPCResult WindowGlobalChild::RecvSaveStorageAccessGranted(
const nsCString& aPermissionKey) {
nsCOMPtr<nsPIDOMWindowInner> window = GetWindowGlobal();
if (!window) {
return IPC_OK();
}
#ifdef DEBUG
nsAutoCString trackingOrigin;
nsCOMPtr<nsIPrincipal> principal = DocumentPrincipal();
if (principal && NS_SUCCEEDED(principal->GetOriginNoSuffix(trackingOrigin))) {
nsAutoCString permissionKey;
AntiTrackingUtils::CreateStoragePermissionKey(trackingOrigin,
permissionKey);
MOZ_ASSERT(permissionKey == aPermissionKey);
}
#endif
window->SaveStorageAccessGranted(aPermissionKey);
return IPC_OK();
}
mozilla::ipc::IPCResult WindowGlobalChild::RecvDispatchSecurityPolicyViolation(
const nsString& aViolationEventJSON) {
nsGlobalWindowInner* window = GetWindowGlobal();

Просмотреть файл

@ -142,6 +142,9 @@ class WindowGlobalChild final : public WindowGlobalActor,
mozilla::ipc::IPCResult RecvGetSecurityInfo(
GetSecurityInfoResolver&& aResolve);
mozilla::ipc::IPCResult RecvSaveStorageAccessGranted(
const nsCString& aPermissionKey);
virtual void ActorDestroy(ActorDestroyReason aWhy) override;
private: