Bug 1885602 - Part 5: Implement navigating to the SUMO help topic from the menu heade...
[gecko.git] / dom / bindings / test / TestInterfaceMaplikeObject.h
blob894447cc4157cbdbe905925c9732ba34264744b4
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_TestInterfaceMaplikeObject_h
8 #define mozilla_dom_TestInterfaceMaplikeObject_h
10 #include "nsWrapperCache.h"
11 #include "nsCOMPtr.h"
13 class nsPIDOMWindowInner;
15 namespace mozilla {
17 class ErrorResult;
19 namespace dom {
21 class GlobalObject;
22 class TestInterfaceMaplike;
24 // Implementation of test binding for webidl maplike interfaces, using
25 // primitives for key types and objects for value types.
26 class TestInterfaceMaplikeObject final : public nsISupports,
27 public nsWrapperCache {
28 public:
29 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
30 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(TestInterfaceMaplikeObject)
32 explicit TestInterfaceMaplikeObject(nsPIDOMWindowInner* aParent);
33 nsPIDOMWindowInner* GetParentObject() const;
34 virtual JSObject* WrapObject(JSContext* aCx,
35 JS::Handle<JSObject*> aGivenProto) override;
36 static already_AddRefed<TestInterfaceMaplikeObject> Constructor(
37 const GlobalObject& aGlobal, ErrorResult& rv);
39 // External access for testing internal convenience functions.
40 void SetInternal(const nsAString& aKey);
41 void ClearInternal();
42 bool DeleteInternal(const nsAString& aKey);
43 bool HasInternal(const nsAString& aKey);
44 already_AddRefed<TestInterfaceMaplike> GetInternal(const nsAString& aKey,
45 ErrorResult& aRv);
47 private:
48 virtual ~TestInterfaceMaplikeObject() = default;
49 nsCOMPtr<nsPIDOMWindowInner> mParent;
52 } // namespace dom
53 } // namespace mozilla
55 #endif // mozilla_dom_TestInterfaceMaplikeObject_h