Bug 1637126 [wpt PR 23522] - Update wpt metadata, a=testonly
[gecko.git] / storage / mozStorageStatementParams.h
blobea2b078d0010bf1c564fe7033e0e1ad29871afae
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 MOZSTORAGESTATEMENTPARAMS_H
8 #define MOZSTORAGESTATEMENTPARAMS_H
10 #include "mozilla/Attributes.h"
11 #include "mozilla/ErrorResult.h"
12 #include "nsPIDOMWindow.h"
13 #include "nsWrapperCache.h"
15 namespace mozilla {
16 namespace storage {
18 class Statement;
20 class StatementParams final : public nsISupports, public nsWrapperCache {
21 public:
22 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
23 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(StatementParams)
25 explicit StatementParams(nsPIDOMWindowInner* aWindow, Statement* aStatement);
27 void NamedGetter(JSContext* aCx, const nsAString& aName, bool& aFound,
28 JS::MutableHandle<JS::Value> aResult,
29 mozilla::ErrorResult& aRv);
31 void NamedSetter(JSContext* aCx, const nsAString& aName,
32 JS::Handle<JS::Value> aValue, mozilla::ErrorResult& aRv);
34 uint32_t Length() const { return mParamCount; }
36 void IndexedGetter(JSContext* aCx, uint32_t aIndex, bool& aFound,
37 JS::MutableHandle<JS::Value> aResult,
38 mozilla::ErrorResult& aRv);
40 void IndexedSetter(JSContext* aCx, uint32_t aIndex,
41 JS::Handle<JS::Value> aValue, mozilla::ErrorResult& aRv);
43 void GetSupportedNames(nsTArray<nsString>& aNames);
45 JSObject* WrapObject(JSContext* aCx,
46 JS::Handle<JSObject*> aGivenProto) override;
48 nsPIDOMWindowInner* GetParentObject() const { return mWindow; }
50 private:
51 ~StatementParams() {}
53 nsCOMPtr<nsPIDOMWindowInner> mWindow;
54 Statement* mStatement;
55 uint32_t mParamCount;
57 friend class StatementParamsHolder;
60 } // namespace storage
61 } // namespace mozilla
63 #endif /* MOZSTORAGESTATEMENTPARAMS_H */