/work/obj-fuzz/dist/include/mozilla/dom/MessageManagerBinding.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* THIS FILE IS AUTOGENERATED FROM MessageManager.webidl BY Codegen.py - DO NOT EDIT */ |
2 | | |
3 | | #ifndef mozilla_dom_MessageManagerBinding_h |
4 | | #define mozilla_dom_MessageManagerBinding_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/CallbackInterface.h" |
12 | | #include "mozilla/dom/MessagePort.h" |
13 | | #include "mozilla/dom/Nullable.h" |
14 | | #include "mozilla/dom/PrototypeList.h" |
15 | | #include "mozilla/dom/ToJSValue.h" |
16 | | #include "nsFrameLoader.h" |
17 | | #include "nsIPrincipal.h" |
18 | | #include "nsISupports.h" |
19 | | |
20 | | class nsFrameLoader; |
21 | | class nsIPrincipal; |
22 | | class nsISupports; |
23 | | |
24 | | namespace mozilla { |
25 | | namespace dom { |
26 | | |
27 | | class ChildProcessMessageManager; |
28 | | struct ChildProcessMessageManagerAtoms; |
29 | | class ChromeMessageBroadcaster; |
30 | | struct ChromeMessageBroadcasterAtoms; |
31 | | class ChromeMessageSender; |
32 | | struct ChromeMessageSenderAtoms; |
33 | | class ContentFrameMessageManager; |
34 | | struct ContentFrameMessageManagerAtoms; |
35 | | class ContentProcessMessageManager; |
36 | | struct ContentProcessMessageManagerAtoms; |
37 | | class MessageBroadcaster; |
38 | | struct MessageBroadcasterAtoms; |
39 | | class MessageListener; |
40 | | struct MessageListenerAtoms; |
41 | | class MessageListenerManager; |
42 | | struct MessageListenerManagerAtoms; |
43 | | class MessagePort; |
44 | | class MessageSender; |
45 | | struct MessageSenderAtoms; |
46 | | struct NativePropertyHooks; |
47 | | class ParentProcessMessageManager; |
48 | | struct ParentProcessMessageManagerAtoms; |
49 | | class ProcessMessageManager; |
50 | | struct ProcessMessageManagerAtoms; |
51 | | class ProtoAndIfaceCache; |
52 | | struct ReceiveMessageArgument; |
53 | | struct ReceiveMessageArgumentAtoms; |
54 | | class SyncMessageSender; |
55 | | struct SyncMessageSenderAtoms; |
56 | | |
57 | | } // namespace dom |
58 | | } // namespace mozilla |
59 | | |
60 | | namespace mozilla { |
61 | | namespace dom { |
62 | | |
63 | | struct ReceiveMessageArgument : public DictionaryBase |
64 | | { |
65 | | MOZ_INIT_OUTSIDE_CTOR JS::Value mData; |
66 | | MOZ_INIT_OUTSIDE_CTOR JS::Value mJson; |
67 | | MOZ_INIT_OUTSIDE_CTOR nsString mName; |
68 | | MOZ_INIT_OUTSIDE_CTOR JSObject* mObjects; |
69 | | MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<OwningNonNull<mozilla::dom::MessagePort>>> mPorts; |
70 | | MOZ_INIT_OUTSIDE_CTOR RefPtr<nsIPrincipal> mPrincipal; |
71 | | MOZ_INIT_OUTSIDE_CTOR bool mSync; |
72 | | MOZ_INIT_OUTSIDE_CTOR RefPtr<nsISupports> mTarget; |
73 | | MOZ_INIT_OUTSIDE_CTOR Optional<OwningNonNull<nsFrameLoader>> mTargetFrameLoader; |
74 | | |
75 | | ReceiveMessageArgument(); |
76 | | |
77 | | explicit inline ReceiveMessageArgument(const FastDictionaryInitializer& ) |
78 | | : mData(JS::UndefinedValue()), |
79 | | mJson(JS::UndefinedValue()), |
80 | | mObjects(nullptr) |
81 | 0 | { |
82 | 0 | // Do nothing here; this is used by our "Fast" subclass |
83 | 0 | } |
84 | | |
85 | | private: |
86 | | ReceiveMessageArgument(const ReceiveMessageArgument&) = delete; |
87 | | ReceiveMessageArgument& operator=(const ReceiveMessageArgument&) = delete; |
88 | | |
89 | | static bool |
90 | | InitIds(JSContext* cx, ReceiveMessageArgumentAtoms* atomsCache); |
91 | | |
92 | | public: |
93 | | bool |
94 | | Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false); |
95 | | |
96 | | bool |
97 | | ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const; |
98 | | |
99 | | void |
100 | | TraceDictionary(JSTracer* trc); |
101 | | |
102 | | inline void |
103 | | TraverseForCC(nsCycleCollectionTraversalCallback& aCallback, uint32_t aFlags) |
104 | 0 | { |
105 | 0 | ImplCycleCollectionTraverse(aCallback, mPorts, "mPorts", aFlags); |
106 | 0 | ImplCycleCollectionTraverse(aCallback, mPrincipal, "mPrincipal", aFlags); |
107 | 0 | ImplCycleCollectionTraverse(aCallback, mTarget, "mTarget", aFlags); |
108 | 0 | ImplCycleCollectionTraverse(aCallback, mTargetFrameLoader, "mTargetFrameLoader", aFlags); |
109 | 0 | } |
110 | | |
111 | | inline void |
112 | | UnlinkForCC() |
113 | 0 | { |
114 | 0 | ImplCycleCollectionUnlink(mPorts); |
115 | 0 | ImplCycleCollectionUnlink(mPrincipal); |
116 | 0 | ImplCycleCollectionUnlink(mTarget); |
117 | 0 | ImplCycleCollectionUnlink(mTargetFrameLoader); |
118 | 0 | } |
119 | | }; |
120 | | |
121 | | namespace binding_detail { |
122 | | struct FastReceiveMessageArgument : public ReceiveMessageArgument |
123 | | { |
124 | | inline FastReceiveMessageArgument() |
125 | | : ReceiveMessageArgument(FastDictionaryInitializer()) |
126 | 0 | { |
127 | 0 | // Doesn't matter what int we pass to the parent constructor |
128 | 0 | } |
129 | | }; |
130 | | } // namespace binding_detail |
131 | | |
132 | | |
133 | | namespace ChildProcessMessageManager_Binding { |
134 | | |
135 | | typedef mozilla::dom::ChildProcessMessageManager NativeType; |
136 | | |
137 | | bool |
138 | | ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj); |
139 | | |
140 | | const JSClass* |
141 | | GetJSClass(); |
142 | | |
143 | | bool |
144 | | Wrap(JSContext* aCx, mozilla::dom::ChildProcessMessageManager* 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::ChildProcessMessageManager, |
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::ChildProcessMessageManager, |
181 | 0 | &CreateInterfaceObjects, |
182 | 0 | aDefineOnGlobal); |
183 | 0 | } |
184 | | |
185 | | JSObject* |
186 | | GetConstructorObject(JSContext* aCx); |
187 | | |
188 | | } // namespace ChildProcessMessageManager_Binding |
189 | | |
190 | | |
191 | | |
192 | | namespace ChromeMessageBroadcaster_Binding { |
193 | | |
194 | | typedef mozilla::dom::ChromeMessageBroadcaster NativeType; |
195 | | |
196 | | bool |
197 | | ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj); |
198 | | |
199 | | const JSClass* |
200 | | GetJSClass(); |
201 | | |
202 | | bool |
203 | | Wrap(JSContext* aCx, mozilla::dom::ChromeMessageBroadcaster* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector); |
204 | | |
205 | | template <class T> |
206 | | inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto) |
207 | 0 | { |
208 | 0 | JS::Rooted<JSObject*> reflector(aCx); |
209 | 0 | return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr; |
210 | 0 | } |
211 | | |
212 | | // We declare this as an array so that retrieving a pointer to this |
213 | | // binding's property hooks only requires compile/link-time resolvable |
214 | | // address arithmetic. Declaring it as a pointer instead would require |
215 | | // doing a run-time load to fetch a pointer to this binding's property |
216 | | // hooks. And then structures which embedded a pointer to this structure |
217 | | // would require a run-time load for proper initialization, which would |
218 | | // then induce static constructors. Lots of static constructors. |
219 | | extern const NativePropertyHooks sNativePropertyHooks[]; |
220 | | |
221 | | void |
222 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal); |
223 | | |
224 | | inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx) |
225 | 0 | { |
226 | 0 | /* Get the interface prototype object for this class. This will create the |
227 | 0 | object as needed. */ |
228 | 0 | return GetPerInterfaceObjectHandle(aCx, prototypes::id::ChromeMessageBroadcaster, |
229 | 0 | &CreateInterfaceObjects, |
230 | 0 | /* aDefineOnGlobal = */ true); |
231 | 0 |
|
232 | 0 | } |
233 | | |
234 | | inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true) |
235 | 0 | { |
236 | 0 | /* Get the interface object for this class. This will create the object as |
237 | 0 | needed. */ |
238 | 0 |
|
239 | 0 | return GetPerInterfaceObjectHandle(aCx, constructors::id::ChromeMessageBroadcaster, |
240 | 0 | &CreateInterfaceObjects, |
241 | 0 | aDefineOnGlobal); |
242 | 0 | } |
243 | | |
244 | | JSObject* |
245 | | GetConstructorObject(JSContext* aCx); |
246 | | |
247 | | } // namespace ChromeMessageBroadcaster_Binding |
248 | | |
249 | | |
250 | | |
251 | | namespace ChromeMessageSender_Binding { |
252 | | |
253 | | typedef mozilla::dom::ChromeMessageSender NativeType; |
254 | | |
255 | | bool |
256 | | ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj); |
257 | | |
258 | | const JSClass* |
259 | | GetJSClass(); |
260 | | |
261 | | bool |
262 | | Wrap(JSContext* aCx, mozilla::dom::ChromeMessageSender* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector); |
263 | | |
264 | | template <class T> |
265 | | inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto) |
266 | 0 | { |
267 | 0 | JS::Rooted<JSObject*> reflector(aCx); |
268 | 0 | return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr; |
269 | 0 | } |
270 | | |
271 | | // We declare this as an array so that retrieving a pointer to this |
272 | | // binding's property hooks only requires compile/link-time resolvable |
273 | | // address arithmetic. Declaring it as a pointer instead would require |
274 | | // doing a run-time load to fetch a pointer to this binding's property |
275 | | // hooks. And then structures which embedded a pointer to this structure |
276 | | // would require a run-time load for proper initialization, which would |
277 | | // then induce static constructors. Lots of static constructors. |
278 | | extern const NativePropertyHooks sNativePropertyHooks[]; |
279 | | |
280 | | void |
281 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal); |
282 | | |
283 | | inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx) |
284 | 0 | { |
285 | 0 | /* Get the interface prototype object for this class. This will create the |
286 | 0 | object as needed. */ |
287 | 0 | return GetPerInterfaceObjectHandle(aCx, prototypes::id::ChromeMessageSender, |
288 | 0 | &CreateInterfaceObjects, |
289 | 0 | /* aDefineOnGlobal = */ true); |
290 | 0 |
|
291 | 0 | } |
292 | | |
293 | | inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true) |
294 | 0 | { |
295 | 0 | /* Get the interface object for this class. This will create the object as |
296 | 0 | needed. */ |
297 | 0 |
|
298 | 0 | return GetPerInterfaceObjectHandle(aCx, constructors::id::ChromeMessageSender, |
299 | 0 | &CreateInterfaceObjects, |
300 | 0 | aDefineOnGlobal); |
301 | 0 | } |
302 | | |
303 | | JSObject* |
304 | | GetConstructorObject(JSContext* aCx); |
305 | | |
306 | | } // namespace ChromeMessageSender_Binding |
307 | | |
308 | | |
309 | | |
310 | | namespace ContentFrameMessageManager_Binding { |
311 | | |
312 | | typedef mozilla::dom::ContentFrameMessageManager NativeType; |
313 | | |
314 | | bool |
315 | | ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj); |
316 | | |
317 | | const JSClass* |
318 | | GetJSClass(); |
319 | | |
320 | | bool |
321 | | Wrap(JSContext* aCx, mozilla::dom::ContentFrameMessageManager* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector); |
322 | | |
323 | | template <class T> |
324 | | inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto) |
325 | 0 | { |
326 | 0 | JS::Rooted<JSObject*> reflector(aCx); |
327 | 0 | return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr; |
328 | 0 | } Unexecuted instantiation: JSObject* mozilla::dom::ContentFrameMessageManager_Binding::Wrap<mozilla::dom::InProcessTabChildMessageManager>(JSContext*, mozilla::dom::InProcessTabChildMessageManager*, JS::Handle<JSObject*>) Unexecuted instantiation: JSObject* mozilla::dom::ContentFrameMessageManager_Binding::Wrap<mozilla::dom::TabChildMessageManager>(JSContext*, mozilla::dom::TabChildMessageManager*, JS::Handle<JSObject*>) |
329 | | |
330 | | // We declare this as an array so that retrieving a pointer to this |
331 | | // binding's property hooks only requires compile/link-time resolvable |
332 | | // address arithmetic. Declaring it as a pointer instead would require |
333 | | // doing a run-time load to fetch a pointer to this binding's property |
334 | | // hooks. And then structures which embedded a pointer to this structure |
335 | | // would require a run-time load for proper initialization, which would |
336 | | // then induce static constructors. Lots of static constructors. |
337 | | extern const NativePropertyHooks sNativePropertyHooks[]; |
338 | | |
339 | | void |
340 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal); |
341 | | |
342 | | inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx) |
343 | 0 | { |
344 | 0 | /* Get the interface prototype object for this class. This will create the |
345 | 0 | object as needed. */ |
346 | 0 | return GetPerInterfaceObjectHandle(aCx, prototypes::id::ContentFrameMessageManager, |
347 | 0 | &CreateInterfaceObjects, |
348 | 0 | /* aDefineOnGlobal = */ true); |
349 | 0 |
|
350 | 0 | } |
351 | | |
352 | | inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true) |
353 | 0 | { |
354 | 0 | /* Get the interface object for this class. This will create the object as |
355 | 0 | needed. */ |
356 | 0 |
|
357 | 0 | return GetPerInterfaceObjectHandle(aCx, constructors::id::ContentFrameMessageManager, |
358 | 0 | &CreateInterfaceObjects, |
359 | 0 | aDefineOnGlobal); |
360 | 0 | } |
361 | | |
362 | | JSObject* |
363 | | GetConstructorObject(JSContext* aCx); |
364 | | |
365 | | } // namespace ContentFrameMessageManager_Binding |
366 | | |
367 | | |
368 | | |
369 | | namespace ContentProcessMessageManager_Binding { |
370 | | |
371 | | typedef mozilla::dom::ContentProcessMessageManager NativeType; |
372 | | |
373 | | bool |
374 | | ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj); |
375 | | |
376 | | const JSClass* |
377 | | GetJSClass(); |
378 | | |
379 | | bool |
380 | | Wrap(JSContext* aCx, mozilla::dom::ContentProcessMessageManager* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector); |
381 | | |
382 | | template <class T> |
383 | | inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto) |
384 | 0 | { |
385 | 0 | JS::Rooted<JSObject*> reflector(aCx); |
386 | 0 | return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr; |
387 | 0 | } |
388 | | |
389 | | // We declare this as an array so that retrieving a pointer to this |
390 | | // binding's property hooks only requires compile/link-time resolvable |
391 | | // address arithmetic. Declaring it as a pointer instead would require |
392 | | // doing a run-time load to fetch a pointer to this binding's property |
393 | | // hooks. And then structures which embedded a pointer to this structure |
394 | | // would require a run-time load for proper initialization, which would |
395 | | // then induce static constructors. Lots of static constructors. |
396 | | extern const NativePropertyHooks sNativePropertyHooks[]; |
397 | | |
398 | | void |
399 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal); |
400 | | |
401 | | inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx) |
402 | 0 | { |
403 | 0 | /* Get the interface prototype object for this class. This will create the |
404 | 0 | object as needed. */ |
405 | 0 | return GetPerInterfaceObjectHandle(aCx, prototypes::id::ContentProcessMessageManager, |
406 | 0 | &CreateInterfaceObjects, |
407 | 0 | /* aDefineOnGlobal = */ true); |
408 | 0 |
|
409 | 0 | } |
410 | | |
411 | | inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true) |
412 | 0 | { |
413 | 0 | /* Get the interface object for this class. This will create the object as |
414 | 0 | needed. */ |
415 | 0 |
|
416 | 0 | return GetPerInterfaceObjectHandle(aCx, constructors::id::ContentProcessMessageManager, |
417 | 0 | &CreateInterfaceObjects, |
418 | 0 | aDefineOnGlobal); |
419 | 0 | } |
420 | | |
421 | | JSObject* |
422 | | GetConstructorObject(JSContext* aCx); |
423 | | |
424 | | } // namespace ContentProcessMessageManager_Binding |
425 | | |
426 | | |
427 | | |
428 | | namespace MessageBroadcaster_Binding { |
429 | | |
430 | | typedef mozilla::dom::MessageBroadcaster NativeType; |
431 | | |
432 | | bool |
433 | | ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj); |
434 | | |
435 | | // We declare this as an array so that retrieving a pointer to this |
436 | | // binding's property hooks only requires compile/link-time resolvable |
437 | | // address arithmetic. Declaring it as a pointer instead would require |
438 | | // doing a run-time load to fetch a pointer to this binding's property |
439 | | // hooks. And then structures which embedded a pointer to this structure |
440 | | // would require a run-time load for proper initialization, which would |
441 | | // then induce static constructors. Lots of static constructors. |
442 | | extern const NativePropertyHooks sNativePropertyHooks[]; |
443 | | |
444 | | void |
445 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal); |
446 | | |
447 | | inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx) |
448 | 0 | { |
449 | 0 | /* Get the interface prototype object for this class. This will create the |
450 | 0 | object as needed. */ |
451 | 0 | return GetPerInterfaceObjectHandle(aCx, prototypes::id::MessageBroadcaster, |
452 | 0 | &CreateInterfaceObjects, |
453 | 0 | /* aDefineOnGlobal = */ true); |
454 | 0 |
|
455 | 0 | } |
456 | | |
457 | | JSObject* |
458 | | GetProtoObject(JSContext* aCx); |
459 | | |
460 | | inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true) |
461 | 0 | { |
462 | 0 | /* Get the interface object for this class. This will create the object as |
463 | 0 | needed. */ |
464 | 0 |
|
465 | 0 | return GetPerInterfaceObjectHandle(aCx, constructors::id::MessageBroadcaster, |
466 | 0 | &CreateInterfaceObjects, |
467 | 0 | aDefineOnGlobal); |
468 | 0 | } |
469 | | |
470 | | JSObject* |
471 | | GetConstructorObject(JSContext* aCx); |
472 | | |
473 | | } // namespace MessageBroadcaster_Binding |
474 | | |
475 | | |
476 | | |
477 | | namespace MessageListenerManager_Binding { |
478 | | |
479 | | typedef mozilla::dom::MessageListenerManager NativeType; |
480 | | |
481 | | bool |
482 | | ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj); |
483 | | |
484 | | // We declare this as an array so that retrieving a pointer to this |
485 | | // binding's property hooks only requires compile/link-time resolvable |
486 | | // address arithmetic. Declaring it as a pointer instead would require |
487 | | // doing a run-time load to fetch a pointer to this binding's property |
488 | | // hooks. And then structures which embedded a pointer to this structure |
489 | | // would require a run-time load for proper initialization, which would |
490 | | // then induce static constructors. Lots of static constructors. |
491 | | extern const NativePropertyHooks sNativePropertyHooks[]; |
492 | | |
493 | | void |
494 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal); |
495 | | |
496 | | inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx) |
497 | 0 | { |
498 | 0 | /* Get the interface prototype object for this class. This will create the |
499 | 0 | object as needed. */ |
500 | 0 | return GetPerInterfaceObjectHandle(aCx, prototypes::id::MessageListenerManager, |
501 | 0 | &CreateInterfaceObjects, |
502 | 0 | /* aDefineOnGlobal = */ true); |
503 | 0 |
|
504 | 0 | } |
505 | | |
506 | | JSObject* |
507 | | GetProtoObject(JSContext* aCx); |
508 | | |
509 | | inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true) |
510 | 0 | { |
511 | 0 | /* Get the interface object for this class. This will create the object as |
512 | 0 | needed. */ |
513 | 0 |
|
514 | 0 | return GetPerInterfaceObjectHandle(aCx, constructors::id::MessageListenerManager, |
515 | 0 | &CreateInterfaceObjects, |
516 | 0 | aDefineOnGlobal); |
517 | 0 | } |
518 | | |
519 | | JSObject* |
520 | | GetConstructorObject(JSContext* aCx); |
521 | | |
522 | | } // namespace MessageListenerManager_Binding |
523 | | |
524 | | |
525 | | |
526 | | namespace MessageSender_Binding { |
527 | | |
528 | | typedef mozilla::dom::MessageSender NativeType; |
529 | | |
530 | | bool |
531 | | ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj); |
532 | | |
533 | | // We declare this as an array so that retrieving a pointer to this |
534 | | // binding's property hooks only requires compile/link-time resolvable |
535 | | // address arithmetic. Declaring it as a pointer instead would require |
536 | | // doing a run-time load to fetch a pointer to this binding's property |
537 | | // hooks. And then structures which embedded a pointer to this structure |
538 | | // would require a run-time load for proper initialization, which would |
539 | | // then induce static constructors. Lots of static constructors. |
540 | | extern const NativePropertyHooks sNativePropertyHooks[]; |
541 | | |
542 | | void |
543 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal); |
544 | | |
545 | | inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx) |
546 | 0 | { |
547 | 0 | /* Get the interface prototype object for this class. This will create the |
548 | 0 | object as needed. */ |
549 | 0 | return GetPerInterfaceObjectHandle(aCx, prototypes::id::MessageSender, |
550 | 0 | &CreateInterfaceObjects, |
551 | 0 | /* aDefineOnGlobal = */ true); |
552 | 0 |
|
553 | 0 | } |
554 | | |
555 | | JSObject* |
556 | | GetProtoObject(JSContext* aCx); |
557 | | |
558 | | inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true) |
559 | 0 | { |
560 | 0 | /* Get the interface object for this class. This will create the object as |
561 | 0 | needed. */ |
562 | 0 |
|
563 | 0 | return GetPerInterfaceObjectHandle(aCx, constructors::id::MessageSender, |
564 | 0 | &CreateInterfaceObjects, |
565 | 0 | aDefineOnGlobal); |
566 | 0 | } |
567 | | |
568 | | JSObject* |
569 | | GetConstructorObject(JSContext* aCx); |
570 | | |
571 | | } // namespace MessageSender_Binding |
572 | | |
573 | | |
574 | | |
575 | | namespace ParentProcessMessageManager_Binding { |
576 | | |
577 | | typedef mozilla::dom::ParentProcessMessageManager NativeType; |
578 | | |
579 | | bool |
580 | | ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj); |
581 | | |
582 | | const JSClass* |
583 | | GetJSClass(); |
584 | | |
585 | | bool |
586 | | Wrap(JSContext* aCx, mozilla::dom::ParentProcessMessageManager* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector); |
587 | | |
588 | | template <class T> |
589 | | inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto) |
590 | 0 | { |
591 | 0 | JS::Rooted<JSObject*> reflector(aCx); |
592 | 0 | return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr; |
593 | 0 | } |
594 | | |
595 | | // We declare this as an array so that retrieving a pointer to this |
596 | | // binding's property hooks only requires compile/link-time resolvable |
597 | | // address arithmetic. Declaring it as a pointer instead would require |
598 | | // doing a run-time load to fetch a pointer to this binding's property |
599 | | // hooks. And then structures which embedded a pointer to this structure |
600 | | // would require a run-time load for proper initialization, which would |
601 | | // then induce static constructors. Lots of static constructors. |
602 | | extern const NativePropertyHooks sNativePropertyHooks[]; |
603 | | |
604 | | void |
605 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal); |
606 | | |
607 | | inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx) |
608 | 0 | { |
609 | 0 | /* Get the interface prototype object for this class. This will create the |
610 | 0 | object as needed. */ |
611 | 0 | return GetPerInterfaceObjectHandle(aCx, prototypes::id::ParentProcessMessageManager, |
612 | 0 | &CreateInterfaceObjects, |
613 | 0 | /* aDefineOnGlobal = */ true); |
614 | 0 |
|
615 | 0 | } |
616 | | |
617 | | inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true) |
618 | 0 | { |
619 | 0 | /* Get the interface object for this class. This will create the object as |
620 | 0 | needed. */ |
621 | 0 |
|
622 | 0 | return GetPerInterfaceObjectHandle(aCx, constructors::id::ParentProcessMessageManager, |
623 | 0 | &CreateInterfaceObjects, |
624 | 0 | aDefineOnGlobal); |
625 | 0 | } |
626 | | |
627 | | JSObject* |
628 | | GetConstructorObject(JSContext* aCx); |
629 | | |
630 | | } // namespace ParentProcessMessageManager_Binding |
631 | | |
632 | | |
633 | | |
634 | | namespace ProcessMessageManager_Binding { |
635 | | |
636 | | typedef mozilla::dom::ProcessMessageManager NativeType; |
637 | | |
638 | | bool |
639 | | ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj); |
640 | | |
641 | | const JSClass* |
642 | | GetJSClass(); |
643 | | |
644 | | bool |
645 | | Wrap(JSContext* aCx, mozilla::dom::ProcessMessageManager* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector); |
646 | | |
647 | | template <class T> |
648 | | inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto) |
649 | 0 | { |
650 | 0 | JS::Rooted<JSObject*> reflector(aCx); |
651 | 0 | return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr; |
652 | 0 | } |
653 | | |
654 | | // We declare this as an array so that retrieving a pointer to this |
655 | | // binding's property hooks only requires compile/link-time resolvable |
656 | | // address arithmetic. Declaring it as a pointer instead would require |
657 | | // doing a run-time load to fetch a pointer to this binding's property |
658 | | // hooks. And then structures which embedded a pointer to this structure |
659 | | // would require a run-time load for proper initialization, which would |
660 | | // then induce static constructors. Lots of static constructors. |
661 | | extern const NativePropertyHooks sNativePropertyHooks[]; |
662 | | |
663 | | void |
664 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal); |
665 | | |
666 | | inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx) |
667 | 0 | { |
668 | 0 | /* Get the interface prototype object for this class. This will create the |
669 | 0 | object as needed. */ |
670 | 0 | return GetPerInterfaceObjectHandle(aCx, prototypes::id::ProcessMessageManager, |
671 | 0 | &CreateInterfaceObjects, |
672 | 0 | /* aDefineOnGlobal = */ true); |
673 | 0 |
|
674 | 0 | } |
675 | | |
676 | | inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true) |
677 | 0 | { |
678 | 0 | /* Get the interface object for this class. This will create the object as |
679 | 0 | needed. */ |
680 | 0 |
|
681 | 0 | return GetPerInterfaceObjectHandle(aCx, constructors::id::ProcessMessageManager, |
682 | 0 | &CreateInterfaceObjects, |
683 | 0 | aDefineOnGlobal); |
684 | 0 | } |
685 | | |
686 | | JSObject* |
687 | | GetConstructorObject(JSContext* aCx); |
688 | | |
689 | | } // namespace ProcessMessageManager_Binding |
690 | | |
691 | | |
692 | | |
693 | | namespace SyncMessageSender_Binding { |
694 | | |
695 | | typedef mozilla::dom::SyncMessageSender NativeType; |
696 | | |
697 | | bool |
698 | | ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj); |
699 | | |
700 | | // We declare this as an array so that retrieving a pointer to this |
701 | | // binding's property hooks only requires compile/link-time resolvable |
702 | | // address arithmetic. Declaring it as a pointer instead would require |
703 | | // doing a run-time load to fetch a pointer to this binding's property |
704 | | // hooks. And then structures which embedded a pointer to this structure |
705 | | // would require a run-time load for proper initialization, which would |
706 | | // then induce static constructors. Lots of static constructors. |
707 | | extern const NativePropertyHooks sNativePropertyHooks[]; |
708 | | |
709 | | void |
710 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal); |
711 | | |
712 | | inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx) |
713 | 0 | { |
714 | 0 | /* Get the interface prototype object for this class. This will create the |
715 | 0 | object as needed. */ |
716 | 0 | return GetPerInterfaceObjectHandle(aCx, prototypes::id::SyncMessageSender, |
717 | 0 | &CreateInterfaceObjects, |
718 | 0 | /* aDefineOnGlobal = */ true); |
719 | 0 |
|
720 | 0 | } |
721 | | |
722 | | JSObject* |
723 | | GetProtoObject(JSContext* aCx); |
724 | | |
725 | | inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true) |
726 | 0 | { |
727 | 0 | /* Get the interface object for this class. This will create the object as |
728 | 0 | needed. */ |
729 | 0 |
|
730 | 0 | return GetPerInterfaceObjectHandle(aCx, constructors::id::SyncMessageSender, |
731 | 0 | &CreateInterfaceObjects, |
732 | 0 | aDefineOnGlobal); |
733 | 0 | } |
734 | | |
735 | | JSObject* |
736 | | GetConstructorObject(JSContext* aCx); |
737 | | |
738 | | } // namespace SyncMessageSender_Binding |
739 | | |
740 | | |
741 | | |
742 | | class MessageListener : public CallbackInterface |
743 | | { |
744 | | public: |
745 | | explicit inline MessageListener(JSContext* aCx, JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aCallbackGlobal, nsIGlobalObject* aIncumbentGlobal) |
746 | | : CallbackInterface(aCx, aCallback, aCallbackGlobal, aIncumbentGlobal) |
747 | 0 | { |
748 | 0 | } |
749 | | |
750 | | explicit inline MessageListener(JSObject* aCallback, JSObject* aCallbackGlobal, const FastCallbackConstructor& ) |
751 | | : CallbackInterface(aCallback, aCallbackGlobal, FastCallbackConstructor()) |
752 | 0 | { |
753 | 0 | } |
754 | | |
755 | | explicit inline MessageListener(JSObject* aCallback, JSObject* aCallbackGlobal, JSObject* aAsyncStack, nsIGlobalObject* aIncumbentGlobal) |
756 | | : CallbackInterface(aCallback, aCallbackGlobal, aAsyncStack, aIncumbentGlobal) |
757 | 0 | { |
758 | 0 | } |
759 | | |
760 | | template <typename T> |
761 | | inline void |
762 | | ReceiveMessage(const T& thisVal, const ReceiveMessageArgument& argument, JS::MutableHandle<JS::Value> aRetVal, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr) |
763 | 0 | { |
764 | 0 | MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!"); |
765 | 0 | if (!aExecutionReason) { |
766 | 0 | aExecutionReason = "MessageListener.receiveMessage"; |
767 | 0 | } |
768 | 0 | CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm); |
769 | 0 | if (!s.GetContext()) { |
770 | 0 | MOZ_ASSERT(aRv.Failed()); |
771 | 0 | return; |
772 | 0 | } |
773 | 0 | JS::Rooted<JS::Value> thisValJS(s.GetContext()); |
774 | 0 | if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) { |
775 | 0 | aRv.Throw(NS_ERROR_FAILURE); |
776 | 0 | return; |
777 | 0 | } |
778 | 0 | return ReceiveMessage(s.GetContext(), thisValJS, argument, aRetVal, aRv); |
779 | 0 | } |
780 | | |
781 | | inline void |
782 | | ReceiveMessage(const ReceiveMessageArgument& argument, JS::MutableHandle<JS::Value> aRetVal, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr) |
783 | 0 | { |
784 | 0 | MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!"); |
785 | 0 | if (!aExecutionReason) { |
786 | 0 | aExecutionReason = "MessageListener.receiveMessage"; |
787 | 0 | } |
788 | 0 | CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm); |
789 | 0 | if (!s.GetContext()) { |
790 | 0 | MOZ_ASSERT(aRv.Failed()); |
791 | 0 | return; |
792 | 0 | } |
793 | 0 | return ReceiveMessage(s.GetContext(), JS::UndefinedHandleValue, argument, aRetVal, aRv); |
794 | 0 | } |
795 | | |
796 | | template <typename T> |
797 | | inline void |
798 | | ReceiveMessage(const T& thisVal, const ReceiveMessageArgument& argument, JS::MutableHandle<JS::Value> aRetVal, const char* aExecutionReason = nullptr) |
799 | | { |
800 | | return ReceiveMessage(thisVal, argument, aRetVal, IgnoreErrors(), aExecutionReason); |
801 | | } |
802 | | |
803 | | inline void |
804 | | ReceiveMessage(const ReceiveMessageArgument& argument, JS::MutableHandle<JS::Value> aRetVal, const char* aExecutionReason = nullptr) |
805 | 0 | { |
806 | 0 | return ReceiveMessage(argument, aRetVal, IgnoreErrors(), aExecutionReason, eReportExceptions, nullptr); |
807 | 0 | } |
808 | | |
809 | | inline bool |
810 | | operator==(const MessageListener& aOther) const |
811 | 0 | { |
812 | 0 | return CallbackInterface::operator==(aOther); |
813 | 0 | } |
814 | | |
815 | | private: |
816 | | void ReceiveMessage(JSContext* cx, JS::Handle<JS::Value> aThisVal, const ReceiveMessageArgument& argument, JS::MutableHandle<JS::Value> aRetVal, ErrorResult& aRv); |
817 | | |
818 | | static bool |
819 | | InitIds(JSContext* cx, MessageListenerAtoms* atomsCache); |
820 | | }; |
821 | | |
822 | | |
823 | | namespace binding_detail { |
824 | | class FastMessageListener : public MessageListener |
825 | | { |
826 | | public: |
827 | | explicit inline FastMessageListener(JSObject* aCallback, JSObject* aCallbackGlobal) |
828 | | : MessageListener(aCallback, aCallbackGlobal, FastCallbackConstructor()) |
829 | 0 | { |
830 | 0 | } |
831 | | |
832 | | inline void |
833 | | Trace(JSTracer* aTracer) |
834 | 0 | { |
835 | 0 | MessageListener::Trace(aTracer); |
836 | 0 | } |
837 | | |
838 | | inline void |
839 | | FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx) |
840 | 0 | { |
841 | 0 | MessageListener::FinishSlowJSInitIfMoreThanOneOwner(aCx); |
842 | 0 | } |
843 | | }; |
844 | | } // namespace binding_detail |
845 | | |
846 | | |
847 | | } // namespace dom |
848 | | } // namespace mozilla |
849 | | |
850 | | #endif // mozilla_dom_MessageManagerBinding_h |