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_TestInterfaceAsyncIterableDouble_h
8 #define mozilla_dom_TestInterfaceAsyncIterableDouble_h
10 #include "IterableIterator.h"
14 #include "nsWrapperCache.h"
16 class nsPIDOMWindowInner
;
26 // Implementation of test binding for webidl iterable interfaces, using
27 // primitives for value type
28 class TestInterfaceAsyncIterableDouble final
: public nsISupports
,
29 public nsWrapperCache
{
31 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
32 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(TestInterfaceAsyncIterableDouble
)
34 explicit TestInterfaceAsyncIterableDouble(nsPIDOMWindowInner
* aParent
);
35 nsPIDOMWindowInner
* GetParentObject() const;
36 virtual JSObject
* WrapObject(JSContext
* aCx
,
37 JS::Handle
<JSObject
*> aGivenProto
) override
;
38 static already_AddRefed
<TestInterfaceAsyncIterableDouble
> Constructor(
39 const GlobalObject
& aGlobal
, ErrorResult
& rv
);
45 using Iterator
= AsyncIterableIterator
<TestInterfaceAsyncIterableDouble
>;
47 void InitAsyncIteratorData(IteratorData
& aData
, Iterator::IteratorType aType
,
48 ErrorResult
& aError
) {}
50 already_AddRefed
<Promise
> GetNextIterationResult(Iterator
* aIterator
,
54 virtual ~TestInterfaceAsyncIterableDouble() = default;
55 void ResolvePromise(Iterator
* aIterator
, Promise
* aPromise
);
57 nsCOMPtr
<nsPIDOMWindowInner
> mParent
;
58 nsTArray
<std::pair
<nsString
, nsString
>> mValues
;
62 } // namespace mozilla
64 #endif // mozilla_dom_TestInterfaceAsyncIterableDouble_h