Bug 1454293 [wpt PR 10484] - null is not the correct origin for createDocument()...
[gecko.git] / storage / mozStorageAsyncStatementParams.h
blobfa903515b3b73b3a4a346719db128cfba400ae62
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"
15 namespace mozilla {
16 namespace storage {
18 class AsyncStatement;
20 class AsyncStatementParams final : public nsISupports
21 , public nsWrapperCache
23 public:
24 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
25 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(AsyncStatementParams)
27 explicit AsyncStatementParams(nsPIDOMWindowInner* aWindow, AsyncStatement* 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 // WebIDL requires a .length property when there's an indexed getter.
42 // Unfortunately we don't know how many params there are in the async case,
43 // so we have to lie.
44 return UINT16_MAX;
47 void IndexedGetter(JSContext* aCx,
48 uint32_t aIndex,
49 bool& aFound,
50 JS::MutableHandle<JS::Value> aResult,
51 mozilla::ErrorResult& aRv);
53 void IndexedSetter(JSContext* aCx,
54 uint32_t aIndex,
55 JS::Handle<JS::Value> aValue,
56 mozilla::ErrorResult& aRv);
58 void GetSupportedNames(nsTArray<nsString>& aNames);
60 JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
62 nsPIDOMWindowInner* GetParentObject() const
64 return mWindow;
67 private:
68 virtual ~AsyncStatementParams() {}
70 nsCOMPtr<nsPIDOMWindowInner> mWindow;
71 AsyncStatement* mStatement;
73 friend class AsyncStatementParamsHolder;
76 } // namespace storage
77 } // namespace mozilla
79 #endif // mozilla_storage_mozStorageAsyncStatementParams_h_