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/. */
7 #ifndef mozilla_dom_PartitionedLocalStorage_h
8 #define mozilla_dom_PartitionedLocalStorage_h
14 namespace mozilla::dom
{
16 class SessionStorageCache
;
18 // PartitionedLocalStorage is a in-memory-only storage exposed to trackers. It
19 // doesn't share data with other contexts.
21 class PartitionedLocalStorage final
: public Storage
{
23 NS_DECL_ISUPPORTS_INHERITED
24 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(PartitionedLocalStorage
, Storage
)
26 PartitionedLocalStorage(nsPIDOMWindowInner
* aWindow
, nsIPrincipal
* aPrincipal
,
27 nsIPrincipal
* aStoragePrincipal
,
28 SessionStorageCache
* aCache
);
30 StorageType
Type() const override
{ return ePartitionedLocalStorage
; }
32 int64_t GetOriginQuotaUsage() const override
;
34 bool IsForkOf(const Storage
* aStorage
) const override
;
37 uint32_t GetLength(nsIPrincipal
& aSubjectPrincipal
,
38 ErrorResult
& aRv
) override
;
40 void Key(uint32_t aIndex
, nsAString
& aResult
, nsIPrincipal
& aSubjectPrincipal
,
41 ErrorResult
& aRv
) override
;
43 void GetItem(const nsAString
& aKey
, nsAString
& aResult
,
44 nsIPrincipal
& aSubjectPrincipal
, ErrorResult
& aRv
) override
;
46 void GetSupportedNames(nsTArray
<nsString
>& aKeys
) override
;
48 void SetItem(const nsAString
& aKey
, const nsAString
& aValue
,
49 nsIPrincipal
& aSubjectPrincipal
, ErrorResult
& aRv
) override
;
51 void RemoveItem(const nsAString
& aKey
, nsIPrincipal
& aSubjectPrincipal
,
52 ErrorResult
& aRv
) override
;
54 void Clear(nsIPrincipal
& aSubjectPrincipal
, ErrorResult
& aRv
) override
;
57 ~PartitionedLocalStorage();
59 RefPtr
<SessionStorageCache
> mCache
;
62 } // namespace mozilla::dom
64 #endif // mozilla_dom_PartitionedLocalStorage_h