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 "mozilla/ErrorResult.h"
12 #include "nsPIDOMWindow.h"
13 #include "nsWrapperCache.h"
20 class AsyncStatementParams final
: public nsISupports
, public nsWrapperCache
{
22 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
23 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(AsyncStatementParams
)
25 explicit AsyncStatementParams(nsPIDOMWindowInner
* aWindow
,
26 AsyncStatement
* aStatement
);
28 void NamedGetter(JSContext
* aCx
, const nsAString
& aName
, bool& aFound
,
29 JS::MutableHandle
<JS::Value
> aResult
,
30 mozilla::ErrorResult
& aRv
);
32 void NamedSetter(JSContext
* aCx
, const nsAString
& aName
,
33 JS::Handle
<JS::Value
> aValue
, mozilla::ErrorResult
& aRv
);
35 uint32_t Length() const {
36 // WebIDL requires a .length property when there's an indexed getter.
37 // Unfortunately we don't know how many params there are in the async case,
42 void IndexedGetter(JSContext
* aCx
, uint32_t aIndex
, bool& aFound
,
43 JS::MutableHandle
<JS::Value
> aResult
,
44 mozilla::ErrorResult
& aRv
);
46 void IndexedSetter(JSContext
* aCx
, uint32_t aIndex
,
47 JS::Handle
<JS::Value
> aValue
, mozilla::ErrorResult
& aRv
);
49 void GetSupportedNames(nsTArray
<nsString
>& aNames
);
51 JSObject
* WrapObject(JSContext
* aCx
,
52 JS::Handle
<JSObject
*> aGivenProto
) override
;
54 nsPIDOMWindowInner
* GetParentObject() const { return mWindow
; }
57 virtual ~AsyncStatementParams() {}
59 nsCOMPtr
<nsPIDOMWindowInner
> mWindow
;
60 AsyncStatement
* mStatement
;
62 friend class AsyncStatementParamsHolder
;
65 } // namespace storage
66 } // namespace mozilla
68 #endif // mozilla_storage_mozStorageAsyncStatementParams_h_