Bug 1816170 - Disable perftest-on-autoland cron. r=aglavic
[gecko.git] / dom / indexedDB / IDBEvents.h
blob2b27261404ba2364e6bb0e9e4b4e78ceae34acb0
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
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_dom_idbevents_h__
8 #define mozilla_dom_idbevents_h__
10 #include "js/RootingAPI.h"
11 #include "mozilla/dom/BindingDeclarations.h"
12 #include "mozilla/dom/Event.h"
13 #include "mozilla/dom/Nullable.h"
14 #include "nsStringFwd.h"
16 #define IDBVERSIONCHANGEEVENT_IID \
17 { \
18 0x3b65d4c3, 0x73ad, 0x492e, { \
19 0xb1, 0x2d, 0x15, 0xf9, 0xda, 0xc2, 0x08, 0x4b \
20 } \
23 namespace mozilla {
25 class ErrorResult;
27 namespace dom {
29 class EventTarget;
30 class GlobalObject;
31 struct IDBVersionChangeEventInit;
33 namespace indexedDB {
35 enum Bubbles { eDoesNotBubble, eDoesBubble };
37 enum Cancelable { eNotCancelable, eCancelable };
39 extern const char16_t* kAbortEventType;
40 extern const char16_t* kBlockedEventType;
41 extern const char16_t* kCompleteEventType;
42 extern const char16_t* kErrorEventType;
43 extern const char16_t* kSuccessEventType;
44 extern const char16_t* kUpgradeNeededEventType;
45 extern const char16_t* kVersionChangeEventType;
46 extern const char16_t* kCloseEventType;
48 [[nodiscard]] RefPtr<Event> CreateGenericEvent(EventTarget* aOwner,
49 const nsDependentString& aType,
50 Bubbles aBubbles,
51 Cancelable aCancelable);
53 } // namespace indexedDB
55 class IDBVersionChangeEvent final : public Event {
56 uint64_t mOldVersion;
57 Nullable<uint64_t> mNewVersion;
59 public:
60 [[nodiscard]] static RefPtr<IDBVersionChangeEvent> Create(
61 EventTarget* aOwner, const nsDependentString& aName, uint64_t aOldVersion,
62 uint64_t aNewVersion);
64 [[nodiscard]] static RefPtr<IDBVersionChangeEvent> Create(
65 EventTarget* aOwner, const nsDependentString& aName,
66 uint64_t aOldVersion);
68 [[nodiscard]] static RefPtr<IDBVersionChangeEvent> Constructor(
69 const GlobalObject& aGlobal, const nsAString& aType,
70 const IDBVersionChangeEventInit& aOptions);
72 uint64_t OldVersion() const { return mOldVersion; }
74 Nullable<uint64_t> GetNewVersion() const { return mNewVersion; }
76 NS_DECLARE_STATIC_IID_ACCESSOR(IDBVERSIONCHANGEEVENT_IID)
78 NS_DECL_ISUPPORTS_INHERITED
80 virtual JSObject* WrapObjectInternal(
81 JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
83 private:
84 IDBVersionChangeEvent(EventTarget* aOwner, uint64_t aOldVersion)
85 : Event(aOwner, nullptr, nullptr), mOldVersion(aOldVersion) {}
87 ~IDBVersionChangeEvent() = default;
89 [[nodiscard]] static RefPtr<IDBVersionChangeEvent> CreateInternal(
90 EventTarget* aOwner, const nsAString& aType, uint64_t aOldVersion,
91 const Nullable<uint64_t>& aNewVersion);
94 NS_DEFINE_STATIC_IID_ACCESSOR(IDBVersionChangeEvent, IDBVERSIONCHANGEEVENT_IID)
96 } // namespace dom
97 } // namespace mozilla
99 #endif // mozilla_dom_idbevents_h__