/work/obj-fuzz/dist/include/mozilla/dom/AddonManagerBinding.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* THIS FILE IS AUTOGENERATED FROM AddonManager.webidl BY Codegen.py - DO NOT EDIT */ |
2 | | |
3 | | #ifndef mozilla_dom_AddonManagerBinding_h |
4 | | #define mozilla_dom_AddonManagerBinding_h |
5 | | |
6 | | #include "GeckoProfiler.h" |
7 | | #include "js/RootingAPI.h" |
8 | | #include "jspubtd.h" |
9 | | #include "mozilla/DOMEventTargetHelper.h" |
10 | | #include "mozilla/ErrorResult.h" |
11 | | #include "mozilla/dom/BindingDeclarations.h" |
12 | | #include "mozilla/dom/CallbackInterface.h" |
13 | | #include "mozilla/dom/Nullable.h" |
14 | | #include "mozilla/dom/PrototypeList.h" |
15 | | #include "mozilla/dom/ToJSValue.h" |
16 | | #include "nsWeakReference.h" |
17 | | |
18 | | namespace mozilla { |
19 | | namespace dom { |
20 | | |
21 | | class Addon; |
22 | | struct AddonAtoms; |
23 | | class AddonInstall; |
24 | | struct AddonInstallAtoms; |
25 | | class AddonManager; |
26 | | struct AddonManagerAtoms; |
27 | | class AddonManagerPermissions; |
28 | | struct AddonManagerPermissionsAtoms; |
29 | | struct NativePropertyHooks; |
30 | | class Promise; |
31 | | class ProtoAndIfaceCache; |
32 | | struct addonInstallOptions; |
33 | | struct addonInstallOptionsAtoms; |
34 | | |
35 | | } // namespace dom |
36 | | } // namespace mozilla |
37 | | |
38 | | namespace mozilla { |
39 | | namespace dom { |
40 | | |
41 | | struct addonInstallOptions : public DictionaryBase |
42 | | { |
43 | | MOZ_INIT_OUTSIDE_CTOR nsString mHash; |
44 | | MOZ_INIT_OUTSIDE_CTOR nsString mUrl; |
45 | | |
46 | | addonInstallOptions(); |
47 | | |
48 | | explicit inline addonInstallOptions(const FastDictionaryInitializer& ) |
49 | 0 | { |
50 | 0 | // Do nothing here; this is used by our "Fast" subclass |
51 | 0 | } |
52 | | |
53 | | explicit inline addonInstallOptions(const addonInstallOptions& aOther) |
54 | 0 | { |
55 | 0 | *this = aOther; |
56 | 0 | } |
57 | | |
58 | | bool |
59 | | Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false); |
60 | | |
61 | | bool |
62 | | Init(const nsAString& aJSON); |
63 | | |
64 | | bool |
65 | | ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const; |
66 | | |
67 | | bool |
68 | | ToJSON(nsAString& aJSON) const; |
69 | | |
70 | | void |
71 | | TraceDictionary(JSTracer* trc); |
72 | | |
73 | | addonInstallOptions& |
74 | | operator=(const addonInstallOptions& aOther); |
75 | | |
76 | | private: |
77 | | static bool |
78 | | InitIds(JSContext* cx, addonInstallOptionsAtoms* atomsCache); |
79 | | }; |
80 | | |
81 | | namespace binding_detail { |
82 | | struct FastaddonInstallOptions : public addonInstallOptions |
83 | | { |
84 | | inline FastaddonInstallOptions() |
85 | | : addonInstallOptions(FastDictionaryInitializer()) |
86 | 0 | { |
87 | 0 | // Doesn't matter what int we pass to the parent constructor |
88 | 0 | } |
89 | | }; |
90 | | } // namespace binding_detail |
91 | | |
92 | | |
93 | | namespace Addon_Binding { |
94 | | |
95 | | typedef mozilla::dom::Addon NativeType; |
96 | | |
97 | | bool |
98 | | ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj); |
99 | | |
100 | | const JSClass* |
101 | | GetJSClass(); |
102 | | |
103 | | bool |
104 | | Wrap(JSContext* aCx, mozilla::dom::Addon* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector); |
105 | | |
106 | | template <class T> |
107 | | inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto) |
108 | 0 | { |
109 | 0 | JS::Rooted<JSObject*> reflector(aCx); |
110 | 0 | return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr; |
111 | 0 | } |
112 | | |
113 | | // We declare this as an array so that retrieving a pointer to this |
114 | | // binding's property hooks only requires compile/link-time resolvable |
115 | | // address arithmetic. Declaring it as a pointer instead would require |
116 | | // doing a run-time load to fetch a pointer to this binding's property |
117 | | // hooks. And then structures which embedded a pointer to this structure |
118 | | // would require a run-time load for proper initialization, which would |
119 | | // then induce static constructors. Lots of static constructors. |
120 | | extern const NativePropertyHooks sNativePropertyHooks[]; |
121 | | |
122 | | void |
123 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal); |
124 | | |
125 | | inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx) |
126 | 0 | { |
127 | 0 | /* Get the interface prototype object for this class. This will create the |
128 | 0 | object as needed. */ |
129 | 0 | return GetPerInterfaceObjectHandle(aCx, prototypes::id::Addon, |
130 | 0 | &CreateInterfaceObjects, |
131 | 0 | /* aDefineOnGlobal = */ true); |
132 | 0 |
|
133 | 0 | } |
134 | | |
135 | | inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true) |
136 | 0 | { |
137 | 0 | /* Get the interface object for this class. This will create the object as |
138 | 0 | needed. */ |
139 | 0 |
|
140 | 0 | return GetPerInterfaceObjectHandle(aCx, constructors::id::Addon, |
141 | 0 | &CreateInterfaceObjects, |
142 | 0 | aDefineOnGlobal); |
143 | 0 | } |
144 | | |
145 | | JSObject* |
146 | | GetConstructorObject(JSContext* aCx); |
147 | | |
148 | | } // namespace Addon_Binding |
149 | | |
150 | | |
151 | | |
152 | | namespace AddonInstall_Binding { |
153 | | |
154 | | typedef mozilla::dom::AddonInstall NativeType; |
155 | | |
156 | | bool |
157 | | ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj); |
158 | | |
159 | | const JSClass* |
160 | | GetJSClass(); |
161 | | |
162 | | bool |
163 | | Wrap(JSContext* aCx, mozilla::dom::AddonInstall* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector); |
164 | | |
165 | | template <class T> |
166 | | inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto) |
167 | 0 | { |
168 | 0 | JS::Rooted<JSObject*> reflector(aCx); |
169 | 0 | return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr; |
170 | 0 | } |
171 | | |
172 | | // We declare this as an array so that retrieving a pointer to this |
173 | | // binding's property hooks only requires compile/link-time resolvable |
174 | | // address arithmetic. Declaring it as a pointer instead would require |
175 | | // doing a run-time load to fetch a pointer to this binding's property |
176 | | // hooks. And then structures which embedded a pointer to this structure |
177 | | // would require a run-time load for proper initialization, which would |
178 | | // then induce static constructors. Lots of static constructors. |
179 | | extern const NativePropertyHooks sNativePropertyHooks[]; |
180 | | |
181 | | void |
182 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal); |
183 | | |
184 | | inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx) |
185 | 0 | { |
186 | 0 | /* Get the interface prototype object for this class. This will create the |
187 | 0 | object as needed. */ |
188 | 0 | return GetPerInterfaceObjectHandle(aCx, prototypes::id::AddonInstall, |
189 | 0 | &CreateInterfaceObjects, |
190 | 0 | /* aDefineOnGlobal = */ true); |
191 | 0 |
|
192 | 0 | } |
193 | | |
194 | | inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true) |
195 | 0 | { |
196 | 0 | /* Get the interface object for this class. This will create the object as |
197 | 0 | needed. */ |
198 | 0 |
|
199 | 0 | return GetPerInterfaceObjectHandle(aCx, constructors::id::AddonInstall, |
200 | 0 | &CreateInterfaceObjects, |
201 | 0 | aDefineOnGlobal); |
202 | 0 | } |
203 | | |
204 | | JSObject* |
205 | | GetConstructorObject(JSContext* aCx); |
206 | | |
207 | | } // namespace AddonInstall_Binding |
208 | | |
209 | | |
210 | | |
211 | | namespace AddonManager_Binding { |
212 | | |
213 | | typedef mozilla::dom::AddonManager NativeType; |
214 | | |
215 | | already_AddRefed<AddonManager> |
216 | | ConstructNavigatorObject(JSContext* cx, JS::Handle<JSObject*> obj, ErrorResult& aRv); |
217 | | |
218 | | bool |
219 | | ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj); |
220 | | |
221 | | const JSClass* |
222 | | GetJSClass(); |
223 | | |
224 | | bool |
225 | | Wrap(JSContext* aCx, mozilla::dom::AddonManager* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector); |
226 | | |
227 | | template <class T> |
228 | | inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto) |
229 | 0 | { |
230 | 0 | JS::Rooted<JSObject*> reflector(aCx); |
231 | 0 | return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr; |
232 | 0 | } |
233 | | |
234 | | // We declare this as an array so that retrieving a pointer to this |
235 | | // binding's property hooks only requires compile/link-time resolvable |
236 | | // address arithmetic. Declaring it as a pointer instead would require |
237 | | // doing a run-time load to fetch a pointer to this binding's property |
238 | | // hooks. And then structures which embedded a pointer to this structure |
239 | | // would require a run-time load for proper initialization, which would |
240 | | // then induce static constructors. Lots of static constructors. |
241 | | extern const NativePropertyHooks sNativePropertyHooks[]; |
242 | | |
243 | | void |
244 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal); |
245 | | |
246 | | inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx) |
247 | 0 | { |
248 | 0 | /* Get the interface prototype object for this class. This will create the |
249 | 0 | object as needed. */ |
250 | 0 | return GetPerInterfaceObjectHandle(aCx, prototypes::id::AddonManager, |
251 | 0 | &CreateInterfaceObjects, |
252 | 0 | /* aDefineOnGlobal = */ true); |
253 | 0 |
|
254 | 0 | } |
255 | | |
256 | | inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true) |
257 | 0 | { |
258 | 0 | /* Get the interface object for this class. This will create the object as |
259 | 0 | needed. */ |
260 | 0 |
|
261 | 0 | return GetPerInterfaceObjectHandle(aCx, constructors::id::AddonManager, |
262 | 0 | &CreateInterfaceObjects, |
263 | 0 | aDefineOnGlobal); |
264 | 0 | } |
265 | | |
266 | | JSObject* |
267 | | GetConstructorObject(JSContext* aCx); |
268 | | |
269 | | } // namespace AddonManager_Binding |
270 | | |
271 | | |
272 | | |
273 | | namespace AddonManagerPermissions_Binding { |
274 | | |
275 | | typedef mozilla::dom::AddonManagerPermissions NativeType; |
276 | | |
277 | | bool |
278 | | ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj); |
279 | | |
280 | | void |
281 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal); |
282 | | |
283 | | inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true) |
284 | 0 | { |
285 | 0 | /* Get the interface object for this class. This will create the object as |
286 | 0 | needed. */ |
287 | 0 |
|
288 | 0 | return GetPerInterfaceObjectHandle(aCx, constructors::id::AddonManagerPermissions, |
289 | 0 | &CreateInterfaceObjects, |
290 | 0 | aDefineOnGlobal); |
291 | 0 | } |
292 | | |
293 | | JSObject* |
294 | | GetConstructorObject(JSContext* aCx); |
295 | | |
296 | | } // namespace AddonManagerPermissions_Binding |
297 | | |
298 | | |
299 | | |
300 | | class AddonJSImpl : public CallbackInterface |
301 | | { |
302 | | public: |
303 | | explicit inline AddonJSImpl(JSContext* aCx, JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aCallbackGlobal, nsIGlobalObject* aIncumbentGlobal) |
304 | | : CallbackInterface(aCx, aCallback, aCallbackGlobal, aIncumbentGlobal) |
305 | 0 | { |
306 | 0 | } |
307 | | |
308 | | explicit inline AddonJSImpl(JSObject* aCallback, JSObject* aCallbackGlobal, const FastCallbackConstructor& ) |
309 | | : CallbackInterface(aCallback, aCallbackGlobal, FastCallbackConstructor()) |
310 | 0 | { |
311 | 0 | } |
312 | | |
313 | | explicit inline AddonJSImpl(JSObject* aCallback, JSObject* aCallbackGlobal, JSObject* aAsyncStack, nsIGlobalObject* aIncumbentGlobal) |
314 | | : CallbackInterface(aCallback, aCallbackGlobal, aAsyncStack, aIncumbentGlobal) |
315 | 0 | { |
316 | 0 | } |
317 | | |
318 | | already_AddRefed<Promise> Uninstall(ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
319 | | |
320 | | already_AddRefed<Promise> SetEnabled(bool value, ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
321 | | |
322 | | inline bool |
323 | | operator==(const AddonJSImpl& aOther) const |
324 | 0 | { |
325 | 0 | return CallbackInterface::operator==(aOther); |
326 | 0 | } |
327 | | |
328 | | void GetId(nsString& aRetVal, ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
329 | | |
330 | | void GetVersion(nsString& aRetVal, ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
331 | | |
332 | | void GetType(nsString& aRetVal, ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
333 | | |
334 | | void GetName(nsString& aRetVal, ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
335 | | |
336 | | void GetDescription(nsString& aRetVal, ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
337 | | |
338 | | bool GetIsEnabled(ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
339 | | |
340 | | bool GetIsActive(ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
341 | | |
342 | | bool GetCanUninstall(ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
343 | | |
344 | | private: |
345 | | static bool |
346 | | InitIds(JSContext* cx, AddonAtoms* atomsCache); |
347 | | }; |
348 | | |
349 | | |
350 | | class Addon final : public nsSupportsWeakReference, |
351 | | public nsWrapperCache |
352 | | { |
353 | | public: |
354 | | NS_DECL_CYCLE_COLLECTING_ISUPPORTS |
355 | | NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Addon) |
356 | | |
357 | | private: |
358 | | RefPtr<AddonJSImpl> mImpl; |
359 | | nsCOMPtr<nsIGlobalObject> mParent; |
360 | | |
361 | | public: |
362 | | Addon(JS::Handle<JSObject*> aJSImplObject, JS::Handle<JSObject*> aJSImplGlobal, nsIGlobalObject* aParent); |
363 | | |
364 | | private: |
365 | | ~Addon(); |
366 | | |
367 | | public: |
368 | | nsISupports* GetParentObject() const; |
369 | | |
370 | | virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override; |
371 | | |
372 | | void GetId(nsString& aRetVal, ErrorResult& aRv, JS::Realm* aRealm = nullptr) const; |
373 | | |
374 | | void GetVersion(nsString& aRetVal, ErrorResult& aRv, JS::Realm* aRealm = nullptr) const; |
375 | | |
376 | | void GetType(nsString& aRetVal, ErrorResult& aRv, JS::Realm* aRealm = nullptr) const; |
377 | | |
378 | | void GetName(nsString& aRetVal, ErrorResult& aRv, JS::Realm* aRealm = nullptr) const; |
379 | | |
380 | | void GetDescription(nsString& aRetVal, ErrorResult& aRv, JS::Realm* aRealm = nullptr) const; |
381 | | |
382 | | bool GetIsEnabled(ErrorResult& aRv, JS::Realm* aRealm = nullptr) const; |
383 | | |
384 | | bool GetIsActive(ErrorResult& aRv, JS::Realm* aRealm = nullptr) const; |
385 | | |
386 | | bool GetCanUninstall(ErrorResult& aRv, JS::Realm* aRealm = nullptr) const; |
387 | | |
388 | | // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee). |
389 | | already_AddRefed<Promise> Uninstall(ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
390 | | |
391 | | // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee). |
392 | | already_AddRefed<Promise> SetEnabled(bool value, ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
393 | | |
394 | | static bool |
395 | | _Create(JSContext* cx, unsigned argc, JS::Value* vp); |
396 | | }; |
397 | | |
398 | | |
399 | | class AddonInstallJSImpl : public CallbackInterface |
400 | | { |
401 | | public: |
402 | | explicit inline AddonInstallJSImpl(JSContext* aCx, JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aCallbackGlobal, nsIGlobalObject* aIncumbentGlobal) |
403 | | : CallbackInterface(aCx, aCallback, aCallbackGlobal, aIncumbentGlobal) |
404 | 0 | { |
405 | 0 | } |
406 | | |
407 | | explicit inline AddonInstallJSImpl(JSObject* aCallback, JSObject* aCallbackGlobal, const FastCallbackConstructor& ) |
408 | | : CallbackInterface(aCallback, aCallbackGlobal, FastCallbackConstructor()) |
409 | 0 | { |
410 | 0 | } |
411 | | |
412 | | explicit inline AddonInstallJSImpl(JSObject* aCallback, JSObject* aCallbackGlobal, JSObject* aAsyncStack, nsIGlobalObject* aIncumbentGlobal) |
413 | | : CallbackInterface(aCallback, aCallbackGlobal, aAsyncStack, aIncumbentGlobal) |
414 | 0 | { |
415 | 0 | } |
416 | | |
417 | | already_AddRefed<Promise> Install(ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
418 | | |
419 | | already_AddRefed<Promise> Cancel(ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
420 | | |
421 | | inline bool |
422 | | operator==(const AddonInstallJSImpl& aOther) const |
423 | 0 | { |
424 | 0 | return CallbackInterface::operator==(aOther); |
425 | 0 | } |
426 | | |
427 | | void GetState(nsString& aRetVal, ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
428 | | |
429 | | void GetError(nsString& aRetVal, ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
430 | | |
431 | | int64_t GetProgress(ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
432 | | |
433 | | int64_t GetMaxProgress(ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
434 | | |
435 | | private: |
436 | | static bool |
437 | | InitIds(JSContext* cx, AddonInstallAtoms* atomsCache); |
438 | | }; |
439 | | |
440 | | |
441 | | class AddonInstall final : public mozilla::DOMEventTargetHelper |
442 | | { |
443 | | public: |
444 | | NS_DECL_ISUPPORTS_INHERITED |
445 | | NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(AddonInstall, mozilla::DOMEventTargetHelper) |
446 | | |
447 | | private: |
448 | | RefPtr<AddonInstallJSImpl> mImpl; |
449 | | nsCOMPtr<nsIGlobalObject> mParent; |
450 | | |
451 | | public: |
452 | | AddonInstall(JS::Handle<JSObject*> aJSImplObject, JS::Handle<JSObject*> aJSImplGlobal, nsIGlobalObject* aParent); |
453 | | |
454 | | private: |
455 | | ~AddonInstall(); |
456 | | |
457 | | public: |
458 | | nsISupports* GetParentObject() const; |
459 | | |
460 | | virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override; |
461 | | |
462 | | void GetState(nsString& aRetVal, ErrorResult& aRv, JS::Realm* aRealm = nullptr) const; |
463 | | |
464 | | void GetError(nsString& aRetVal, ErrorResult& aRv, JS::Realm* aRealm = nullptr) const; |
465 | | |
466 | | int64_t GetProgress(ErrorResult& aRv, JS::Realm* aRealm = nullptr) const; |
467 | | |
468 | | int64_t GetMaxProgress(ErrorResult& aRv, JS::Realm* aRealm = nullptr) const; |
469 | | |
470 | | // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee). |
471 | | already_AddRefed<Promise> Install(ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
472 | | |
473 | | // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee). |
474 | | already_AddRefed<Promise> Cancel(ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
475 | | |
476 | | static bool |
477 | | _Create(JSContext* cx, unsigned argc, JS::Value* vp); |
478 | | }; |
479 | | |
480 | | |
481 | | class AddonManagerJSImpl : public CallbackInterface |
482 | | { |
483 | | public: |
484 | | explicit inline AddonManagerJSImpl(JSContext* aCx, JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aCallbackGlobal, nsIGlobalObject* aIncumbentGlobal) |
485 | | : CallbackInterface(aCx, aCallback, aCallbackGlobal, aIncumbentGlobal) |
486 | 0 | { |
487 | 0 | } |
488 | | |
489 | | explicit inline AddonManagerJSImpl(JSObject* aCallback, JSObject* aCallbackGlobal, const FastCallbackConstructor& ) |
490 | | : CallbackInterface(aCallback, aCallbackGlobal, FastCallbackConstructor()) |
491 | 0 | { |
492 | 0 | } |
493 | | |
494 | | explicit inline AddonManagerJSImpl(JSObject* aCallback, JSObject* aCallbackGlobal, JSObject* aAsyncStack, nsIGlobalObject* aIncumbentGlobal) |
495 | | : CallbackInterface(aCallback, aCallbackGlobal, aAsyncStack, aIncumbentGlobal) |
496 | 0 | { |
497 | 0 | } |
498 | | |
499 | | already_AddRefed<Promise> GetAddonByID(const nsAString& id, ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
500 | | |
501 | | already_AddRefed<Promise> CreateInstall(const addonInstallOptions& options, ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
502 | | |
503 | | void EventListenerAdded(const nsAString& aType, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr); |
504 | | |
505 | | void EventListenerRemoved(const nsAString& aType, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr); |
506 | | |
507 | | inline bool |
508 | | operator==(const AddonManagerJSImpl& aOther) const |
509 | 0 | { |
510 | 0 | return CallbackInterface::operator==(aOther); |
511 | 0 | } |
512 | | |
513 | | bool GetPermissionPromptsEnabled(ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
514 | | |
515 | | private: |
516 | | static bool |
517 | | InitIds(JSContext* cx, AddonManagerAtoms* atomsCache); |
518 | | }; |
519 | | |
520 | | |
521 | | class AddonManager final : public mozilla::DOMEventTargetHelper |
522 | | { |
523 | | public: |
524 | | NS_DECL_ISUPPORTS_INHERITED |
525 | | NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(AddonManager, mozilla::DOMEventTargetHelper) |
526 | | |
527 | | private: |
528 | | RefPtr<AddonManagerJSImpl> mImpl; |
529 | | nsCOMPtr<nsIGlobalObject> mParent; |
530 | | |
531 | | public: |
532 | | AddonManager(JS::Handle<JSObject*> aJSImplObject, JS::Handle<JSObject*> aJSImplGlobal, nsIGlobalObject* aParent); |
533 | | |
534 | | private: |
535 | | ~AddonManager(); |
536 | | |
537 | | public: |
538 | | nsISupports* GetParentObject() const; |
539 | | |
540 | | virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override; |
541 | | |
542 | | // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee). |
543 | | already_AddRefed<Promise> GetAddonByID(const nsAString& id, ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
544 | | |
545 | | // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee). |
546 | | already_AddRefed<Promise> CreateInstall(const addonInstallOptions& options, ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
547 | | |
548 | | bool GetPermissionPromptsEnabled(ErrorResult& aRv, JS::Realm* aRealm = nullptr) const; |
549 | | |
550 | | virtual void |
551 | | EventListenerAdded(nsAtom* aType) override; |
552 | | |
553 | | using mozilla::DOMEventTargetHelper::EventListenerAdded; |
554 | | |
555 | | virtual void |
556 | | EventListenerRemoved(nsAtom* aType) override; |
557 | | |
558 | | using mozilla::DOMEventTargetHelper::EventListenerRemoved; |
559 | | |
560 | | static bool |
561 | | _Create(JSContext* cx, unsigned argc, JS::Value* vp); |
562 | | }; |
563 | | |
564 | | |
565 | | } // namespace dom |
566 | | } // namespace mozilla |
567 | | |
568 | | #endif // mozilla_dom_AddonManagerBinding_h |