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
13 #include "nsWrapperCache.h"
15 class nsPIDOMWindowInner
;
25 // Implementation of test binding for webidl iterable interfaces, using
26 // primitives for value type
27 class TestInterfaceIterableDouble final
: public nsISupports
,
28 public nsWrapperCache
{
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
);
45 virtual ~TestInterfaceIterableDouble() = default;
46 nsCOMPtr
<nsPIDOMWindowInner
> mParent
;
47 nsTArray
<std::pair
<nsString
, nsString
>> mValues
;
51 } // namespace mozilla
53 #endif // mozilla_dom_TestInterfaceIterableDouble_h