Bug 1941128 - Turn off network.dns.native_https_query on Mac again
[gecko.git] / dom / bindings / test / TestInterfaceMaplike.h
blobe82f290d17b33b1f24e4bc8ca745b9bade226242
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_TestInterfaceMaplike_h
8 #define mozilla_dom_TestInterfaceMaplike_h
10 #include "nsWrapperCache.h"
11 #include "nsCOMPtr.h"
13 class nsPIDOMWindowInner;
15 namespace mozilla {
17 class ErrorResult;
19 namespace dom {
21 class GlobalObject;
23 // Implementation of test binding for webidl maplike interfaces, using
24 // primitives for key and value types.
25 class TestInterfaceMaplike final : public nsISupports, public nsWrapperCache {
26 public:
27 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
28 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(TestInterfaceMaplike)
30 explicit TestInterfaceMaplike(nsPIDOMWindowInner* aParent);
31 nsPIDOMWindowInner* GetParentObject() const;
32 virtual JSObject* WrapObject(JSContext* aCx,
33 JS::Handle<JSObject*> aGivenProto) override;
34 static already_AddRefed<TestInterfaceMaplike> Constructor(
35 const GlobalObject& aGlobal, ErrorResult& rv);
37 // External access for testing internal convenience functions.
38 void SetInternal(const nsAString& aKey, int32_t aValue);
39 void ClearInternal();
40 bool DeleteInternal(const nsAString& aKey);
41 bool HasInternal(const nsAString& aKey);
42 int32_t GetInternal(const nsAString& aKey, ErrorResult& aRv);
44 private:
45 virtual ~TestInterfaceMaplike() = default;
46 nsCOMPtr<nsPIDOMWindowInner> mParent;
49 } // namespace dom
50 } // namespace mozilla
52 #endif // mozilla_dom_TestInterfaceMaplike_h