2010-03-24 10:32:40 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* vim: sw=2 ts=2 et lcs=trail\:.,tab\:>~ :
|
2012-05-21 15:12:37 +04:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-03-24 10:32:40 +03:00
|
|
|
|
|
|
|
#ifndef mozilla_storage_mozStorageAsyncStatementParams_h_
|
|
|
|
#define mozilla_storage_mozStorageAsyncStatementParams_h_
|
|
|
|
|
2012-06-13 07:35:10 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2017-08-24 11:52:52 +03:00
|
|
|
#include "mozilla/ErrorResult.h"
|
|
|
|
#include "nsPIDOMWindow.h"
|
|
|
|
#include "nsWrapperCache.h"
|
2010-03-24 10:32:40 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace storage {
|
|
|
|
|
2015-03-24 03:09:13 +03:00
|
|
|
class AsyncStatement;
|
|
|
|
|
2017-08-24 11:52:52 +03:00
|
|
|
class AsyncStatementParams final : public nsISupports
|
|
|
|
, public nsWrapperCache
|
2010-03-24 10:32:40 +03:00
|
|
|
{
|
|
|
|
public:
|
2017-08-24 11:52:52 +03:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(AsyncStatementParams)
|
2010-03-24 10:32:40 +03:00
|
|
|
|
2017-08-24 11:52:52 +03:00
|
|
|
explicit AsyncStatementParams(nsPIDOMWindowInner* aWindow, AsyncStatement* aStatement);
|
2010-03-24 10:32:40 +03:00
|
|
|
|
2017-08-24 11:52:52 +03:00
|
|
|
void NamedGetter(JSContext* aCx,
|
|
|
|
const nsAString& aName,
|
|
|
|
bool& aFound,
|
|
|
|
JS::MutableHandle<JS::Value> aResult,
|
|
|
|
mozilla::ErrorResult& aRv);
|
|
|
|
|
|
|
|
void NamedSetter(JSContext* aCx,
|
|
|
|
const nsAString& aName,
|
|
|
|
JS::Handle<JS::Value> aValue,
|
|
|
|
mozilla::ErrorResult& aRv);
|
|
|
|
|
|
|
|
uint32_t Length() const {
|
|
|
|
// WebIDL requires a .length property when there's an indexed getter.
|
|
|
|
// Unfortunately we don't know how many params there are in the async case,
|
|
|
|
// so we have to lie.
|
|
|
|
return UINT16_MAX;
|
|
|
|
}
|
|
|
|
|
|
|
|
void IndexedGetter(JSContext* aCx,
|
|
|
|
uint32_t aIndex,
|
|
|
|
bool& aFound,
|
|
|
|
JS::MutableHandle<JS::Value> aResult,
|
|
|
|
mozilla::ErrorResult& aRv);
|
|
|
|
|
|
|
|
void IndexedSetter(JSContext* aCx,
|
|
|
|
uint32_t aIndex,
|
|
|
|
JS::Handle<JS::Value> aValue,
|
|
|
|
mozilla::ErrorResult& aRv);
|
|
|
|
|
|
|
|
void GetSupportedNames(nsTArray<nsString>& aNames);
|
|
|
|
|
|
|
|
JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
|
|
|
|
|
|
|
nsPIDOMWindowInner* GetParentObject() const
|
|
|
|
{
|
|
|
|
return mWindow;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2014-06-24 02:40:03 +04:00
|
|
|
virtual ~AsyncStatementParams() {}
|
|
|
|
|
2017-08-24 11:52:52 +03:00
|
|
|
nsCOMPtr<nsPIDOMWindowInner> mWindow;
|
|
|
|
AsyncStatement* mStatement;
|
2010-03-24 10:32:40 +03:00
|
|
|
|
2015-03-12 19:55:56 +03:00
|
|
|
friend class AsyncStatementParamsHolder;
|
2010-03-24 10:32:40 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace storage
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_storage_mozStorageAsyncStatementParams_h_
|