Bug 1942639 - Propagate --filter argument from desktop_unittest.py to runreftest...
[gecko.git] / dom / bindings / test / TestInterfaceIterableDouble.h
blobba38b47e89ce5fae9476a69ba1ced8624d571f08
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_TestInterfaceIterableDouble_h
8 #define mozilla_dom_TestInterfaceIterableDouble_h
10 #include "nsCOMPtr.h"
11 #include "nsString.h"
12 #include "nsTArray.h"
13 #include "nsWrapperCache.h"
15 class nsPIDOMWindowInner;
17 namespace mozilla {
19 class ErrorResult;
21 namespace dom {
23 class GlobalObject;
25 // Implementation of test binding for webidl iterable interfaces, using
26 // primitives for value type
27 class TestInterfaceIterableDouble final : public nsISupports,
28 public nsWrapperCache {
29 public:
30 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
31 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(TestInterfaceIterableDouble)
33 explicit TestInterfaceIterableDouble(nsPIDOMWindowInner* aParent);
34 nsPIDOMWindowInner* GetParentObject() const;
35 virtual JSObject* WrapObject(JSContext* aCx,
36 JS::Handle<JSObject*> aGivenProto) override;
37 static already_AddRefed<TestInterfaceIterableDouble> Constructor(
38 const GlobalObject& aGlobal, ErrorResult& rv);
40 size_t GetIterableLength();
41 nsAString& GetKeyAtIndex(uint32_t aIndex);
42 nsAString& GetValueAtIndex(uint32_t aIndex);
44 private:
45 virtual ~TestInterfaceIterableDouble() = default;
46 nsCOMPtr<nsPIDOMWindowInner> mParent;
47 nsTArray<std::pair<nsString, nsString>> mValues;
50 } // namespace dom
51 } // namespace mozilla
53 #endif // mozilla_dom_TestInterfaceIterableDouble_h