Bug 1782289 [wpt PR 35277] - Move mojojs support out of fedcm-helper.js, a=testonly
[gecko.git] / storage / mozStorageStatementParams.h
blob647e111b42ec5083dc4210c7dce015537a32de01
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 "nsPIDOMWindow.h"
12 #include "nsWrapperCache.h"
14 namespace mozilla {
15 class ErrorResult;
17 namespace storage {
19 class Statement;
21 class StatementParams final : public nsISupports, public nsWrapperCache {
22 public:
23 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
24 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(StatementParams)
26 explicit StatementParams(nsPIDOMWindowInner* aWindow, Statement* 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 { return mParamCount; }
37 void IndexedGetter(JSContext* aCx, uint32_t aIndex, bool& aFound,
38 JS::MutableHandle<JS::Value> aResult,
39 mozilla::ErrorResult& aRv);
41 void IndexedSetter(JSContext* aCx, uint32_t aIndex,
42 JS::Handle<JS::Value> aValue, mozilla::ErrorResult& aRv);
44 void GetSupportedNames(nsTArray<nsString>& aNames);
46 JSObject* WrapObject(JSContext* aCx,
47 JS::Handle<JSObject*> aGivenProto) override;
49 nsPIDOMWindowInner* GetParentObject() const { return mWindow; }
51 private:
52 ~StatementParams() {}
54 nsCOMPtr<nsPIDOMWindowInner> mWindow;
55 Statement* mStatement;
56 uint32_t mParamCount;
58 friend class StatementParamsHolder;
61 } // namespace storage
62 } // namespace mozilla
64 #endif /* MOZSTORAGESTATEMENTPARAMS_H */