Source code

Revision control

Other Tools

1
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
3
/* This Source Code Form is subject to the terms of the Mozilla Public
4
* License, v. 2.0. If a copy of the MPL was not distributed with this
5
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7
#ifndef mozilla_dom_PartitionedLocalStorage_h
8
#define mozilla_dom_PartitionedLocalStorage_h
9
10
#include "Storage.h"
11
12
class nsIPrincipal;
13
14
namespace mozilla {
15
namespace dom {
16
17
class SessionStorageCache;
18
19
// PartitionedLocalStorage is a in-memory-only storage exposed to trackers. It
20
// doesn't share data with other contexts.
21
22
class PartitionedLocalStorage final : public Storage {
23
public:
24
NS_DECL_ISUPPORTS_INHERITED
25
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(PartitionedLocalStorage, Storage)
26
27
PartitionedLocalStorage(nsPIDOMWindowInner* aWindow, nsIPrincipal* aPrincipal,
28
nsIPrincipal* aStoragePrincipal,
29
SessionStorageCache* aCache);
30
31
StorageType Type() const override { return ePartitionedLocalStorage; }
32
33
int64_t GetOriginQuotaUsage() const override;
34
35
bool IsForkOf(const Storage* aStorage) const override;
36
37
// WebIDL
38
uint32_t GetLength(nsIPrincipal& aSubjectPrincipal,
39
ErrorResult& aRv) override;
40
41
void Key(uint32_t aIndex, nsAString& aResult, nsIPrincipal& aSubjectPrincipal,
42
ErrorResult& aRv) override;
43
44
void GetItem(const nsAString& aKey, nsAString& aResult,
45
nsIPrincipal& aSubjectPrincipal, ErrorResult& aRv) override;
46
47
void GetSupportedNames(nsTArray<nsString>& aKeys) override;
48
49
void SetItem(const nsAString& aKey, const nsAString& aValue,
50
nsIPrincipal& aSubjectPrincipal, ErrorResult& aRv) override;
51
52
void RemoveItem(const nsAString& aKey, nsIPrincipal& aSubjectPrincipal,
53
ErrorResult& aRv) override;
54
55
void Clear(nsIPrincipal& aSubjectPrincipal, ErrorResult& aRv) override;
56
57
private:
58
~PartitionedLocalStorage();
59
60
RefPtr<SessionStorageCache> mCache;
61
};
62
63
} // namespace dom
64
} // namespace mozilla
65
66
#endif // mozilla_dom_PartitionedLocalStorage_h