1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * vim: sw=2 ts=2 et lcs=trail\:.,tab\:>~ :
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_storage_mozStorageAsyncStatementParams_h_
8 #define mozilla_storage_mozStorageAsyncStatementParams_h_
10 #include "mozilla/Attributes.h"
11 #include "nsPIDOMWindow.h"
12 #include "nsWrapperCache.h"
21 class AsyncStatementParams final
: public nsISupports
, public nsWrapperCache
{
23 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
24 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(AsyncStatementParams
)
26 explicit AsyncStatementParams(nsPIDOMWindowInner
* aWindow
,
27 AsyncStatement
* aStatement
);
29 void NamedGetter(JSContext
* aCx
, const nsAString
& aName
, bool& aFound
,
30 JS::MutableHandle
<JS::Value
> aResult
,
31 mozilla::ErrorResult
& aRv
);
33 void NamedSetter(JSContext
* aCx
, const nsAString
& aName
,
34 JS::Handle
<JS::Value
> aValue
, mozilla::ErrorResult
& aRv
);
36 uint32_t Length() const {
37 // WebIDL requires a .length property when there's an indexed getter.
38 // Unfortunately we don't know how many params there are in the async case,
43 void IndexedGetter(JSContext
* aCx
, uint32_t aIndex
, bool& aFound
,
44 JS::MutableHandle
<JS::Value
> aResult
,
45 mozilla::ErrorResult
& aRv
);
47 void IndexedSetter(JSContext
* aCx
, uint32_t aIndex
,
48 JS::Handle
<JS::Value
> aValue
, mozilla::ErrorResult
& aRv
);
50 void GetSupportedNames(nsTArray
<nsString
>& aNames
);
52 JSObject
* WrapObject(JSContext
* aCx
,
53 JS::Handle
<JSObject
*> aGivenProto
) override
;
55 nsPIDOMWindowInner
* GetParentObject() const { return mWindow
; }
58 virtual ~AsyncStatementParams() {}
60 nsCOMPtr
<nsPIDOMWindowInner
> mWindow
;
61 AsyncStatement
* mStatement
;
63 friend class AsyncStatementParamsHolder
;
66 } // namespace storage
67 } // namespace mozilla
69 #endif // mozilla_storage_mozStorageAsyncStatementParams_h_