/work/obj-fuzz/dom/bindings/HTMLImageElementBinding.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* THIS FILE IS AUTOGENERATED FROM HTMLImageElement.webidl BY Codegen.py - DO NOT EDIT */ |
2 | | |
3 | | #include "HTMLElementBinding.h" |
4 | | #include "HTMLImageElementBinding.h" |
5 | | #include "WrapperFactory.h" |
6 | | #include "imgINotificationObserver.h" |
7 | | #include "imgIRequest.h" |
8 | | #include "mozilla/OwningNonNull.h" |
9 | | #include "mozilla/dom/BindingUtils.h" |
10 | | #include "mozilla/dom/CustomElementRegistry.h" |
11 | | #include "mozilla/dom/DOMJSClass.h" |
12 | | #include "mozilla/dom/DocGroup.h" |
13 | | #include "mozilla/dom/HTMLImageElement.h" |
14 | | #include "mozilla/dom/NonRefcountedDOMObject.h" |
15 | | #include "mozilla/dom/Nullable.h" |
16 | | #include "mozilla/dom/PrimitiveConversions.h" |
17 | | #include "mozilla/dom/XrayExpandoClass.h" |
18 | | #include "nsContentUtils.h" |
19 | | #include "nsIURI.h" |
20 | | |
21 | | namespace mozilla { |
22 | | namespace dom { |
23 | | |
24 | | namespace binding_detail {}; // Just to make sure it's known as a namespace |
25 | | using namespace mozilla::dom::binding_detail; |
26 | | |
27 | | |
28 | | namespace HTMLImageElement_Binding { |
29 | | |
30 | | static_assert(IsRefcounted<NativeType>::value == IsRefcounted<HTMLElement_Binding::NativeType>::value, |
31 | | "Can't inherit from an interface with a different ownership model."); |
32 | | |
33 | | static bool |
34 | | _Image(JSContext* cx, unsigned argc, JS::Value* vp) |
35 | 0 | { |
36 | 0 | AUTO_PROFILER_LABEL_FAST("Image constructor", DOM, cx); |
37 | 0 |
|
38 | 0 | JS::CallArgs args = JS::CallArgsFromVp(argc, vp); |
39 | 0 | JS::Rooted<JSObject*> obj(cx, &args.callee()); |
40 | 0 | if (!args.isConstructing()) { |
41 | 0 | // XXXbz wish I could get the name from the callee instead of |
42 | 0 | // Adding more relocations |
43 | 0 | return ThrowConstructorWithoutNew(cx, "Image"); |
44 | 0 | } |
45 | 0 | |
46 | 0 | JS::Rooted<JSObject*> desiredProto(cx); |
47 | 0 | if (!GetDesiredProto(cx, args, &desiredProto)) { |
48 | 0 | return false; |
49 | 0 | } |
50 | 0 | |
51 | 0 | GlobalObject global(cx, obj); |
52 | 0 | if (global.Failed()) { |
53 | 0 | return false; |
54 | 0 | } |
55 | 0 | |
56 | 0 | bool objIsXray = xpc::WrapperFactory::IsXrayWrapper(obj); |
57 | 0 | Optional<uint32_t> arg0; |
58 | 0 | if (args.hasDefined(0)) { |
59 | 0 | arg0.Construct(); |
60 | 0 | if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0.Value())) { |
61 | 0 | return false; |
62 | 0 | } |
63 | 0 | } |
64 | 0 | Optional<uint32_t> arg1; |
65 | 0 | if (args.hasDefined(1)) { |
66 | 0 | arg1.Construct(); |
67 | 0 | if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1.Value())) { |
68 | 0 | return false; |
69 | 0 | } |
70 | 0 | } |
71 | 0 | Maybe<JSAutoRealm> ar; |
72 | 0 | if (objIsXray) { |
73 | 0 | obj = js::CheckedUnwrap(obj); |
74 | 0 | if (!obj) { |
75 | 0 | return false; |
76 | 0 | } |
77 | 0 | ar.emplace(cx, obj); |
78 | 0 | if (!JS_WrapObject(cx, &desiredProto)) { |
79 | 0 | return false; |
80 | 0 | } |
81 | 0 | } |
82 | 0 | FastErrorResult rv; |
83 | 0 | auto result(StrongOrRawPtr<mozilla::dom::HTMLImageElement>(mozilla::dom::HTMLImageElement::Image(global, Constify(arg0), Constify(arg1), rv))); |
84 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
85 | 0 | return false; |
86 | 0 | } |
87 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
88 | 0 | static_assert(!IsPointer<decltype(result)>::value, |
89 | 0 | "NewObject implies that we need to keep the object alive with a strong reference."); |
90 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval(), desiredProto)) { |
91 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
92 | 0 | return false; |
93 | 0 | } |
94 | 0 | return true; |
95 | 0 | } |
96 | | |
97 | | MOZ_CAN_RUN_SCRIPT static bool |
98 | | get_alt(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitGetterCallArgs args) |
99 | 0 | { |
100 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLImageElement.alt", DOM, cx); |
101 | 0 |
|
102 | 0 | DOMString result; |
103 | 0 | self->GetAlt(result); |
104 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
105 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
106 | 0 | return false; |
107 | 0 | } |
108 | 0 | return true; |
109 | 0 | } |
110 | | |
111 | | MOZ_CAN_RUN_SCRIPT static bool |
112 | | set_alt(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitSetterCallArgs args) |
113 | 0 | { |
114 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLImageElement.alt", DOM, cx); |
115 | 0 |
|
116 | 0 | binding_detail::FakeString arg0; |
117 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
118 | 0 | return false; |
119 | 0 | } |
120 | 0 | Maybe<AutoCEReaction> ceReaction; |
121 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
122 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
123 | 0 | if (docGroup) { |
124 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
125 | 0 | } |
126 | 0 | } |
127 | 0 | FastErrorResult rv; |
128 | 0 | self->SetAlt(NonNullHelper(Constify(arg0)), rv); |
129 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
130 | 0 | return false; |
131 | 0 | } |
132 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
133 | 0 |
|
134 | 0 | return true; |
135 | 0 | } |
136 | | |
137 | | static const JSJitInfo alt_getterinfo = { |
138 | | { (JSJitGetterOp)get_alt }, |
139 | | { prototypes::id::HTMLImageElement }, |
140 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
141 | | JSJitInfo::Getter, |
142 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
143 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
144 | | false, /* isInfallible. False in setters. */ |
145 | | false, /* isMovable. Not relevant for setters. */ |
146 | | false, /* isEliminatable. Not relevant for setters. */ |
147 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
148 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
149 | | false, /* isTypedMethod. Only relevant for methods. */ |
150 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
151 | | }; |
152 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
153 | | static_assert(0 < 1, "There is no slot for us"); |
154 | | static const JSJitInfo alt_setterinfo = { |
155 | | { (JSJitGetterOp)set_alt }, |
156 | | { prototypes::id::HTMLImageElement }, |
157 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
158 | | JSJitInfo::Setter, |
159 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
160 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
161 | | false, /* isInfallible. False in setters. */ |
162 | | false, /* isMovable. Not relevant for setters. */ |
163 | | false, /* 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 | | |
172 | | MOZ_CAN_RUN_SCRIPT static bool |
173 | | get_src(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitGetterCallArgs args) |
174 | 0 | { |
175 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLImageElement.src", DOM, cx); |
176 | 0 |
|
177 | 0 | DOMString result; |
178 | 0 | self->GetSrc(result); |
179 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
180 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
181 | 0 | return false; |
182 | 0 | } |
183 | 0 | return true; |
184 | 0 | } |
185 | | |
186 | | MOZ_CAN_RUN_SCRIPT static bool |
187 | | set_src(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitSetterCallArgs args) |
188 | 0 | { |
189 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLImageElement.src", DOM, cx); |
190 | 0 |
|
191 | 0 | binding_detail::FakeString arg0; |
192 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
193 | 0 | return false; |
194 | 0 | } |
195 | 0 | Maybe<AutoCEReaction> ceReaction; |
196 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
197 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
198 | 0 | if (docGroup) { |
199 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
200 | 0 | } |
201 | 0 | } |
202 | 0 | FastErrorResult rv; |
203 | 0 | nsIPrincipal* subjectPrincipal; |
204 | 0 | { |
205 | 0 | JS::Realm* realm = js::GetContextRealm(cx); |
206 | 0 | MOZ_ASSERT(realm); |
207 | 0 | JSPrincipals* principals = JS::GetRealmPrincipals(realm); |
208 | 0 | nsIPrincipal* principal = nsJSPrincipals::get(principals); |
209 | 0 | if (nsContentUtils::IsSystemPrincipal(principal)) { |
210 | 0 | principal = nullptr; |
211 | 0 | } |
212 | 0 |
|
213 | 0 | subjectPrincipal = principal; |
214 | 0 | } |
215 | 0 | self->SetSrc(NonNullHelper(Constify(arg0)), subjectPrincipal, rv); |
216 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
217 | 0 | return false; |
218 | 0 | } |
219 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
220 | 0 |
|
221 | 0 | return true; |
222 | 0 | } |
223 | | |
224 | | static const JSJitInfo src_getterinfo = { |
225 | | { (JSJitGetterOp)get_src }, |
226 | | { prototypes::id::HTMLImageElement }, |
227 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
228 | | JSJitInfo::Getter, |
229 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
230 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
231 | | false, /* isInfallible. False in setters. */ |
232 | | false, /* isMovable. Not relevant for setters. */ |
233 | | false, /* isEliminatable. Not relevant for setters. */ |
234 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
235 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
236 | | false, /* isTypedMethod. Only relevant for methods. */ |
237 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
238 | | }; |
239 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
240 | | static_assert(0 < 1, "There is no slot for us"); |
241 | | static const JSJitInfo src_setterinfo = { |
242 | | { (JSJitGetterOp)set_src }, |
243 | | { prototypes::id::HTMLImageElement }, |
244 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
245 | | JSJitInfo::Setter, |
246 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
247 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
248 | | false, /* isInfallible. False in setters. */ |
249 | | false, /* isMovable. Not relevant for setters. */ |
250 | | false, /* isEliminatable. Not relevant for setters. */ |
251 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
252 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
253 | | false, /* isTypedMethod. Only relevant for methods. */ |
254 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
255 | | }; |
256 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
257 | | static_assert(0 < 1, "There is no slot for us"); |
258 | | |
259 | | MOZ_CAN_RUN_SCRIPT static bool |
260 | | get_srcset(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitGetterCallArgs args) |
261 | 0 | { |
262 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLImageElement.srcset", DOM, cx); |
263 | 0 |
|
264 | 0 | DOMString result; |
265 | 0 | self->GetSrcset(result); |
266 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
267 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
268 | 0 | return false; |
269 | 0 | } |
270 | 0 | return true; |
271 | 0 | } |
272 | | |
273 | | MOZ_CAN_RUN_SCRIPT static bool |
274 | | set_srcset(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitSetterCallArgs args) |
275 | 0 | { |
276 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLImageElement.srcset", DOM, cx); |
277 | 0 |
|
278 | 0 | binding_detail::FakeString arg0; |
279 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
280 | 0 | return false; |
281 | 0 | } |
282 | 0 | Maybe<AutoCEReaction> ceReaction; |
283 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
284 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
285 | 0 | if (docGroup) { |
286 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
287 | 0 | } |
288 | 0 | } |
289 | 0 | FastErrorResult rv; |
290 | 0 | nsIPrincipal* subjectPrincipal; |
291 | 0 | { |
292 | 0 | JS::Realm* realm = js::GetContextRealm(cx); |
293 | 0 | MOZ_ASSERT(realm); |
294 | 0 | JSPrincipals* principals = JS::GetRealmPrincipals(realm); |
295 | 0 | nsIPrincipal* principal = nsJSPrincipals::get(principals); |
296 | 0 | if (nsContentUtils::IsSystemPrincipal(principal)) { |
297 | 0 | principal = nullptr; |
298 | 0 | } |
299 | 0 |
|
300 | 0 | subjectPrincipal = principal; |
301 | 0 | } |
302 | 0 | self->SetSrcset(NonNullHelper(Constify(arg0)), subjectPrincipal, rv); |
303 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
304 | 0 | return false; |
305 | 0 | } |
306 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
307 | 0 |
|
308 | 0 | return true; |
309 | 0 | } |
310 | | |
311 | | static const JSJitInfo srcset_getterinfo = { |
312 | | { (JSJitGetterOp)get_srcset }, |
313 | | { prototypes::id::HTMLImageElement }, |
314 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
315 | | JSJitInfo::Getter, |
316 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
317 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
318 | | false, /* isInfallible. False in setters. */ |
319 | | false, /* isMovable. Not relevant for setters. */ |
320 | | false, /* isEliminatable. Not relevant for setters. */ |
321 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
322 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
323 | | false, /* isTypedMethod. Only relevant for methods. */ |
324 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
325 | | }; |
326 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
327 | | static_assert(0 < 1, "There is no slot for us"); |
328 | | static const JSJitInfo srcset_setterinfo = { |
329 | | { (JSJitGetterOp)set_srcset }, |
330 | | { prototypes::id::HTMLImageElement }, |
331 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
332 | | JSJitInfo::Setter, |
333 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
334 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
335 | | false, /* isInfallible. False in setters. */ |
336 | | false, /* isMovable. Not relevant for setters. */ |
337 | | false, /* isEliminatable. Not relevant for setters. */ |
338 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
339 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
340 | | false, /* isTypedMethod. Only relevant for methods. */ |
341 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
342 | | }; |
343 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
344 | | static_assert(0 < 1, "There is no slot for us"); |
345 | | |
346 | | MOZ_CAN_RUN_SCRIPT static bool |
347 | | get_crossOrigin(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitGetterCallArgs args) |
348 | 0 | { |
349 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLImageElement.crossOrigin", DOM, cx); |
350 | 0 |
|
351 | 0 | DOMString result; |
352 | 0 | self->GetCrossOrigin(result); |
353 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
354 | 0 | if (!xpc::StringToJsval(cx, result, args.rval())) { |
355 | 0 | return false; |
356 | 0 | } |
357 | 0 | return true; |
358 | 0 | } |
359 | | |
360 | | MOZ_CAN_RUN_SCRIPT static bool |
361 | | set_crossOrigin(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitSetterCallArgs args) |
362 | 0 | { |
363 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLImageElement.crossOrigin", DOM, cx); |
364 | 0 |
|
365 | 0 | binding_detail::FakeString arg0; |
366 | 0 | if (!ConvertJSValueToString(cx, args[0], eNull, eNull, arg0)) { |
367 | 0 | return false; |
368 | 0 | } |
369 | 0 | Maybe<AutoCEReaction> ceReaction; |
370 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
371 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
372 | 0 | if (docGroup) { |
373 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
374 | 0 | } |
375 | 0 | } |
376 | 0 | FastErrorResult rv; |
377 | 0 | self->SetCrossOrigin(NonNullHelper(Constify(arg0)), rv); |
378 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
379 | 0 | return false; |
380 | 0 | } |
381 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
382 | 0 |
|
383 | 0 | return true; |
384 | 0 | } |
385 | | |
386 | | static const JSJitInfo crossOrigin_getterinfo = { |
387 | | { (JSJitGetterOp)get_crossOrigin }, |
388 | | { prototypes::id::HTMLImageElement }, |
389 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
390 | | JSJitInfo::Getter, |
391 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
392 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
393 | | false, /* isInfallible. False in setters. */ |
394 | | false, /* isMovable. Not relevant for setters. */ |
395 | | false, /* isEliminatable. Not relevant for setters. */ |
396 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
397 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
398 | | false, /* isTypedMethod. Only relevant for methods. */ |
399 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
400 | | }; |
401 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
402 | | static_assert(0 < 1, "There is no slot for us"); |
403 | | static const JSJitInfo crossOrigin_setterinfo = { |
404 | | { (JSJitGetterOp)set_crossOrigin }, |
405 | | { prototypes::id::HTMLImageElement }, |
406 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
407 | | JSJitInfo::Setter, |
408 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
409 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
410 | | false, /* isInfallible. False in setters. */ |
411 | | false, /* isMovable. Not relevant for setters. */ |
412 | | false, /* isEliminatable. Not relevant for setters. */ |
413 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
414 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
415 | | false, /* isTypedMethod. Only relevant for methods. */ |
416 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
417 | | }; |
418 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
419 | | static_assert(0 < 1, "There is no slot for us"); |
420 | | |
421 | | MOZ_CAN_RUN_SCRIPT static bool |
422 | | get_useMap(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitGetterCallArgs args) |
423 | 0 | { |
424 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLImageElement.useMap", DOM, cx); |
425 | 0 |
|
426 | 0 | DOMString result; |
427 | 0 | self->GetUseMap(result); |
428 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
429 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
430 | 0 | return false; |
431 | 0 | } |
432 | 0 | return true; |
433 | 0 | } |
434 | | |
435 | | MOZ_CAN_RUN_SCRIPT static bool |
436 | | set_useMap(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitSetterCallArgs args) |
437 | 0 | { |
438 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLImageElement.useMap", DOM, cx); |
439 | 0 |
|
440 | 0 | binding_detail::FakeString arg0; |
441 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
442 | 0 | return false; |
443 | 0 | } |
444 | 0 | Maybe<AutoCEReaction> ceReaction; |
445 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
446 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
447 | 0 | if (docGroup) { |
448 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
449 | 0 | } |
450 | 0 | } |
451 | 0 | FastErrorResult rv; |
452 | 0 | self->SetUseMap(NonNullHelper(Constify(arg0)), rv); |
453 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
454 | 0 | return false; |
455 | 0 | } |
456 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
457 | 0 |
|
458 | 0 | return true; |
459 | 0 | } |
460 | | |
461 | | static const JSJitInfo useMap_getterinfo = { |
462 | | { (JSJitGetterOp)get_useMap }, |
463 | | { prototypes::id::HTMLImageElement }, |
464 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
465 | | JSJitInfo::Getter, |
466 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
467 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
468 | | false, /* isInfallible. False in setters. */ |
469 | | false, /* isMovable. Not relevant for setters. */ |
470 | | false, /* isEliminatable. Not relevant for setters. */ |
471 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
472 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
473 | | false, /* isTypedMethod. Only relevant for methods. */ |
474 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
475 | | }; |
476 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
477 | | static_assert(0 < 1, "There is no slot for us"); |
478 | | static const JSJitInfo useMap_setterinfo = { |
479 | | { (JSJitGetterOp)set_useMap }, |
480 | | { prototypes::id::HTMLImageElement }, |
481 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
482 | | JSJitInfo::Setter, |
483 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
484 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
485 | | false, /* isInfallible. False in setters. */ |
486 | | false, /* isMovable. Not relevant for setters. */ |
487 | | false, /* isEliminatable. Not relevant for setters. */ |
488 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
489 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
490 | | false, /* isTypedMethod. Only relevant for methods. */ |
491 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
492 | | }; |
493 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
494 | | static_assert(0 < 1, "There is no slot for us"); |
495 | | |
496 | | MOZ_CAN_RUN_SCRIPT static bool |
497 | | get_referrerPolicy(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitGetterCallArgs args) |
498 | 0 | { |
499 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLImageElement.referrerPolicy", DOM, cx); |
500 | 0 |
|
501 | 0 | DOMString result; |
502 | 0 | self->GetReferrerPolicy(result); |
503 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
504 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
505 | 0 | return false; |
506 | 0 | } |
507 | 0 | return true; |
508 | 0 | } |
509 | | |
510 | | MOZ_CAN_RUN_SCRIPT static bool |
511 | | set_referrerPolicy(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitSetterCallArgs args) |
512 | 0 | { |
513 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLImageElement.referrerPolicy", DOM, cx); |
514 | 0 |
|
515 | 0 | binding_detail::FakeString arg0; |
516 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
517 | 0 | return false; |
518 | 0 | } |
519 | 0 | Maybe<AutoCEReaction> ceReaction; |
520 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
521 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
522 | 0 | if (docGroup) { |
523 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
524 | 0 | } |
525 | 0 | } |
526 | 0 | FastErrorResult rv; |
527 | 0 | self->SetReferrerPolicy(NonNullHelper(Constify(arg0)), rv); |
528 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
529 | 0 | return false; |
530 | 0 | } |
531 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
532 | 0 |
|
533 | 0 | return true; |
534 | 0 | } |
535 | | |
536 | | static const JSJitInfo referrerPolicy_getterinfo = { |
537 | | { (JSJitGetterOp)get_referrerPolicy }, |
538 | | { prototypes::id::HTMLImageElement }, |
539 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
540 | | JSJitInfo::Getter, |
541 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
542 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
543 | | false, /* isInfallible. False in setters. */ |
544 | | false, /* isMovable. Not relevant for setters. */ |
545 | | false, /* isEliminatable. Not relevant for setters. */ |
546 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
547 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
548 | | false, /* isTypedMethod. Only relevant for methods. */ |
549 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
550 | | }; |
551 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
552 | | static_assert(0 < 1, "There is no slot for us"); |
553 | | static const JSJitInfo referrerPolicy_setterinfo = { |
554 | | { (JSJitGetterOp)set_referrerPolicy }, |
555 | | { prototypes::id::HTMLImageElement }, |
556 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
557 | | JSJitInfo::Setter, |
558 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
559 | | JSVAL_TYPE_UNDEFINED, /* 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 | | get_isMap(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitGetterCallArgs args) |
573 | 0 | { |
574 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLImageElement.isMap", DOM, cx); |
575 | 0 |
|
576 | 0 | bool result(self->IsMap()); |
577 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
578 | 0 | args.rval().setBoolean(result); |
579 | 0 | return true; |
580 | 0 | } |
581 | | |
582 | | MOZ_CAN_RUN_SCRIPT static bool |
583 | | set_isMap(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitSetterCallArgs args) |
584 | 0 | { |
585 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLImageElement.isMap", DOM, cx); |
586 | 0 |
|
587 | 0 | bool arg0; |
588 | 0 | if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) { |
589 | 0 | return false; |
590 | 0 | } |
591 | 0 | Maybe<AutoCEReaction> ceReaction; |
592 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
593 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
594 | 0 | if (docGroup) { |
595 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
596 | 0 | } |
597 | 0 | } |
598 | 0 | FastErrorResult rv; |
599 | 0 | self->SetIsMap(arg0, rv); |
600 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
601 | 0 | return false; |
602 | 0 | } |
603 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
604 | 0 |
|
605 | 0 | return true; |
606 | 0 | } |
607 | | |
608 | | static const JSJitInfo isMap_getterinfo = { |
609 | | { (JSJitGetterOp)get_isMap }, |
610 | | { prototypes::id::HTMLImageElement }, |
611 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
612 | | JSJitInfo::Getter, |
613 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
614 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
615 | | true, /* isInfallible. False in setters. */ |
616 | | false, /* isMovable. Not relevant for setters. */ |
617 | | false, /* isEliminatable. Not relevant for setters. */ |
618 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
619 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
620 | | false, /* isTypedMethod. Only relevant for methods. */ |
621 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
622 | | }; |
623 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
624 | | static_assert(0 < 1, "There is no slot for us"); |
625 | | static const JSJitInfo isMap_setterinfo = { |
626 | | { (JSJitGetterOp)set_isMap }, |
627 | | { prototypes::id::HTMLImageElement }, |
628 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
629 | | JSJitInfo::Setter, |
630 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
631 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
632 | | false, /* isInfallible. False in setters. */ |
633 | | false, /* isMovable. Not relevant for setters. */ |
634 | | false, /* isEliminatable. Not relevant for setters. */ |
635 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
636 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
637 | | false, /* isTypedMethod. Only relevant for methods. */ |
638 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
639 | | }; |
640 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
641 | | static_assert(0 < 1, "There is no slot for us"); |
642 | | |
643 | | MOZ_CAN_RUN_SCRIPT static bool |
644 | | get_width(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitGetterCallArgs args) |
645 | 0 | { |
646 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLImageElement.width", DOM, cx); |
647 | 0 |
|
648 | 0 | uint32_t result(self->Width()); |
649 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
650 | 0 | args.rval().setNumber(result); |
651 | 0 | return true; |
652 | 0 | } |
653 | | |
654 | | MOZ_CAN_RUN_SCRIPT static bool |
655 | | set_width(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitSetterCallArgs args) |
656 | 0 | { |
657 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLImageElement.width", DOM, cx); |
658 | 0 |
|
659 | 0 | uint32_t arg0; |
660 | 0 | if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) { |
661 | 0 | return false; |
662 | 0 | } |
663 | 0 | Maybe<AutoCEReaction> ceReaction; |
664 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
665 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
666 | 0 | if (docGroup) { |
667 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
668 | 0 | } |
669 | 0 | } |
670 | 0 | FastErrorResult rv; |
671 | 0 | self->SetWidth(arg0, rv); |
672 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
673 | 0 | return false; |
674 | 0 | } |
675 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
676 | 0 |
|
677 | 0 | return true; |
678 | 0 | } |
679 | | |
680 | | static const JSJitInfo width_getterinfo = { |
681 | | { (JSJitGetterOp)get_width }, |
682 | | { prototypes::id::HTMLImageElement }, |
683 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
684 | | JSJitInfo::Getter, |
685 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
686 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
687 | | true, /* isInfallible. False in setters. */ |
688 | | false, /* isMovable. Not relevant for setters. */ |
689 | | false, /* isEliminatable. Not relevant for setters. */ |
690 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
691 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
692 | | false, /* isTypedMethod. Only relevant for methods. */ |
693 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
694 | | }; |
695 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
696 | | static_assert(0 < 1, "There is no slot for us"); |
697 | | static const JSJitInfo width_setterinfo = { |
698 | | { (JSJitGetterOp)set_width }, |
699 | | { prototypes::id::HTMLImageElement }, |
700 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
701 | | JSJitInfo::Setter, |
702 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
703 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
704 | | false, /* isInfallible. False in setters. */ |
705 | | false, /* isMovable. Not relevant for setters. */ |
706 | | false, /* isEliminatable. Not relevant for setters. */ |
707 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
708 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
709 | | false, /* isTypedMethod. Only relevant for methods. */ |
710 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
711 | | }; |
712 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
713 | | static_assert(0 < 1, "There is no slot for us"); |
714 | | |
715 | | MOZ_CAN_RUN_SCRIPT static bool |
716 | | get_height(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitGetterCallArgs args) |
717 | 0 | { |
718 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLImageElement.height", DOM, cx); |
719 | 0 |
|
720 | 0 | uint32_t result(self->Height()); |
721 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
722 | 0 | args.rval().setNumber(result); |
723 | 0 | return true; |
724 | 0 | } |
725 | | |
726 | | MOZ_CAN_RUN_SCRIPT static bool |
727 | | set_height(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitSetterCallArgs args) |
728 | 0 | { |
729 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLImageElement.height", DOM, cx); |
730 | 0 |
|
731 | 0 | uint32_t arg0; |
732 | 0 | if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) { |
733 | 0 | return false; |
734 | 0 | } |
735 | 0 | Maybe<AutoCEReaction> ceReaction; |
736 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
737 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
738 | 0 | if (docGroup) { |
739 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
740 | 0 | } |
741 | 0 | } |
742 | 0 | FastErrorResult rv; |
743 | 0 | self->SetHeight(arg0, rv); |
744 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
745 | 0 | return false; |
746 | 0 | } |
747 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
748 | 0 |
|
749 | 0 | return true; |
750 | 0 | } |
751 | | |
752 | | static const JSJitInfo height_getterinfo = { |
753 | | { (JSJitGetterOp)get_height }, |
754 | | { prototypes::id::HTMLImageElement }, |
755 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
756 | | JSJitInfo::Getter, |
757 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
758 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
759 | | true, /* isInfallible. False in setters. */ |
760 | | false, /* isMovable. Not relevant for setters. */ |
761 | | false, /* isEliminatable. Not relevant for setters. */ |
762 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
763 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
764 | | false, /* isTypedMethod. Only relevant for methods. */ |
765 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
766 | | }; |
767 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
768 | | static_assert(0 < 1, "There is no slot for us"); |
769 | | static const JSJitInfo height_setterinfo = { |
770 | | { (JSJitGetterOp)set_height }, |
771 | | { prototypes::id::HTMLImageElement }, |
772 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
773 | | JSJitInfo::Setter, |
774 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
775 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
776 | | false, /* 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 | | get_decoding(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitGetterCallArgs args) |
789 | 0 | { |
790 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLImageElement.decoding", DOM, cx); |
791 | 0 |
|
792 | 0 | DOMString result; |
793 | 0 | self->GetDecoding(result); |
794 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
795 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
796 | 0 | return false; |
797 | 0 | } |
798 | 0 | return true; |
799 | 0 | } |
800 | | |
801 | | MOZ_CAN_RUN_SCRIPT static bool |
802 | | set_decoding(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitSetterCallArgs args) |
803 | 0 | { |
804 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLImageElement.decoding", DOM, cx); |
805 | 0 |
|
806 | 0 | binding_detail::FakeString arg0; |
807 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
808 | 0 | return false; |
809 | 0 | } |
810 | 0 | Maybe<AutoCEReaction> ceReaction; |
811 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
812 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
813 | 0 | if (docGroup) { |
814 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
815 | 0 | } |
816 | 0 | } |
817 | 0 | FastErrorResult rv; |
818 | 0 | self->SetDecoding(NonNullHelper(Constify(arg0)), rv); |
819 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
820 | 0 | return false; |
821 | 0 | } |
822 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
823 | 0 |
|
824 | 0 | return true; |
825 | 0 | } |
826 | | |
827 | | static const JSJitInfo decoding_getterinfo = { |
828 | | { (JSJitGetterOp)get_decoding }, |
829 | | { prototypes::id::HTMLImageElement }, |
830 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
831 | | JSJitInfo::Getter, |
832 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
833 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
834 | | false, /* isInfallible. False in setters. */ |
835 | | false, /* isMovable. Not relevant for setters. */ |
836 | | false, /* isEliminatable. Not relevant for setters. */ |
837 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
838 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
839 | | false, /* isTypedMethod. Only relevant for methods. */ |
840 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
841 | | }; |
842 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
843 | | static_assert(0 < 1, "There is no slot for us"); |
844 | | static const JSJitInfo decoding_setterinfo = { |
845 | | { (JSJitGetterOp)set_decoding }, |
846 | | { prototypes::id::HTMLImageElement }, |
847 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
848 | | JSJitInfo::Setter, |
849 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
850 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
851 | | false, /* isInfallible. False in setters. */ |
852 | | false, /* isMovable. Not relevant for setters. */ |
853 | | false, /* isEliminatable. Not relevant for setters. */ |
854 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
855 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
856 | | false, /* isTypedMethod. Only relevant for methods. */ |
857 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
858 | | }; |
859 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
860 | | static_assert(0 < 1, "There is no slot for us"); |
861 | | |
862 | | MOZ_CAN_RUN_SCRIPT static bool |
863 | | get_naturalWidth(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitGetterCallArgs args) |
864 | 0 | { |
865 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLImageElement.naturalWidth", DOM, cx); |
866 | 0 |
|
867 | 0 | uint32_t result(self->NaturalWidth()); |
868 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
869 | 0 | args.rval().setNumber(result); |
870 | 0 | return true; |
871 | 0 | } |
872 | | |
873 | | static const JSJitInfo naturalWidth_getterinfo = { |
874 | | { (JSJitGetterOp)get_naturalWidth }, |
875 | | { prototypes::id::HTMLImageElement }, |
876 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
877 | | JSJitInfo::Getter, |
878 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
879 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
880 | | true, /* isInfallible. False in setters. */ |
881 | | false, /* isMovable. Not relevant for setters. */ |
882 | | false, /* isEliminatable. Not relevant for setters. */ |
883 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
884 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
885 | | false, /* isTypedMethod. Only relevant for methods. */ |
886 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
887 | | }; |
888 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
889 | | static_assert(0 < 1, "There is no slot for us"); |
890 | | |
891 | | MOZ_CAN_RUN_SCRIPT static bool |
892 | | get_naturalHeight(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitGetterCallArgs args) |
893 | 0 | { |
894 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLImageElement.naturalHeight", DOM, cx); |
895 | 0 |
|
896 | 0 | uint32_t result(self->NaturalHeight()); |
897 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
898 | 0 | args.rval().setNumber(result); |
899 | 0 | return true; |
900 | 0 | } |
901 | | |
902 | | static const JSJitInfo naturalHeight_getterinfo = { |
903 | | { (JSJitGetterOp)get_naturalHeight }, |
904 | | { prototypes::id::HTMLImageElement }, |
905 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
906 | | JSJitInfo::Getter, |
907 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
908 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
909 | | true, /* isInfallible. False in setters. */ |
910 | | false, /* isMovable. Not relevant for setters. */ |
911 | | false, /* isEliminatable. Not relevant for setters. */ |
912 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
913 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
914 | | false, /* isTypedMethod. Only relevant for methods. */ |
915 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
916 | | }; |
917 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
918 | | static_assert(0 < 1, "There is no slot for us"); |
919 | | |
920 | | MOZ_CAN_RUN_SCRIPT static bool |
921 | | get_complete(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitGetterCallArgs args) |
922 | 0 | { |
923 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLImageElement.complete", DOM, cx); |
924 | 0 |
|
925 | 0 | bool result(self->Complete()); |
926 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
927 | 0 | args.rval().setBoolean(result); |
928 | 0 | return true; |
929 | 0 | } |
930 | | |
931 | | static const JSJitInfo complete_getterinfo = { |
932 | | { (JSJitGetterOp)get_complete }, |
933 | | { prototypes::id::HTMLImageElement }, |
934 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
935 | | JSJitInfo::Getter, |
936 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
937 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
938 | | true, /* isInfallible. False in setters. */ |
939 | | false, /* isMovable. Not relevant for setters. */ |
940 | | false, /* isEliminatable. Not relevant for setters. */ |
941 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
942 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
943 | | false, /* isTypedMethod. Only relevant for methods. */ |
944 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
945 | | }; |
946 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
947 | | static_assert(0 < 1, "There is no slot for us"); |
948 | | |
949 | | MOZ_CAN_RUN_SCRIPT static bool |
950 | | get_name(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitGetterCallArgs args) |
951 | 0 | { |
952 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLImageElement.name", DOM, cx); |
953 | 0 |
|
954 | 0 | DOMString result; |
955 | 0 | self->GetName(result); |
956 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
957 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
958 | 0 | return false; |
959 | 0 | } |
960 | 0 | return true; |
961 | 0 | } |
962 | | |
963 | | MOZ_CAN_RUN_SCRIPT static bool |
964 | | set_name(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitSetterCallArgs args) |
965 | 0 | { |
966 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLImageElement.name", DOM, cx); |
967 | 0 |
|
968 | 0 | binding_detail::FakeString arg0; |
969 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
970 | 0 | return false; |
971 | 0 | } |
972 | 0 | Maybe<AutoCEReaction> ceReaction; |
973 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
974 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
975 | 0 | if (docGroup) { |
976 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
977 | 0 | } |
978 | 0 | } |
979 | 0 | FastErrorResult rv; |
980 | 0 | self->SetName(NonNullHelper(Constify(arg0)), rv); |
981 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
982 | 0 | return false; |
983 | 0 | } |
984 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
985 | 0 |
|
986 | 0 | return true; |
987 | 0 | } |
988 | | |
989 | | static const JSJitInfo name_getterinfo = { |
990 | | { (JSJitGetterOp)get_name }, |
991 | | { prototypes::id::HTMLImageElement }, |
992 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
993 | | JSJitInfo::Getter, |
994 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
995 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
996 | | false, /* isInfallible. False in setters. */ |
997 | | false, /* isMovable. Not relevant for setters. */ |
998 | | false, /* isEliminatable. Not relevant for setters. */ |
999 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1000 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1001 | | false, /* isTypedMethod. Only relevant for methods. */ |
1002 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1003 | | }; |
1004 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1005 | | static_assert(0 < 1, "There is no slot for us"); |
1006 | | static const JSJitInfo name_setterinfo = { |
1007 | | { (JSJitGetterOp)set_name }, |
1008 | | { prototypes::id::HTMLImageElement }, |
1009 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
1010 | | JSJitInfo::Setter, |
1011 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1012 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1013 | | false, /* isInfallible. False in setters. */ |
1014 | | false, /* isMovable. Not relevant for setters. */ |
1015 | | false, /* isEliminatable. Not relevant for setters. */ |
1016 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1017 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1018 | | false, /* isTypedMethod. Only relevant for methods. */ |
1019 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1020 | | }; |
1021 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1022 | | static_assert(0 < 1, "There is no slot for us"); |
1023 | | |
1024 | | MOZ_CAN_RUN_SCRIPT static bool |
1025 | | get_align(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitGetterCallArgs args) |
1026 | 0 | { |
1027 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLImageElement.align", DOM, cx); |
1028 | 0 |
|
1029 | 0 | DOMString result; |
1030 | 0 | self->GetAlign(result); |
1031 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1032 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
1033 | 0 | return false; |
1034 | 0 | } |
1035 | 0 | return true; |
1036 | 0 | } |
1037 | | |
1038 | | MOZ_CAN_RUN_SCRIPT static bool |
1039 | | set_align(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitSetterCallArgs args) |
1040 | 0 | { |
1041 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLImageElement.align", DOM, cx); |
1042 | 0 |
|
1043 | 0 | binding_detail::FakeString arg0; |
1044 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
1045 | 0 | return false; |
1046 | 0 | } |
1047 | 0 | Maybe<AutoCEReaction> ceReaction; |
1048 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
1049 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
1050 | 0 | if (docGroup) { |
1051 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
1052 | 0 | } |
1053 | 0 | } |
1054 | 0 | FastErrorResult rv; |
1055 | 0 | self->SetAlign(NonNullHelper(Constify(arg0)), rv); |
1056 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1057 | 0 | return false; |
1058 | 0 | } |
1059 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1060 | 0 |
|
1061 | 0 | return true; |
1062 | 0 | } |
1063 | | |
1064 | | static const JSJitInfo align_getterinfo = { |
1065 | | { (JSJitGetterOp)get_align }, |
1066 | | { prototypes::id::HTMLImageElement }, |
1067 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
1068 | | JSJitInfo::Getter, |
1069 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1070 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
1071 | | false, /* isInfallible. False in setters. */ |
1072 | | false, /* isMovable. Not relevant for setters. */ |
1073 | | false, /* isEliminatable. Not relevant for setters. */ |
1074 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1075 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1076 | | false, /* isTypedMethod. Only relevant for methods. */ |
1077 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1078 | | }; |
1079 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1080 | | static_assert(0 < 1, "There is no slot for us"); |
1081 | | static const JSJitInfo align_setterinfo = { |
1082 | | { (JSJitGetterOp)set_align }, |
1083 | | { prototypes::id::HTMLImageElement }, |
1084 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
1085 | | JSJitInfo::Setter, |
1086 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1087 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1088 | | false, /* isInfallible. False in setters. */ |
1089 | | false, /* isMovable. Not relevant for setters. */ |
1090 | | false, /* isEliminatable. Not relevant for setters. */ |
1091 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1092 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1093 | | false, /* isTypedMethod. Only relevant for methods. */ |
1094 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1095 | | }; |
1096 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1097 | | static_assert(0 < 1, "There is no slot for us"); |
1098 | | |
1099 | | MOZ_CAN_RUN_SCRIPT static bool |
1100 | | get_hspace(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitGetterCallArgs args) |
1101 | 0 | { |
1102 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLImageElement.hspace", DOM, cx); |
1103 | 0 |
|
1104 | 0 | uint32_t result(self->Hspace()); |
1105 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1106 | 0 | args.rval().setNumber(result); |
1107 | 0 | return true; |
1108 | 0 | } |
1109 | | |
1110 | | MOZ_CAN_RUN_SCRIPT static bool |
1111 | | set_hspace(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitSetterCallArgs args) |
1112 | 0 | { |
1113 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLImageElement.hspace", DOM, cx); |
1114 | 0 |
|
1115 | 0 | uint32_t arg0; |
1116 | 0 | if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) { |
1117 | 0 | return false; |
1118 | 0 | } |
1119 | 0 | Maybe<AutoCEReaction> ceReaction; |
1120 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
1121 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
1122 | 0 | if (docGroup) { |
1123 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
1124 | 0 | } |
1125 | 0 | } |
1126 | 0 | FastErrorResult rv; |
1127 | 0 | self->SetHspace(arg0, rv); |
1128 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1129 | 0 | return false; |
1130 | 0 | } |
1131 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1132 | 0 |
|
1133 | 0 | return true; |
1134 | 0 | } |
1135 | | |
1136 | | static const JSJitInfo hspace_getterinfo = { |
1137 | | { (JSJitGetterOp)get_hspace }, |
1138 | | { prototypes::id::HTMLImageElement }, |
1139 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
1140 | | JSJitInfo::Getter, |
1141 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1142 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
1143 | | true, /* isInfallible. False in setters. */ |
1144 | | false, /* isMovable. Not relevant for setters. */ |
1145 | | false, /* isEliminatable. Not relevant for setters. */ |
1146 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1147 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1148 | | false, /* isTypedMethod. Only relevant for methods. */ |
1149 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1150 | | }; |
1151 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1152 | | static_assert(0 < 1, "There is no slot for us"); |
1153 | | static const JSJitInfo hspace_setterinfo = { |
1154 | | { (JSJitGetterOp)set_hspace }, |
1155 | | { prototypes::id::HTMLImageElement }, |
1156 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
1157 | | JSJitInfo::Setter, |
1158 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1159 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1160 | | false, /* isInfallible. False in setters. */ |
1161 | | false, /* isMovable. Not relevant for setters. */ |
1162 | | false, /* isEliminatable. Not relevant for setters. */ |
1163 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1164 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1165 | | false, /* isTypedMethod. Only relevant for methods. */ |
1166 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1167 | | }; |
1168 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1169 | | static_assert(0 < 1, "There is no slot for us"); |
1170 | | |
1171 | | MOZ_CAN_RUN_SCRIPT static bool |
1172 | | get_vspace(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitGetterCallArgs args) |
1173 | 0 | { |
1174 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLImageElement.vspace", DOM, cx); |
1175 | 0 |
|
1176 | 0 | uint32_t result(self->Vspace()); |
1177 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1178 | 0 | args.rval().setNumber(result); |
1179 | 0 | return true; |
1180 | 0 | } |
1181 | | |
1182 | | MOZ_CAN_RUN_SCRIPT static bool |
1183 | | set_vspace(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitSetterCallArgs args) |
1184 | 0 | { |
1185 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLImageElement.vspace", DOM, cx); |
1186 | 0 |
|
1187 | 0 | uint32_t arg0; |
1188 | 0 | if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) { |
1189 | 0 | return false; |
1190 | 0 | } |
1191 | 0 | Maybe<AutoCEReaction> ceReaction; |
1192 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
1193 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
1194 | 0 | if (docGroup) { |
1195 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
1196 | 0 | } |
1197 | 0 | } |
1198 | 0 | FastErrorResult rv; |
1199 | 0 | self->SetVspace(arg0, rv); |
1200 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1201 | 0 | return false; |
1202 | 0 | } |
1203 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1204 | 0 |
|
1205 | 0 | return true; |
1206 | 0 | } |
1207 | | |
1208 | | static const JSJitInfo vspace_getterinfo = { |
1209 | | { (JSJitGetterOp)get_vspace }, |
1210 | | { prototypes::id::HTMLImageElement }, |
1211 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
1212 | | JSJitInfo::Getter, |
1213 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1214 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
1215 | | true, /* isInfallible. False in setters. */ |
1216 | | false, /* isMovable. Not relevant for setters. */ |
1217 | | false, /* isEliminatable. Not relevant for setters. */ |
1218 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1219 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1220 | | false, /* isTypedMethod. Only relevant for methods. */ |
1221 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1222 | | }; |
1223 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1224 | | static_assert(0 < 1, "There is no slot for us"); |
1225 | | static const JSJitInfo vspace_setterinfo = { |
1226 | | { (JSJitGetterOp)set_vspace }, |
1227 | | { prototypes::id::HTMLImageElement }, |
1228 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
1229 | | JSJitInfo::Setter, |
1230 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1231 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1232 | | false, /* isInfallible. False in setters. */ |
1233 | | false, /* isMovable. Not relevant for setters. */ |
1234 | | false, /* isEliminatable. Not relevant for setters. */ |
1235 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1236 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1237 | | false, /* isTypedMethod. Only relevant for methods. */ |
1238 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1239 | | }; |
1240 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1241 | | static_assert(0 < 1, "There is no slot for us"); |
1242 | | |
1243 | | MOZ_CAN_RUN_SCRIPT static bool |
1244 | | get_longDesc(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitGetterCallArgs args) |
1245 | 0 | { |
1246 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLImageElement.longDesc", DOM, cx); |
1247 | 0 |
|
1248 | 0 | DOMString result; |
1249 | 0 | self->GetLongDesc(result); |
1250 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1251 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
1252 | 0 | return false; |
1253 | 0 | } |
1254 | 0 | return true; |
1255 | 0 | } |
1256 | | |
1257 | | MOZ_CAN_RUN_SCRIPT static bool |
1258 | | set_longDesc(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitSetterCallArgs args) |
1259 | 0 | { |
1260 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLImageElement.longDesc", DOM, cx); |
1261 | 0 |
|
1262 | 0 | binding_detail::FakeString arg0; |
1263 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
1264 | 0 | return false; |
1265 | 0 | } |
1266 | 0 | Maybe<AutoCEReaction> ceReaction; |
1267 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
1268 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
1269 | 0 | if (docGroup) { |
1270 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
1271 | 0 | } |
1272 | 0 | } |
1273 | 0 | FastErrorResult rv; |
1274 | 0 | self->SetLongDesc(NonNullHelper(Constify(arg0)), rv); |
1275 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1276 | 0 | return false; |
1277 | 0 | } |
1278 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1279 | 0 |
|
1280 | 0 | return true; |
1281 | 0 | } |
1282 | | |
1283 | | static const JSJitInfo longDesc_getterinfo = { |
1284 | | { (JSJitGetterOp)get_longDesc }, |
1285 | | { prototypes::id::HTMLImageElement }, |
1286 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
1287 | | JSJitInfo::Getter, |
1288 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1289 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
1290 | | false, /* isInfallible. False in setters. */ |
1291 | | false, /* isMovable. Not relevant for setters. */ |
1292 | | false, /* isEliminatable. Not relevant for setters. */ |
1293 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1294 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1295 | | false, /* isTypedMethod. Only relevant for methods. */ |
1296 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1297 | | }; |
1298 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1299 | | static_assert(0 < 1, "There is no slot for us"); |
1300 | | static const JSJitInfo longDesc_setterinfo = { |
1301 | | { (JSJitGetterOp)set_longDesc }, |
1302 | | { prototypes::id::HTMLImageElement }, |
1303 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
1304 | | JSJitInfo::Setter, |
1305 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1306 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1307 | | false, /* isInfallible. False in setters. */ |
1308 | | false, /* isMovable. Not relevant for setters. */ |
1309 | | false, /* isEliminatable. Not relevant for setters. */ |
1310 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1311 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1312 | | false, /* isTypedMethod. Only relevant for methods. */ |
1313 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1314 | | }; |
1315 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1316 | | static_assert(0 < 1, "There is no slot for us"); |
1317 | | |
1318 | | MOZ_CAN_RUN_SCRIPT static bool |
1319 | | get_border(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitGetterCallArgs args) |
1320 | 0 | { |
1321 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLImageElement.border", DOM, cx); |
1322 | 0 |
|
1323 | 0 | DOMString result; |
1324 | 0 | self->GetBorder(result); |
1325 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1326 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
1327 | 0 | return false; |
1328 | 0 | } |
1329 | 0 | return true; |
1330 | 0 | } |
1331 | | |
1332 | | MOZ_CAN_RUN_SCRIPT static bool |
1333 | | set_border(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitSetterCallArgs args) |
1334 | 0 | { |
1335 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLImageElement.border", DOM, cx); |
1336 | 0 |
|
1337 | 0 | binding_detail::FakeString arg0; |
1338 | 0 | if (!ConvertJSValueToString(cx, args[0], eEmpty, eStringify, arg0)) { |
1339 | 0 | return false; |
1340 | 0 | } |
1341 | 0 | Maybe<AutoCEReaction> ceReaction; |
1342 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
1343 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
1344 | 0 | if (docGroup) { |
1345 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
1346 | 0 | } |
1347 | 0 | } |
1348 | 0 | FastErrorResult rv; |
1349 | 0 | self->SetBorder(NonNullHelper(Constify(arg0)), rv); |
1350 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1351 | 0 | return false; |
1352 | 0 | } |
1353 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1354 | 0 |
|
1355 | 0 | return true; |
1356 | 0 | } |
1357 | | |
1358 | | static const JSJitInfo border_getterinfo = { |
1359 | | { (JSJitGetterOp)get_border }, |
1360 | | { prototypes::id::HTMLImageElement }, |
1361 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
1362 | | JSJitInfo::Getter, |
1363 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1364 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
1365 | | false, /* isInfallible. False in setters. */ |
1366 | | false, /* isMovable. Not relevant for setters. */ |
1367 | | false, /* isEliminatable. Not relevant for setters. */ |
1368 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1369 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1370 | | false, /* isTypedMethod. Only relevant for methods. */ |
1371 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1372 | | }; |
1373 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1374 | | static_assert(0 < 1, "There is no slot for us"); |
1375 | | static const JSJitInfo border_setterinfo = { |
1376 | | { (JSJitGetterOp)set_border }, |
1377 | | { prototypes::id::HTMLImageElement }, |
1378 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
1379 | | JSJitInfo::Setter, |
1380 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1381 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1382 | | false, /* isInfallible. False in setters. */ |
1383 | | false, /* isMovable. Not relevant for setters. */ |
1384 | | false, /* isEliminatable. Not relevant for setters. */ |
1385 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1386 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1387 | | false, /* isTypedMethod. Only relevant for methods. */ |
1388 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1389 | | }; |
1390 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1391 | | static_assert(0 < 1, "There is no slot for us"); |
1392 | | |
1393 | | MOZ_CAN_RUN_SCRIPT static bool |
1394 | | get_sizes(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitGetterCallArgs args) |
1395 | 0 | { |
1396 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLImageElement.sizes", DOM, cx); |
1397 | 0 |
|
1398 | 0 | DOMString result; |
1399 | 0 | self->GetSizes(result); |
1400 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1401 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
1402 | 0 | return false; |
1403 | 0 | } |
1404 | 0 | return true; |
1405 | 0 | } |
1406 | | |
1407 | | MOZ_CAN_RUN_SCRIPT static bool |
1408 | | set_sizes(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitSetterCallArgs args) |
1409 | 0 | { |
1410 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLImageElement.sizes", DOM, cx); |
1411 | 0 |
|
1412 | 0 | binding_detail::FakeString arg0; |
1413 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
1414 | 0 | return false; |
1415 | 0 | } |
1416 | 0 | Maybe<AutoCEReaction> ceReaction; |
1417 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
1418 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
1419 | 0 | if (docGroup) { |
1420 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
1421 | 0 | } |
1422 | 0 | } |
1423 | 0 | FastErrorResult rv; |
1424 | 0 | self->SetSizes(NonNullHelper(Constify(arg0)), rv); |
1425 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1426 | 0 | return false; |
1427 | 0 | } |
1428 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1429 | 0 |
|
1430 | 0 | return true; |
1431 | 0 | } |
1432 | | |
1433 | | static const JSJitInfo sizes_getterinfo = { |
1434 | | { (JSJitGetterOp)get_sizes }, |
1435 | | { prototypes::id::HTMLImageElement }, |
1436 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
1437 | | JSJitInfo::Getter, |
1438 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1439 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
1440 | | false, /* isInfallible. False in setters. */ |
1441 | | false, /* isMovable. Not relevant for setters. */ |
1442 | | false, /* isEliminatable. Not relevant for setters. */ |
1443 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1444 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1445 | | false, /* isTypedMethod. Only relevant for methods. */ |
1446 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1447 | | }; |
1448 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1449 | | static_assert(0 < 1, "There is no slot for us"); |
1450 | | static const JSJitInfo sizes_setterinfo = { |
1451 | | { (JSJitGetterOp)set_sizes }, |
1452 | | { prototypes::id::HTMLImageElement }, |
1453 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
1454 | | JSJitInfo::Setter, |
1455 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1456 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1457 | | false, /* isInfallible. False in setters. */ |
1458 | | false, /* isMovable. Not relevant for setters. */ |
1459 | | false, /* isEliminatable. Not relevant for setters. */ |
1460 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1461 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1462 | | false, /* isTypedMethod. Only relevant for methods. */ |
1463 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1464 | | }; |
1465 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1466 | | static_assert(0 < 1, "There is no slot for us"); |
1467 | | |
1468 | | MOZ_CAN_RUN_SCRIPT static bool |
1469 | | get_currentSrc(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitGetterCallArgs args) |
1470 | 0 | { |
1471 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLImageElement.currentSrc", DOM, cx); |
1472 | 0 |
|
1473 | 0 | DOMString result; |
1474 | 0 | self->GetCurrentSrc(result); |
1475 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1476 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
1477 | 0 | return false; |
1478 | 0 | } |
1479 | 0 | return true; |
1480 | 0 | } |
1481 | | |
1482 | | static const JSJitInfo currentSrc_getterinfo = { |
1483 | | { (JSJitGetterOp)get_currentSrc }, |
1484 | | { prototypes::id::HTMLImageElement }, |
1485 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
1486 | | JSJitInfo::Getter, |
1487 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1488 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
1489 | | false, /* isInfallible. False in setters. */ |
1490 | | false, /* isMovable. Not relevant for setters. */ |
1491 | | false, /* isEliminatable. Not relevant for setters. */ |
1492 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1493 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1494 | | false, /* isTypedMethod. Only relevant for methods. */ |
1495 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1496 | | }; |
1497 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1498 | | static_assert(0 < 1, "There is no slot for us"); |
1499 | | |
1500 | | MOZ_CAN_RUN_SCRIPT static bool |
1501 | | get_lowsrc(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitGetterCallArgs args) |
1502 | 0 | { |
1503 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLImageElement.lowsrc", DOM, cx); |
1504 | 0 |
|
1505 | 0 | DOMString result; |
1506 | 0 | self->GetLowsrc(result); |
1507 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1508 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
1509 | 0 | return false; |
1510 | 0 | } |
1511 | 0 | return true; |
1512 | 0 | } |
1513 | | |
1514 | | MOZ_CAN_RUN_SCRIPT static bool |
1515 | | set_lowsrc(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitSetterCallArgs args) |
1516 | 0 | { |
1517 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLImageElement.lowsrc", DOM, cx); |
1518 | 0 |
|
1519 | 0 | binding_detail::FakeString arg0; |
1520 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
1521 | 0 | return false; |
1522 | 0 | } |
1523 | 0 | Maybe<AutoCEReaction> ceReaction; |
1524 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
1525 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
1526 | 0 | if (docGroup) { |
1527 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
1528 | 0 | } |
1529 | 0 | } |
1530 | 0 | FastErrorResult rv; |
1531 | 0 | self->SetLowsrc(NonNullHelper(Constify(arg0)), rv); |
1532 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1533 | 0 | return false; |
1534 | 0 | } |
1535 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1536 | 0 |
|
1537 | 0 | return true; |
1538 | 0 | } |
1539 | | |
1540 | | static const JSJitInfo lowsrc_getterinfo = { |
1541 | | { (JSJitGetterOp)get_lowsrc }, |
1542 | | { prototypes::id::HTMLImageElement }, |
1543 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
1544 | | JSJitInfo::Getter, |
1545 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1546 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
1547 | | false, /* isInfallible. False in setters. */ |
1548 | | false, /* isMovable. Not relevant for setters. */ |
1549 | | false, /* isEliminatable. Not relevant for setters. */ |
1550 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1551 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1552 | | false, /* isTypedMethod. Only relevant for methods. */ |
1553 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1554 | | }; |
1555 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1556 | | static_assert(0 < 1, "There is no slot for us"); |
1557 | | static const JSJitInfo lowsrc_setterinfo = { |
1558 | | { (JSJitGetterOp)set_lowsrc }, |
1559 | | { prototypes::id::HTMLImageElement }, |
1560 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
1561 | | JSJitInfo::Setter, |
1562 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1563 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1564 | | false, /* isInfallible. False in setters. */ |
1565 | | false, /* isMovable. Not relevant for setters. */ |
1566 | | false, /* isEliminatable. Not relevant for setters. */ |
1567 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1568 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1569 | | false, /* isTypedMethod. Only relevant for methods. */ |
1570 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1571 | | }; |
1572 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1573 | | static_assert(0 < 1, "There is no slot for us"); |
1574 | | |
1575 | | MOZ_CAN_RUN_SCRIPT static bool |
1576 | | get_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitGetterCallArgs args) |
1577 | 0 | { |
1578 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLImageElement.x", DOM, cx); |
1579 | 0 |
|
1580 | 0 | int32_t result(self->X()); |
1581 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1582 | 0 | args.rval().setInt32(int32_t(result)); |
1583 | 0 | return true; |
1584 | 0 | } |
1585 | | |
1586 | | static const JSJitInfo x_getterinfo = { |
1587 | | { (JSJitGetterOp)get_x }, |
1588 | | { prototypes::id::HTMLImageElement }, |
1589 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
1590 | | JSJitInfo::Getter, |
1591 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1592 | | JSVAL_TYPE_INT32, /* returnType. Not relevant for setters. */ |
1593 | | true, /* isInfallible. False in setters. */ |
1594 | | false, /* isMovable. Not relevant for setters. */ |
1595 | | false, /* isEliminatable. Not relevant for setters. */ |
1596 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1597 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1598 | | false, /* isTypedMethod. Only relevant for methods. */ |
1599 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1600 | | }; |
1601 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1602 | | static_assert(0 < 1, "There is no slot for us"); |
1603 | | |
1604 | | MOZ_CAN_RUN_SCRIPT static bool |
1605 | | get_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitGetterCallArgs args) |
1606 | 0 | { |
1607 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLImageElement.y", DOM, cx); |
1608 | 0 |
|
1609 | 0 | int32_t result(self->Y()); |
1610 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1611 | 0 | args.rval().setInt32(int32_t(result)); |
1612 | 0 | return true; |
1613 | 0 | } |
1614 | | |
1615 | | static const JSJitInfo y_getterinfo = { |
1616 | | { (JSJitGetterOp)get_y }, |
1617 | | { prototypes::id::HTMLImageElement }, |
1618 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
1619 | | JSJitInfo::Getter, |
1620 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1621 | | JSVAL_TYPE_INT32, /* returnType. Not relevant for setters. */ |
1622 | | true, /* isInfallible. False in setters. */ |
1623 | | false, /* isMovable. Not relevant for setters. */ |
1624 | | false, /* isEliminatable. Not relevant for setters. */ |
1625 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1626 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1627 | | false, /* isTypedMethod. Only relevant for methods. */ |
1628 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1629 | | }; |
1630 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1631 | | static_assert(0 < 1, "There is no slot for us"); |
1632 | | |
1633 | | MOZ_CAN_RUN_SCRIPT static bool |
1634 | | get_loadingEnabled(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitGetterCallArgs args) |
1635 | 0 | { |
1636 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLImageElement.loadingEnabled", DOM, cx); |
1637 | 0 |
|
1638 | 0 | bool result(self->LoadingEnabled()); |
1639 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1640 | 0 | args.rval().setBoolean(result); |
1641 | 0 | return true; |
1642 | 0 | } |
1643 | | |
1644 | | MOZ_CAN_RUN_SCRIPT static bool |
1645 | | set_loadingEnabled(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitSetterCallArgs args) |
1646 | 0 | { |
1647 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLImageElement.loadingEnabled", DOM, cx); |
1648 | 0 |
|
1649 | 0 | bool arg0; |
1650 | 0 | if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) { |
1651 | 0 | return false; |
1652 | 0 | } |
1653 | 0 | self->SetLoadingEnabled(arg0); |
1654 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1655 | 0 |
|
1656 | 0 | return true; |
1657 | 0 | } |
1658 | | |
1659 | | static const JSJitInfo loadingEnabled_getterinfo = { |
1660 | | { (JSJitGetterOp)get_loadingEnabled }, |
1661 | | { prototypes::id::HTMLImageElement }, |
1662 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
1663 | | JSJitInfo::Getter, |
1664 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1665 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
1666 | | true, /* isInfallible. False in setters. */ |
1667 | | false, /* isMovable. Not relevant for setters. */ |
1668 | | false, /* isEliminatable. Not relevant for setters. */ |
1669 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1670 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1671 | | false, /* isTypedMethod. Only relevant for methods. */ |
1672 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1673 | | }; |
1674 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1675 | | static_assert(0 < 1, "There is no slot for us"); |
1676 | | static const JSJitInfo loadingEnabled_setterinfo = { |
1677 | | { (JSJitGetterOp)set_loadingEnabled }, |
1678 | | { prototypes::id::HTMLImageElement }, |
1679 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
1680 | | JSJitInfo::Setter, |
1681 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1682 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1683 | | false, /* isInfallible. False in setters. */ |
1684 | | false, /* isMovable. Not relevant for setters. */ |
1685 | | false, /* isEliminatable. Not relevant for setters. */ |
1686 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1687 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1688 | | false, /* isTypedMethod. Only relevant for methods. */ |
1689 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1690 | | }; |
1691 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1692 | | static_assert(0 < 1, "There is no slot for us"); |
1693 | | |
1694 | | MOZ_CAN_RUN_SCRIPT static bool |
1695 | | get_imageBlockingStatus(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitGetterCallArgs args) |
1696 | 0 | { |
1697 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLImageElement.imageBlockingStatus", DOM, cx); |
1698 | 0 |
|
1699 | 0 | int16_t result(self->ImageBlockingStatus()); |
1700 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1701 | 0 | args.rval().setInt32(int32_t(result)); |
1702 | 0 | return true; |
1703 | 0 | } |
1704 | | |
1705 | | static const JSJitInfo imageBlockingStatus_getterinfo = { |
1706 | | { (JSJitGetterOp)get_imageBlockingStatus }, |
1707 | | { prototypes::id::HTMLImageElement }, |
1708 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
1709 | | JSJitInfo::Getter, |
1710 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1711 | | JSVAL_TYPE_INT32, /* returnType. Not relevant for setters. */ |
1712 | | true, /* isInfallible. False in setters. */ |
1713 | | false, /* isMovable. Not relevant for setters. */ |
1714 | | false, /* isEliminatable. Not relevant for setters. */ |
1715 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1716 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1717 | | false, /* isTypedMethod. Only relevant for methods. */ |
1718 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1719 | | }; |
1720 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1721 | | static_assert(0 < 1, "There is no slot for us"); |
1722 | | |
1723 | | MOZ_CAN_RUN_SCRIPT static bool |
1724 | | addObserver(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, const JSJitMethodCallArgs& args) |
1725 | 0 | { |
1726 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLImageElement.addObserver", DOM, cx); |
1727 | 0 |
|
1728 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
1729 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLImageElement.addObserver"); |
1730 | 0 | } |
1731 | 0 | imgINotificationObserver* arg0; |
1732 | 0 | RefPtr<imgINotificationObserver> arg0_holder; |
1733 | 0 | if (args[0].isObject()) { |
1734 | 0 | JS::Rooted<JSObject*> source(cx, &args[0].toObject()); |
1735 | 0 | if (NS_FAILED(UnwrapArg<imgINotificationObserver>(cx, source, getter_AddRefs(arg0_holder)))) { |
1736 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of HTMLImageElement.addObserver", "imgINotificationObserver"); |
1737 | 0 | return false; |
1738 | 0 | } |
1739 | 0 | MOZ_ASSERT(arg0_holder); |
1740 | 0 | arg0 = arg0_holder; |
1741 | 0 | } else { |
1742 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of HTMLImageElement.addObserver"); |
1743 | 0 | return false; |
1744 | 0 | } |
1745 | 0 | self->AddObserver(MOZ_KnownLive(NonNullHelper(arg0))); |
1746 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1747 | 0 | args.rval().setUndefined(); |
1748 | 0 | return true; |
1749 | 0 | } |
1750 | | |
1751 | | static const JSJitInfo addObserver_methodinfo = { |
1752 | | { (JSJitGetterOp)addObserver }, |
1753 | | { prototypes::id::HTMLImageElement }, |
1754 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
1755 | | JSJitInfo::Method, |
1756 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1757 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1758 | | false, /* isInfallible. False in setters. */ |
1759 | | false, /* isMovable. Not relevant for setters. */ |
1760 | | false, /* isEliminatable. Not relevant for setters. */ |
1761 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1762 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1763 | | false, /* isTypedMethod. Only relevant for methods. */ |
1764 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1765 | | }; |
1766 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1767 | | static_assert(0 < 1, "There is no slot for us"); |
1768 | | |
1769 | | MOZ_CAN_RUN_SCRIPT static bool |
1770 | | removeObserver(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, const JSJitMethodCallArgs& args) |
1771 | 0 | { |
1772 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLImageElement.removeObserver", DOM, cx); |
1773 | 0 |
|
1774 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
1775 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLImageElement.removeObserver"); |
1776 | 0 | } |
1777 | 0 | imgINotificationObserver* arg0; |
1778 | 0 | RefPtr<imgINotificationObserver> arg0_holder; |
1779 | 0 | if (args[0].isObject()) { |
1780 | 0 | JS::Rooted<JSObject*> source(cx, &args[0].toObject()); |
1781 | 0 | if (NS_FAILED(UnwrapArg<imgINotificationObserver>(cx, source, getter_AddRefs(arg0_holder)))) { |
1782 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of HTMLImageElement.removeObserver", "imgINotificationObserver"); |
1783 | 0 | return false; |
1784 | 0 | } |
1785 | 0 | MOZ_ASSERT(arg0_holder); |
1786 | 0 | arg0 = arg0_holder; |
1787 | 0 | } else { |
1788 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of HTMLImageElement.removeObserver"); |
1789 | 0 | return false; |
1790 | 0 | } |
1791 | 0 | self->RemoveObserver(MOZ_KnownLive(NonNullHelper(arg0))); |
1792 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1793 | 0 | args.rval().setUndefined(); |
1794 | 0 | return true; |
1795 | 0 | } |
1796 | | |
1797 | | static const JSJitInfo removeObserver_methodinfo = { |
1798 | | { (JSJitGetterOp)removeObserver }, |
1799 | | { prototypes::id::HTMLImageElement }, |
1800 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
1801 | | JSJitInfo::Method, |
1802 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1803 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1804 | | false, /* isInfallible. False in setters. */ |
1805 | | false, /* isMovable. Not relevant for setters. */ |
1806 | | false, /* isEliminatable. Not relevant for setters. */ |
1807 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1808 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1809 | | false, /* isTypedMethod. Only relevant for methods. */ |
1810 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1811 | | }; |
1812 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1813 | | static_assert(0 < 1, "There is no slot for us"); |
1814 | | |
1815 | | MOZ_CAN_RUN_SCRIPT static bool |
1816 | | getRequest(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, const JSJitMethodCallArgs& args) |
1817 | 0 | { |
1818 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLImageElement.getRequest", DOM, cx); |
1819 | 0 |
|
1820 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
1821 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLImageElement.getRequest"); |
1822 | 0 | } |
1823 | 0 | int32_t arg0; |
1824 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
1825 | 0 | return false; |
1826 | 0 | } |
1827 | 0 | FastErrorResult rv; |
1828 | 0 | auto result(StrongOrRawPtr<imgIRequest>(self->GetRequest(arg0, rv))); |
1829 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1830 | 0 | return false; |
1831 | 0 | } |
1832 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1833 | 0 | if (!result) { |
1834 | 0 | args.rval().setNull(); |
1835 | 0 | return true; |
1836 | 0 | } |
1837 | 0 | if (!WrapObject(cx, result, &NS_GET_IID(imgIRequest), args.rval())) { |
1838 | 0 | return false; |
1839 | 0 | } |
1840 | 0 | return true; |
1841 | 0 | } |
1842 | | |
1843 | | static const JSJitInfo getRequest_methodinfo = { |
1844 | | { (JSJitGetterOp)getRequest }, |
1845 | | { prototypes::id::HTMLImageElement }, |
1846 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
1847 | | JSJitInfo::Method, |
1848 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1849 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
1850 | | false, /* isInfallible. False in setters. */ |
1851 | | false, /* isMovable. Not relevant for setters. */ |
1852 | | false, /* isEliminatable. Not relevant for setters. */ |
1853 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1854 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1855 | | false, /* isTypedMethod. Only relevant for methods. */ |
1856 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1857 | | }; |
1858 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1859 | | static_assert(0 < 1, "There is no slot for us"); |
1860 | | |
1861 | | MOZ_CAN_RUN_SCRIPT static bool |
1862 | | getRequestType(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, const JSJitMethodCallArgs& args) |
1863 | 0 | { |
1864 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLImageElement.getRequestType", DOM, cx); |
1865 | 0 |
|
1866 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
1867 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLImageElement.getRequestType"); |
1868 | 0 | } |
1869 | 0 | imgIRequest* arg0; |
1870 | 0 | RefPtr<imgIRequest> arg0_holder; |
1871 | 0 | if (args[0].isObject()) { |
1872 | 0 | JS::Rooted<JSObject*> source(cx, &args[0].toObject()); |
1873 | 0 | if (NS_FAILED(UnwrapArg<imgIRequest>(cx, source, getter_AddRefs(arg0_holder)))) { |
1874 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of HTMLImageElement.getRequestType", "imgIRequest"); |
1875 | 0 | return false; |
1876 | 0 | } |
1877 | 0 | MOZ_ASSERT(arg0_holder); |
1878 | 0 | arg0 = arg0_holder; |
1879 | 0 | } else { |
1880 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of HTMLImageElement.getRequestType"); |
1881 | 0 | return false; |
1882 | 0 | } |
1883 | 0 | FastErrorResult rv; |
1884 | 0 | int32_t result(self->GetRequestType(MOZ_KnownLive(NonNullHelper(arg0)), rv)); |
1885 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1886 | 0 | return false; |
1887 | 0 | } |
1888 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1889 | 0 | args.rval().setInt32(int32_t(result)); |
1890 | 0 | return true; |
1891 | 0 | } |
1892 | | |
1893 | | static const JSJitInfo getRequestType_methodinfo = { |
1894 | | { (JSJitGetterOp)getRequestType }, |
1895 | | { prototypes::id::HTMLImageElement }, |
1896 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
1897 | | JSJitInfo::Method, |
1898 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1899 | | JSVAL_TYPE_INT32, /* returnType. Not relevant for setters. */ |
1900 | | false, /* isInfallible. False in setters. */ |
1901 | | false, /* isMovable. Not relevant for setters. */ |
1902 | | false, /* isEliminatable. Not relevant for setters. */ |
1903 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1904 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1905 | | false, /* isTypedMethod. Only relevant for methods. */ |
1906 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1907 | | }; |
1908 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1909 | | static_assert(0 < 1, "There is no slot for us"); |
1910 | | |
1911 | | MOZ_CAN_RUN_SCRIPT static bool |
1912 | | get_currentURI(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitGetterCallArgs args) |
1913 | 0 | { |
1914 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLImageElement.currentURI", DOM, cx); |
1915 | 0 |
|
1916 | 0 | FastErrorResult rv; |
1917 | 0 | auto result(StrongOrRawPtr<nsIURI>(self->GetCurrentURI(rv))); |
1918 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1919 | 0 | return false; |
1920 | 0 | } |
1921 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1922 | 0 | if (!result) { |
1923 | 0 | args.rval().setNull(); |
1924 | 0 | return true; |
1925 | 0 | } |
1926 | 0 | if (!WrapObject(cx, result, &NS_GET_IID(nsIURI), args.rval())) { |
1927 | 0 | return false; |
1928 | 0 | } |
1929 | 0 | return true; |
1930 | 0 | } |
1931 | | |
1932 | | static const JSJitInfo currentURI_getterinfo = { |
1933 | | { (JSJitGetterOp)get_currentURI }, |
1934 | | { prototypes::id::HTMLImageElement }, |
1935 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
1936 | | JSJitInfo::Getter, |
1937 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1938 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
1939 | | false, /* isInfallible. False in setters. */ |
1940 | | false, /* isMovable. Not relevant for setters. */ |
1941 | | false, /* isEliminatable. Not relevant for setters. */ |
1942 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1943 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1944 | | false, /* isTypedMethod. Only relevant for methods. */ |
1945 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1946 | | }; |
1947 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1948 | | static_assert(0 < 1, "There is no slot for us"); |
1949 | | |
1950 | | MOZ_CAN_RUN_SCRIPT static bool |
1951 | | get_currentRequestFinalURI(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, JSJitGetterCallArgs args) |
1952 | 0 | { |
1953 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLImageElement.currentRequestFinalURI", DOM, cx); |
1954 | 0 |
|
1955 | 0 | auto result(StrongOrRawPtr<nsIURI>(self->GetCurrentRequestFinalURI())); |
1956 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1957 | 0 | if (!result) { |
1958 | 0 | args.rval().setNull(); |
1959 | 0 | return true; |
1960 | 0 | } |
1961 | 0 | if (!WrapObject(cx, result, &NS_GET_IID(nsIURI), args.rval())) { |
1962 | 0 | return false; |
1963 | 0 | } |
1964 | 0 | return true; |
1965 | 0 | } |
1966 | | |
1967 | | static const JSJitInfo currentRequestFinalURI_getterinfo = { |
1968 | | { (JSJitGetterOp)get_currentRequestFinalURI }, |
1969 | | { prototypes::id::HTMLImageElement }, |
1970 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
1971 | | JSJitInfo::Getter, |
1972 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1973 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
1974 | | false, /* isInfallible. False in setters. */ |
1975 | | false, /* isMovable. Not relevant for setters. */ |
1976 | | false, /* isEliminatable. Not relevant for setters. */ |
1977 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1978 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1979 | | false, /* isTypedMethod. Only relevant for methods. */ |
1980 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1981 | | }; |
1982 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1983 | | static_assert(0 < 1, "There is no slot for us"); |
1984 | | |
1985 | | MOZ_CAN_RUN_SCRIPT static bool |
1986 | | forceReload(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, const JSJitMethodCallArgs& args) |
1987 | 0 | { |
1988 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLImageElement.forceReload", DOM, cx); |
1989 | 0 |
|
1990 | 0 | bool arg0; |
1991 | 0 | if (args.hasDefined(0)) { |
1992 | 0 | if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) { |
1993 | 0 | return false; |
1994 | 0 | } |
1995 | 0 | } else { |
1996 | 0 | arg0 = true; |
1997 | 0 | } |
1998 | 0 | FastErrorResult rv; |
1999 | 0 | self->ForceReload(arg0, rv); |
2000 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
2001 | 0 | return false; |
2002 | 0 | } |
2003 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2004 | 0 | args.rval().setUndefined(); |
2005 | 0 | return true; |
2006 | 0 | } |
2007 | | |
2008 | | static const JSJitInfo forceReload_methodinfo = { |
2009 | | { (JSJitGetterOp)forceReload }, |
2010 | | { prototypes::id::HTMLImageElement }, |
2011 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
2012 | | JSJitInfo::Method, |
2013 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
2014 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
2015 | | false, /* isInfallible. False in setters. */ |
2016 | | false, /* isMovable. Not relevant for setters. */ |
2017 | | false, /* isEliminatable. Not relevant for setters. */ |
2018 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2019 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2020 | | false, /* isTypedMethod. Only relevant for methods. */ |
2021 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2022 | | }; |
2023 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2024 | | static_assert(0 < 1, "There is no slot for us"); |
2025 | | |
2026 | | MOZ_CAN_RUN_SCRIPT static bool |
2027 | | forceImageState(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLImageElement* self, const JSJitMethodCallArgs& args) |
2028 | 0 | { |
2029 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLImageElement.forceImageState", DOM, cx); |
2030 | 0 |
|
2031 | 0 | if (MOZ_UNLIKELY(args.length() < 2)) { |
2032 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLImageElement.forceImageState"); |
2033 | 0 | } |
2034 | 0 | bool arg0; |
2035 | 0 | if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) { |
2036 | 0 | return false; |
2037 | 0 | } |
2038 | 0 | uint64_t arg1; |
2039 | 0 | if (!ValueToPrimitive<uint64_t, eDefault>(cx, args[1], &arg1)) { |
2040 | 0 | return false; |
2041 | 0 | } |
2042 | 0 | self->ForceImageState(arg0, arg1); |
2043 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2044 | 0 | args.rval().setUndefined(); |
2045 | 0 | return true; |
2046 | 0 | } |
2047 | | |
2048 | | static const JSJitInfo forceImageState_methodinfo = { |
2049 | | { (JSJitGetterOp)forceImageState }, |
2050 | | { prototypes::id::HTMLImageElement }, |
2051 | | { PrototypeTraits<prototypes::id::HTMLImageElement>::Depth }, |
2052 | | JSJitInfo::Method, |
2053 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
2054 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
2055 | | false, /* isInfallible. False in setters. */ |
2056 | | false, /* isMovable. Not relevant for setters. */ |
2057 | | false, /* isEliminatable. Not relevant for setters. */ |
2058 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2059 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2060 | | false, /* isTypedMethod. Only relevant for methods. */ |
2061 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2062 | | }; |
2063 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2064 | | static_assert(0 < 1, "There is no slot for us"); |
2065 | | |
2066 | | static bool |
2067 | | _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val) |
2068 | 0 | { |
2069 | 0 | mozilla::dom::HTMLImageElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLImageElement>(obj); |
2070 | 0 | // We don't want to preserve if we don't have a wrapper, and we |
2071 | 0 | // obviously can't preserve if we're not initialized. |
2072 | 0 | if (self && self->GetWrapperPreserveColor()) { |
2073 | 0 | PreserveWrapper(self); |
2074 | 0 | } |
2075 | 0 | return true; |
2076 | 0 | } |
2077 | | |
2078 | | static void |
2079 | | _finalize(js::FreeOp* fop, JSObject* obj) |
2080 | 0 | { |
2081 | 0 | mozilla::dom::HTMLImageElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLImageElement>(obj); |
2082 | 0 | if (self) { |
2083 | 0 | ClearWrapper(self, self, obj); |
2084 | 0 | AddForDeferredFinalization<mozilla::dom::HTMLImageElement>(self); |
2085 | 0 | } |
2086 | 0 | } |
2087 | | |
2088 | | static size_t |
2089 | | _objectMoved(JSObject* obj, JSObject* old) |
2090 | 0 | { |
2091 | 0 | mozilla::dom::HTMLImageElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLImageElement>(obj); |
2092 | 0 | if (self) { |
2093 | 0 | UpdateWrapper(self, self, obj, old); |
2094 | 0 | } |
2095 | 0 |
|
2096 | 0 | return 0; |
2097 | 0 | } |
2098 | | |
2099 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
2100 | | #if defined(__clang__) |
2101 | | #pragma clang diagnostic push |
2102 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
2103 | | #endif |
2104 | | static const JSFunctionSpec sChromeMethods_specs[] = { |
2105 | | JS_FNSPEC("addObserver", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&addObserver_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
2106 | | JS_FNSPEC("removeObserver", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&removeObserver_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
2107 | | JS_FNSPEC("getRequest", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getRequest_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
2108 | | JS_FNSPEC("getRequestType", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getRequestType_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
2109 | | JS_FNSPEC("forceReload", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&forceReload_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
2110 | | JS_FNSPEC("forceImageState", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&forceImageState_methodinfo), 2, JSPROP_ENUMERATE, nullptr), |
2111 | | JS_FS_END |
2112 | | }; |
2113 | | #if defined(__clang__) |
2114 | | #pragma clang diagnostic pop |
2115 | | #endif |
2116 | | |
2117 | | |
2118 | | static const Prefable<const JSFunctionSpec> sChromeMethods[] = { |
2119 | | { nullptr, &sChromeMethods_specs[0] }, |
2120 | | { nullptr, nullptr } |
2121 | | }; |
2122 | | |
2123 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
2124 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
2125 | | static_assert(6 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
2126 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
2127 | | |
2128 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
2129 | | #if defined(__clang__) |
2130 | | #pragma clang diagnostic push |
2131 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
2132 | | #endif |
2133 | | static const JSPropertySpec sAttributes_specs[] = { |
2134 | | { "alt", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &alt_getterinfo, GenericSetter<NormalThisPolicy>, &alt_setterinfo }, |
2135 | | { "src", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &src_getterinfo, GenericSetter<NormalThisPolicy>, &src_setterinfo }, |
2136 | | { "srcset", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &srcset_getterinfo, GenericSetter<NormalThisPolicy>, &srcset_setterinfo }, |
2137 | | { "crossOrigin", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &crossOrigin_getterinfo, GenericSetter<NormalThisPolicy>, &crossOrigin_setterinfo }, |
2138 | | { "useMap", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &useMap_getterinfo, GenericSetter<NormalThisPolicy>, &useMap_setterinfo }, |
2139 | | { "referrerPolicy", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &referrerPolicy_getterinfo, GenericSetter<NormalThisPolicy>, &referrerPolicy_setterinfo }, |
2140 | | { "isMap", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &isMap_getterinfo, GenericSetter<NormalThisPolicy>, &isMap_setterinfo }, |
2141 | | { "width", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &width_getterinfo, GenericSetter<NormalThisPolicy>, &width_setterinfo }, |
2142 | | { "height", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &height_getterinfo, GenericSetter<NormalThisPolicy>, &height_setterinfo }, |
2143 | | { "decoding", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &decoding_getterinfo, GenericSetter<NormalThisPolicy>, &decoding_setterinfo }, |
2144 | | { "naturalWidth", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &naturalWidth_getterinfo, nullptr, nullptr }, |
2145 | | { "naturalHeight", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &naturalHeight_getterinfo, nullptr, nullptr }, |
2146 | | { "complete", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &complete_getterinfo, nullptr, nullptr }, |
2147 | | { "name", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &name_getterinfo, GenericSetter<NormalThisPolicy>, &name_setterinfo }, |
2148 | | { "align", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &align_getterinfo, GenericSetter<NormalThisPolicy>, &align_setterinfo }, |
2149 | | { "hspace", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &hspace_getterinfo, GenericSetter<NormalThisPolicy>, &hspace_setterinfo }, |
2150 | | { "vspace", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &vspace_getterinfo, GenericSetter<NormalThisPolicy>, &vspace_setterinfo }, |
2151 | | { "longDesc", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &longDesc_getterinfo, GenericSetter<NormalThisPolicy>, &longDesc_setterinfo }, |
2152 | | { "border", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &border_getterinfo, GenericSetter<NormalThisPolicy>, &border_setterinfo }, |
2153 | | { "sizes", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &sizes_getterinfo, GenericSetter<NormalThisPolicy>, &sizes_setterinfo }, |
2154 | | { "currentSrc", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, ¤tSrc_getterinfo, nullptr, nullptr }, |
2155 | | { "lowsrc", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &lowsrc_getterinfo, GenericSetter<NormalThisPolicy>, &lowsrc_setterinfo }, |
2156 | | { "x", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &x_getterinfo, nullptr, nullptr }, |
2157 | | { "y", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &y_getterinfo, nullptr, nullptr }, |
2158 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr } |
2159 | | }; |
2160 | | #if defined(__clang__) |
2161 | | #pragma clang diagnostic pop |
2162 | | #endif |
2163 | | |
2164 | | |
2165 | | static const Prefable<const JSPropertySpec> sAttributes[] = { |
2166 | | { nullptr, &sAttributes_specs[0] }, |
2167 | | { nullptr, nullptr } |
2168 | | }; |
2169 | | |
2170 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
2171 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
2172 | | static_assert(24 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
2173 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
2174 | | |
2175 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
2176 | | #if defined(__clang__) |
2177 | | #pragma clang diagnostic push |
2178 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
2179 | | #endif |
2180 | | static const JSPropertySpec sChromeAttributes_specs[] = { |
2181 | | { "loadingEnabled", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &loadingEnabled_getterinfo, GenericSetter<NormalThisPolicy>, &loadingEnabled_setterinfo }, |
2182 | | { "imageBlockingStatus", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &imageBlockingStatus_getterinfo, nullptr, nullptr }, |
2183 | | { "currentURI", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, ¤tURI_getterinfo, nullptr, nullptr }, |
2184 | | { "currentRequestFinalURI", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, ¤tRequestFinalURI_getterinfo, nullptr, nullptr }, |
2185 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr } |
2186 | | }; |
2187 | | #if defined(__clang__) |
2188 | | #pragma clang diagnostic pop |
2189 | | #endif |
2190 | | |
2191 | | |
2192 | | static const Prefable<const JSPropertySpec> sChromeAttributes[] = { |
2193 | | { nullptr, &sChromeAttributes_specs[0] }, |
2194 | | { nullptr, nullptr } |
2195 | | }; |
2196 | | |
2197 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
2198 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
2199 | | static_assert(4 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
2200 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
2201 | | |
2202 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
2203 | | #if defined(__clang__) |
2204 | | #pragma clang diagnostic push |
2205 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
2206 | | #endif |
2207 | | static const ConstantSpec sChromeConstants_specs[] = { |
2208 | | { "UNKNOWN_REQUEST", JS::Int32Value(-1) }, |
2209 | | { "CURRENT_REQUEST", JS::Int32Value(0) }, |
2210 | | { "PENDING_REQUEST", JS::Int32Value(1) }, |
2211 | | { 0, JS::UndefinedValue() } |
2212 | | }; |
2213 | | #if defined(__clang__) |
2214 | | #pragma clang diagnostic pop |
2215 | | #endif |
2216 | | |
2217 | | |
2218 | | static const Prefable<const ConstantSpec> sChromeConstants[] = { |
2219 | | { nullptr, &sChromeConstants_specs[0] }, |
2220 | | { nullptr, nullptr } |
2221 | | }; |
2222 | | |
2223 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
2224 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
2225 | | static_assert(3 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
2226 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
2227 | | |
2228 | | |
2229 | | static uint16_t sNativeProperties_sortedPropertyIndices[24]; |
2230 | | static PropertyInfo sNativeProperties_propertyInfos[24]; |
2231 | | |
2232 | | static const NativePropertiesN<1> sNativeProperties = { |
2233 | | false, 0, |
2234 | | false, 0, |
2235 | | false, 0, |
2236 | | true, 0 /* sAttributes */, |
2237 | | false, 0, |
2238 | | false, 0, |
2239 | | false, 0, |
2240 | | -1, |
2241 | | 24, |
2242 | | sNativeProperties_sortedPropertyIndices, |
2243 | | { |
2244 | | { sAttributes, &sNativeProperties_propertyInfos[0] } |
2245 | | } |
2246 | | }; |
2247 | | static_assert(24 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount), |
2248 | | "We have a property info count that is oversized"); |
2249 | | |
2250 | | static uint16_t sChromeOnlyNativeProperties_sortedPropertyIndices[13]; |
2251 | | static PropertyInfo sChromeOnlyNativeProperties_propertyInfos[13]; |
2252 | | |
2253 | | static const NativePropertiesN<3> sChromeOnlyNativeProperties = { |
2254 | | false, 0, |
2255 | | false, 0, |
2256 | | true, 0 /* sChromeMethods */, |
2257 | | true, 1 /* sChromeAttributes */, |
2258 | | false, 0, |
2259 | | false, 0, |
2260 | | true, 2 /* sChromeConstants */, |
2261 | | -1, |
2262 | | 13, |
2263 | | sChromeOnlyNativeProperties_sortedPropertyIndices, |
2264 | | { |
2265 | | { sChromeMethods, &sChromeOnlyNativeProperties_propertyInfos[0] }, |
2266 | | { sChromeAttributes, &sChromeOnlyNativeProperties_propertyInfos[6] }, |
2267 | | { sChromeConstants, &sChromeOnlyNativeProperties_propertyInfos[10] } |
2268 | | } |
2269 | | }; |
2270 | | static_assert(13 < 1ull << CHAR_BIT * sizeof(sChromeOnlyNativeProperties.propertyInfoCount), |
2271 | | "We have a property info count that is oversized"); |
2272 | | |
2273 | | static bool |
2274 | | _constructor(JSContext* cx, unsigned argc, JS::Value* vp) |
2275 | 0 | { |
2276 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLImageElement constructor", DOM, cx); |
2277 | 0 |
|
2278 | 0 | return HTMLConstructor(cx, argc, vp, |
2279 | 0 | constructors::id::HTMLImageElement, |
2280 | 0 | prototypes::id::HTMLImageElement, |
2281 | 0 | CreateInterfaceObjects); |
2282 | 0 | } |
2283 | | |
2284 | | static const js::ClassOps sInterfaceObjectClassOps = { |
2285 | | nullptr, /* addProperty */ |
2286 | | nullptr, /* delProperty */ |
2287 | | nullptr, /* enumerate */ |
2288 | | nullptr, /* newEnumerate */ |
2289 | | nullptr, /* resolve */ |
2290 | | nullptr, /* mayResolve */ |
2291 | | nullptr, /* finalize */ |
2292 | | _constructor, /* call */ |
2293 | | nullptr, /* hasInstance */ |
2294 | | _constructor, /* construct */ |
2295 | | nullptr, /* trace */ |
2296 | | }; |
2297 | | |
2298 | | static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = { |
2299 | | { |
2300 | | "Function", |
2301 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE + 1 /* slots for the named constructors */), |
2302 | | &sInterfaceObjectClassOps, |
2303 | | JS_NULL_CLASS_SPEC, |
2304 | | JS_NULL_CLASS_EXT, |
2305 | | &sInterfaceObjectClassObjectOps |
2306 | | }, |
2307 | | eInterface, |
2308 | | true, |
2309 | | prototypes::id::HTMLImageElement, |
2310 | | PrototypeTraits<prototypes::id::HTMLImageElement>::Depth, |
2311 | | sNativePropertyHooks, |
2312 | | "function HTMLImageElement() {\n [native code]\n}", |
2313 | | HTMLElement_Binding::GetConstructorObject |
2314 | | }; |
2315 | | |
2316 | | const NativePropertyHooks sNamedConstructorNativePropertyHooks = { |
2317 | | nullptr, |
2318 | | nullptr, |
2319 | | nullptr, |
2320 | | { nullptr, nullptr }, |
2321 | | prototypes::id::HTMLImageElement, |
2322 | | constructors::id::HTMLImageElement, |
2323 | | nullptr |
2324 | | }; |
2325 | | |
2326 | | static const NamedConstructor namedConstructors[] = { |
2327 | | { "Image", { _Image, &sNamedConstructorNativePropertyHooks }, 0 }, |
2328 | | { nullptr, { nullptr, nullptr }, 0 } |
2329 | | }; |
2330 | | |
2331 | | static const DOMIfaceAndProtoJSClass sPrototypeClass = { |
2332 | | { |
2333 | | "HTMLImageElementPrototype", |
2334 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE), |
2335 | | JS_NULL_CLASS_OPS, |
2336 | | JS_NULL_CLASS_SPEC, |
2337 | | JS_NULL_CLASS_EXT, |
2338 | | JS_NULL_OBJECT_OPS |
2339 | | }, |
2340 | | eInterfacePrototype, |
2341 | | false, |
2342 | | prototypes::id::HTMLImageElement, |
2343 | | PrototypeTraits<prototypes::id::HTMLImageElement>::Depth, |
2344 | | sNativePropertyHooks, |
2345 | | "[object HTMLImageElementPrototype]", |
2346 | | HTMLElement_Binding::GetProtoObject |
2347 | | }; |
2348 | | |
2349 | | static const js::ClassOps sClassOps = { |
2350 | | _addProperty, /* addProperty */ |
2351 | | nullptr, /* delProperty */ |
2352 | | nullptr, /* enumerate */ |
2353 | | nullptr, /* newEnumerate */ |
2354 | | nullptr, /* resolve */ |
2355 | | nullptr, /* mayResolve */ |
2356 | | _finalize, /* finalize */ |
2357 | | nullptr, /* call */ |
2358 | | nullptr, /* hasInstance */ |
2359 | | nullptr, /* construct */ |
2360 | | nullptr, /* trace */ |
2361 | | }; |
2362 | | |
2363 | | static const js::ClassExtension sClassExtension = { |
2364 | | nullptr, /* weakmapKeyDelegateOp */ |
2365 | | _objectMoved /* objectMovedOp */ |
2366 | | }; |
2367 | | |
2368 | | static const DOMJSClass sClass = { |
2369 | | { "HTMLImageElement", |
2370 | | JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1), |
2371 | | &sClassOps, |
2372 | | JS_NULL_CLASS_SPEC, |
2373 | | &sClassExtension, |
2374 | | JS_NULL_OBJECT_OPS |
2375 | | }, |
2376 | | { prototypes::id::EventTarget, prototypes::id::Node, prototypes::id::Element, prototypes::id::HTMLElement, prototypes::id::HTMLImageElement, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count }, |
2377 | | IsBaseOf<nsISupports, mozilla::dom::HTMLImageElement >::value, |
2378 | | sNativePropertyHooks, |
2379 | | FindAssociatedGlobalForNative<mozilla::dom::HTMLImageElement>::Get, |
2380 | | GetProtoObjectHandle, |
2381 | | GetCCParticipant<mozilla::dom::HTMLImageElement>::Get() |
2382 | | }; |
2383 | | static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS, |
2384 | | "Must have the right minimal number of reserved slots."); |
2385 | | static_assert(1 >= 1, |
2386 | | "Must have enough reserved slots."); |
2387 | | |
2388 | | const JSClass* |
2389 | | GetJSClass() |
2390 | 0 | { |
2391 | 0 | return sClass.ToJSClass(); |
2392 | 0 | } |
2393 | | |
2394 | | bool |
2395 | | Wrap(JSContext* aCx, mozilla::dom::HTMLImageElement* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector) |
2396 | 0 | { |
2397 | 0 | static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::dom::HTMLImageElement>::value, |
2398 | 0 | "Shouldn't have wrappercached things that are not refcounted."); |
2399 | 0 | MOZ_ASSERT(static_cast<mozilla::dom::HTMLImageElement*>(aObject) == |
2400 | 0 | reinterpret_cast<mozilla::dom::HTMLImageElement*>(aObject), |
2401 | 0 | "Multiple inheritance for mozilla::dom::HTMLImageElement is broken."); |
2402 | 0 | MOZ_ASSERT(static_cast<nsGenericHTMLElement*>(aObject) == |
2403 | 0 | reinterpret_cast<nsGenericHTMLElement*>(aObject), |
2404 | 0 | "Multiple inheritance for nsGenericHTMLElement is broken."); |
2405 | 0 | MOZ_ASSERT(static_cast<mozilla::dom::Element*>(aObject) == |
2406 | 0 | reinterpret_cast<mozilla::dom::Element*>(aObject), |
2407 | 0 | "Multiple inheritance for mozilla::dom::Element is broken."); |
2408 | 0 | MOZ_ASSERT(static_cast<nsINode*>(aObject) == |
2409 | 0 | reinterpret_cast<nsINode*>(aObject), |
2410 | 0 | "Multiple inheritance for nsINode is broken."); |
2411 | 0 | MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) == |
2412 | 0 | reinterpret_cast<mozilla::dom::EventTarget*>(aObject), |
2413 | 0 | "Multiple inheritance for mozilla::dom::EventTarget is broken."); |
2414 | 0 | MOZ_ASSERT(ToSupportsIsCorrect(aObject)); |
2415 | 0 | MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx)); |
2416 | 0 | MOZ_ASSERT(!aCache->GetWrapper(), |
2417 | 0 | "You should probably not be using Wrap() directly; use " |
2418 | 0 | "GetOrCreateDOMReflector instead"); |
2419 | 0 |
|
2420 | 0 | MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache), |
2421 | 0 | "nsISupports must be on our primary inheritance chain"); |
2422 | 0 |
|
2423 | 0 | JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject())); |
2424 | 0 | if (!global) { |
2425 | 0 | return false; |
2426 | 0 | } |
2427 | 0 | MOZ_ASSERT(JS_IsGlobalObject(global)); |
2428 | 0 | MOZ_ASSERT(JS::ObjectIsNotGray(global)); |
2429 | 0 |
|
2430 | 0 | // That might have ended up wrapping us already, due to the wonders |
2431 | 0 | // of XBL. Check for that, and bail out as needed. |
2432 | 0 | aReflector.set(aCache->GetWrapper()); |
2433 | 0 | if (aReflector) { |
2434 | | #ifdef DEBUG |
2435 | | AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto); |
2436 | | #endif // DEBUG |
2437 | | return true; |
2438 | 0 | } |
2439 | 0 |
|
2440 | 0 | JSAutoRealm ar(aCx, global); |
2441 | 0 | JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx); |
2442 | 0 | if (!canonicalProto) { |
2443 | 0 | return false; |
2444 | 0 | } |
2445 | 0 | JS::Rooted<JSObject*> proto(aCx); |
2446 | 0 | if (aGivenProto) { |
2447 | 0 | proto = aGivenProto; |
2448 | 0 | // Unfortunately, while aGivenProto was in the compartment of aCx |
2449 | 0 | // coming in, we changed compartments to that of "parent" so may need |
2450 | 0 | // to wrap the proto here. |
2451 | 0 | if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) { |
2452 | 0 | if (!JS_WrapObject(aCx, &proto)) { |
2453 | 0 | return false; |
2454 | 0 | } |
2455 | 0 | } |
2456 | 0 | } else { |
2457 | 0 | proto = canonicalProto; |
2458 | 0 | } |
2459 | 0 |
|
2460 | 0 | BindingJSObjectCreator<mozilla::dom::HTMLImageElement> creator(aCx); |
2461 | 0 | creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector); |
2462 | 0 | if (!aReflector) { |
2463 | 0 | return false; |
2464 | 0 | } |
2465 | 0 | |
2466 | 0 | aCache->SetWrapper(aReflector); |
2467 | 0 | creator.InitializationSucceeded(); |
2468 | 0 |
|
2469 | 0 | MOZ_ASSERT(aCache->GetWrapperPreserveColor() && |
2470 | 0 | aCache->GetWrapperPreserveColor() == aReflector); |
2471 | 0 | // If proto != canonicalProto, we have to preserve our wrapper; |
2472 | 0 | // otherwise we won't be able to properly recreate it later, since |
2473 | 0 | // we won't know what proto to use. Note that we don't check |
2474 | 0 | // aGivenProto here, since it's entirely possible (and even |
2475 | 0 | // somewhat common) to have a non-null aGivenProto which is the |
2476 | 0 | // same as canonicalProto. |
2477 | 0 | if (proto != canonicalProto) { |
2478 | 0 | PreserveWrapper(aObject); |
2479 | 0 | } |
2480 | 0 |
|
2481 | 0 | return true; |
2482 | 0 | } |
2483 | | |
2484 | | const NativePropertyHooks sNativePropertyHooks[] = { { |
2485 | | nullptr, |
2486 | | nullptr, |
2487 | | nullptr, |
2488 | | { sNativeProperties.Upcast(), sChromeOnlyNativeProperties.Upcast() }, |
2489 | | prototypes::id::HTMLImageElement, |
2490 | | constructors::id::HTMLImageElement, |
2491 | | HTMLElement_Binding::sNativePropertyHooks, |
2492 | | &DefaultXrayExpandoObjectClass |
2493 | | } }; |
2494 | | |
2495 | | void |
2496 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal) |
2497 | 0 | { |
2498 | 0 | JS::Handle<JSObject*> parentProto(HTMLElement_Binding::GetProtoObjectHandle(aCx)); |
2499 | 0 | if (!parentProto) { |
2500 | 0 | return; |
2501 | 0 | } |
2502 | 0 | |
2503 | 0 | JS::Handle<JSObject*> constructorProto(HTMLElement_Binding::GetConstructorObjectHandle(aCx)); |
2504 | 0 | if (!constructorProto) { |
2505 | 0 | return; |
2506 | 0 | } |
2507 | 0 | |
2508 | 0 | static bool sIdsInited = false; |
2509 | 0 | if (!sIdsInited && NS_IsMainThread()) { |
2510 | 0 | if (!InitIds(aCx, sNativeProperties.Upcast())) { |
2511 | 0 | return; |
2512 | 0 | } |
2513 | 0 | if (!InitIds(aCx, sChromeOnlyNativeProperties.Upcast())) { |
2514 | 0 | return; |
2515 | 0 | } |
2516 | 0 | sIdsInited = true; |
2517 | 0 | } |
2518 | 0 |
|
2519 | 0 | JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::HTMLImageElement); |
2520 | 0 | JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::HTMLImageElement); |
2521 | 0 | dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, |
2522 | 0 | &sPrototypeClass.mBase, protoCache, |
2523 | 0 | nullptr, |
2524 | 0 | constructorProto, &sInterfaceObjectClass.mBase, 0, namedConstructors, |
2525 | 0 | interfaceCache, |
2526 | 0 | sNativeProperties.Upcast(), |
2527 | 0 | sChromeOnlyNativeProperties.Upcast(), |
2528 | 0 | "HTMLImageElement", aDefineOnGlobal, |
2529 | 0 | nullptr, |
2530 | 0 | false); |
2531 | 0 | } |
2532 | | |
2533 | | JSObject* |
2534 | | GetConstructorObject(JSContext* aCx) |
2535 | 0 | { |
2536 | 0 | return GetConstructorObjectHandle(aCx); |
2537 | 0 | } |
2538 | | |
2539 | | } // namespace HTMLImageElement_Binding |
2540 | | |
2541 | | |
2542 | | |
2543 | | } // namespace dom |
2544 | | } // namespace mozilla |