Bug 1441336 - Use addon permissions for PerformanceTiming properties r=bz,kmag
[gecko.git] / storage / mozStorageStatementParams.h
blob518b944028e6d0b21f52a7956d84cda98e861cb7
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
21 , public nsWrapperCache
23 public:
24 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
25 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(StatementParams)
27 explicit StatementParams(nsPIDOMWindowInner* aWindow, Statement* aStatement);
29 void NamedGetter(JSContext* aCx,
30 const nsAString& aName,
31 bool& aFound,
32 JS::MutableHandle<JS::Value> aResult,
33 mozilla::ErrorResult& aRv);
35 void NamedSetter(JSContext* aCx,
36 const nsAString& aName,
37 JS::Handle<JS::Value> aValue,
38 mozilla::ErrorResult& aRv);
40 uint32_t Length() const {
41 return mParamCount;
44 void IndexedGetter(JSContext* aCx,
45 uint32_t aIndex,
46 bool& aFound,
47 JS::MutableHandle<JS::Value> aResult,
48 mozilla::ErrorResult& aRv);
50 void IndexedSetter(JSContext* aCx,
51 uint32_t aIndex,
52 JS::Handle<JS::Value> aValue,
53 mozilla::ErrorResult& aRv);
55 void GetSupportedNames(nsTArray<nsString>& aNames);
57 JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
59 nsPIDOMWindowInner* GetParentObject() const
61 return mWindow;
64 private:
65 ~StatementParams() {}
67 nsCOMPtr<nsPIDOMWindowInner> mWindow;
68 Statement* mStatement;
69 uint32_t mParamCount;
71 friend class StatementParamsHolder;
74 } // namespace storage
75 } // namespace mozilla
77 #endif /* MOZSTORAGESTATEMENTPARAMS_H */