/work/obj-fuzz/dom/bindings/HTMLEmbedElementBinding.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* THIS FILE IS AUTOGENERATED FROM HTMLEmbedElement.webidl BY Codegen.py - DO NOT EDIT */ |
2 | | |
3 | | #include "HTMLElementBinding.h" |
4 | | #include "HTMLEmbedElementBinding.h" |
5 | | #include "HTMLObjectElementBinding.h" |
6 | | #include "WrapperFactory.h" |
7 | | #include "imgINotificationObserver.h" |
8 | | #include "imgIRequest.h" |
9 | | #include "mozilla/OwningNonNull.h" |
10 | | #include "mozilla/dom/BindingUtils.h" |
11 | | #include "mozilla/dom/CustomElementRegistry.h" |
12 | | #include "mozilla/dom/DOMJSClass.h" |
13 | | #include "mozilla/dom/DocGroup.h" |
14 | | #include "mozilla/dom/HTMLEmbedElement.h" |
15 | | #include "mozilla/dom/HTMLIFrameElement.h" |
16 | | #include "mozilla/dom/NonRefcountedDOMObject.h" |
17 | | #include "mozilla/dom/Nullable.h" |
18 | | #include "mozilla/dom/PrimitiveConversions.h" |
19 | | #include "mozilla/dom/XULFrameElement.h" |
20 | | #include "mozilla/dom/XrayExpandoClass.h" |
21 | | #include "nsContentUtils.h" |
22 | | #include "nsFrameLoader.h" |
23 | | #include "nsIDocument.h" |
24 | | #include "nsIURI.h" |
25 | | #include "nsPIDOMWindow.h" |
26 | | |
27 | | namespace mozilla { |
28 | | namespace dom { |
29 | | |
30 | | namespace binding_detail {}; // Just to make sure it's known as a namespace |
31 | | using namespace mozilla::dom::binding_detail; |
32 | | |
33 | | |
34 | | namespace HTMLEmbedElement_Binding { |
35 | | |
36 | | static_assert(IsRefcounted<NativeType>::value == IsRefcounted<HTMLElement_Binding::NativeType>::value, |
37 | | "Can't inherit from an interface with a different ownership model."); |
38 | | |
39 | | MOZ_CAN_RUN_SCRIPT static bool |
40 | | get_src(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLEmbedElement* self, JSJitGetterCallArgs args) |
41 | 0 | { |
42 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLEmbedElement.src", DOM, cx); |
43 | 0 |
|
44 | 0 | DOMString result; |
45 | 0 | self->GetSrc(result); |
46 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
47 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
48 | 0 | return false; |
49 | 0 | } |
50 | 0 | return true; |
51 | 0 | } |
52 | | |
53 | | MOZ_CAN_RUN_SCRIPT static bool |
54 | | set_src(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLEmbedElement* self, JSJitSetterCallArgs args) |
55 | 0 | { |
56 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLEmbedElement.src", DOM, cx); |
57 | 0 |
|
58 | 0 | binding_detail::FakeString arg0; |
59 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
60 | 0 | return false; |
61 | 0 | } |
62 | 0 | Maybe<AutoCEReaction> ceReaction; |
63 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
64 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
65 | 0 | if (docGroup) { |
66 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
67 | 0 | } |
68 | 0 | } |
69 | 0 | FastErrorResult rv; |
70 | 0 | self->SetSrc(NonNullHelper(Constify(arg0)), rv); |
71 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
72 | 0 | return false; |
73 | 0 | } |
74 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
75 | 0 |
|
76 | 0 | return true; |
77 | 0 | } |
78 | | |
79 | | static const JSJitInfo src_getterinfo = { |
80 | | { (JSJitGetterOp)get_src }, |
81 | | { prototypes::id::HTMLEmbedElement }, |
82 | | { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth }, |
83 | | JSJitInfo::Getter, |
84 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
85 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
86 | | false, /* isInfallible. False in setters. */ |
87 | | true, /* isMovable. Not relevant for setters. */ |
88 | | true, /* isEliminatable. Not relevant for setters. */ |
89 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
90 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
91 | | false, /* isTypedMethod. Only relevant for methods. */ |
92 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
93 | | }; |
94 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
95 | | static_assert(0 < 1, "There is no slot for us"); |
96 | | static const JSJitInfo src_setterinfo = { |
97 | | { (JSJitGetterOp)set_src }, |
98 | | { prototypes::id::HTMLEmbedElement }, |
99 | | { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth }, |
100 | | JSJitInfo::Setter, |
101 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
102 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
103 | | false, /* isInfallible. False in setters. */ |
104 | | false, /* isMovable. Not relevant for setters. */ |
105 | | false, /* isEliminatable. Not relevant for setters. */ |
106 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
107 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
108 | | false, /* isTypedMethod. Only relevant for methods. */ |
109 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
110 | | }; |
111 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
112 | | static_assert(0 < 1, "There is no slot for us"); |
113 | | |
114 | | MOZ_CAN_RUN_SCRIPT static bool |
115 | | get_type(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLEmbedElement* self, JSJitGetterCallArgs args) |
116 | 0 | { |
117 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLEmbedElement.type", DOM, cx); |
118 | 0 |
|
119 | 0 | DOMString result; |
120 | 0 | self->GetType(result); |
121 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
122 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
123 | 0 | return false; |
124 | 0 | } |
125 | 0 | return true; |
126 | 0 | } |
127 | | |
128 | | MOZ_CAN_RUN_SCRIPT static bool |
129 | | set_type(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLEmbedElement* self, JSJitSetterCallArgs args) |
130 | 0 | { |
131 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLEmbedElement.type", DOM, cx); |
132 | 0 |
|
133 | 0 | binding_detail::FakeString arg0; |
134 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
135 | 0 | return false; |
136 | 0 | } |
137 | 0 | Maybe<AutoCEReaction> ceReaction; |
138 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
139 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
140 | 0 | if (docGroup) { |
141 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
142 | 0 | } |
143 | 0 | } |
144 | 0 | FastErrorResult rv; |
145 | 0 | self->SetType(NonNullHelper(Constify(arg0)), rv); |
146 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
147 | 0 | return false; |
148 | 0 | } |
149 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
150 | 0 |
|
151 | 0 | return true; |
152 | 0 | } |
153 | | |
154 | | static const JSJitInfo type_getterinfo = { |
155 | | { (JSJitGetterOp)get_type }, |
156 | | { prototypes::id::HTMLEmbedElement }, |
157 | | { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth }, |
158 | | JSJitInfo::Getter, |
159 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
160 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
161 | | false, /* isInfallible. False in setters. */ |
162 | | true, /* isMovable. Not relevant for setters. */ |
163 | | true, /* isEliminatable. Not relevant for setters. */ |
164 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
165 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
166 | | false, /* isTypedMethod. Only relevant for methods. */ |
167 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
168 | | }; |
169 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
170 | | static_assert(0 < 1, "There is no slot for us"); |
171 | | static const JSJitInfo type_setterinfo = { |
172 | | { (JSJitGetterOp)set_type }, |
173 | | { prototypes::id::HTMLEmbedElement }, |
174 | | { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth }, |
175 | | JSJitInfo::Setter, |
176 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
177 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
178 | | false, /* isInfallible. False in setters. */ |
179 | | false, /* isMovable. Not relevant for setters. */ |
180 | | false, /* isEliminatable. Not relevant for setters. */ |
181 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
182 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
183 | | false, /* isTypedMethod. Only relevant for methods. */ |
184 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
185 | | }; |
186 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
187 | | static_assert(0 < 1, "There is no slot for us"); |
188 | | |
189 | | MOZ_CAN_RUN_SCRIPT static bool |
190 | | get_width(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLEmbedElement* self, JSJitGetterCallArgs args) |
191 | 0 | { |
192 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLEmbedElement.width", DOM, cx); |
193 | 0 |
|
194 | 0 | DOMString result; |
195 | 0 | self->GetWidth(result); |
196 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
197 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
198 | 0 | return false; |
199 | 0 | } |
200 | 0 | return true; |
201 | 0 | } |
202 | | |
203 | | MOZ_CAN_RUN_SCRIPT static bool |
204 | | set_width(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLEmbedElement* self, JSJitSetterCallArgs args) |
205 | 0 | { |
206 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLEmbedElement.width", DOM, cx); |
207 | 0 |
|
208 | 0 | binding_detail::FakeString arg0; |
209 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
210 | 0 | return false; |
211 | 0 | } |
212 | 0 | Maybe<AutoCEReaction> ceReaction; |
213 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
214 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
215 | 0 | if (docGroup) { |
216 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
217 | 0 | } |
218 | 0 | } |
219 | 0 | FastErrorResult rv; |
220 | 0 | self->SetWidth(NonNullHelper(Constify(arg0)), rv); |
221 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
222 | 0 | return false; |
223 | 0 | } |
224 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
225 | 0 |
|
226 | 0 | return true; |
227 | 0 | } |
228 | | |
229 | | static const JSJitInfo width_getterinfo = { |
230 | | { (JSJitGetterOp)get_width }, |
231 | | { prototypes::id::HTMLEmbedElement }, |
232 | | { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth }, |
233 | | JSJitInfo::Getter, |
234 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
235 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
236 | | false, /* isInfallible. False in setters. */ |
237 | | true, /* isMovable. Not relevant for setters. */ |
238 | | true, /* isEliminatable. Not relevant for setters. */ |
239 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
240 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
241 | | false, /* isTypedMethod. Only relevant for methods. */ |
242 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
243 | | }; |
244 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
245 | | static_assert(0 < 1, "There is no slot for us"); |
246 | | static const JSJitInfo width_setterinfo = { |
247 | | { (JSJitGetterOp)set_width }, |
248 | | { prototypes::id::HTMLEmbedElement }, |
249 | | { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth }, |
250 | | JSJitInfo::Setter, |
251 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
252 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
253 | | false, /* isInfallible. False in setters. */ |
254 | | false, /* isMovable. Not relevant for setters. */ |
255 | | false, /* isEliminatable. Not relevant for setters. */ |
256 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
257 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
258 | | false, /* isTypedMethod. Only relevant for methods. */ |
259 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
260 | | }; |
261 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
262 | | static_assert(0 < 1, "There is no slot for us"); |
263 | | |
264 | | MOZ_CAN_RUN_SCRIPT static bool |
265 | | get_height(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLEmbedElement* self, JSJitGetterCallArgs args) |
266 | 0 | { |
267 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLEmbedElement.height", DOM, cx); |
268 | 0 |
|
269 | 0 | DOMString result; |
270 | 0 | self->GetHeight(result); |
271 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
272 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
273 | 0 | return false; |
274 | 0 | } |
275 | 0 | return true; |
276 | 0 | } |
277 | | |
278 | | MOZ_CAN_RUN_SCRIPT static bool |
279 | | set_height(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLEmbedElement* self, JSJitSetterCallArgs args) |
280 | 0 | { |
281 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLEmbedElement.height", DOM, cx); |
282 | 0 |
|
283 | 0 | binding_detail::FakeString arg0; |
284 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
285 | 0 | return false; |
286 | 0 | } |
287 | 0 | Maybe<AutoCEReaction> ceReaction; |
288 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
289 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
290 | 0 | if (docGroup) { |
291 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
292 | 0 | } |
293 | 0 | } |
294 | 0 | FastErrorResult rv; |
295 | 0 | self->SetHeight(NonNullHelper(Constify(arg0)), rv); |
296 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
297 | 0 | return false; |
298 | 0 | } |
299 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
300 | 0 |
|
301 | 0 | return true; |
302 | 0 | } |
303 | | |
304 | | static const JSJitInfo height_getterinfo = { |
305 | | { (JSJitGetterOp)get_height }, |
306 | | { prototypes::id::HTMLEmbedElement }, |
307 | | { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth }, |
308 | | JSJitInfo::Getter, |
309 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
310 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
311 | | false, /* isInfallible. False in setters. */ |
312 | | true, /* isMovable. Not relevant for setters. */ |
313 | | true, /* isEliminatable. Not relevant for setters. */ |
314 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
315 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
316 | | false, /* isTypedMethod. Only relevant for methods. */ |
317 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
318 | | }; |
319 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
320 | | static_assert(0 < 1, "There is no slot for us"); |
321 | | static const JSJitInfo height_setterinfo = { |
322 | | { (JSJitGetterOp)set_height }, |
323 | | { prototypes::id::HTMLEmbedElement }, |
324 | | { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth }, |
325 | | JSJitInfo::Setter, |
326 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
327 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
328 | | false, /* isInfallible. False in setters. */ |
329 | | false, /* isMovable. Not relevant for setters. */ |
330 | | false, /* isEliminatable. Not relevant for setters. */ |
331 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
332 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
333 | | false, /* isTypedMethod. Only relevant for methods. */ |
334 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
335 | | }; |
336 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
337 | | static_assert(0 < 1, "There is no slot for us"); |
338 | | |
339 | | MOZ_CAN_RUN_SCRIPT static bool |
340 | | get_align(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLEmbedElement* self, JSJitGetterCallArgs args) |
341 | 0 | { |
342 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLEmbedElement.align", DOM, cx); |
343 | 0 |
|
344 | 0 | DOMString result; |
345 | 0 | self->GetAlign(result); |
346 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
347 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
348 | 0 | return false; |
349 | 0 | } |
350 | 0 | return true; |
351 | 0 | } |
352 | | |
353 | | MOZ_CAN_RUN_SCRIPT static bool |
354 | | set_align(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLEmbedElement* self, JSJitSetterCallArgs args) |
355 | 0 | { |
356 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLEmbedElement.align", DOM, cx); |
357 | 0 |
|
358 | 0 | binding_detail::FakeString arg0; |
359 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
360 | 0 | return false; |
361 | 0 | } |
362 | 0 | Maybe<AutoCEReaction> ceReaction; |
363 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
364 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
365 | 0 | if (docGroup) { |
366 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
367 | 0 | } |
368 | 0 | } |
369 | 0 | FastErrorResult rv; |
370 | 0 | self->SetAlign(NonNullHelper(Constify(arg0)), rv); |
371 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
372 | 0 | return false; |
373 | 0 | } |
374 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
375 | 0 |
|
376 | 0 | return true; |
377 | 0 | } |
378 | | |
379 | | static const JSJitInfo align_getterinfo = { |
380 | | { (JSJitGetterOp)get_align }, |
381 | | { prototypes::id::HTMLEmbedElement }, |
382 | | { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth }, |
383 | | JSJitInfo::Getter, |
384 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
385 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
386 | | false, /* isInfallible. False in setters. */ |
387 | | true, /* isMovable. Not relevant for setters. */ |
388 | | true, /* isEliminatable. Not relevant for setters. */ |
389 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
390 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
391 | | false, /* isTypedMethod. Only relevant for methods. */ |
392 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
393 | | }; |
394 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
395 | | static_assert(0 < 1, "There is no slot for us"); |
396 | | static const JSJitInfo align_setterinfo = { |
397 | | { (JSJitGetterOp)set_align }, |
398 | | { prototypes::id::HTMLEmbedElement }, |
399 | | { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth }, |
400 | | JSJitInfo::Setter, |
401 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
402 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
403 | | false, /* isInfallible. False in setters. */ |
404 | | false, /* isMovable. Not relevant for setters. */ |
405 | | false, /* isEliminatable. Not relevant for setters. */ |
406 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
407 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
408 | | false, /* isTypedMethod. Only relevant for methods. */ |
409 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
410 | | }; |
411 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
412 | | static_assert(0 < 1, "There is no slot for us"); |
413 | | |
414 | | MOZ_CAN_RUN_SCRIPT static bool |
415 | | get_name(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLEmbedElement* self, JSJitGetterCallArgs args) |
416 | 0 | { |
417 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLEmbedElement.name", DOM, cx); |
418 | 0 |
|
419 | 0 | DOMString result; |
420 | 0 | self->GetName(result); |
421 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
422 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
423 | 0 | return false; |
424 | 0 | } |
425 | 0 | return true; |
426 | 0 | } |
427 | | |
428 | | MOZ_CAN_RUN_SCRIPT static bool |
429 | | set_name(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLEmbedElement* self, JSJitSetterCallArgs args) |
430 | 0 | { |
431 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLEmbedElement.name", DOM, cx); |
432 | 0 |
|
433 | 0 | binding_detail::FakeString arg0; |
434 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
435 | 0 | return false; |
436 | 0 | } |
437 | 0 | Maybe<AutoCEReaction> ceReaction; |
438 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
439 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
440 | 0 | if (docGroup) { |
441 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
442 | 0 | } |
443 | 0 | } |
444 | 0 | FastErrorResult rv; |
445 | 0 | self->SetName(NonNullHelper(Constify(arg0)), rv); |
446 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
447 | 0 | return false; |
448 | 0 | } |
449 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
450 | 0 |
|
451 | 0 | return true; |
452 | 0 | } |
453 | | |
454 | | static const JSJitInfo name_getterinfo = { |
455 | | { (JSJitGetterOp)get_name }, |
456 | | { prototypes::id::HTMLEmbedElement }, |
457 | | { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth }, |
458 | | JSJitInfo::Getter, |
459 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
460 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
461 | | false, /* isInfallible. False in setters. */ |
462 | | true, /* isMovable. Not relevant for setters. */ |
463 | | true, /* isEliminatable. Not relevant for setters. */ |
464 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
465 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
466 | | false, /* isTypedMethod. Only relevant for methods. */ |
467 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
468 | | }; |
469 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
470 | | static_assert(0 < 1, "There is no slot for us"); |
471 | | static const JSJitInfo name_setterinfo = { |
472 | | { (JSJitGetterOp)set_name }, |
473 | | { prototypes::id::HTMLEmbedElement }, |
474 | | { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth }, |
475 | | JSJitInfo::Setter, |
476 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
477 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
478 | | false, /* isInfallible. False in setters. */ |
479 | | false, /* isMovable. Not relevant for setters. */ |
480 | | false, /* isEliminatable. Not relevant for setters. */ |
481 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
482 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
483 | | false, /* isTypedMethod. Only relevant for methods. */ |
484 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
485 | | }; |
486 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
487 | | static_assert(0 < 1, "There is no slot for us"); |
488 | | |
489 | | MOZ_CAN_RUN_SCRIPT static bool |
490 | | getSVGDocument(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLEmbedElement* self, const JSJitMethodCallArgs& args) |
491 | 0 | { |
492 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLEmbedElement.getSVGDocument", DOM, cx); |
493 | 0 |
|
494 | 0 | NonNull<nsIPrincipal> subjectPrincipal; |
495 | 0 | { |
496 | 0 | JS::Realm* realm = js::GetContextRealm(cx); |
497 | 0 | MOZ_ASSERT(realm); |
498 | 0 | JSPrincipals* principals = JS::GetRealmPrincipals(realm); |
499 | 0 | nsIPrincipal* principal = nsJSPrincipals::get(principals); |
500 | 0 |
|
501 | 0 | subjectPrincipal = principal; |
502 | 0 | } |
503 | 0 | auto result(StrongOrRawPtr<nsIDocument>(self->GetSVGDocument(subjectPrincipal))); |
504 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
505 | 0 | if (!result) { |
506 | 0 | args.rval().setNull(); |
507 | 0 | return true; |
508 | 0 | } |
509 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
510 | 0 | MOZ_CRASH("Looks like bug 1488480/1405521, with getting the reflector failing"); |
511 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
512 | 0 | return false; |
513 | 0 | } |
514 | 0 | return true; |
515 | 0 | } |
516 | | |
517 | | static const JSJitInfo getSVGDocument_methodinfo = { |
518 | | { (JSJitGetterOp)getSVGDocument }, |
519 | | { prototypes::id::HTMLEmbedElement }, |
520 | | { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth }, |
521 | | JSJitInfo::Method, |
522 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
523 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
524 | | false, /* isInfallible. False in setters. */ |
525 | | false, /* isMovable. Not relevant for setters. */ |
526 | | false, /* isEliminatable. Not relevant for setters. */ |
527 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
528 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
529 | | false, /* isTypedMethod. Only relevant for methods. */ |
530 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
531 | | }; |
532 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
533 | | static_assert(0 < 1, "There is no slot for us"); |
534 | | |
535 | | MOZ_CAN_RUN_SCRIPT static bool |
536 | | get_frameLoader(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLEmbedElement* self, JSJitGetterCallArgs args) |
537 | 0 | { |
538 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLEmbedElement.frameLoader", DOM, cx); |
539 | 0 |
|
540 | 0 | auto result(StrongOrRawPtr<nsFrameLoader>(self->GetFrameLoader())); |
541 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
542 | 0 | if (!result) { |
543 | 0 | args.rval().setNull(); |
544 | 0 | return true; |
545 | 0 | } |
546 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
547 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
548 | 0 | return false; |
549 | 0 | } |
550 | 0 | return true; |
551 | 0 | } |
552 | | |
553 | | static const JSJitInfo frameLoader_getterinfo = { |
554 | | { (JSJitGetterOp)get_frameLoader }, |
555 | | { prototypes::id::HTMLEmbedElement }, |
556 | | { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth }, |
557 | | JSJitInfo::Getter, |
558 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
559 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
560 | | false, /* isInfallible. False in setters. */ |
561 | | false, /* isMovable. Not relevant for setters. */ |
562 | | false, /* isEliminatable. Not relevant for setters. */ |
563 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
564 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
565 | | false, /* isTypedMethod. Only relevant for methods. */ |
566 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
567 | | }; |
568 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
569 | | static_assert(0 < 1, "There is no slot for us"); |
570 | | |
571 | | MOZ_CAN_RUN_SCRIPT static bool |
572 | | presetOpenerWindow(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLEmbedElement* self, const JSJitMethodCallArgs& args) |
573 | 0 | { |
574 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLEmbedElement.presetOpenerWindow", DOM, cx); |
575 | 0 |
|
576 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
577 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLEmbedElement.presetOpenerWindow"); |
578 | 0 | } |
579 | 0 | nsPIDOMWindowOuter* arg0; |
580 | 0 | RefPtr<nsPIDOMWindowOuter> arg0_holder; |
581 | 0 | if (args[0].isObject()) { |
582 | 0 | JS::Rooted<JSObject*> source(cx, &args[0].toObject()); |
583 | 0 | if (NS_FAILED(UnwrapArg<nsPIDOMWindowOuter>(cx, source, getter_AddRefs(arg0_holder)))) { |
584 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of HTMLEmbedElement.presetOpenerWindow", "WindowProxy"); |
585 | 0 | return false; |
586 | 0 | } |
587 | 0 | MOZ_ASSERT(arg0_holder); |
588 | 0 | arg0 = arg0_holder; |
589 | 0 | } else if (args[0].isNullOrUndefined()) { |
590 | 0 | arg0 = nullptr; |
591 | 0 | } else { |
592 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of HTMLEmbedElement.presetOpenerWindow"); |
593 | 0 | return false; |
594 | 0 | } |
595 | 0 | FastErrorResult rv; |
596 | 0 | self->PresetOpenerWindow(MOZ_KnownLive(Constify(arg0)), rv); |
597 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
598 | 0 | return false; |
599 | 0 | } |
600 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
601 | 0 | args.rval().setUndefined(); |
602 | 0 | return true; |
603 | 0 | } |
604 | | |
605 | | static const JSJitInfo presetOpenerWindow_methodinfo = { |
606 | | { (JSJitGetterOp)presetOpenerWindow }, |
607 | | { prototypes::id::HTMLEmbedElement }, |
608 | | { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth }, |
609 | | JSJitInfo::Method, |
610 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
611 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
612 | | false, /* isInfallible. False in setters. */ |
613 | | false, /* isMovable. Not relevant for setters. */ |
614 | | false, /* isEliminatable. Not relevant for setters. */ |
615 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
616 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
617 | | false, /* isTypedMethod. Only relevant for methods. */ |
618 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
619 | | }; |
620 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
621 | | static_assert(0 < 1, "There is no slot for us"); |
622 | | |
623 | | MOZ_CAN_RUN_SCRIPT static bool |
624 | | swapFrameLoaders(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLEmbedElement* self, const JSJitMethodCallArgs& args) |
625 | 0 | { |
626 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLEmbedElement.swapFrameLoaders", DOM, cx); |
627 | 0 |
|
628 | 0 | unsigned argcount = std::min(args.length(), 1u); |
629 | 0 | switch (argcount) { |
630 | 0 | case 1: { |
631 | 0 | if (args[0].isObject()) { |
632 | 0 | do { |
633 | 0 | NonNull<mozilla::dom::XULFrameElement> arg0; |
634 | 0 | { |
635 | 0 | nsresult rv = UnwrapObject<prototypes::id::XULFrameElement, mozilla::dom::XULFrameElement>(args[0], arg0); |
636 | 0 | if (NS_FAILED(rv)) { |
637 | 0 | break; |
638 | 0 | } |
639 | 0 | } |
640 | 0 | FastErrorResult rv; |
641 | 0 | self->SwapFrameLoaders(MOZ_KnownLive(NonNullHelper(arg0)), rv); |
642 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
643 | 0 | return false; |
644 | 0 | } |
645 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
646 | 0 | args.rval().setUndefined(); |
647 | 0 | return true; |
648 | 0 | } while (false); |
649 | 0 | do { |
650 | 0 | NonNull<mozilla::dom::HTMLIFrameElement> arg0; |
651 | 0 | { |
652 | 0 | nsresult rv = UnwrapObject<prototypes::id::HTMLIFrameElement, mozilla::dom::HTMLIFrameElement>(args[0], arg0); |
653 | 0 | if (NS_FAILED(rv)) { |
654 | 0 | break; |
655 | 0 | } |
656 | 0 | } |
657 | 0 | FastErrorResult rv; |
658 | 0 | self->SwapFrameLoaders(MOZ_KnownLive(NonNullHelper(arg0)), rv); |
659 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
660 | 0 | return false; |
661 | 0 | } |
662 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
663 | 0 | args.rval().setUndefined(); |
664 | 0 | return true; |
665 | 0 | } while (false); |
666 | 0 | } |
667 | 0 | return ThrowErrorMessage(cx, MSG_OVERLOAD_RESOLUTION_FAILED, "1", "1", "HTMLEmbedElement.swapFrameLoaders"); |
668 | 0 | break; |
669 | 0 | } |
670 | 0 | default: { |
671 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLEmbedElement.swapFrameLoaders"); |
672 | 0 | break; |
673 | 0 | } |
674 | 0 | } |
675 | 0 | MOZ_CRASH("We have an always-returning default case"); |
676 | 0 | return false; |
677 | 0 | } |
678 | | |
679 | | static const JSJitInfo swapFrameLoaders_methodinfo = { |
680 | | { (JSJitGetterOp)swapFrameLoaders }, |
681 | | { prototypes::id::HTMLEmbedElement }, |
682 | | { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth }, |
683 | | JSJitInfo::Method, |
684 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
685 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
686 | | false, /* isInfallible. False in setters. */ |
687 | | false, /* isMovable. Not relevant for setters. */ |
688 | | false, /* isEliminatable. Not relevant for setters. */ |
689 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
690 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
691 | | false, /* isTypedMethod. Only relevant for methods. */ |
692 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
693 | | }; |
694 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
695 | | static_assert(0 < 1, "There is no slot for us"); |
696 | | |
697 | | MOZ_CAN_RUN_SCRIPT static bool |
698 | | get_loadingEnabled(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLEmbedElement* self, JSJitGetterCallArgs args) |
699 | 0 | { |
700 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLEmbedElement.loadingEnabled", DOM, cx); |
701 | 0 |
|
702 | 0 | bool result(self->LoadingEnabled()); |
703 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
704 | 0 | args.rval().setBoolean(result); |
705 | 0 | return true; |
706 | 0 | } |
707 | | |
708 | | MOZ_CAN_RUN_SCRIPT static bool |
709 | | set_loadingEnabled(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLEmbedElement* self, JSJitSetterCallArgs args) |
710 | 0 | { |
711 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLEmbedElement.loadingEnabled", DOM, cx); |
712 | 0 |
|
713 | 0 | bool arg0; |
714 | 0 | if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) { |
715 | 0 | return false; |
716 | 0 | } |
717 | 0 | self->SetLoadingEnabled(arg0); |
718 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
719 | 0 |
|
720 | 0 | return true; |
721 | 0 | } |
722 | | |
723 | | static const JSJitInfo loadingEnabled_getterinfo = { |
724 | | { (JSJitGetterOp)get_loadingEnabled }, |
725 | | { prototypes::id::HTMLEmbedElement }, |
726 | | { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth }, |
727 | | JSJitInfo::Getter, |
728 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
729 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
730 | | true, /* isInfallible. False in setters. */ |
731 | | false, /* isMovable. Not relevant for setters. */ |
732 | | false, /* isEliminatable. Not relevant for setters. */ |
733 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
734 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
735 | | false, /* isTypedMethod. Only relevant for methods. */ |
736 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
737 | | }; |
738 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
739 | | static_assert(0 < 1, "There is no slot for us"); |
740 | | static const JSJitInfo loadingEnabled_setterinfo = { |
741 | | { (JSJitGetterOp)set_loadingEnabled }, |
742 | | { prototypes::id::HTMLEmbedElement }, |
743 | | { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth }, |
744 | | JSJitInfo::Setter, |
745 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
746 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
747 | | false, /* isInfallible. False in setters. */ |
748 | | false, /* isMovable. Not relevant for setters. */ |
749 | | false, /* isEliminatable. Not relevant for setters. */ |
750 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
751 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
752 | | false, /* isTypedMethod. Only relevant for methods. */ |
753 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
754 | | }; |
755 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
756 | | static_assert(0 < 1, "There is no slot for us"); |
757 | | |
758 | | MOZ_CAN_RUN_SCRIPT static bool |
759 | | get_imageBlockingStatus(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLEmbedElement* self, JSJitGetterCallArgs args) |
760 | 0 | { |
761 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLEmbedElement.imageBlockingStatus", DOM, cx); |
762 | 0 |
|
763 | 0 | int16_t result(self->ImageBlockingStatus()); |
764 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
765 | 0 | args.rval().setInt32(int32_t(result)); |
766 | 0 | return true; |
767 | 0 | } |
768 | | |
769 | | static const JSJitInfo imageBlockingStatus_getterinfo = { |
770 | | { (JSJitGetterOp)get_imageBlockingStatus }, |
771 | | { prototypes::id::HTMLEmbedElement }, |
772 | | { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth }, |
773 | | JSJitInfo::Getter, |
774 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
775 | | JSVAL_TYPE_INT32, /* returnType. Not relevant for setters. */ |
776 | | true, /* isInfallible. False in setters. */ |
777 | | false, /* isMovable. Not relevant for setters. */ |
778 | | false, /* isEliminatable. Not relevant for setters. */ |
779 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
780 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
781 | | false, /* isTypedMethod. Only relevant for methods. */ |
782 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
783 | | }; |
784 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
785 | | static_assert(0 < 1, "There is no slot for us"); |
786 | | |
787 | | MOZ_CAN_RUN_SCRIPT static bool |
788 | | addObserver(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLEmbedElement* self, const JSJitMethodCallArgs& args) |
789 | 0 | { |
790 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLEmbedElement.addObserver", DOM, cx); |
791 | 0 |
|
792 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
793 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLEmbedElement.addObserver"); |
794 | 0 | } |
795 | 0 | imgINotificationObserver* arg0; |
796 | 0 | RefPtr<imgINotificationObserver> arg0_holder; |
797 | 0 | if (args[0].isObject()) { |
798 | 0 | JS::Rooted<JSObject*> source(cx, &args[0].toObject()); |
799 | 0 | if (NS_FAILED(UnwrapArg<imgINotificationObserver>(cx, source, getter_AddRefs(arg0_holder)))) { |
800 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of HTMLEmbedElement.addObserver", "imgINotificationObserver"); |
801 | 0 | return false; |
802 | 0 | } |
803 | 0 | MOZ_ASSERT(arg0_holder); |
804 | 0 | arg0 = arg0_holder; |
805 | 0 | } else { |
806 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of HTMLEmbedElement.addObserver"); |
807 | 0 | return false; |
808 | 0 | } |
809 | 0 | self->AddObserver(MOZ_KnownLive(NonNullHelper(arg0))); |
810 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
811 | 0 | args.rval().setUndefined(); |
812 | 0 | return true; |
813 | 0 | } |
814 | | |
815 | | static const JSJitInfo addObserver_methodinfo = { |
816 | | { (JSJitGetterOp)addObserver }, |
817 | | { prototypes::id::HTMLEmbedElement }, |
818 | | { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth }, |
819 | | JSJitInfo::Method, |
820 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
821 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
822 | | false, /* isInfallible. False in setters. */ |
823 | | false, /* isMovable. Not relevant for setters. */ |
824 | | false, /* isEliminatable. Not relevant for setters. */ |
825 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
826 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
827 | | false, /* isTypedMethod. Only relevant for methods. */ |
828 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
829 | | }; |
830 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
831 | | static_assert(0 < 1, "There is no slot for us"); |
832 | | |
833 | | MOZ_CAN_RUN_SCRIPT static bool |
834 | | removeObserver(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLEmbedElement* self, const JSJitMethodCallArgs& args) |
835 | 0 | { |
836 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLEmbedElement.removeObserver", DOM, cx); |
837 | 0 |
|
838 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
839 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLEmbedElement.removeObserver"); |
840 | 0 | } |
841 | 0 | imgINotificationObserver* arg0; |
842 | 0 | RefPtr<imgINotificationObserver> arg0_holder; |
843 | 0 | if (args[0].isObject()) { |
844 | 0 | JS::Rooted<JSObject*> source(cx, &args[0].toObject()); |
845 | 0 | if (NS_FAILED(UnwrapArg<imgINotificationObserver>(cx, source, getter_AddRefs(arg0_holder)))) { |
846 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of HTMLEmbedElement.removeObserver", "imgINotificationObserver"); |
847 | 0 | return false; |
848 | 0 | } |
849 | 0 | MOZ_ASSERT(arg0_holder); |
850 | 0 | arg0 = arg0_holder; |
851 | 0 | } else { |
852 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of HTMLEmbedElement.removeObserver"); |
853 | 0 | return false; |
854 | 0 | } |
855 | 0 | self->RemoveObserver(MOZ_KnownLive(NonNullHelper(arg0))); |
856 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
857 | 0 | args.rval().setUndefined(); |
858 | 0 | return true; |
859 | 0 | } |
860 | | |
861 | | static const JSJitInfo removeObserver_methodinfo = { |
862 | | { (JSJitGetterOp)removeObserver }, |
863 | | { prototypes::id::HTMLEmbedElement }, |
864 | | { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth }, |
865 | | JSJitInfo::Method, |
866 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
867 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
868 | | false, /* isInfallible. False in setters. */ |
869 | | false, /* isMovable. Not relevant for setters. */ |
870 | | false, /* isEliminatable. Not relevant for setters. */ |
871 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
872 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
873 | | false, /* isTypedMethod. Only relevant for methods. */ |
874 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
875 | | }; |
876 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
877 | | static_assert(0 < 1, "There is no slot for us"); |
878 | | |
879 | | MOZ_CAN_RUN_SCRIPT static bool |
880 | | getRequest(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLEmbedElement* self, const JSJitMethodCallArgs& args) |
881 | 0 | { |
882 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLEmbedElement.getRequest", DOM, cx); |
883 | 0 |
|
884 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
885 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLEmbedElement.getRequest"); |
886 | 0 | } |
887 | 0 | int32_t arg0; |
888 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
889 | 0 | return false; |
890 | 0 | } |
891 | 0 | FastErrorResult rv; |
892 | 0 | auto result(StrongOrRawPtr<imgIRequest>(self->GetRequest(arg0, rv))); |
893 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
894 | 0 | return false; |
895 | 0 | } |
896 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
897 | 0 | if (!result) { |
898 | 0 | args.rval().setNull(); |
899 | 0 | return true; |
900 | 0 | } |
901 | 0 | if (!WrapObject(cx, result, &NS_GET_IID(imgIRequest), args.rval())) { |
902 | 0 | return false; |
903 | 0 | } |
904 | 0 | return true; |
905 | 0 | } |
906 | | |
907 | | static const JSJitInfo getRequest_methodinfo = { |
908 | | { (JSJitGetterOp)getRequest }, |
909 | | { prototypes::id::HTMLEmbedElement }, |
910 | | { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth }, |
911 | | JSJitInfo::Method, |
912 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
913 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
914 | | false, /* isInfallible. False in setters. */ |
915 | | false, /* isMovable. Not relevant for setters. */ |
916 | | false, /* isEliminatable. Not relevant for setters. */ |
917 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
918 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
919 | | false, /* isTypedMethod. Only relevant for methods. */ |
920 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
921 | | }; |
922 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
923 | | static_assert(0 < 1, "There is no slot for us"); |
924 | | |
925 | | MOZ_CAN_RUN_SCRIPT static bool |
926 | | getRequestType(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLEmbedElement* self, const JSJitMethodCallArgs& args) |
927 | 0 | { |
928 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLEmbedElement.getRequestType", DOM, cx); |
929 | 0 |
|
930 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
931 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLEmbedElement.getRequestType"); |
932 | 0 | } |
933 | 0 | imgIRequest* arg0; |
934 | 0 | RefPtr<imgIRequest> arg0_holder; |
935 | 0 | if (args[0].isObject()) { |
936 | 0 | JS::Rooted<JSObject*> source(cx, &args[0].toObject()); |
937 | 0 | if (NS_FAILED(UnwrapArg<imgIRequest>(cx, source, getter_AddRefs(arg0_holder)))) { |
938 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of HTMLEmbedElement.getRequestType", "imgIRequest"); |
939 | 0 | return false; |
940 | 0 | } |
941 | 0 | MOZ_ASSERT(arg0_holder); |
942 | 0 | arg0 = arg0_holder; |
943 | 0 | } else { |
944 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of HTMLEmbedElement.getRequestType"); |
945 | 0 | return false; |
946 | 0 | } |
947 | 0 | FastErrorResult rv; |
948 | 0 | int32_t result(self->GetRequestType(MOZ_KnownLive(NonNullHelper(arg0)), rv)); |
949 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
950 | 0 | return false; |
951 | 0 | } |
952 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
953 | 0 | args.rval().setInt32(int32_t(result)); |
954 | 0 | return true; |
955 | 0 | } |
956 | | |
957 | | static const JSJitInfo getRequestType_methodinfo = { |
958 | | { (JSJitGetterOp)getRequestType }, |
959 | | { prototypes::id::HTMLEmbedElement }, |
960 | | { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth }, |
961 | | JSJitInfo::Method, |
962 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
963 | | JSVAL_TYPE_INT32, /* returnType. Not relevant for setters. */ |
964 | | false, /* isInfallible. False in setters. */ |
965 | | false, /* isMovable. Not relevant for setters. */ |
966 | | false, /* isEliminatable. Not relevant for setters. */ |
967 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
968 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
969 | | false, /* isTypedMethod. Only relevant for methods. */ |
970 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
971 | | }; |
972 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
973 | | static_assert(0 < 1, "There is no slot for us"); |
974 | | |
975 | | MOZ_CAN_RUN_SCRIPT static bool |
976 | | get_currentURI(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLEmbedElement* self, JSJitGetterCallArgs args) |
977 | 0 | { |
978 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLEmbedElement.currentURI", DOM, cx); |
979 | 0 |
|
980 | 0 | FastErrorResult rv; |
981 | 0 | auto result(StrongOrRawPtr<nsIURI>(self->GetCurrentURI(rv))); |
982 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
983 | 0 | return false; |
984 | 0 | } |
985 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
986 | 0 | if (!result) { |
987 | 0 | args.rval().setNull(); |
988 | 0 | return true; |
989 | 0 | } |
990 | 0 | if (!WrapObject(cx, result, &NS_GET_IID(nsIURI), args.rval())) { |
991 | 0 | return false; |
992 | 0 | } |
993 | 0 | return true; |
994 | 0 | } |
995 | | |
996 | | static const JSJitInfo currentURI_getterinfo = { |
997 | | { (JSJitGetterOp)get_currentURI }, |
998 | | { prototypes::id::HTMLEmbedElement }, |
999 | | { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth }, |
1000 | | JSJitInfo::Getter, |
1001 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1002 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
1003 | | false, /* isInfallible. False in setters. */ |
1004 | | false, /* isMovable. Not relevant for setters. */ |
1005 | | false, /* isEliminatable. Not relevant for setters. */ |
1006 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1007 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1008 | | false, /* isTypedMethod. Only relevant for methods. */ |
1009 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1010 | | }; |
1011 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1012 | | static_assert(0 < 1, "There is no slot for us"); |
1013 | | |
1014 | | MOZ_CAN_RUN_SCRIPT static bool |
1015 | | get_currentRequestFinalURI(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLEmbedElement* self, JSJitGetterCallArgs args) |
1016 | 0 | { |
1017 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLEmbedElement.currentRequestFinalURI", DOM, cx); |
1018 | 0 |
|
1019 | 0 | auto result(StrongOrRawPtr<nsIURI>(self->GetCurrentRequestFinalURI())); |
1020 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1021 | 0 | if (!result) { |
1022 | 0 | args.rval().setNull(); |
1023 | 0 | return true; |
1024 | 0 | } |
1025 | 0 | if (!WrapObject(cx, result, &NS_GET_IID(nsIURI), args.rval())) { |
1026 | 0 | return false; |
1027 | 0 | } |
1028 | 0 | return true; |
1029 | 0 | } |
1030 | | |
1031 | | static const JSJitInfo currentRequestFinalURI_getterinfo = { |
1032 | | { (JSJitGetterOp)get_currentRequestFinalURI }, |
1033 | | { prototypes::id::HTMLEmbedElement }, |
1034 | | { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth }, |
1035 | | JSJitInfo::Getter, |
1036 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1037 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
1038 | | false, /* isInfallible. False in setters. */ |
1039 | | false, /* isMovable. Not relevant for setters. */ |
1040 | | false, /* isEliminatable. Not relevant for setters. */ |
1041 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1042 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1043 | | false, /* isTypedMethod. Only relevant for methods. */ |
1044 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1045 | | }; |
1046 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1047 | | static_assert(0 < 1, "There is no slot for us"); |
1048 | | |
1049 | | MOZ_CAN_RUN_SCRIPT static bool |
1050 | | forceReload(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLEmbedElement* self, const JSJitMethodCallArgs& args) |
1051 | 0 | { |
1052 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLEmbedElement.forceReload", DOM, cx); |
1053 | 0 |
|
1054 | 0 | bool arg0; |
1055 | 0 | if (args.hasDefined(0)) { |
1056 | 0 | if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) { |
1057 | 0 | return false; |
1058 | 0 | } |
1059 | 0 | } else { |
1060 | 0 | arg0 = true; |
1061 | 0 | } |
1062 | 0 | FastErrorResult rv; |
1063 | 0 | self->ForceReload(arg0, rv); |
1064 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1065 | 0 | return false; |
1066 | 0 | } |
1067 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1068 | 0 | args.rval().setUndefined(); |
1069 | 0 | return true; |
1070 | 0 | } |
1071 | | |
1072 | | static const JSJitInfo forceReload_methodinfo = { |
1073 | | { (JSJitGetterOp)forceReload }, |
1074 | | { prototypes::id::HTMLEmbedElement }, |
1075 | | { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth }, |
1076 | | JSJitInfo::Method, |
1077 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1078 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1079 | | false, /* isInfallible. False in setters. */ |
1080 | | false, /* isMovable. Not relevant for setters. */ |
1081 | | false, /* isEliminatable. Not relevant for setters. */ |
1082 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1083 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1084 | | false, /* isTypedMethod. Only relevant for methods. */ |
1085 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1086 | | }; |
1087 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1088 | | static_assert(0 < 1, "There is no slot for us"); |
1089 | | |
1090 | | MOZ_CAN_RUN_SCRIPT static bool |
1091 | | forceImageState(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLEmbedElement* self, const JSJitMethodCallArgs& args) |
1092 | 0 | { |
1093 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLEmbedElement.forceImageState", DOM, cx); |
1094 | 0 |
|
1095 | 0 | if (MOZ_UNLIKELY(args.length() < 2)) { |
1096 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLEmbedElement.forceImageState"); |
1097 | 0 | } |
1098 | 0 | bool arg0; |
1099 | 0 | if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) { |
1100 | 0 | return false; |
1101 | 0 | } |
1102 | 0 | uint64_t arg1; |
1103 | 0 | if (!ValueToPrimitive<uint64_t, eDefault>(cx, args[1], &arg1)) { |
1104 | 0 | return false; |
1105 | 0 | } |
1106 | 0 | self->ForceImageState(arg0, arg1); |
1107 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1108 | 0 | args.rval().setUndefined(); |
1109 | 0 | return true; |
1110 | 0 | } |
1111 | | |
1112 | | static const JSJitInfo forceImageState_methodinfo = { |
1113 | | { (JSJitGetterOp)forceImageState }, |
1114 | | { prototypes::id::HTMLEmbedElement }, |
1115 | | { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth }, |
1116 | | JSJitInfo::Method, |
1117 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1118 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1119 | | false, /* isInfallible. False in setters. */ |
1120 | | false, /* isMovable. Not relevant for setters. */ |
1121 | | false, /* isEliminatable. Not relevant for setters. */ |
1122 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1123 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1124 | | false, /* isTypedMethod. Only relevant for methods. */ |
1125 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1126 | | }; |
1127 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1128 | | static_assert(0 < 1, "There is no slot for us"); |
1129 | | |
1130 | | MOZ_CAN_RUN_SCRIPT static bool |
1131 | | get_actualType(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLEmbedElement* self, JSJitGetterCallArgs args) |
1132 | 0 | { |
1133 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLEmbedElement.actualType", DOM, cx); |
1134 | 0 |
|
1135 | 0 | DOMString result; |
1136 | 0 | self->GetActualType(result); |
1137 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1138 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
1139 | 0 | return false; |
1140 | 0 | } |
1141 | 0 | return true; |
1142 | 0 | } |
1143 | | |
1144 | | static const JSJitInfo actualType_getterinfo = { |
1145 | | { (JSJitGetterOp)get_actualType }, |
1146 | | { prototypes::id::HTMLEmbedElement }, |
1147 | | { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth }, |
1148 | | JSJitInfo::Getter, |
1149 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1150 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
1151 | | false, /* isInfallible. False in setters. */ |
1152 | | false, /* isMovable. Not relevant for setters. */ |
1153 | | false, /* isEliminatable. Not relevant for setters. */ |
1154 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1155 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1156 | | false, /* isTypedMethod. Only relevant for methods. */ |
1157 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1158 | | }; |
1159 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1160 | | static_assert(0 < 1, "There is no slot for us"); |
1161 | | |
1162 | | MOZ_CAN_RUN_SCRIPT static bool |
1163 | | get_displayedType(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLEmbedElement* self, JSJitGetterCallArgs args) |
1164 | 0 | { |
1165 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLEmbedElement.displayedType", DOM, cx); |
1166 | 0 |
|
1167 | 0 | uint32_t result(self->DisplayedType()); |
1168 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1169 | 0 | args.rval().setNumber(result); |
1170 | 0 | return true; |
1171 | 0 | } |
1172 | | |
1173 | | static const JSJitInfo displayedType_getterinfo = { |
1174 | | { (JSJitGetterOp)get_displayedType }, |
1175 | | { prototypes::id::HTMLEmbedElement }, |
1176 | | { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth }, |
1177 | | JSJitInfo::Getter, |
1178 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1179 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
1180 | | true, /* isInfallible. False in setters. */ |
1181 | | false, /* isMovable. Not relevant for setters. */ |
1182 | | false, /* isEliminatable. Not relevant for setters. */ |
1183 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1184 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1185 | | false, /* isTypedMethod. Only relevant for methods. */ |
1186 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1187 | | }; |
1188 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1189 | | static_assert(0 < 1, "There is no slot for us"); |
1190 | | |
1191 | | MOZ_CAN_RUN_SCRIPT static bool |
1192 | | getContentTypeForMIMEType(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLEmbedElement* self, const JSJitMethodCallArgs& args) |
1193 | 0 | { |
1194 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLEmbedElement.getContentTypeForMIMEType", DOM, cx); |
1195 | 0 |
|
1196 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
1197 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLEmbedElement.getContentTypeForMIMEType"); |
1198 | 0 | } |
1199 | 0 | binding_detail::FakeString arg0; |
1200 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
1201 | 0 | return false; |
1202 | 0 | } |
1203 | 0 | uint32_t result(self->GetContentTypeForMIMEType(NonNullHelper(Constify(arg0)))); |
1204 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1205 | 0 | args.rval().setNumber(result); |
1206 | 0 | return true; |
1207 | 0 | } |
1208 | | |
1209 | | static const JSJitInfo getContentTypeForMIMEType_methodinfo = { |
1210 | | { (JSJitGetterOp)getContentTypeForMIMEType }, |
1211 | | { prototypes::id::HTMLEmbedElement }, |
1212 | | { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth }, |
1213 | | JSJitInfo::Method, |
1214 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1215 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
1216 | | false, /* isInfallible. False in setters. */ |
1217 | | false, /* isMovable. Not relevant for setters. */ |
1218 | | false, /* isEliminatable. Not relevant for setters. */ |
1219 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1220 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1221 | | false, /* isTypedMethod. Only relevant for methods. */ |
1222 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1223 | | }; |
1224 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1225 | | static_assert(0 < 1, "There is no slot for us"); |
1226 | | |
1227 | | MOZ_CAN_RUN_SCRIPT static bool |
1228 | | getPluginAttributes(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLEmbedElement* self, const JSJitMethodCallArgs& args) |
1229 | 0 | { |
1230 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLEmbedElement.getPluginAttributes", DOM, cx); |
1231 | 0 |
|
1232 | 0 | nsTArray<MozPluginParameter> result; |
1233 | 0 | self->GetPluginAttributes(result); |
1234 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1235 | 0 |
|
1236 | 0 | uint32_t length = result.Length(); |
1237 | 0 | JS::Rooted<JSObject*> returnArray(cx, JS_NewArrayObject(cx, length)); |
1238 | 0 | if (!returnArray) { |
1239 | 0 | return false; |
1240 | 0 | } |
1241 | 0 | // Scope for 'tmp' |
1242 | 0 | { |
1243 | 0 | JS::Rooted<JS::Value> tmp(cx); |
1244 | 0 | for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { |
1245 | 0 | // Control block to let us common up the JS_DefineElement calls when there |
1246 | 0 | // are different ways to succeed at wrapping the object. |
1247 | 0 | do { |
1248 | 0 | if (!result[sequenceIdx0].ToObjectInternal(cx, &tmp)) { |
1249 | 0 | return false; |
1250 | 0 | } |
1251 | 0 | break; |
1252 | 0 | } while (false); |
1253 | 0 | if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, |
1254 | 0 | JSPROP_ENUMERATE)) { |
1255 | 0 | return false; |
1256 | 0 | } |
1257 | 0 | } |
1258 | 0 | } |
1259 | 0 | args.rval().setObject(*returnArray); |
1260 | 0 | return true; |
1261 | 0 | } |
1262 | | |
1263 | | static const JSJitInfo getPluginAttributes_methodinfo = { |
1264 | | { (JSJitGetterOp)getPluginAttributes }, |
1265 | | { prototypes::id::HTMLEmbedElement }, |
1266 | | { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth }, |
1267 | | JSJitInfo::Method, |
1268 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1269 | | JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ |
1270 | | false, /* isInfallible. False in setters. */ |
1271 | | false, /* isMovable. Not relevant for setters. */ |
1272 | | false, /* isEliminatable. Not relevant for setters. */ |
1273 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1274 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1275 | | false, /* isTypedMethod. Only relevant for methods. */ |
1276 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1277 | | }; |
1278 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1279 | | static_assert(0 < 1, "There is no slot for us"); |
1280 | | |
1281 | | MOZ_CAN_RUN_SCRIPT static bool |
1282 | | getPluginParameters(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLEmbedElement* self, const JSJitMethodCallArgs& args) |
1283 | 0 | { |
1284 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLEmbedElement.getPluginParameters", DOM, cx); |
1285 | 0 |
|
1286 | 0 | nsTArray<MozPluginParameter> result; |
1287 | 0 | self->GetPluginParameters(result); |
1288 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1289 | 0 |
|
1290 | 0 | uint32_t length = result.Length(); |
1291 | 0 | JS::Rooted<JSObject*> returnArray(cx, JS_NewArrayObject(cx, length)); |
1292 | 0 | if (!returnArray) { |
1293 | 0 | return false; |
1294 | 0 | } |
1295 | 0 | // Scope for 'tmp' |
1296 | 0 | { |
1297 | 0 | JS::Rooted<JS::Value> tmp(cx); |
1298 | 0 | for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { |
1299 | 0 | // Control block to let us common up the JS_DefineElement calls when there |
1300 | 0 | // are different ways to succeed at wrapping the object. |
1301 | 0 | do { |
1302 | 0 | if (!result[sequenceIdx0].ToObjectInternal(cx, &tmp)) { |
1303 | 0 | return false; |
1304 | 0 | } |
1305 | 0 | break; |
1306 | 0 | } while (false); |
1307 | 0 | if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, |
1308 | 0 | JSPROP_ENUMERATE)) { |
1309 | 0 | return false; |
1310 | 0 | } |
1311 | 0 | } |
1312 | 0 | } |
1313 | 0 | args.rval().setObject(*returnArray); |
1314 | 0 | return true; |
1315 | 0 | } |
1316 | | |
1317 | | static const JSJitInfo getPluginParameters_methodinfo = { |
1318 | | { (JSJitGetterOp)getPluginParameters }, |
1319 | | { prototypes::id::HTMLEmbedElement }, |
1320 | | { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth }, |
1321 | | JSJitInfo::Method, |
1322 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1323 | | JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ |
1324 | | false, /* isInfallible. False in setters. */ |
1325 | | false, /* isMovable. Not relevant for setters. */ |
1326 | | false, /* isEliminatable. Not relevant for setters. */ |
1327 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1328 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1329 | | false, /* isTypedMethod. Only relevant for methods. */ |
1330 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1331 | | }; |
1332 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1333 | | static_assert(0 < 1, "There is no slot for us"); |
1334 | | |
1335 | | MOZ_CAN_RUN_SCRIPT static bool |
1336 | | playPlugin(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLEmbedElement* self, const JSJitMethodCallArgs& args) |
1337 | 0 | { |
1338 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLEmbedElement.playPlugin", DOM, cx); |
1339 | 0 |
|
1340 | 0 | FastErrorResult rv; |
1341 | 0 | self->PlayPlugin(SystemCallerGuarantee(), rv); |
1342 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1343 | 0 | return false; |
1344 | 0 | } |
1345 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1346 | 0 | args.rval().setUndefined(); |
1347 | 0 | return true; |
1348 | 0 | } |
1349 | | |
1350 | | static const JSJitInfo playPlugin_methodinfo = { |
1351 | | { (JSJitGetterOp)playPlugin }, |
1352 | | { prototypes::id::HTMLEmbedElement }, |
1353 | | { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth }, |
1354 | | JSJitInfo::Method, |
1355 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1356 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1357 | | false, /* isInfallible. False in setters. */ |
1358 | | false, /* isMovable. Not relevant for setters. */ |
1359 | | false, /* isEliminatable. Not relevant for setters. */ |
1360 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1361 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1362 | | false, /* isTypedMethod. Only relevant for methods. */ |
1363 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1364 | | }; |
1365 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1366 | | static_assert(0 < 1, "There is no slot for us"); |
1367 | | |
1368 | | MOZ_CAN_RUN_SCRIPT static bool |
1369 | | reload(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLEmbedElement* self, const JSJitMethodCallArgs& args) |
1370 | 0 | { |
1371 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLEmbedElement.reload", DOM, cx); |
1372 | 0 |
|
1373 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
1374 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLEmbedElement.reload"); |
1375 | 0 | } |
1376 | 0 | bool arg0; |
1377 | 0 | if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) { |
1378 | 0 | return false; |
1379 | 0 | } |
1380 | 0 | FastErrorResult rv; |
1381 | 0 | self->Reload(arg0, rv); |
1382 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1383 | 0 | return false; |
1384 | 0 | } |
1385 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1386 | 0 | args.rval().setUndefined(); |
1387 | 0 | return true; |
1388 | 0 | } |
1389 | | |
1390 | | static const JSJitInfo reload_methodinfo = { |
1391 | | { (JSJitGetterOp)reload }, |
1392 | | { prototypes::id::HTMLEmbedElement }, |
1393 | | { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth }, |
1394 | | JSJitInfo::Method, |
1395 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1396 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1397 | | false, /* isInfallible. False in setters. */ |
1398 | | false, /* isMovable. Not relevant for setters. */ |
1399 | | false, /* isEliminatable. Not relevant for setters. */ |
1400 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1401 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1402 | | false, /* isTypedMethod. Only relevant for methods. */ |
1403 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1404 | | }; |
1405 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1406 | | static_assert(0 < 1, "There is no slot for us"); |
1407 | | |
1408 | | MOZ_CAN_RUN_SCRIPT static bool |
1409 | | get_activated(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLEmbedElement* self, JSJitGetterCallArgs args) |
1410 | 0 | { |
1411 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLEmbedElement.activated", DOM, cx); |
1412 | 0 |
|
1413 | 0 | bool result(self->Activated()); |
1414 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1415 | 0 | args.rval().setBoolean(result); |
1416 | 0 | return true; |
1417 | 0 | } |
1418 | | |
1419 | | static const JSJitInfo activated_getterinfo = { |
1420 | | { (JSJitGetterOp)get_activated }, |
1421 | | { prototypes::id::HTMLEmbedElement }, |
1422 | | { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth }, |
1423 | | JSJitInfo::Getter, |
1424 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1425 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
1426 | | true, /* isInfallible. False in setters. */ |
1427 | | false, /* isMovable. Not relevant for setters. */ |
1428 | | false, /* isEliminatable. Not relevant for setters. */ |
1429 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1430 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1431 | | false, /* isTypedMethod. Only relevant for methods. */ |
1432 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1433 | | }; |
1434 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1435 | | static_assert(0 < 1, "There is no slot for us"); |
1436 | | |
1437 | | MOZ_CAN_RUN_SCRIPT static bool |
1438 | | get_srcURI(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLEmbedElement* self, JSJitGetterCallArgs args) |
1439 | 0 | { |
1440 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLEmbedElement.srcURI", DOM, cx); |
1441 | 0 |
|
1442 | 0 | auto result(StrongOrRawPtr<nsIURI>(self->GetSrcURI())); |
1443 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1444 | 0 | if (!result) { |
1445 | 0 | args.rval().setNull(); |
1446 | 0 | return true; |
1447 | 0 | } |
1448 | 0 | if (!WrapObject(cx, result, &NS_GET_IID(nsIURI), args.rval())) { |
1449 | 0 | return false; |
1450 | 0 | } |
1451 | 0 | return true; |
1452 | 0 | } |
1453 | | |
1454 | | static const JSJitInfo srcURI_getterinfo = { |
1455 | | { (JSJitGetterOp)get_srcURI }, |
1456 | | { prototypes::id::HTMLEmbedElement }, |
1457 | | { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth }, |
1458 | | JSJitInfo::Getter, |
1459 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1460 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
1461 | | false, /* isInfallible. False in setters. */ |
1462 | | false, /* isMovable. Not relevant for setters. */ |
1463 | | false, /* isEliminatable. Not relevant for setters. */ |
1464 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1465 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1466 | | false, /* isTypedMethod. Only relevant for methods. */ |
1467 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1468 | | }; |
1469 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1470 | | static_assert(0 < 1, "There is no slot for us"); |
1471 | | |
1472 | | MOZ_CAN_RUN_SCRIPT static bool |
1473 | | get_defaultFallbackType(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLEmbedElement* self, JSJitGetterCallArgs args) |
1474 | 0 | { |
1475 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLEmbedElement.defaultFallbackType", DOM, cx); |
1476 | 0 |
|
1477 | 0 | uint32_t result(self->DefaultFallbackType()); |
1478 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1479 | 0 | args.rval().setNumber(result); |
1480 | 0 | return true; |
1481 | 0 | } |
1482 | | |
1483 | | static const JSJitInfo defaultFallbackType_getterinfo = { |
1484 | | { (JSJitGetterOp)get_defaultFallbackType }, |
1485 | | { prototypes::id::HTMLEmbedElement }, |
1486 | | { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth }, |
1487 | | JSJitInfo::Getter, |
1488 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1489 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
1490 | | true, /* isInfallible. False in setters. */ |
1491 | | false, /* isMovable. Not relevant for setters. */ |
1492 | | false, /* isEliminatable. Not relevant for setters. */ |
1493 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1494 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1495 | | false, /* isTypedMethod. Only relevant for methods. */ |
1496 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1497 | | }; |
1498 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1499 | | static_assert(0 < 1, "There is no slot for us"); |
1500 | | |
1501 | | MOZ_CAN_RUN_SCRIPT static bool |
1502 | | get_pluginFallbackType(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLEmbedElement* self, JSJitGetterCallArgs args) |
1503 | 0 | { |
1504 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLEmbedElement.pluginFallbackType", DOM, cx); |
1505 | 0 |
|
1506 | 0 | uint32_t result(self->PluginFallbackType()); |
1507 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1508 | 0 | args.rval().setNumber(result); |
1509 | 0 | return true; |
1510 | 0 | } |
1511 | | |
1512 | | static const JSJitInfo pluginFallbackType_getterinfo = { |
1513 | | { (JSJitGetterOp)get_pluginFallbackType }, |
1514 | | { prototypes::id::HTMLEmbedElement }, |
1515 | | { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth }, |
1516 | | JSJitInfo::Getter, |
1517 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1518 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
1519 | | true, /* isInfallible. False in setters. */ |
1520 | | false, /* isMovable. Not relevant for setters. */ |
1521 | | false, /* isEliminatable. Not relevant for setters. */ |
1522 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1523 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1524 | | false, /* isTypedMethod. Only relevant for methods. */ |
1525 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1526 | | }; |
1527 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1528 | | static_assert(0 < 1, "There is no slot for us"); |
1529 | | |
1530 | | MOZ_CAN_RUN_SCRIPT static bool |
1531 | | get_hasRunningPlugin(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLEmbedElement* self, JSJitGetterCallArgs args) |
1532 | 0 | { |
1533 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLEmbedElement.hasRunningPlugin", DOM, cx); |
1534 | 0 |
|
1535 | 0 | bool result(self->HasRunningPlugin()); |
1536 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1537 | 0 | args.rval().setBoolean(result); |
1538 | 0 | return true; |
1539 | 0 | } |
1540 | | |
1541 | | static const JSJitInfo hasRunningPlugin_getterinfo = { |
1542 | | { (JSJitGetterOp)get_hasRunningPlugin }, |
1543 | | { prototypes::id::HTMLEmbedElement }, |
1544 | | { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth }, |
1545 | | JSJitInfo::Getter, |
1546 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1547 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
1548 | | true, /* isInfallible. False in setters. */ |
1549 | | false, /* isMovable. Not relevant for setters. */ |
1550 | | false, /* isEliminatable. Not relevant for setters. */ |
1551 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1552 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1553 | | false, /* isTypedMethod. Only relevant for methods. */ |
1554 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1555 | | }; |
1556 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1557 | | static_assert(0 < 1, "There is no slot for us"); |
1558 | | |
1559 | | MOZ_CAN_RUN_SCRIPT static bool |
1560 | | skipFakePlugins(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLEmbedElement* self, const JSJitMethodCallArgs& args) |
1561 | 0 | { |
1562 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLEmbedElement.skipFakePlugins", DOM, cx); |
1563 | 0 |
|
1564 | 0 | FastErrorResult rv; |
1565 | 0 | self->SkipFakePlugins(rv); |
1566 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1567 | 0 | return false; |
1568 | 0 | } |
1569 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1570 | 0 | args.rval().setUndefined(); |
1571 | 0 | return true; |
1572 | 0 | } |
1573 | | |
1574 | | static const JSJitInfo skipFakePlugins_methodinfo = { |
1575 | | { (JSJitGetterOp)skipFakePlugins }, |
1576 | | { prototypes::id::HTMLEmbedElement }, |
1577 | | { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth }, |
1578 | | JSJitInfo::Method, |
1579 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1580 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1581 | | false, /* isInfallible. False in setters. */ |
1582 | | false, /* isMovable. Not relevant for setters. */ |
1583 | | false, /* isEliminatable. Not relevant for setters. */ |
1584 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1585 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1586 | | false, /* isTypedMethod. Only relevant for methods. */ |
1587 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1588 | | }; |
1589 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1590 | | static_assert(0 < 1, "There is no slot for us"); |
1591 | | |
1592 | | MOZ_CAN_RUN_SCRIPT static bool |
1593 | | get_runID(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLEmbedElement* self, JSJitGetterCallArgs args) |
1594 | 0 | { |
1595 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLEmbedElement.runID", DOM, cx); |
1596 | 0 |
|
1597 | 0 | FastErrorResult rv; |
1598 | 0 | uint32_t result(self->GetRunID(SystemCallerGuarantee(), rv)); |
1599 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1600 | 0 | return false; |
1601 | 0 | } |
1602 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1603 | 0 | args.rval().setNumber(result); |
1604 | 0 | return true; |
1605 | 0 | } |
1606 | | |
1607 | | static const JSJitInfo runID_getterinfo = { |
1608 | | { (JSJitGetterOp)get_runID }, |
1609 | | { prototypes::id::HTMLEmbedElement }, |
1610 | | { PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth }, |
1611 | | JSJitInfo::Getter, |
1612 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1613 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
1614 | | false, /* isInfallible. False in setters. */ |
1615 | | false, /* isMovable. Not relevant for setters. */ |
1616 | | false, /* isEliminatable. Not relevant for setters. */ |
1617 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1618 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1619 | | false, /* isTypedMethod. Only relevant for methods. */ |
1620 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1621 | | }; |
1622 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1623 | | static_assert(0 < 1, "There is no slot for us"); |
1624 | | |
1625 | | static bool |
1626 | | _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val) |
1627 | 0 | { |
1628 | 0 | mozilla::dom::HTMLEmbedElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLEmbedElement>(obj); |
1629 | 0 | // We don't want to preserve if we don't have a wrapper, and we |
1630 | 0 | // obviously can't preserve if we're not initialized. |
1631 | 0 | if (self && self->GetWrapperPreserveColor()) { |
1632 | 0 | PreserveWrapper(self); |
1633 | 0 | } |
1634 | 0 | return true; |
1635 | 0 | } |
1636 | | |
1637 | | static void |
1638 | | _finalize(js::FreeOp* fop, JSObject* obj) |
1639 | 0 | { |
1640 | 0 | mozilla::dom::HTMLEmbedElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLEmbedElement>(obj); |
1641 | 0 | if (self) { |
1642 | 0 | ClearWrapper(self, self, obj); |
1643 | 0 | AddForDeferredFinalization<mozilla::dom::HTMLEmbedElement>(self); |
1644 | 0 | } |
1645 | 0 | } |
1646 | | |
1647 | | static size_t |
1648 | | _objectMoved(JSObject* obj, JSObject* old) |
1649 | 0 | { |
1650 | 0 | mozilla::dom::HTMLEmbedElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLEmbedElement>(obj); |
1651 | 0 | if (self) { |
1652 | 0 | UpdateWrapper(self, self, obj, old); |
1653 | 0 | } |
1654 | 0 |
|
1655 | 0 | return 0; |
1656 | 0 | } |
1657 | | |
1658 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
1659 | | #if defined(__clang__) |
1660 | | #pragma clang diagnostic push |
1661 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
1662 | | #endif |
1663 | | static const JSFunctionSpec sMethods_specs[] = { |
1664 | | JS_FNSPEC("getSVGDocument", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getSVGDocument_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
1665 | | JS_FS_END |
1666 | | }; |
1667 | | #if defined(__clang__) |
1668 | | #pragma clang diagnostic pop |
1669 | | #endif |
1670 | | |
1671 | | |
1672 | | static const Prefable<const JSFunctionSpec> sMethods[] = { |
1673 | | { nullptr, &sMethods_specs[0] }, |
1674 | | { nullptr, nullptr } |
1675 | | }; |
1676 | | |
1677 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
1678 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
1679 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
1680 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
1681 | | |
1682 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
1683 | | #if defined(__clang__) |
1684 | | #pragma clang diagnostic push |
1685 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
1686 | | #endif |
1687 | | static const JSFunctionSpec sChromeMethods_specs[] = { |
1688 | | JS_FNSPEC("presetOpenerWindow", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&presetOpenerWindow_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
1689 | | JS_FNSPEC("swapFrameLoaders", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&swapFrameLoaders_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
1690 | | JS_FNSPEC("addObserver", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&addObserver_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
1691 | | JS_FNSPEC("removeObserver", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&removeObserver_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
1692 | | JS_FNSPEC("getRequest", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getRequest_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
1693 | | JS_FNSPEC("getRequestType", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getRequestType_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
1694 | | JS_FNSPEC("forceReload", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&forceReload_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
1695 | | JS_FNSPEC("forceImageState", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&forceImageState_methodinfo), 2, JSPROP_ENUMERATE, nullptr), |
1696 | | JS_FNSPEC("getContentTypeForMIMEType", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getContentTypeForMIMEType_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
1697 | | JS_FNSPEC("getPluginAttributes", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getPluginAttributes_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
1698 | | JS_FNSPEC("getPluginParameters", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getPluginParameters_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
1699 | | JS_FNSPEC("playPlugin", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&playPlugin_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
1700 | | JS_FNSPEC("reload", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&reload_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
1701 | | JS_FNSPEC("skipFakePlugins", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&skipFakePlugins_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
1702 | | JS_FS_END |
1703 | | }; |
1704 | | #if defined(__clang__) |
1705 | | #pragma clang diagnostic pop |
1706 | | #endif |
1707 | | |
1708 | | |
1709 | | static const Prefable<const JSFunctionSpec> sChromeMethods[] = { |
1710 | | { nullptr, &sChromeMethods_specs[0] }, |
1711 | | { nullptr, nullptr } |
1712 | | }; |
1713 | | |
1714 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
1715 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
1716 | | static_assert(14 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
1717 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
1718 | | |
1719 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
1720 | | #if defined(__clang__) |
1721 | | #pragma clang diagnostic push |
1722 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
1723 | | #endif |
1724 | | static const JSPropertySpec sAttributes_specs[] = { |
1725 | | { "src", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &src_getterinfo, GenericSetter<NormalThisPolicy>, &src_setterinfo }, |
1726 | | { "type", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &type_getterinfo, GenericSetter<NormalThisPolicy>, &type_setterinfo }, |
1727 | | { "width", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &width_getterinfo, GenericSetter<NormalThisPolicy>, &width_setterinfo }, |
1728 | | { "height", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &height_getterinfo, GenericSetter<NormalThisPolicy>, &height_setterinfo }, |
1729 | | { "align", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &align_getterinfo, GenericSetter<NormalThisPolicy>, &align_setterinfo }, |
1730 | | { "name", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &name_getterinfo, GenericSetter<NormalThisPolicy>, &name_setterinfo }, |
1731 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr } |
1732 | | }; |
1733 | | #if defined(__clang__) |
1734 | | #pragma clang diagnostic pop |
1735 | | #endif |
1736 | | |
1737 | | |
1738 | | static const Prefable<const JSPropertySpec> sAttributes[] = { |
1739 | | { nullptr, &sAttributes_specs[0] }, |
1740 | | { nullptr, nullptr } |
1741 | | }; |
1742 | | |
1743 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
1744 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
1745 | | static_assert(6 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
1746 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
1747 | | |
1748 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
1749 | | #if defined(__clang__) |
1750 | | #pragma clang diagnostic push |
1751 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
1752 | | #endif |
1753 | | static const JSPropertySpec sChromeAttributes_specs[] = { |
1754 | | { "frameLoader", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &frameLoader_getterinfo, nullptr, nullptr }, |
1755 | | { "loadingEnabled", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &loadingEnabled_getterinfo, GenericSetter<NormalThisPolicy>, &loadingEnabled_setterinfo }, |
1756 | | { "imageBlockingStatus", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &imageBlockingStatus_getterinfo, nullptr, nullptr }, |
1757 | | { "currentURI", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, ¤tURI_getterinfo, nullptr, nullptr }, |
1758 | | { "currentRequestFinalURI", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, ¤tRequestFinalURI_getterinfo, nullptr, nullptr }, |
1759 | | { "actualType", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &actualType_getterinfo, nullptr, nullptr }, |
1760 | | { "displayedType", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &displayedType_getterinfo, nullptr, nullptr }, |
1761 | | { "activated", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &activated_getterinfo, nullptr, nullptr }, |
1762 | | { "srcURI", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &srcURI_getterinfo, nullptr, nullptr }, |
1763 | | { "defaultFallbackType", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &defaultFallbackType_getterinfo, nullptr, nullptr }, |
1764 | | { "pluginFallbackType", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &pluginFallbackType_getterinfo, nullptr, nullptr }, |
1765 | | { "hasRunningPlugin", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &hasRunningPlugin_getterinfo, nullptr, nullptr }, |
1766 | | { "runID", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &runID_getterinfo, nullptr, nullptr }, |
1767 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr } |
1768 | | }; |
1769 | | #if defined(__clang__) |
1770 | | #pragma clang diagnostic pop |
1771 | | #endif |
1772 | | |
1773 | | |
1774 | | static const Prefable<const JSPropertySpec> sChromeAttributes[] = { |
1775 | | { nullptr, &sChromeAttributes_specs[0] }, |
1776 | | { nullptr, nullptr } |
1777 | | }; |
1778 | | |
1779 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
1780 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
1781 | | static_assert(13 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
1782 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
1783 | | |
1784 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
1785 | | #if defined(__clang__) |
1786 | | #pragma clang diagnostic push |
1787 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
1788 | | #endif |
1789 | | static const ConstantSpec sChromeConstants_specs[] = { |
1790 | | { "UNKNOWN_REQUEST", JS::Int32Value(-1) }, |
1791 | | { "CURRENT_REQUEST", JS::Int32Value(0) }, |
1792 | | { "PENDING_REQUEST", JS::Int32Value(1) }, |
1793 | | { "TYPE_LOADING", JS::NumberValue(0U) }, |
1794 | | { "TYPE_IMAGE", JS::NumberValue(1U) }, |
1795 | | { "TYPE_PLUGIN", JS::NumberValue(2U) }, |
1796 | | { "TYPE_FAKE_PLUGIN", JS::NumberValue(3U) }, |
1797 | | { "TYPE_DOCUMENT", JS::NumberValue(4U) }, |
1798 | | { "TYPE_NULL", JS::NumberValue(5U) }, |
1799 | | { "PLUGIN_UNSUPPORTED", JS::NumberValue(0U) }, |
1800 | | { "PLUGIN_ALTERNATE", JS::NumberValue(1U) }, |
1801 | | { "PLUGIN_DISABLED", JS::NumberValue(2U) }, |
1802 | | { "PLUGIN_BLOCKLISTED", JS::NumberValue(3U) }, |
1803 | | { "PLUGIN_OUTDATED", JS::NumberValue(4U) }, |
1804 | | { "PLUGIN_CRASHED", JS::NumberValue(5U) }, |
1805 | | { "PLUGIN_SUPPRESSED", JS::NumberValue(6U) }, |
1806 | | { "PLUGIN_USER_DISABLED", JS::NumberValue(7U) }, |
1807 | | { "PLUGIN_CLICK_TO_PLAY", JS::NumberValue(8U) }, |
1808 | | { "PLUGIN_VULNERABLE_UPDATABLE", JS::NumberValue(9U) }, |
1809 | | { "PLUGIN_VULNERABLE_NO_UPDATE", JS::NumberValue(10U) }, |
1810 | | { 0, JS::UndefinedValue() } |
1811 | | }; |
1812 | | #if defined(__clang__) |
1813 | | #pragma clang diagnostic pop |
1814 | | #endif |
1815 | | |
1816 | | |
1817 | | static const Prefable<const ConstantSpec> sChromeConstants[] = { |
1818 | | { nullptr, &sChromeConstants_specs[0] }, |
1819 | | { nullptr, nullptr } |
1820 | | }; |
1821 | | |
1822 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
1823 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
1824 | | static_assert(20 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
1825 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
1826 | | |
1827 | | |
1828 | | static uint16_t sNativeProperties_sortedPropertyIndices[7]; |
1829 | | static PropertyInfo sNativeProperties_propertyInfos[7]; |
1830 | | |
1831 | | static const NativePropertiesN<2> sNativeProperties = { |
1832 | | false, 0, |
1833 | | false, 0, |
1834 | | true, 0 /* sMethods */, |
1835 | | true, 1 /* sAttributes */, |
1836 | | false, 0, |
1837 | | false, 0, |
1838 | | false, 0, |
1839 | | -1, |
1840 | | 7, |
1841 | | sNativeProperties_sortedPropertyIndices, |
1842 | | { |
1843 | | { sMethods, &sNativeProperties_propertyInfos[0] }, |
1844 | | { sAttributes, &sNativeProperties_propertyInfos[1] } |
1845 | | } |
1846 | | }; |
1847 | | static_assert(7 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount), |
1848 | | "We have a property info count that is oversized"); |
1849 | | |
1850 | | static uint16_t sChromeOnlyNativeProperties_sortedPropertyIndices[47]; |
1851 | | static PropertyInfo sChromeOnlyNativeProperties_propertyInfos[47]; |
1852 | | |
1853 | | static const NativePropertiesN<3> sChromeOnlyNativeProperties = { |
1854 | | false, 0, |
1855 | | false, 0, |
1856 | | true, 0 /* sChromeMethods */, |
1857 | | true, 1 /* sChromeAttributes */, |
1858 | | false, 0, |
1859 | | false, 0, |
1860 | | true, 2 /* sChromeConstants */, |
1861 | | -1, |
1862 | | 47, |
1863 | | sChromeOnlyNativeProperties_sortedPropertyIndices, |
1864 | | { |
1865 | | { sChromeMethods, &sChromeOnlyNativeProperties_propertyInfos[0] }, |
1866 | | { sChromeAttributes, &sChromeOnlyNativeProperties_propertyInfos[14] }, |
1867 | | { sChromeConstants, &sChromeOnlyNativeProperties_propertyInfos[27] } |
1868 | | } |
1869 | | }; |
1870 | | static_assert(47 < 1ull << CHAR_BIT * sizeof(sChromeOnlyNativeProperties.propertyInfoCount), |
1871 | | "We have a property info count that is oversized"); |
1872 | | |
1873 | | static bool |
1874 | | _constructor(JSContext* cx, unsigned argc, JS::Value* vp) |
1875 | 0 | { |
1876 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLEmbedElement constructor", DOM, cx); |
1877 | 0 |
|
1878 | 0 | return HTMLConstructor(cx, argc, vp, |
1879 | 0 | constructors::id::HTMLEmbedElement, |
1880 | 0 | prototypes::id::HTMLEmbedElement, |
1881 | 0 | CreateInterfaceObjects); |
1882 | 0 | } |
1883 | | |
1884 | | static const js::ClassOps sInterfaceObjectClassOps = { |
1885 | | nullptr, /* addProperty */ |
1886 | | nullptr, /* delProperty */ |
1887 | | nullptr, /* enumerate */ |
1888 | | nullptr, /* newEnumerate */ |
1889 | | nullptr, /* resolve */ |
1890 | | nullptr, /* mayResolve */ |
1891 | | nullptr, /* finalize */ |
1892 | | _constructor, /* call */ |
1893 | | nullptr, /* hasInstance */ |
1894 | | _constructor, /* construct */ |
1895 | | nullptr, /* trace */ |
1896 | | }; |
1897 | | |
1898 | | static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = { |
1899 | | { |
1900 | | "Function", |
1901 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE), |
1902 | | &sInterfaceObjectClassOps, |
1903 | | JS_NULL_CLASS_SPEC, |
1904 | | JS_NULL_CLASS_EXT, |
1905 | | &sInterfaceObjectClassObjectOps |
1906 | | }, |
1907 | | eInterface, |
1908 | | true, |
1909 | | prototypes::id::HTMLEmbedElement, |
1910 | | PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth, |
1911 | | sNativePropertyHooks, |
1912 | | "function HTMLEmbedElement() {\n [native code]\n}", |
1913 | | HTMLElement_Binding::GetConstructorObject |
1914 | | }; |
1915 | | |
1916 | | static bool |
1917 | | _resolve(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, bool* resolvedp) |
1918 | 0 | { |
1919 | 0 | mozilla::dom::HTMLEmbedElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLEmbedElement>(obj); |
1920 | 0 | JS::Rooted<JS::PropertyDescriptor> desc(cx); |
1921 | 0 | if (!self->DoResolve(cx, obj, id, &desc)) { |
1922 | 0 | return false; |
1923 | 0 | } |
1924 | 0 | if (!desc.object()) { |
1925 | 0 | return true; |
1926 | 0 | } |
1927 | 0 | // If desc.value() is undefined, then the DoResolve call |
1928 | 0 | // has already defined it on the object. Don't try to also |
1929 | 0 | // define it. |
1930 | 0 | if (!desc.value().isUndefined()) { |
1931 | 0 | desc.attributesRef() |= JSPROP_RESOLVING; |
1932 | 0 | if (!JS_DefinePropertyById(cx, obj, id, desc)) { |
1933 | 0 | return false; |
1934 | 0 | } |
1935 | 0 | } |
1936 | 0 | *resolvedp = true; |
1937 | 0 | return true; |
1938 | 0 | } |
1939 | | |
1940 | | static bool |
1941 | | _mayResolve(const JSAtomState& names, jsid id, JSObject* maybeObj) |
1942 | 0 | { |
1943 | 0 | return mozilla::dom::HTMLEmbedElement::MayResolve(id); |
1944 | 0 | } |
1945 | | |
1946 | | static bool |
1947 | | _newEnumerate(JSContext* cx, JS::Handle<JSObject*> obj, JS::AutoIdVector& properties, bool enumerableOnly) |
1948 | 0 | { |
1949 | 0 | mozilla::dom::HTMLEmbedElement* self; |
1950 | 0 | JS::Rooted<JS::Value> rootSelf(cx, JS::ObjectValue(*obj)); |
1951 | 0 | { |
1952 | 0 | nsresult rv = UnwrapObject<prototypes::id::HTMLEmbedElement, mozilla::dom::HTMLEmbedElement>(&rootSelf, self); |
1953 | 0 | if (NS_FAILED(rv)) { |
1954 | 0 | return ThrowErrorMessage(cx, MSG_THIS_DOES_NOT_IMPLEMENT_INTERFACE, "Value", "HTMLEmbedElement"); |
1955 | 0 | } |
1956 | 0 | } |
1957 | 0 | FastErrorResult rv; |
1958 | 0 | self->GetOwnPropertyNames(cx, properties, enumerableOnly, rv); |
1959 | 0 | if (rv.MaybeSetPendingException(cx)) { |
1960 | 0 | return false; |
1961 | 0 | } |
1962 | 0 | return true; |
1963 | 0 | } |
1964 | | |
1965 | | static const DOMIfaceAndProtoJSClass sPrototypeClass = { |
1966 | | { |
1967 | | "HTMLEmbedElementPrototype", |
1968 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE), |
1969 | | JS_NULL_CLASS_OPS, |
1970 | | JS_NULL_CLASS_SPEC, |
1971 | | JS_NULL_CLASS_EXT, |
1972 | | JS_NULL_OBJECT_OPS |
1973 | | }, |
1974 | | eInterfacePrototype, |
1975 | | false, |
1976 | | prototypes::id::HTMLEmbedElement, |
1977 | | PrototypeTraits<prototypes::id::HTMLEmbedElement>::Depth, |
1978 | | sNativePropertyHooks, |
1979 | | "[object HTMLEmbedElementPrototype]", |
1980 | | HTMLElement_Binding::GetProtoObject |
1981 | | }; |
1982 | | |
1983 | | static const js::ClassOps sClassOps = { |
1984 | | _addProperty, /* addProperty */ |
1985 | | nullptr, /* delProperty */ |
1986 | | nullptr, /* enumerate */ |
1987 | | _newEnumerate, /* newEnumerate */ |
1988 | | _resolve, /* resolve */ |
1989 | | _mayResolve, /* mayResolve */ |
1990 | | _finalize, /* finalize */ |
1991 | | nullptr, /* call */ |
1992 | | nullptr, /* hasInstance */ |
1993 | | nullptr, /* construct */ |
1994 | | nullptr, /* trace */ |
1995 | | }; |
1996 | | |
1997 | | static const js::ClassExtension sClassExtension = { |
1998 | | nullptr, /* weakmapKeyDelegateOp */ |
1999 | | _objectMoved /* objectMovedOp */ |
2000 | | }; |
2001 | | |
2002 | | static const DOMJSClass sClass = { |
2003 | | { "HTMLEmbedElement", |
2004 | | JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1), |
2005 | | &sClassOps, |
2006 | | JS_NULL_CLASS_SPEC, |
2007 | | &sClassExtension, |
2008 | | JS_NULL_OBJECT_OPS |
2009 | | }, |
2010 | | { prototypes::id::EventTarget, prototypes::id::Node, prototypes::id::Element, prototypes::id::HTMLElement, prototypes::id::HTMLEmbedElement, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count }, |
2011 | | IsBaseOf<nsISupports, mozilla::dom::HTMLEmbedElement >::value, |
2012 | | sNativePropertyHooks, |
2013 | | FindAssociatedGlobalForNative<mozilla::dom::HTMLEmbedElement>::Get, |
2014 | | GetProtoObjectHandle, |
2015 | | GetCCParticipant<mozilla::dom::HTMLEmbedElement>::Get() |
2016 | | }; |
2017 | | static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS, |
2018 | | "Must have the right minimal number of reserved slots."); |
2019 | | static_assert(1 >= 1, |
2020 | | "Must have enough reserved slots."); |
2021 | | |
2022 | | const JSClass* |
2023 | | GetJSClass() |
2024 | 0 | { |
2025 | 0 | return sClass.ToJSClass(); |
2026 | 0 | } |
2027 | | |
2028 | | bool |
2029 | | Wrap(JSContext* aCx, mozilla::dom::HTMLEmbedElement* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector) |
2030 | 0 | { |
2031 | 0 | static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::dom::HTMLEmbedElement>::value, |
2032 | 0 | "Shouldn't have wrappercached things that are not refcounted."); |
2033 | 0 | MOZ_ASSERT(static_cast<mozilla::dom::HTMLEmbedElement*>(aObject) == |
2034 | 0 | reinterpret_cast<mozilla::dom::HTMLEmbedElement*>(aObject), |
2035 | 0 | "Multiple inheritance for mozilla::dom::HTMLEmbedElement is broken."); |
2036 | 0 | MOZ_ASSERT(static_cast<nsGenericHTMLElement*>(aObject) == |
2037 | 0 | reinterpret_cast<nsGenericHTMLElement*>(aObject), |
2038 | 0 | "Multiple inheritance for nsGenericHTMLElement is broken."); |
2039 | 0 | MOZ_ASSERT(static_cast<mozilla::dom::Element*>(aObject) == |
2040 | 0 | reinterpret_cast<mozilla::dom::Element*>(aObject), |
2041 | 0 | "Multiple inheritance for mozilla::dom::Element is broken."); |
2042 | 0 | MOZ_ASSERT(static_cast<nsINode*>(aObject) == |
2043 | 0 | reinterpret_cast<nsINode*>(aObject), |
2044 | 0 | "Multiple inheritance for nsINode is broken."); |
2045 | 0 | MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) == |
2046 | 0 | reinterpret_cast<mozilla::dom::EventTarget*>(aObject), |
2047 | 0 | "Multiple inheritance for mozilla::dom::EventTarget is broken."); |
2048 | 0 | MOZ_ASSERT(ToSupportsIsCorrect(aObject)); |
2049 | 0 | MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx)); |
2050 | 0 | MOZ_ASSERT(!aCache->GetWrapper(), |
2051 | 0 | "You should probably not be using Wrap() directly; use " |
2052 | 0 | "GetOrCreateDOMReflector instead"); |
2053 | 0 |
|
2054 | 0 | MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache), |
2055 | 0 | "nsISupports must be on our primary inheritance chain"); |
2056 | 0 |
|
2057 | 0 | JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject())); |
2058 | 0 | if (!global) { |
2059 | 0 | return false; |
2060 | 0 | } |
2061 | 0 | MOZ_ASSERT(JS_IsGlobalObject(global)); |
2062 | 0 | MOZ_ASSERT(JS::ObjectIsNotGray(global)); |
2063 | 0 |
|
2064 | 0 | // That might have ended up wrapping us already, due to the wonders |
2065 | 0 | // of XBL. Check for that, and bail out as needed. |
2066 | 0 | aReflector.set(aCache->GetWrapper()); |
2067 | 0 | if (aReflector) { |
2068 | | #ifdef DEBUG |
2069 | | AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto); |
2070 | | #endif // DEBUG |
2071 | | return true; |
2072 | 0 | } |
2073 | 0 |
|
2074 | 0 | JSAutoRealm ar(aCx, global); |
2075 | 0 | JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx); |
2076 | 0 | if (!canonicalProto) { |
2077 | 0 | return false; |
2078 | 0 | } |
2079 | 0 | JS::Rooted<JSObject*> proto(aCx); |
2080 | 0 | if (aGivenProto) { |
2081 | 0 | proto = aGivenProto; |
2082 | 0 | // Unfortunately, while aGivenProto was in the compartment of aCx |
2083 | 0 | // coming in, we changed compartments to that of "parent" so may need |
2084 | 0 | // to wrap the proto here. |
2085 | 0 | if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) { |
2086 | 0 | if (!JS_WrapObject(aCx, &proto)) { |
2087 | 0 | return false; |
2088 | 0 | } |
2089 | 0 | } |
2090 | 0 | } else { |
2091 | 0 | proto = canonicalProto; |
2092 | 0 | } |
2093 | 0 |
|
2094 | 0 | BindingJSObjectCreator<mozilla::dom::HTMLEmbedElement> creator(aCx); |
2095 | 0 | creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector); |
2096 | 0 | if (!aReflector) { |
2097 | 0 | return false; |
2098 | 0 | } |
2099 | 0 | |
2100 | 0 | aCache->SetWrapper(aReflector); |
2101 | 0 | creator.InitializationSucceeded(); |
2102 | 0 |
|
2103 | 0 | MOZ_ASSERT(aCache->GetWrapperPreserveColor() && |
2104 | 0 | aCache->GetWrapperPreserveColor() == aReflector); |
2105 | 0 | // If proto != canonicalProto, we have to preserve our wrapper; |
2106 | 0 | // otherwise we won't be able to properly recreate it later, since |
2107 | 0 | // we won't know what proto to use. Note that we don't check |
2108 | 0 | // aGivenProto here, since it's entirely possible (and even |
2109 | 0 | // somewhat common) to have a non-null aGivenProto which is the |
2110 | 0 | // same as canonicalProto. |
2111 | 0 | if (proto != canonicalProto) { |
2112 | 0 | PreserveWrapper(aObject); |
2113 | 0 | } |
2114 | 0 |
|
2115 | 0 | return true; |
2116 | 0 | } |
2117 | | |
2118 | | const NativePropertyHooks sNativePropertyHooks[] = { { |
2119 | | nullptr, |
2120 | | nullptr, |
2121 | | nullptr, |
2122 | | { sNativeProperties.Upcast(), sChromeOnlyNativeProperties.Upcast() }, |
2123 | | prototypes::id::HTMLEmbedElement, |
2124 | | constructors::id::HTMLEmbedElement, |
2125 | | HTMLElement_Binding::sNativePropertyHooks, |
2126 | | &DefaultXrayExpandoObjectClass |
2127 | | } }; |
2128 | | |
2129 | | void |
2130 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal) |
2131 | 0 | { |
2132 | 0 | JS::Handle<JSObject*> parentProto(HTMLElement_Binding::GetProtoObjectHandle(aCx)); |
2133 | 0 | if (!parentProto) { |
2134 | 0 | return; |
2135 | 0 | } |
2136 | 0 | |
2137 | 0 | JS::Handle<JSObject*> constructorProto(HTMLElement_Binding::GetConstructorObjectHandle(aCx)); |
2138 | 0 | if (!constructorProto) { |
2139 | 0 | return; |
2140 | 0 | } |
2141 | 0 | |
2142 | 0 | static bool sIdsInited = false; |
2143 | 0 | if (!sIdsInited && NS_IsMainThread()) { |
2144 | 0 | if (!InitIds(aCx, sNativeProperties.Upcast())) { |
2145 | 0 | return; |
2146 | 0 | } |
2147 | 0 | if (!InitIds(aCx, sChromeOnlyNativeProperties.Upcast())) { |
2148 | 0 | return; |
2149 | 0 | } |
2150 | 0 | sIdsInited = true; |
2151 | 0 | } |
2152 | 0 |
|
2153 | 0 | JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::HTMLEmbedElement); |
2154 | 0 | JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::HTMLEmbedElement); |
2155 | 0 | dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, |
2156 | 0 | &sPrototypeClass.mBase, protoCache, |
2157 | 0 | nullptr, |
2158 | 0 | constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr, |
2159 | 0 | interfaceCache, |
2160 | 0 | sNativeProperties.Upcast(), |
2161 | 0 | sChromeOnlyNativeProperties.Upcast(), |
2162 | 0 | "HTMLEmbedElement", aDefineOnGlobal, |
2163 | 0 | nullptr, |
2164 | 0 | false); |
2165 | 0 | } |
2166 | | |
2167 | | JSObject* |
2168 | | GetConstructorObject(JSContext* aCx) |
2169 | 0 | { |
2170 | 0 | return GetConstructorObjectHandle(aCx); |
2171 | 0 | } |
2172 | | |
2173 | | } // namespace HTMLEmbedElement_Binding |
2174 | | |
2175 | | |
2176 | | |
2177 | | } // namespace dom |
2178 | | } // namespace mozilla |