Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM FileSystem.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #ifndef mozilla_dom_FileSystemBinding_h
4 : #define mozilla_dom_FileSystemBinding_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 : class DOMException;
18 : class ErrorCallback;
19 : struct ErrorCallbackAtoms;
20 : class FileSystem;
21 : struct FileSystemAtoms;
22 : class FileSystemEntry;
23 : class FileSystemEntryCallback;
24 : struct FileSystemEntryCallbackAtoms;
25 : struct FileSystemFlagsAtoms;
26 : struct NativePropertyHooks;
27 : class ProtoAndIfaceCache;
28 : class VoidCallback;
29 : struct VoidCallbackAtoms;
30 :
31 : } // namespace dom
32 : } // namespace mozilla
33 :
34 : namespace mozilla {
35 : namespace dom {
36 :
37 : struct FileSystemFlags : public DictionaryBase
38 : {
39 : MOZ_INIT_OUTSIDE_CTOR bool mCreate;
40 : MOZ_INIT_OUTSIDE_CTOR bool mExclusive;
41 :
42 : FileSystemFlags();
43 :
44 0 : explicit inline FileSystemFlags(const FastDictionaryInitializer& )
45 0 : {
46 : // Do nothing here; this is used by our "Fast" subclass
47 0 : }
48 :
49 : explicit inline FileSystemFlags(const FileSystemFlags& aOther)
50 : {
51 : *this = aOther;
52 : }
53 :
54 : bool
55 : Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
56 :
57 : bool
58 : Init(const nsAString& aJSON);
59 :
60 : bool
61 : ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
62 :
63 : bool
64 : ToJSON(nsAString& aJSON) const;
65 :
66 : void
67 : TraceDictionary(JSTracer* trc);
68 :
69 : FileSystemFlags&
70 : operator=(const FileSystemFlags& aOther);
71 :
72 : private:
73 : static bool
74 : InitIds(JSContext* cx, FileSystemFlagsAtoms* atomsCache);
75 : };
76 :
77 : namespace binding_detail {
78 : struct FastFileSystemFlags : public FileSystemFlags
79 : {
80 0 : inline FastFileSystemFlags()
81 0 : : FileSystemFlags(FastDictionaryInitializer())
82 : {
83 : // Doesn't matter what int we pass to the parent constructor
84 0 : }
85 : };
86 : } // namespace binding_detail
87 :
88 :
89 : namespace FileSystemBinding {
90 :
91 : typedef mozilla::dom::FileSystem NativeType;
92 :
93 : JSObject*
94 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);
95 :
96 : const JSClass*
97 : GetJSClass();
98 :
99 : bool
100 : Wrap(JSContext* aCx, mozilla::dom::FileSystem* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
101 :
102 : template <class T>
103 0 : inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
104 : {
105 0 : JS::Rooted<JSObject*> reflector(aCx);
106 0 : return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
107 : }
108 :
109 : // We declare this as an array so that retrieving a pointer to this
110 : // binding's property hooks only requires compile/link-time resolvable
111 : // address arithmetic. Declaring it as a pointer instead would require
112 : // doing a run-time load to fetch a pointer to this binding's property
113 : // hooks. And then structures which embedded a pointer to this structure
114 : // would require a run-time load for proper initialization, which would
115 : // then induce static constructors. Lots of static constructors.
116 : extern const NativePropertyHooks sNativePropertyHooks[];
117 :
118 : void
119 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
120 :
121 : JS::Handle<JSObject*>
122 : GetProtoObjectHandle(JSContext* aCx);
123 :
124 : JS::Handle<JSObject*>
125 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);
126 :
127 : JSObject*
128 : GetConstructorObject(JSContext* aCx);
129 :
130 : } // namespace FileSystemBinding
131 :
132 :
133 :
134 0 : class ErrorCallback : public CallbackInterface
135 : {
136 : public:
137 0 : explicit inline ErrorCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, nsIGlobalObject* aIncumbentGlobal)
138 0 : : CallbackInterface(aCx, aCallback, aIncumbentGlobal)
139 : {
140 0 : }
141 :
142 : explicit inline ErrorCallback(JS::Handle<JSObject*> aCallback, const FastCallbackConstructor& )
143 : : CallbackInterface(aCallback, FastCallbackConstructor())
144 : {
145 : }
146 :
147 : explicit inline ErrorCallback(JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
148 : : CallbackInterface(aCallback, aAsyncStack, aIncumbentGlobal)
149 : {
150 : }
151 :
152 : template <typename T>
153 : inline void
154 : HandleEvent(const T& thisVal, DOMException& err, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr)
155 : {
156 : MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
157 : if (!aExecutionReason) {
158 : aExecutionReason = "ErrorCallback.handleEvent";
159 : }
160 : CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aCompartment);
161 : if (!s.GetContext()) {
162 : MOZ_ASSERT(aRv.Failed());
163 : return;
164 : }
165 : JS::Rooted<JS::Value> thisValJS(s.GetContext());
166 : if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) {
167 : aRv.Throw(NS_ERROR_FAILURE);
168 : return;
169 : }
170 : return HandleEvent(s.GetContext(), thisValJS, err, aRv);
171 : }
172 :
173 : inline void
174 0 : HandleEvent(DOMException& err, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr)
175 : {
176 0 : MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
177 0 : if (!aExecutionReason) {
178 0 : aExecutionReason = "ErrorCallback.handleEvent";
179 : }
180 0 : CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aCompartment);
181 0 : if (!s.GetContext()) {
182 0 : MOZ_ASSERT(aRv.Failed());
183 0 : return;
184 : }
185 0 : return HandleEvent(s.GetContext(), JS::UndefinedHandleValue, err, aRv);
186 : }
187 :
188 : template <typename T>
189 : inline void
190 : HandleEvent(const T& thisVal, DOMException& err, const char* aExecutionReason = nullptr)
191 : {
192 : IgnoredErrorResult rv;
193 : return HandleEvent(thisVal, err, rv, aExecutionReason);
194 : }
195 :
196 : inline void
197 0 : HandleEvent(DOMException& err, const char* aExecutionReason = nullptr)
198 : {
199 0 : IgnoredErrorResult rv;
200 0 : return HandleEvent(err, rv, aExecutionReason, eReportExceptions, nullptr);
201 : }
202 :
203 : inline bool
204 : operator==(const ErrorCallback& aOther) const
205 : {
206 : return CallbackInterface::operator==(aOther);
207 : }
208 :
209 : private:
210 : void HandleEvent(JSContext* cx, JS::Handle<JS::Value> aThisVal, DOMException& err, ErrorResult& aRv);
211 :
212 : static bool
213 : InitIds(JSContext* cx, ErrorCallbackAtoms* atomsCache);
214 : };
215 :
216 :
217 0 : class FileSystemEntryCallback : public CallbackInterface
218 : {
219 : public:
220 0 : explicit inline FileSystemEntryCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, nsIGlobalObject* aIncumbentGlobal)
221 0 : : CallbackInterface(aCx, aCallback, aIncumbentGlobal)
222 : {
223 0 : }
224 :
225 : explicit inline FileSystemEntryCallback(JS::Handle<JSObject*> aCallback, const FastCallbackConstructor& )
226 : : CallbackInterface(aCallback, FastCallbackConstructor())
227 : {
228 : }
229 :
230 : explicit inline FileSystemEntryCallback(JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
231 : : CallbackInterface(aCallback, aAsyncStack, aIncumbentGlobal)
232 : {
233 : }
234 :
235 : template <typename T>
236 : inline void
237 : HandleEvent(const T& thisVal, FileSystemEntry& entry, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr)
238 : {
239 : MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
240 : if (!aExecutionReason) {
241 : aExecutionReason = "FileSystemEntryCallback.handleEvent";
242 : }
243 : CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aCompartment);
244 : if (!s.GetContext()) {
245 : MOZ_ASSERT(aRv.Failed());
246 : return;
247 : }
248 : JS::Rooted<JS::Value> thisValJS(s.GetContext());
249 : if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) {
250 : aRv.Throw(NS_ERROR_FAILURE);
251 : return;
252 : }
253 : return HandleEvent(s.GetContext(), thisValJS, entry, aRv);
254 : }
255 :
256 : inline void
257 0 : HandleEvent(FileSystemEntry& entry, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr)
258 : {
259 0 : MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
260 0 : if (!aExecutionReason) {
261 0 : aExecutionReason = "FileSystemEntryCallback.handleEvent";
262 : }
263 0 : CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aCompartment);
264 0 : if (!s.GetContext()) {
265 0 : MOZ_ASSERT(aRv.Failed());
266 0 : return;
267 : }
268 0 : return HandleEvent(s.GetContext(), JS::UndefinedHandleValue, entry, aRv);
269 : }
270 :
271 : template <typename T>
272 : inline void
273 : HandleEvent(const T& thisVal, FileSystemEntry& entry, const char* aExecutionReason = nullptr)
274 : {
275 : IgnoredErrorResult rv;
276 : return HandleEvent(thisVal, entry, rv, aExecutionReason);
277 : }
278 :
279 : inline void
280 0 : HandleEvent(FileSystemEntry& entry, const char* aExecutionReason = nullptr)
281 : {
282 0 : IgnoredErrorResult rv;
283 0 : return HandleEvent(entry, rv, aExecutionReason, eReportExceptions, nullptr);
284 : }
285 :
286 : inline bool
287 : operator==(const FileSystemEntryCallback& aOther) const
288 : {
289 : return CallbackInterface::operator==(aOther);
290 : }
291 :
292 : private:
293 : void HandleEvent(JSContext* cx, JS::Handle<JS::Value> aThisVal, FileSystemEntry& entry, ErrorResult& aRv);
294 :
295 : static bool
296 : InitIds(JSContext* cx, FileSystemEntryCallbackAtoms* atomsCache);
297 : };
298 :
299 :
300 : class VoidCallback : public CallbackInterface
301 : {
302 : public:
303 : explicit inline VoidCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, nsIGlobalObject* aIncumbentGlobal)
304 : : CallbackInterface(aCx, aCallback, aIncumbentGlobal)
305 : {
306 : }
307 :
308 : explicit inline VoidCallback(JS::Handle<JSObject*> aCallback, const FastCallbackConstructor& )
309 : : CallbackInterface(aCallback, FastCallbackConstructor())
310 : {
311 : }
312 :
313 : explicit inline VoidCallback(JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
314 : : CallbackInterface(aCallback, aAsyncStack, aIncumbentGlobal)
315 : {
316 : }
317 :
318 : template <typename T>
319 : inline void
320 : HandleEvent(const T& thisVal, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr)
321 : {
322 : MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
323 : if (!aExecutionReason) {
324 : aExecutionReason = "VoidCallback.handleEvent";
325 : }
326 : CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aCompartment);
327 : if (!s.GetContext()) {
328 : MOZ_ASSERT(aRv.Failed());
329 : return;
330 : }
331 : JS::Rooted<JS::Value> thisValJS(s.GetContext());
332 : if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) {
333 : aRv.Throw(NS_ERROR_FAILURE);
334 : return;
335 : }
336 : return HandleEvent(s.GetContext(), thisValJS, aRv);
337 : }
338 :
339 : inline void
340 : HandleEvent(ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr)
341 : {
342 : MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
343 : if (!aExecutionReason) {
344 : aExecutionReason = "VoidCallback.handleEvent";
345 : }
346 : CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aCompartment);
347 : if (!s.GetContext()) {
348 : MOZ_ASSERT(aRv.Failed());
349 : return;
350 : }
351 : return HandleEvent(s.GetContext(), JS::UndefinedHandleValue, aRv);
352 : }
353 :
354 : template <typename T>
355 : inline void
356 : HandleEvent(const T& thisVal, const char* aExecutionReason = nullptr)
357 : {
358 : IgnoredErrorResult rv;
359 : return HandleEvent(thisVal, rv, aExecutionReason);
360 : }
361 :
362 : inline void
363 : HandleEvent(const char* aExecutionReason = nullptr)
364 : {
365 : IgnoredErrorResult rv;
366 : return HandleEvent(rv, aExecutionReason, eReportExceptions, nullptr);
367 : }
368 :
369 : inline bool
370 : operator==(const VoidCallback& aOther) const
371 : {
372 : return CallbackInterface::operator==(aOther);
373 : }
374 :
375 : private:
376 : void HandleEvent(JSContext* cx, JS::Handle<JS::Value> aThisVal, ErrorResult& aRv);
377 :
378 : static bool
379 : InitIds(JSContext* cx, VoidCallbackAtoms* atomsCache);
380 : };
381 :
382 :
383 : namespace binding_detail {
384 : class FastErrorCallback : public ErrorCallback
385 : {
386 : public:
387 : explicit inline FastErrorCallback(JS::Handle<JSObject*> aCallback)
388 : : ErrorCallback(aCallback, FastCallbackConstructor())
389 : {
390 : }
391 :
392 : inline void
393 : Trace(JSTracer* aTracer)
394 : {
395 : ErrorCallback::Trace(aTracer);
396 : }
397 :
398 : inline void
399 : FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx)
400 : {
401 : ErrorCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx);
402 : }
403 : };
404 : } // namespace binding_detail
405 :
406 :
407 : namespace binding_detail {
408 : class FastFileSystemEntryCallback : public FileSystemEntryCallback
409 : {
410 : public:
411 : explicit inline FastFileSystemEntryCallback(JS::Handle<JSObject*> aCallback)
412 : : FileSystemEntryCallback(aCallback, FastCallbackConstructor())
413 : {
414 : }
415 :
416 : inline void
417 : Trace(JSTracer* aTracer)
418 : {
419 : FileSystemEntryCallback::Trace(aTracer);
420 : }
421 :
422 : inline void
423 : FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx)
424 : {
425 : FileSystemEntryCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx);
426 : }
427 : };
428 : } // namespace binding_detail
429 :
430 :
431 : namespace binding_detail {
432 : class FastVoidCallback : public VoidCallback
433 : {
434 : public:
435 : explicit inline FastVoidCallback(JS::Handle<JSObject*> aCallback)
436 : : VoidCallback(aCallback, FastCallbackConstructor())
437 : {
438 : }
439 :
440 : inline void
441 : Trace(JSTracer* aTracer)
442 : {
443 : VoidCallback::Trace(aTracer);
444 : }
445 :
446 : inline void
447 : FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx)
448 : {
449 : VoidCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx);
450 : }
451 : };
452 : } // namespace binding_detail
453 :
454 :
455 : } // namespace dom
456 : } // namespace mozilla
457 :
458 : #endif // mozilla_dom_FileSystemBinding_h
|