Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM FileSystemDirectoryReader.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #ifndef mozilla_dom_FileSystemDirectoryReaderBinding_h
4 : #define mozilla_dom_FileSystemDirectoryReaderBinding_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 FileSystemDirectoryReader;
18 : struct FileSystemDirectoryReaderAtoms;
19 : class FileSystemEntriesCallback;
20 : struct FileSystemEntriesCallbackAtoms;
21 : class FileSystemEntry;
22 : struct NativePropertyHooks;
23 : class ProtoAndIfaceCache;
24 :
25 : } // namespace dom
26 : } // namespace mozilla
27 :
28 : namespace mozilla {
29 : namespace dom {
30 :
31 : namespace FileSystemDirectoryReaderBinding {
32 :
33 : typedef mozilla::dom::FileSystemDirectoryReader NativeType;
34 :
35 : JSObject*
36 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);
37 :
38 : const JSClass*
39 : GetJSClass();
40 :
41 : bool
42 : Wrap(JSContext* aCx, mozilla::dom::FileSystemDirectoryReader* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
43 :
44 : template <class T>
45 0 : inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
46 : {
47 0 : JS::Rooted<JSObject*> reflector(aCx);
48 0 : return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
49 : }
50 :
51 : // We declare this as an array so that retrieving a pointer to this
52 : // binding's property hooks only requires compile/link-time resolvable
53 : // address arithmetic. Declaring it as a pointer instead would require
54 : // doing a run-time load to fetch a pointer to this binding's property
55 : // hooks. And then structures which embedded a pointer to this structure
56 : // would require a run-time load for proper initialization, which would
57 : // then induce static constructors. Lots of static constructors.
58 : extern const NativePropertyHooks sNativePropertyHooks[];
59 :
60 : void
61 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
62 :
63 : JS::Handle<JSObject*>
64 : GetProtoObjectHandle(JSContext* aCx);
65 :
66 : JS::Handle<JSObject*>
67 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);
68 :
69 : JSObject*
70 : GetConstructorObject(JSContext* aCx);
71 :
72 : } // namespace FileSystemDirectoryReaderBinding
73 :
74 :
75 :
76 0 : class FileSystemEntriesCallback : public CallbackInterface
77 : {
78 : public:
79 : explicit inline FileSystemEntriesCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, nsIGlobalObject* aIncumbentGlobal)
80 : : CallbackInterface(aCx, aCallback, aIncumbentGlobal)
81 : {
82 : }
83 :
84 0 : explicit inline FileSystemEntriesCallback(JS::Handle<JSObject*> aCallback, const FastCallbackConstructor& )
85 0 : : CallbackInterface(aCallback, FastCallbackConstructor())
86 : {
87 0 : }
88 :
89 : explicit inline FileSystemEntriesCallback(JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
90 : : CallbackInterface(aCallback, aAsyncStack, aIncumbentGlobal)
91 : {
92 : }
93 :
94 : template <typename T>
95 : inline void
96 : HandleEvent(const T& thisVal, const Sequence<OwningNonNull<FileSystemEntry>>& entries, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr)
97 : {
98 : MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
99 : if (!aExecutionReason) {
100 : aExecutionReason = "FileSystemEntriesCallback.handleEvent";
101 : }
102 : CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aCompartment);
103 : if (!s.GetContext()) {
104 : MOZ_ASSERT(aRv.Failed());
105 : return;
106 : }
107 : JS::Rooted<JS::Value> thisValJS(s.GetContext());
108 : if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) {
109 : aRv.Throw(NS_ERROR_FAILURE);
110 : return;
111 : }
112 : return HandleEvent(s.GetContext(), thisValJS, entries, aRv);
113 : }
114 :
115 : inline void
116 0 : HandleEvent(const Sequence<OwningNonNull<FileSystemEntry>>& entries, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr)
117 : {
118 0 : MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
119 0 : if (!aExecutionReason) {
120 0 : aExecutionReason = "FileSystemEntriesCallback.handleEvent";
121 : }
122 0 : CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aCompartment);
123 0 : if (!s.GetContext()) {
124 0 : MOZ_ASSERT(aRv.Failed());
125 0 : return;
126 : }
127 0 : return HandleEvent(s.GetContext(), JS::UndefinedHandleValue, entries, aRv);
128 : }
129 :
130 : template <typename T>
131 : inline void
132 : HandleEvent(const T& thisVal, const Sequence<OwningNonNull<FileSystemEntry>>& entries, const char* aExecutionReason = nullptr)
133 : {
134 : IgnoredErrorResult rv;
135 : return HandleEvent(thisVal, entries, rv, aExecutionReason);
136 : }
137 :
138 : inline void
139 0 : HandleEvent(const Sequence<OwningNonNull<FileSystemEntry>>& entries, const char* aExecutionReason = nullptr)
140 : {
141 0 : IgnoredErrorResult rv;
142 0 : return HandleEvent(entries, rv, aExecutionReason, eReportExceptions, nullptr);
143 : }
144 :
145 : inline bool
146 : operator==(const FileSystemEntriesCallback& aOther) const
147 : {
148 : return CallbackInterface::operator==(aOther);
149 : }
150 :
151 : private:
152 : void HandleEvent(JSContext* cx, JS::Handle<JS::Value> aThisVal, const Sequence<OwningNonNull<FileSystemEntry>>& entries, ErrorResult& aRv);
153 :
154 : static bool
155 : InitIds(JSContext* cx, FileSystemEntriesCallbackAtoms* atomsCache);
156 : };
157 :
158 :
159 : namespace binding_detail {
160 0 : class FastFileSystemEntriesCallback : public FileSystemEntriesCallback
161 : {
162 : public:
163 0 : explicit inline FastFileSystemEntriesCallback(JS::Handle<JSObject*> aCallback)
164 0 : : FileSystemEntriesCallback(aCallback, FastCallbackConstructor())
165 : {
166 0 : }
167 :
168 : inline void
169 0 : Trace(JSTracer* aTracer)
170 : {
171 0 : FileSystemEntriesCallback::Trace(aTracer);
172 0 : }
173 :
174 : inline void
175 0 : FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx)
176 : {
177 0 : FileSystemEntriesCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx);
178 0 : }
179 : };
180 : } // namespace binding_detail
181 :
182 :
183 : } // namespace dom
184 : } // namespace mozilla
185 :
186 : #endif // mozilla_dom_FileSystemDirectoryReaderBinding_h
|