Bug 1771337 [wpt PR 34217] - Convert `popup=popup` to `popup=auto` or just `popup...
[gecko.git] / dom / storage / PartitionedLocalStorage.h
blob6be4a6a7ab78add015d704a0cd2c8d2fde865473
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
10 #include "Storage.h"
12 class nsIPrincipal;
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 {
22 public:
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;
36 // WebIDL
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;
56 private:
57 ~PartitionedLocalStorage();
59 RefPtr<SessionStorageCache> mCache;
62 } // namespace mozilla::dom
64 #endif // mozilla_dom_PartitionedLocalStorage_h