/work/obj-fuzz/dist/include/mozilla/dom/DataTransferItemBinding.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* THIS FILE IS AUTOGENERATED FROM DataTransferItem.webidl BY Codegen.py - DO NOT EDIT */ |
2 | | |
3 | | #ifndef mozilla_dom_DataTransferItemBinding_h |
4 | | #define mozilla_dom_DataTransferItemBinding_h |
5 | | |
6 | | #include "GeckoProfiler.h" |
7 | | #include "js/RootingAPI.h" |
8 | | #include "jspubtd.h" |
9 | | #include "mozilla/ErrorResult.h" |
10 | | #include "mozilla/dom/BindingDeclarations.h" |
11 | | #include "mozilla/dom/CallbackFunction.h" |
12 | | #include "mozilla/dom/Nullable.h" |
13 | | #include "mozilla/dom/PrototypeList.h" |
14 | | #include "mozilla/dom/ToJSValue.h" |
15 | | |
16 | | namespace mozilla { |
17 | | namespace dom { |
18 | | |
19 | | class DataTransferItem; |
20 | | struct DataTransferItemAtoms; |
21 | | class FunctionStringCallback; |
22 | | struct NativePropertyHooks; |
23 | | class ProtoAndIfaceCache; |
24 | | |
25 | | } // namespace dom |
26 | | } // namespace mozilla |
27 | | |
28 | | namespace mozilla { |
29 | | namespace dom { |
30 | | |
31 | | class FunctionStringCallback : public CallbackFunction |
32 | | { |
33 | | public: |
34 | | explicit inline FunctionStringCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aCallbackGlobal, nsIGlobalObject* aIncumbentGlobal) |
35 | | : CallbackFunction(aCx, aCallback, aCallbackGlobal, aIncumbentGlobal) |
36 | 0 | { |
37 | 0 | MOZ_ASSERT(JS::IsCallable(mCallback)); |
38 | 0 | } |
39 | | |
40 | | explicit inline FunctionStringCallback(JSObject* aCallback, JSObject* aCallbackGlobal, const FastCallbackConstructor& ) |
41 | | : CallbackFunction(aCallback, aCallbackGlobal, FastCallbackConstructor()) |
42 | 0 | { |
43 | 0 | MOZ_ASSERT(JS::IsCallable(mCallback)); |
44 | 0 | } |
45 | | |
46 | | explicit inline FunctionStringCallback(JSObject* aCallback, JSObject* aCallbackGlobal, JSObject* aAsyncStack, nsIGlobalObject* aIncumbentGlobal) |
47 | | : CallbackFunction(aCallback, aCallbackGlobal, aAsyncStack, aIncumbentGlobal) |
48 | 0 | { |
49 | 0 | MOZ_ASSERT(JS::IsCallable(mCallback)); |
50 | 0 | } |
51 | | |
52 | | explicit inline FunctionStringCallback(CallbackFunction* aOther) |
53 | | : CallbackFunction(aOther) |
54 | 0 | { |
55 | 0 | } |
56 | | |
57 | | template <typename T> |
58 | | inline void |
59 | | Call(const T& thisVal, const nsAString& data, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr) |
60 | | { |
61 | | MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!"); |
62 | | if (!aExecutionReason) { |
63 | | aExecutionReason = "FunctionStringCallback"; |
64 | | } |
65 | | CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm); |
66 | | if (!s.GetContext()) { |
67 | | MOZ_ASSERT(aRv.Failed()); |
68 | | return; |
69 | | } |
70 | | JS::Rooted<JS::Value> thisValJS(s.GetContext()); |
71 | | if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) { |
72 | | aRv.Throw(NS_ERROR_FAILURE); |
73 | | return; |
74 | | } |
75 | | return Call(s.GetContext(), thisValJS, data, aRv); |
76 | | } |
77 | | |
78 | | inline void |
79 | | Call(const nsAString& data, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr) |
80 | 0 | { |
81 | 0 | MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!"); |
82 | 0 | if (!aExecutionReason) { |
83 | 0 | aExecutionReason = "FunctionStringCallback"; |
84 | 0 | } |
85 | 0 | CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm); |
86 | 0 | if (!s.GetContext()) { |
87 | 0 | MOZ_ASSERT(aRv.Failed()); |
88 | 0 | return; |
89 | 0 | } |
90 | 0 | return Call(s.GetContext(), JS::UndefinedHandleValue, data, aRv); |
91 | 0 | } |
92 | | |
93 | | template <typename T> |
94 | | inline void |
95 | | Call(const T& thisVal, const nsAString& data, const char* aExecutionReason = nullptr) |
96 | | { |
97 | | return Call(thisVal, data, IgnoreErrors(), aExecutionReason); |
98 | | } |
99 | | |
100 | | inline void |
101 | | Call(const nsAString& data, const char* aExecutionReason = nullptr) |
102 | 0 | { |
103 | 0 | return Call(data, IgnoreErrors(), aExecutionReason, eReportExceptions, nullptr); |
104 | 0 | } |
105 | | |
106 | | inline bool |
107 | | operator==(const FunctionStringCallback& aOther) const |
108 | 0 | { |
109 | 0 | return CallbackFunction::operator==(aOther); |
110 | 0 | } |
111 | | |
112 | | private: |
113 | | void Call(JSContext* cx, JS::Handle<JS::Value> aThisVal, const nsAString& data, ErrorResult& aRv); |
114 | | }; |
115 | | |
116 | | |
117 | | namespace binding_detail { |
118 | | class FastFunctionStringCallback : public FunctionStringCallback |
119 | | { |
120 | | public: |
121 | | explicit inline FastFunctionStringCallback(JSObject* aCallback, JSObject* aCallbackGlobal) |
122 | | : FunctionStringCallback(aCallback, aCallbackGlobal, FastCallbackConstructor()) |
123 | 0 | { |
124 | 0 | } |
125 | | |
126 | | inline void |
127 | | Trace(JSTracer* aTracer) |
128 | 0 | { |
129 | 0 | FunctionStringCallback::Trace(aTracer); |
130 | 0 | } |
131 | | |
132 | | inline void |
133 | | FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx) |
134 | 0 | { |
135 | 0 | FunctionStringCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx); |
136 | 0 | } |
137 | | }; |
138 | | } // namespace binding_detail |
139 | | |
140 | | |
141 | | namespace DataTransferItem_Binding { |
142 | | |
143 | | typedef mozilla::dom::DataTransferItem NativeType; |
144 | | |
145 | | const JSClass* |
146 | | GetJSClass(); |
147 | | |
148 | | bool |
149 | | Wrap(JSContext* aCx, mozilla::dom::DataTransferItem* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector); |
150 | | |
151 | | template <class T> |
152 | | inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto) |
153 | 0 | { |
154 | 0 | JS::Rooted<JSObject*> reflector(aCx); |
155 | 0 | return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr; |
156 | 0 | } |
157 | | |
158 | | // We declare this as an array so that retrieving a pointer to this |
159 | | // binding's property hooks only requires compile/link-time resolvable |
160 | | // address arithmetic. Declaring it as a pointer instead would require |
161 | | // doing a run-time load to fetch a pointer to this binding's property |
162 | | // hooks. And then structures which embedded a pointer to this structure |
163 | | // would require a run-time load for proper initialization, which would |
164 | | // then induce static constructors. Lots of static constructors. |
165 | | extern const NativePropertyHooks sNativePropertyHooks[]; |
166 | | |
167 | | void |
168 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal); |
169 | | |
170 | | inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx) |
171 | 0 | { |
172 | 0 | /* Get the interface prototype object for this class. This will create the |
173 | 0 | object as needed. */ |
174 | 0 | return GetPerInterfaceObjectHandle(aCx, prototypes::id::DataTransferItem, |
175 | 0 | &CreateInterfaceObjects, |
176 | 0 | /* aDefineOnGlobal = */ true); |
177 | 0 |
|
178 | 0 | } |
179 | | |
180 | | inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true) |
181 | 0 | { |
182 | 0 | /* Get the interface object for this class. This will create the object as |
183 | 0 | needed. */ |
184 | 0 |
|
185 | 0 | return GetPerInterfaceObjectHandle(aCx, constructors::id::DataTransferItem, |
186 | 0 | &CreateInterfaceObjects, |
187 | 0 | aDefineOnGlobal); |
188 | 0 | } |
189 | | |
190 | | JSObject* |
191 | | GetConstructorObject(JSContext* aCx); |
192 | | |
193 | | } // namespace DataTransferItem_Binding |
194 | | |
195 | | |
196 | | |
197 | | } // namespace dom |
198 | | } // namespace mozilla |
199 | | |
200 | | #endif // mozilla_dom_DataTransferItemBinding_h |