Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM PromiseDebugging.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #ifndef mozilla_dom_PromiseDebuggingBinding_h
4 : #define mozilla_dom_PromiseDebuggingBinding_h
5 :
6 : #include "js/RootingAPI.h"
7 : #include "jspubtd.h"
8 : #include "mozilla/ErrorResult.h"
9 : #include "mozilla/dom/BindingDeclarations.h"
10 : #include "mozilla/dom/CallbackInterface.h"
11 : #include "mozilla/dom/Nullable.h"
12 : #include "mozilla/dom/ToJSValue.h"
13 :
14 : namespace mozilla {
15 : namespace dom {
16 :
17 : struct NativePropertyHooks;
18 : class PromiseDebugging;
19 : struct PromiseDebuggingAtoms;
20 : struct PromiseDebuggingStateHolderAtoms;
21 : class ProtoAndIfaceCache;
22 : class UncaughtRejectionObserver;
23 : struct UncaughtRejectionObserverAtoms;
24 :
25 : } // namespace dom
26 : } // namespace mozilla
27 :
28 : namespace mozilla {
29 : namespace dom {
30 :
31 : enum class PromiseDebuggingState : uint8_t {
32 : Pending,
33 : Fulfilled,
34 : Rejected,
35 : EndGuard_
36 : };
37 :
38 : namespace PromiseDebuggingStateValues {
39 : extern const EnumEntry strings[4];
40 : } // namespace PromiseDebuggingStateValues
41 :
42 : bool
43 : ToJSValue(JSContext* aCx, PromiseDebuggingState aArgument, JS::MutableHandle<JS::Value> aValue);
44 :
45 :
46 : struct PromiseDebuggingStateHolder : public DictionaryBase
47 : {
48 : MOZ_INIT_OUTSIDE_CTOR JS::Value mReason;
49 : MOZ_INIT_OUTSIDE_CTOR PromiseDebuggingState mState;
50 : MOZ_INIT_OUTSIDE_CTOR JS::Value mValue;
51 :
52 : PromiseDebuggingStateHolder();
53 :
54 : explicit inline PromiseDebuggingStateHolder(const FastDictionaryInitializer& )
55 : : mReason(JS::UndefinedValue()),
56 : mValue(JS::UndefinedValue())
57 : {
58 : // Do nothing here; this is used by our "Fast" subclass
59 : }
60 :
61 : private:
62 : PromiseDebuggingStateHolder(const PromiseDebuggingStateHolder&) = delete;
63 : PromiseDebuggingStateHolder& operator=(const PromiseDebuggingStateHolder&) = delete;
64 :
65 : static bool
66 : InitIds(JSContext* cx, PromiseDebuggingStateHolderAtoms* atomsCache);
67 :
68 : public:
69 : bool
70 : Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
71 :
72 : bool
73 : ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
74 :
75 : void
76 : TraceDictionary(JSTracer* trc);
77 : };
78 :
79 : namespace binding_detail {
80 : struct FastPromiseDebuggingStateHolder : public PromiseDebuggingStateHolder
81 : {
82 : inline FastPromiseDebuggingStateHolder()
83 : : PromiseDebuggingStateHolder(FastDictionaryInitializer())
84 : {
85 : // Doesn't matter what int we pass to the parent constructor
86 : }
87 : };
88 : } // namespace binding_detail
89 :
90 :
91 : namespace PromiseDebuggingBinding {
92 :
93 : typedef mozilla::dom::PromiseDebugging NativeType;
94 :
95 : bool
96 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
97 :
98 : JSObject*
99 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);
100 :
101 : // We declare this as an array so that retrieving a pointer to this
102 : // binding's property hooks only requires compile/link-time resolvable
103 : // address arithmetic. Declaring it as a pointer instead would require
104 : // doing a run-time load to fetch a pointer to this binding's property
105 : // hooks. And then structures which embedded a pointer to this structure
106 : // would require a run-time load for proper initialization, which would
107 : // then induce static constructors. Lots of static constructors.
108 : extern const NativePropertyHooks sNativePropertyHooks[];
109 :
110 : void
111 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
112 :
113 : JS::Handle<JSObject*>
114 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);
115 :
116 : JSObject*
117 : GetConstructorObject(JSContext* aCx);
118 :
119 : } // namespace PromiseDebuggingBinding
120 :
121 :
122 :
123 0 : class UncaughtRejectionObserver : public CallbackInterface
124 : {
125 : public:
126 : explicit inline UncaughtRejectionObserver(JSContext* aCx, JS::Handle<JSObject*> aCallback, nsIGlobalObject* aIncumbentGlobal)
127 : : CallbackInterface(aCx, aCallback, aIncumbentGlobal)
128 : {
129 : }
130 :
131 0 : explicit inline UncaughtRejectionObserver(JS::Handle<JSObject*> aCallback, const FastCallbackConstructor& )
132 0 : : CallbackInterface(aCallback, FastCallbackConstructor())
133 : {
134 0 : }
135 :
136 : explicit inline UncaughtRejectionObserver(JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
137 : : CallbackInterface(aCallback, aAsyncStack, aIncumbentGlobal)
138 : {
139 : }
140 :
141 : void OnLeftUncaught(JS::Handle<JSObject*> p, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr);
142 :
143 : void OnConsumed(JS::Handle<JSObject*> p, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr);
144 :
145 : inline bool
146 0 : operator==(const UncaughtRejectionObserver& aOther) const
147 : {
148 0 : return CallbackInterface::operator==(aOther);
149 : }
150 :
151 : private:
152 : static bool
153 : InitIds(JSContext* cx, UncaughtRejectionObserverAtoms* atomsCache);
154 : };
155 :
156 :
157 : namespace binding_detail {
158 0 : class FastUncaughtRejectionObserver : public UncaughtRejectionObserver
159 : {
160 : public:
161 0 : explicit inline FastUncaughtRejectionObserver(JS::Handle<JSObject*> aCallback)
162 0 : : UncaughtRejectionObserver(aCallback, FastCallbackConstructor())
163 : {
164 0 : }
165 :
166 : inline void
167 0 : Trace(JSTracer* aTracer)
168 : {
169 0 : UncaughtRejectionObserver::Trace(aTracer);
170 0 : }
171 :
172 : inline void
173 0 : FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx)
174 : {
175 0 : UncaughtRejectionObserver::FinishSlowJSInitIfMoreThanOneOwner(aCx);
176 0 : }
177 : };
178 : } // namespace binding_detail
179 :
180 :
181 : } // namespace dom
182 : } // namespace mozilla
183 :
184 : #endif // mozilla_dom_PromiseDebuggingBinding_h
|