/work/obj-fuzz/dist/include/mozilla/dom/FileBinding.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* THIS FILE IS AUTOGENERATED FROM File.webidl BY Codegen.py - DO NOT EDIT */ |
2 | | |
3 | | #ifndef mozilla_dom_FileBinding_h |
4 | | #define mozilla_dom_FileBinding_h |
5 | | |
6 | | #include "FileBinding.h" |
7 | | #include "GeckoProfiler.h" |
8 | | #include "js/RootingAPI.h" |
9 | | #include "jspubtd.h" |
10 | | #include "mozilla/ErrorResult.h" |
11 | | #include "mozilla/dom/BindingDeclarations.h" |
12 | | #include "mozilla/dom/Nullable.h" |
13 | | #include "mozilla/dom/PrototypeList.h" |
14 | | |
15 | | namespace mozilla { |
16 | | namespace dom { |
17 | | |
18 | | struct ChromeFilePropertyBagAtoms; |
19 | | class File; |
20 | | struct FileAtoms; |
21 | | struct FilePropertyBagAtoms; |
22 | | struct NativePropertyHooks; |
23 | | class ProtoAndIfaceCache; |
24 | | |
25 | | } // namespace dom |
26 | | } // namespace mozilla |
27 | | |
28 | | namespace mozilla { |
29 | | namespace dom { |
30 | | |
31 | | struct FilePropertyBag : public DictionaryBase |
32 | | { |
33 | | MOZ_INIT_OUTSIDE_CTOR Optional<int64_t> mLastModified; |
34 | | MOZ_INIT_OUTSIDE_CTOR nsString mType; |
35 | | |
36 | | FilePropertyBag(); |
37 | | |
38 | | explicit inline FilePropertyBag(const FastDictionaryInitializer& ) |
39 | 0 | { |
40 | 0 | // Do nothing here; this is used by our "Fast" subclass |
41 | 0 | } |
42 | | |
43 | | explicit inline FilePropertyBag(const FilePropertyBag& aOther) |
44 | 0 | { |
45 | 0 | *this = aOther; |
46 | 0 | } |
47 | | |
48 | | bool |
49 | | Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false); |
50 | | |
51 | | bool |
52 | | Init(const nsAString& aJSON); |
53 | | |
54 | | bool |
55 | | ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const; |
56 | | |
57 | | bool |
58 | | ToJSON(nsAString& aJSON) const; |
59 | | |
60 | | void |
61 | | TraceDictionary(JSTracer* trc); |
62 | | |
63 | | FilePropertyBag& |
64 | | operator=(const FilePropertyBag& aOther); |
65 | | |
66 | | private: |
67 | | static bool |
68 | | InitIds(JSContext* cx, FilePropertyBagAtoms* atomsCache); |
69 | | }; |
70 | | |
71 | | namespace binding_detail { |
72 | | struct FastFilePropertyBag : public FilePropertyBag |
73 | | { |
74 | | inline FastFilePropertyBag() |
75 | | : FilePropertyBag(FastDictionaryInitializer()) |
76 | 0 | { |
77 | 0 | // Doesn't matter what int we pass to the parent constructor |
78 | 0 | } |
79 | | }; |
80 | | } // namespace binding_detail |
81 | | |
82 | | |
83 | | struct ChromeFilePropertyBag : public FilePropertyBag |
84 | | { |
85 | | MOZ_INIT_OUTSIDE_CTOR bool mExistenceCheck; |
86 | | MOZ_INIT_OUTSIDE_CTOR nsString mName; |
87 | | |
88 | | ChromeFilePropertyBag(); |
89 | | |
90 | | explicit inline ChromeFilePropertyBag(const FastDictionaryInitializer& ) |
91 | | : FilePropertyBag(FastDictionaryInitializer()) |
92 | 0 | { |
93 | 0 | // Do nothing here; this is used by our "Fast" subclass |
94 | 0 | } |
95 | | |
96 | | explicit inline ChromeFilePropertyBag(const ChromeFilePropertyBag& aOther) |
97 | 0 | { |
98 | 0 | *this = aOther; |
99 | 0 | } |
100 | | |
101 | | bool |
102 | | Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false); |
103 | | |
104 | | bool |
105 | | Init(const nsAString& aJSON); |
106 | | |
107 | | bool |
108 | | ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const; |
109 | | |
110 | | bool |
111 | | ToJSON(nsAString& aJSON) const; |
112 | | |
113 | | void |
114 | | TraceDictionary(JSTracer* trc); |
115 | | |
116 | | ChromeFilePropertyBag& |
117 | | operator=(const ChromeFilePropertyBag& aOther); |
118 | | |
119 | | private: |
120 | | static bool |
121 | | InitIds(JSContext* cx, ChromeFilePropertyBagAtoms* atomsCache); |
122 | | }; |
123 | | |
124 | | namespace binding_detail { |
125 | | struct FastChromeFilePropertyBag : public ChromeFilePropertyBag |
126 | | { |
127 | | inline FastChromeFilePropertyBag() |
128 | | : ChromeFilePropertyBag(FastDictionaryInitializer()) |
129 | 0 | { |
130 | 0 | // Doesn't matter what int we pass to the parent constructor |
131 | 0 | } |
132 | | }; |
133 | | } // namespace binding_detail |
134 | | |
135 | | |
136 | | namespace File_Binding { |
137 | | |
138 | | typedef mozilla::dom::File NativeType; |
139 | | |
140 | | const JSClass* |
141 | | GetJSClass(); |
142 | | |
143 | | bool |
144 | | Wrap(JSContext* aCx, mozilla::dom::File* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector); |
145 | | |
146 | | template <class T> |
147 | | inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto) |
148 | 0 | { |
149 | 0 | JS::Rooted<JSObject*> reflector(aCx); |
150 | 0 | return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr; |
151 | 0 | } |
152 | | |
153 | | // We declare this as an array so that retrieving a pointer to this |
154 | | // binding's property hooks only requires compile/link-time resolvable |
155 | | // address arithmetic. Declaring it as a pointer instead would require |
156 | | // doing a run-time load to fetch a pointer to this binding's property |
157 | | // hooks. And then structures which embedded a pointer to this structure |
158 | | // would require a run-time load for proper initialization, which would |
159 | | // then induce static constructors. Lots of static constructors. |
160 | | extern const NativePropertyHooks sNativePropertyHooks[]; |
161 | | |
162 | | void |
163 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal); |
164 | | |
165 | | inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx) |
166 | 0 | { |
167 | 0 | /* Get the interface prototype object for this class. This will create the |
168 | 0 | object as needed. */ |
169 | 0 | return GetPerInterfaceObjectHandle(aCx, prototypes::id::File, |
170 | 0 | &CreateInterfaceObjects, |
171 | 0 | /* aDefineOnGlobal = */ true); |
172 | 0 |
|
173 | 0 | } |
174 | | |
175 | | inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true) |
176 | 0 | { |
177 | 0 | /* Get the interface object for this class. This will create the object as |
178 | 0 | needed. */ |
179 | 0 |
|
180 | 0 | return GetPerInterfaceObjectHandle(aCx, constructors::id::File, |
181 | 0 | &CreateInterfaceObjects, |
182 | 0 | aDefineOnGlobal); |
183 | 0 | } |
184 | | |
185 | | JSObject* |
186 | | GetConstructorObject(JSContext* aCx); |
187 | | |
188 | | } // namespace File_Binding |
189 | | |
190 | | |
191 | | |
192 | | } // namespace dom |
193 | | } // namespace mozilla |
194 | | |
195 | | #endif // mozilla_dom_FileBinding_h |