Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM HTMLAreaElement.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #include "HTMLAreaElementBinding.h"
4 : #include "HTMLElementBinding.h"
5 : #include "WrapperFactory.h"
6 : #include "mozilla/OwningNonNull.h"
7 : #include "mozilla/dom/BindingUtils.h"
8 : #include "mozilla/dom/CustomElementRegistry.h"
9 : #include "mozilla/dom/DOMJSClass.h"
10 : #include "mozilla/dom/HTMLAreaElement.h"
11 : #include "mozilla/dom/NonRefcountedDOMObject.h"
12 : #include "mozilla/dom/PrimitiveConversions.h"
13 : #include "mozilla/dom/XrayExpandoClass.h"
14 : #include "nsDOMTokenList.h"
15 :
16 : namespace mozilla {
17 : namespace dom {
18 :
19 : namespace HTMLAreaElementBinding {
20 :
21 : static_assert(IsRefcounted<NativeType>::value == IsRefcounted<HTMLElementBinding::NativeType>::value,
22 : "Can't inherit from an interface with a different ownership model.");
23 :
24 : static bool
25 0 : get_alt(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLAreaElement* self, JSJitGetterCallArgs args)
26 : {
27 0 : DOMString result;
28 0 : self->GetAlt(result);
29 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
30 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
31 0 : return false;
32 : }
33 0 : return true;
34 : }
35 :
36 : static bool
37 0 : set_alt(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLAreaElement* self, JSJitSetterCallArgs args)
38 : {
39 0 : binding_detail::FakeString arg0;
40 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
41 0 : return false;
42 : }
43 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
44 0 : Maybe<AutoCEReaction> ceReaction;
45 0 : if (reactionsStack) {
46 0 : ceReaction.emplace(reactionsStack);
47 : }
48 0 : binding_detail::FastErrorResult rv;
49 0 : self->SetAlt(NonNullHelper(Constify(arg0)), rv);
50 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
51 0 : return false;
52 : }
53 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
54 :
55 0 : return true;
56 : }
57 :
58 : static const JSJitInfo alt_getterinfo = {
59 : { (JSJitGetterOp)get_alt },
60 : { prototypes::id::HTMLAreaElement },
61 : { PrototypeTraits<prototypes::id::HTMLAreaElement>::Depth },
62 : JSJitInfo::Getter,
63 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
64 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
65 : false, /* isInfallible. False in setters. */
66 : false, /* isMovable. Not relevant for setters. */
67 : false, /* isEliminatable. Not relevant for setters. */
68 : false, /* isAlwaysInSlot. Only relevant for getters. */
69 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
70 : false, /* isTypedMethod. Only relevant for methods. */
71 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
72 : };
73 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
74 : static_assert(0 < 1, "There is no slot for us");
75 : static const JSJitInfo alt_setterinfo = {
76 : { (JSJitGetterOp)set_alt },
77 : { prototypes::id::HTMLAreaElement },
78 : { PrototypeTraits<prototypes::id::HTMLAreaElement>::Depth },
79 : JSJitInfo::Setter,
80 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
81 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
82 : false, /* isInfallible. False in setters. */
83 : false, /* isMovable. Not relevant for setters. */
84 : false, /* isEliminatable. Not relevant for setters. */
85 : false, /* isAlwaysInSlot. Only relevant for getters. */
86 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
87 : false, /* isTypedMethod. Only relevant for methods. */
88 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
89 : };
90 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
91 : static_assert(0 < 1, "There is no slot for us");
92 :
93 : static bool
94 0 : get_coords(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLAreaElement* self, JSJitGetterCallArgs args)
95 : {
96 0 : DOMString result;
97 0 : self->GetCoords(result);
98 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
99 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
100 0 : return false;
101 : }
102 0 : return true;
103 : }
104 :
105 : static bool
106 0 : set_coords(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLAreaElement* self, JSJitSetterCallArgs args)
107 : {
108 0 : binding_detail::FakeString arg0;
109 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
110 0 : return false;
111 : }
112 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
113 0 : Maybe<AutoCEReaction> ceReaction;
114 0 : if (reactionsStack) {
115 0 : ceReaction.emplace(reactionsStack);
116 : }
117 0 : binding_detail::FastErrorResult rv;
118 0 : self->SetCoords(NonNullHelper(Constify(arg0)), rv);
119 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
120 0 : return false;
121 : }
122 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
123 :
124 0 : return true;
125 : }
126 :
127 : static const JSJitInfo coords_getterinfo = {
128 : { (JSJitGetterOp)get_coords },
129 : { prototypes::id::HTMLAreaElement },
130 : { PrototypeTraits<prototypes::id::HTMLAreaElement>::Depth },
131 : JSJitInfo::Getter,
132 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
133 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
134 : false, /* isInfallible. False in setters. */
135 : false, /* isMovable. Not relevant for setters. */
136 : false, /* isEliminatable. Not relevant for setters. */
137 : false, /* isAlwaysInSlot. Only relevant for getters. */
138 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
139 : false, /* isTypedMethod. Only relevant for methods. */
140 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
141 : };
142 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
143 : static_assert(0 < 1, "There is no slot for us");
144 : static const JSJitInfo coords_setterinfo = {
145 : { (JSJitGetterOp)set_coords },
146 : { prototypes::id::HTMLAreaElement },
147 : { PrototypeTraits<prototypes::id::HTMLAreaElement>::Depth },
148 : JSJitInfo::Setter,
149 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
150 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
151 : false, /* isInfallible. False in setters. */
152 : false, /* isMovable. Not relevant for setters. */
153 : false, /* isEliminatable. Not relevant for setters. */
154 : false, /* isAlwaysInSlot. Only relevant for getters. */
155 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
156 : false, /* isTypedMethod. Only relevant for methods. */
157 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
158 : };
159 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
160 : static_assert(0 < 1, "There is no slot for us");
161 :
162 : static bool
163 0 : get_shape(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLAreaElement* self, JSJitGetterCallArgs args)
164 : {
165 0 : DOMString result;
166 0 : self->GetShape(result);
167 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
168 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
169 0 : return false;
170 : }
171 0 : return true;
172 : }
173 :
174 : static bool
175 0 : set_shape(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLAreaElement* self, JSJitSetterCallArgs args)
176 : {
177 0 : binding_detail::FakeString arg0;
178 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
179 0 : return false;
180 : }
181 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
182 0 : Maybe<AutoCEReaction> ceReaction;
183 0 : if (reactionsStack) {
184 0 : ceReaction.emplace(reactionsStack);
185 : }
186 0 : binding_detail::FastErrorResult rv;
187 0 : self->SetShape(NonNullHelper(Constify(arg0)), rv);
188 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
189 0 : return false;
190 : }
191 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
192 :
193 0 : return true;
194 : }
195 :
196 : static const JSJitInfo shape_getterinfo = {
197 : { (JSJitGetterOp)get_shape },
198 : { prototypes::id::HTMLAreaElement },
199 : { PrototypeTraits<prototypes::id::HTMLAreaElement>::Depth },
200 : JSJitInfo::Getter,
201 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
202 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
203 : false, /* isInfallible. False in setters. */
204 : false, /* isMovable. Not relevant for setters. */
205 : false, /* isEliminatable. Not relevant for setters. */
206 : false, /* isAlwaysInSlot. Only relevant for getters. */
207 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
208 : false, /* isTypedMethod. Only relevant for methods. */
209 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
210 : };
211 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
212 : static_assert(0 < 1, "There is no slot for us");
213 : static const JSJitInfo shape_setterinfo = {
214 : { (JSJitGetterOp)set_shape },
215 : { prototypes::id::HTMLAreaElement },
216 : { PrototypeTraits<prototypes::id::HTMLAreaElement>::Depth },
217 : JSJitInfo::Setter,
218 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
219 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
220 : false, /* isInfallible. False in setters. */
221 : false, /* isMovable. Not relevant for setters. */
222 : false, /* isEliminatable. Not relevant for setters. */
223 : false, /* isAlwaysInSlot. Only relevant for getters. */
224 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
225 : false, /* isTypedMethod. Only relevant for methods. */
226 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
227 : };
228 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
229 : static_assert(0 < 1, "There is no slot for us");
230 :
231 : static bool
232 0 : get_target(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLAreaElement* self, JSJitGetterCallArgs args)
233 : {
234 0 : DOMString result;
235 0 : self->GetTarget(result);
236 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
237 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
238 0 : return false;
239 : }
240 0 : return true;
241 : }
242 :
243 : static bool
244 0 : set_target(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLAreaElement* self, JSJitSetterCallArgs args)
245 : {
246 0 : binding_detail::FakeString arg0;
247 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
248 0 : return false;
249 : }
250 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
251 0 : Maybe<AutoCEReaction> ceReaction;
252 0 : if (reactionsStack) {
253 0 : ceReaction.emplace(reactionsStack);
254 : }
255 0 : binding_detail::FastErrorResult rv;
256 0 : self->SetTarget(NonNullHelper(Constify(arg0)), rv);
257 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
258 0 : return false;
259 : }
260 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
261 :
262 0 : return true;
263 : }
264 :
265 : static const JSJitInfo target_getterinfo = {
266 : { (JSJitGetterOp)get_target },
267 : { prototypes::id::HTMLAreaElement },
268 : { PrototypeTraits<prototypes::id::HTMLAreaElement>::Depth },
269 : JSJitInfo::Getter,
270 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
271 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
272 : false, /* isInfallible. False in setters. */
273 : false, /* isMovable. Not relevant for setters. */
274 : false, /* isEliminatable. Not relevant for setters. */
275 : false, /* isAlwaysInSlot. Only relevant for getters. */
276 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
277 : false, /* isTypedMethod. Only relevant for methods. */
278 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
279 : };
280 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
281 : static_assert(0 < 1, "There is no slot for us");
282 : static const JSJitInfo target_setterinfo = {
283 : { (JSJitGetterOp)set_target },
284 : { prototypes::id::HTMLAreaElement },
285 : { PrototypeTraits<prototypes::id::HTMLAreaElement>::Depth },
286 : JSJitInfo::Setter,
287 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
288 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
289 : false, /* isInfallible. False in setters. */
290 : false, /* isMovable. Not relevant for setters. */
291 : false, /* isEliminatable. Not relevant for setters. */
292 : false, /* isAlwaysInSlot. Only relevant for getters. */
293 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
294 : false, /* isTypedMethod. Only relevant for methods. */
295 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
296 : };
297 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
298 : static_assert(0 < 1, "There is no slot for us");
299 :
300 : static bool
301 0 : get_download(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLAreaElement* self, JSJitGetterCallArgs args)
302 : {
303 0 : DOMString result;
304 0 : self->GetDownload(result);
305 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
306 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
307 0 : return false;
308 : }
309 0 : return true;
310 : }
311 :
312 : static bool
313 0 : set_download(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLAreaElement* self, JSJitSetterCallArgs args)
314 : {
315 0 : binding_detail::FakeString arg0;
316 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
317 0 : return false;
318 : }
319 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
320 0 : Maybe<AutoCEReaction> ceReaction;
321 0 : if (reactionsStack) {
322 0 : ceReaction.emplace(reactionsStack);
323 : }
324 0 : binding_detail::FastErrorResult rv;
325 0 : self->SetDownload(NonNullHelper(Constify(arg0)), rv);
326 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
327 0 : return false;
328 : }
329 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
330 :
331 0 : return true;
332 : }
333 :
334 : static const JSJitInfo download_getterinfo = {
335 : { (JSJitGetterOp)get_download },
336 : { prototypes::id::HTMLAreaElement },
337 : { PrototypeTraits<prototypes::id::HTMLAreaElement>::Depth },
338 : JSJitInfo::Getter,
339 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
340 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
341 : false, /* isInfallible. False in setters. */
342 : false, /* isMovable. Not relevant for setters. */
343 : false, /* isEliminatable. Not relevant for setters. */
344 : false, /* isAlwaysInSlot. Only relevant for getters. */
345 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
346 : false, /* isTypedMethod. Only relevant for methods. */
347 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
348 : };
349 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
350 : static_assert(0 < 1, "There is no slot for us");
351 : static const JSJitInfo download_setterinfo = {
352 : { (JSJitGetterOp)set_download },
353 : { prototypes::id::HTMLAreaElement },
354 : { PrototypeTraits<prototypes::id::HTMLAreaElement>::Depth },
355 : JSJitInfo::Setter,
356 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
357 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
358 : false, /* isInfallible. False in setters. */
359 : false, /* isMovable. Not relevant for setters. */
360 : false, /* isEliminatable. Not relevant for setters. */
361 : false, /* isAlwaysInSlot. Only relevant for getters. */
362 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
363 : false, /* isTypedMethod. Only relevant for methods. */
364 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
365 : };
366 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
367 : static_assert(0 < 1, "There is no slot for us");
368 :
369 : static bool
370 0 : get_ping(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLAreaElement* self, JSJitGetterCallArgs args)
371 : {
372 0 : DOMString result;
373 0 : self->GetPing(result);
374 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
375 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
376 0 : return false;
377 : }
378 0 : return true;
379 : }
380 :
381 : static bool
382 0 : set_ping(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLAreaElement* self, JSJitSetterCallArgs args)
383 : {
384 0 : binding_detail::FakeString arg0;
385 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
386 0 : return false;
387 : }
388 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
389 0 : Maybe<AutoCEReaction> ceReaction;
390 0 : if (reactionsStack) {
391 0 : ceReaction.emplace(reactionsStack);
392 : }
393 0 : binding_detail::FastErrorResult rv;
394 0 : self->SetPing(NonNullHelper(Constify(arg0)), rv);
395 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
396 0 : return false;
397 : }
398 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
399 :
400 0 : return true;
401 : }
402 :
403 : static const JSJitInfo ping_getterinfo = {
404 : { (JSJitGetterOp)get_ping },
405 : { prototypes::id::HTMLAreaElement },
406 : { PrototypeTraits<prototypes::id::HTMLAreaElement>::Depth },
407 : JSJitInfo::Getter,
408 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
409 : JSVAL_TYPE_STRING, /* 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 : static const JSJitInfo ping_setterinfo = {
421 : { (JSJitGetterOp)set_ping },
422 : { prototypes::id::HTMLAreaElement },
423 : { PrototypeTraits<prototypes::id::HTMLAreaElement>::Depth },
424 : JSJitInfo::Setter,
425 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
426 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
427 : false, /* isInfallible. False in setters. */
428 : false, /* isMovable. Not relevant for setters. */
429 : false, /* isEliminatable. Not relevant for setters. */
430 : false, /* isAlwaysInSlot. Only relevant for getters. */
431 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
432 : false, /* isTypedMethod. Only relevant for methods. */
433 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
434 : };
435 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
436 : static_assert(0 < 1, "There is no slot for us");
437 :
438 : static bool
439 0 : get_rel(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLAreaElement* self, JSJitGetterCallArgs args)
440 : {
441 0 : DOMString result;
442 0 : self->GetRel(result);
443 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
444 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
445 0 : return false;
446 : }
447 0 : return true;
448 : }
449 :
450 : static bool
451 0 : set_rel(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLAreaElement* self, JSJitSetterCallArgs args)
452 : {
453 0 : binding_detail::FakeString arg0;
454 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
455 0 : return false;
456 : }
457 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
458 0 : Maybe<AutoCEReaction> ceReaction;
459 0 : if (reactionsStack) {
460 0 : ceReaction.emplace(reactionsStack);
461 : }
462 0 : binding_detail::FastErrorResult rv;
463 0 : self->SetRel(NonNullHelper(Constify(arg0)), rv);
464 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
465 0 : return false;
466 : }
467 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
468 :
469 0 : return true;
470 : }
471 :
472 : static const JSJitInfo rel_getterinfo = {
473 : { (JSJitGetterOp)get_rel },
474 : { prototypes::id::HTMLAreaElement },
475 : { PrototypeTraits<prototypes::id::HTMLAreaElement>::Depth },
476 : JSJitInfo::Getter,
477 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
478 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
479 : false, /* isInfallible. False in setters. */
480 : false, /* isMovable. Not relevant for setters. */
481 : false, /* isEliminatable. Not relevant for setters. */
482 : false, /* isAlwaysInSlot. Only relevant for getters. */
483 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
484 : false, /* isTypedMethod. Only relevant for methods. */
485 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
486 : };
487 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
488 : static_assert(0 < 1, "There is no slot for us");
489 : static const JSJitInfo rel_setterinfo = {
490 : { (JSJitGetterOp)set_rel },
491 : { prototypes::id::HTMLAreaElement },
492 : { PrototypeTraits<prototypes::id::HTMLAreaElement>::Depth },
493 : JSJitInfo::Setter,
494 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
495 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
496 : false, /* isInfallible. False in setters. */
497 : false, /* isMovable. Not relevant for setters. */
498 : false, /* isEliminatable. Not relevant for setters. */
499 : false, /* isAlwaysInSlot. Only relevant for getters. */
500 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
501 : false, /* isTypedMethod. Only relevant for methods. */
502 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
503 : };
504 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
505 : static_assert(0 < 1, "There is no slot for us");
506 :
507 : static bool
508 0 : get_referrerPolicy(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLAreaElement* self, JSJitGetterCallArgs args)
509 : {
510 0 : DOMString result;
511 0 : self->GetReferrerPolicy(result);
512 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
513 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
514 0 : return false;
515 : }
516 0 : return true;
517 : }
518 :
519 : static bool
520 0 : set_referrerPolicy(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLAreaElement* self, JSJitSetterCallArgs args)
521 : {
522 0 : binding_detail::FakeString arg0;
523 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
524 0 : return false;
525 : }
526 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
527 0 : Maybe<AutoCEReaction> ceReaction;
528 0 : if (reactionsStack) {
529 0 : ceReaction.emplace(reactionsStack);
530 : }
531 0 : binding_detail::FastErrorResult rv;
532 0 : self->SetReferrerPolicy(NonNullHelper(Constify(arg0)), rv);
533 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
534 0 : return false;
535 : }
536 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
537 :
538 0 : return true;
539 : }
540 :
541 : static const JSJitInfo referrerPolicy_getterinfo = {
542 : { (JSJitGetterOp)get_referrerPolicy },
543 : { prototypes::id::HTMLAreaElement },
544 : { PrototypeTraits<prototypes::id::HTMLAreaElement>::Depth },
545 : JSJitInfo::Getter,
546 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
547 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
548 : false, /* isInfallible. False in setters. */
549 : false, /* isMovable. Not relevant for setters. */
550 : false, /* isEliminatable. Not relevant for setters. */
551 : false, /* isAlwaysInSlot. Only relevant for getters. */
552 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
553 : false, /* isTypedMethod. Only relevant for methods. */
554 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
555 : };
556 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
557 : static_assert(0 < 1, "There is no slot for us");
558 : static const JSJitInfo referrerPolicy_setterinfo = {
559 : { (JSJitGetterOp)set_referrerPolicy },
560 : { prototypes::id::HTMLAreaElement },
561 : { PrototypeTraits<prototypes::id::HTMLAreaElement>::Depth },
562 : JSJitInfo::Setter,
563 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
564 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
565 : false, /* isInfallible. False in setters. */
566 : false, /* isMovable. Not relevant for setters. */
567 : false, /* isEliminatable. Not relevant for setters. */
568 : false, /* isAlwaysInSlot. Only relevant for getters. */
569 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
570 : false, /* isTypedMethod. Only relevant for methods. */
571 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
572 : };
573 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
574 : static_assert(0 < 1, "There is no slot for us");
575 :
576 : static bool
577 0 : get_relList(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLAreaElement* self, JSJitGetterCallArgs args)
578 : {
579 0 : auto result(StrongOrRawPtr<nsDOMTokenList>(self->RelList()));
580 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
581 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
582 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
583 0 : return false;
584 : }
585 0 : return true;
586 : }
587 :
588 : static bool
589 0 : set_relList(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLAreaElement* self, JSJitSetterCallArgs args)
590 : {
591 0 : JS::Rooted<JS::Value> v(cx);
592 0 : if (!JS_GetProperty(cx, obj, "relList", &v)) {
593 0 : return false;
594 : }
595 :
596 0 : if (!v.isObject()) {
597 0 : return ThrowErrorMessage(cx, MSG_NOT_OBJECT, "HTMLAreaElement.relList");
598 : }
599 :
600 0 : JS::Rooted<JSObject*> targetObj(cx, &v.toObject());
601 0 : return JS_SetProperty(cx, targetObj, "value", args[0]);
602 : }
603 :
604 : static const JSJitInfo relList_getterinfo = {
605 : { (JSJitGetterOp)get_relList },
606 : { prototypes::id::HTMLAreaElement },
607 : { PrototypeTraits<prototypes::id::HTMLAreaElement>::Depth },
608 : JSJitInfo::Getter,
609 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
610 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
611 : false, /* isInfallible. False in setters. */
612 : false, /* isMovable. Not relevant for setters. */
613 : false, /* isEliminatable. Not relevant for setters. */
614 : false, /* isAlwaysInSlot. Only relevant for getters. */
615 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
616 : false, /* isTypedMethod. Only relevant for methods. */
617 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
618 : };
619 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
620 : static_assert(0 < 1, "There is no slot for us");
621 : static const JSJitInfo relList_setterinfo = {
622 : { (JSJitGetterOp)set_relList },
623 : { prototypes::id::HTMLAreaElement },
624 : { PrototypeTraits<prototypes::id::HTMLAreaElement>::Depth },
625 : JSJitInfo::Setter,
626 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
627 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
628 : false, /* isInfallible. False in setters. */
629 : false, /* isMovable. Not relevant for setters. */
630 : false, /* isEliminatable. Not relevant for setters. */
631 : false, /* isAlwaysInSlot. Only relevant for getters. */
632 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
633 : false, /* isTypedMethod. Only relevant for methods. */
634 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
635 : };
636 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
637 : static_assert(0 < 1, "There is no slot for us");
638 :
639 : static bool
640 0 : get_noHref(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLAreaElement* self, JSJitGetterCallArgs args)
641 : {
642 0 : bool result(self->NoHref());
643 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
644 0 : args.rval().setBoolean(result);
645 0 : return true;
646 : }
647 :
648 : static bool
649 0 : set_noHref(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLAreaElement* self, JSJitSetterCallArgs args)
650 : {
651 : bool arg0;
652 0 : if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) {
653 0 : return false;
654 : }
655 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
656 0 : Maybe<AutoCEReaction> ceReaction;
657 0 : if (reactionsStack) {
658 0 : ceReaction.emplace(reactionsStack);
659 : }
660 0 : binding_detail::FastErrorResult rv;
661 0 : self->SetNoHref(arg0, rv);
662 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
663 0 : return false;
664 : }
665 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
666 :
667 0 : return true;
668 : }
669 :
670 : static const JSJitInfo noHref_getterinfo = {
671 : { (JSJitGetterOp)get_noHref },
672 : { prototypes::id::HTMLAreaElement },
673 : { PrototypeTraits<prototypes::id::HTMLAreaElement>::Depth },
674 : JSJitInfo::Getter,
675 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
676 : JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */
677 : true, /* isInfallible. False in setters. */
678 : false, /* isMovable. Not relevant for setters. */
679 : false, /* isEliminatable. Not relevant for setters. */
680 : false, /* isAlwaysInSlot. Only relevant for getters. */
681 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
682 : false, /* isTypedMethod. Only relevant for methods. */
683 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
684 : };
685 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
686 : static_assert(0 < 1, "There is no slot for us");
687 : static const JSJitInfo noHref_setterinfo = {
688 : { (JSJitGetterOp)set_noHref },
689 : { prototypes::id::HTMLAreaElement },
690 : { PrototypeTraits<prototypes::id::HTMLAreaElement>::Depth },
691 : JSJitInfo::Setter,
692 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
693 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
694 : false, /* isInfallible. False in setters. */
695 : false, /* isMovable. Not relevant for setters. */
696 : false, /* isEliminatable. Not relevant for setters. */
697 : false, /* isAlwaysInSlot. Only relevant for getters. */
698 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
699 : false, /* isTypedMethod. Only relevant for methods. */
700 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
701 : };
702 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
703 : static_assert(0 < 1, "There is no slot for us");
704 :
705 : static bool
706 0 : __stringifier(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLAreaElement* self, const JSJitMethodCallArgs& args)
707 : {
708 0 : DOMString result;
709 0 : self->Stringify(result);
710 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
711 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
712 0 : return false;
713 : }
714 0 : return true;
715 : }
716 :
717 : static const JSJitInfo __stringifier_methodinfo = {
718 : { (JSJitGetterOp)__stringifier },
719 : { prototypes::id::HTMLAreaElement },
720 : { PrototypeTraits<prototypes::id::HTMLAreaElement>::Depth },
721 : JSJitInfo::Method,
722 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
723 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
724 : false, /* isInfallible. False in setters. */
725 : false, /* isMovable. Not relevant for setters. */
726 : false, /* isEliminatable. Not relevant for setters. */
727 : false, /* isAlwaysInSlot. Only relevant for getters. */
728 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
729 : false, /* isTypedMethod. Only relevant for methods. */
730 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
731 : };
732 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
733 : static_assert(0 < 1, "There is no slot for us");
734 :
735 : static bool
736 0 : get_href(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLAreaElement* self, JSJitGetterCallArgs args)
737 : {
738 0 : DOMString result;
739 0 : self->GetHref(result);
740 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
741 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
742 0 : return false;
743 : }
744 0 : return true;
745 : }
746 :
747 : static bool
748 0 : set_href(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLAreaElement* self, JSJitSetterCallArgs args)
749 : {
750 0 : binding_detail::FakeString arg0;
751 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
752 0 : return false;
753 : }
754 0 : NormalizeUSVString(arg0);
755 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
756 0 : Maybe<AutoCEReaction> ceReaction;
757 0 : if (reactionsStack) {
758 0 : ceReaction.emplace(reactionsStack);
759 : }
760 0 : binding_detail::FastErrorResult rv;
761 0 : self->SetHref(Constify(arg0), rv);
762 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
763 0 : return false;
764 : }
765 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
766 :
767 0 : return true;
768 : }
769 :
770 : static const JSJitInfo href_getterinfo = {
771 : { (JSJitGetterOp)get_href },
772 : { prototypes::id::HTMLAreaElement },
773 : { PrototypeTraits<prototypes::id::HTMLAreaElement>::Depth },
774 : JSJitInfo::Getter,
775 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
776 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
777 : false, /* isInfallible. False in setters. */
778 : false, /* isMovable. Not relevant for setters. */
779 : false, /* isEliminatable. Not relevant for setters. */
780 : false, /* isAlwaysInSlot. Only relevant for getters. */
781 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
782 : false, /* isTypedMethod. Only relevant for methods. */
783 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
784 : };
785 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
786 : static_assert(0 < 1, "There is no slot for us");
787 : static const JSJitInfo href_setterinfo = {
788 : { (JSJitGetterOp)set_href },
789 : { prototypes::id::HTMLAreaElement },
790 : { PrototypeTraits<prototypes::id::HTMLAreaElement>::Depth },
791 : JSJitInfo::Setter,
792 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
793 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
794 : false, /* isInfallible. False in setters. */
795 : false, /* isMovable. Not relevant for setters. */
796 : false, /* isEliminatable. Not relevant for setters. */
797 : false, /* isAlwaysInSlot. Only relevant for getters. */
798 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
799 : false, /* isTypedMethod. Only relevant for methods. */
800 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
801 : };
802 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
803 : static_assert(0 < 1, "There is no slot for us");
804 :
805 : static bool
806 0 : get_origin(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLAreaElement* self, JSJitGetterCallArgs args)
807 : {
808 0 : DOMString result;
809 0 : self->GetOrigin(result);
810 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
811 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
812 0 : return false;
813 : }
814 0 : return true;
815 : }
816 :
817 : static const JSJitInfo origin_getterinfo = {
818 : { (JSJitGetterOp)get_origin },
819 : { prototypes::id::HTMLAreaElement },
820 : { PrototypeTraits<prototypes::id::HTMLAreaElement>::Depth },
821 : JSJitInfo::Getter,
822 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
823 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
824 : false, /* isInfallible. False in setters. */
825 : false, /* isMovable. Not relevant for setters. */
826 : false, /* isEliminatable. Not relevant for setters. */
827 : false, /* isAlwaysInSlot. Only relevant for getters. */
828 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
829 : false, /* isTypedMethod. Only relevant for methods. */
830 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
831 : };
832 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
833 : static_assert(0 < 1, "There is no slot for us");
834 :
835 : static bool
836 0 : get_protocol(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLAreaElement* self, JSJitGetterCallArgs args)
837 : {
838 0 : DOMString result;
839 0 : self->GetProtocol(result);
840 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
841 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
842 0 : return false;
843 : }
844 0 : return true;
845 : }
846 :
847 : static bool
848 0 : set_protocol(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLAreaElement* self, JSJitSetterCallArgs args)
849 : {
850 0 : binding_detail::FakeString arg0;
851 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
852 0 : return false;
853 : }
854 0 : NormalizeUSVString(arg0);
855 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
856 0 : Maybe<AutoCEReaction> ceReaction;
857 0 : if (reactionsStack) {
858 0 : ceReaction.emplace(reactionsStack);
859 : }
860 0 : self->SetProtocol(Constify(arg0));
861 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
862 :
863 0 : return true;
864 : }
865 :
866 : static const JSJitInfo protocol_getterinfo = {
867 : { (JSJitGetterOp)get_protocol },
868 : { prototypes::id::HTMLAreaElement },
869 : { PrototypeTraits<prototypes::id::HTMLAreaElement>::Depth },
870 : JSJitInfo::Getter,
871 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
872 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
873 : false, /* isInfallible. False in setters. */
874 : false, /* isMovable. Not relevant for setters. */
875 : false, /* isEliminatable. Not relevant for setters. */
876 : false, /* isAlwaysInSlot. Only relevant for getters. */
877 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
878 : false, /* isTypedMethod. Only relevant for methods. */
879 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
880 : };
881 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
882 : static_assert(0 < 1, "There is no slot for us");
883 : static const JSJitInfo protocol_setterinfo = {
884 : { (JSJitGetterOp)set_protocol },
885 : { prototypes::id::HTMLAreaElement },
886 : { PrototypeTraits<prototypes::id::HTMLAreaElement>::Depth },
887 : JSJitInfo::Setter,
888 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
889 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
890 : false, /* isInfallible. False in setters. */
891 : false, /* isMovable. Not relevant for setters. */
892 : false, /* isEliminatable. Not relevant for setters. */
893 : false, /* isAlwaysInSlot. Only relevant for getters. */
894 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
895 : false, /* isTypedMethod. Only relevant for methods. */
896 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
897 : };
898 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
899 : static_assert(0 < 1, "There is no slot for us");
900 :
901 : static bool
902 0 : get_username(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLAreaElement* self, JSJitGetterCallArgs args)
903 : {
904 0 : DOMString result;
905 0 : self->GetUsername(result);
906 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
907 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
908 0 : return false;
909 : }
910 0 : return true;
911 : }
912 :
913 : static bool
914 0 : set_username(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLAreaElement* self, JSJitSetterCallArgs args)
915 : {
916 0 : binding_detail::FakeString arg0;
917 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
918 0 : return false;
919 : }
920 0 : NormalizeUSVString(arg0);
921 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
922 0 : Maybe<AutoCEReaction> ceReaction;
923 0 : if (reactionsStack) {
924 0 : ceReaction.emplace(reactionsStack);
925 : }
926 0 : self->SetUsername(Constify(arg0));
927 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
928 :
929 0 : return true;
930 : }
931 :
932 : static const JSJitInfo username_getterinfo = {
933 : { (JSJitGetterOp)get_username },
934 : { prototypes::id::HTMLAreaElement },
935 : { PrototypeTraits<prototypes::id::HTMLAreaElement>::Depth },
936 : JSJitInfo::Getter,
937 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
938 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
939 : false, /* isInfallible. False in setters. */
940 : false, /* isMovable. Not relevant for setters. */
941 : false, /* isEliminatable. Not relevant for setters. */
942 : false, /* isAlwaysInSlot. Only relevant for getters. */
943 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
944 : false, /* isTypedMethod. Only relevant for methods. */
945 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
946 : };
947 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
948 : static_assert(0 < 1, "There is no slot for us");
949 : static const JSJitInfo username_setterinfo = {
950 : { (JSJitGetterOp)set_username },
951 : { prototypes::id::HTMLAreaElement },
952 : { PrototypeTraits<prototypes::id::HTMLAreaElement>::Depth },
953 : JSJitInfo::Setter,
954 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
955 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
956 : false, /* isInfallible. False in setters. */
957 : false, /* isMovable. Not relevant for setters. */
958 : false, /* isEliminatable. Not relevant for setters. */
959 : false, /* isAlwaysInSlot. Only relevant for getters. */
960 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
961 : false, /* isTypedMethod. Only relevant for methods. */
962 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
963 : };
964 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
965 : static_assert(0 < 1, "There is no slot for us");
966 :
967 : static bool
968 0 : get_password(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLAreaElement* self, JSJitGetterCallArgs args)
969 : {
970 0 : DOMString result;
971 0 : self->GetPassword(result);
972 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
973 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
974 0 : return false;
975 : }
976 0 : return true;
977 : }
978 :
979 : static bool
980 0 : set_password(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLAreaElement* self, JSJitSetterCallArgs args)
981 : {
982 0 : binding_detail::FakeString arg0;
983 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
984 0 : return false;
985 : }
986 0 : NormalizeUSVString(arg0);
987 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
988 0 : Maybe<AutoCEReaction> ceReaction;
989 0 : if (reactionsStack) {
990 0 : ceReaction.emplace(reactionsStack);
991 : }
992 0 : self->SetPassword(Constify(arg0));
993 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
994 :
995 0 : return true;
996 : }
997 :
998 : static const JSJitInfo password_getterinfo = {
999 : { (JSJitGetterOp)get_password },
1000 : { prototypes::id::HTMLAreaElement },
1001 : { PrototypeTraits<prototypes::id::HTMLAreaElement>::Depth },
1002 : JSJitInfo::Getter,
1003 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1004 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
1005 : false, /* isInfallible. False in setters. */
1006 : false, /* isMovable. Not relevant for setters. */
1007 : false, /* isEliminatable. Not relevant for setters. */
1008 : false, /* isAlwaysInSlot. Only relevant for getters. */
1009 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1010 : false, /* isTypedMethod. Only relevant for methods. */
1011 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1012 : };
1013 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1014 : static_assert(0 < 1, "There is no slot for us");
1015 : static const JSJitInfo password_setterinfo = {
1016 : { (JSJitGetterOp)set_password },
1017 : { prototypes::id::HTMLAreaElement },
1018 : { PrototypeTraits<prototypes::id::HTMLAreaElement>::Depth },
1019 : JSJitInfo::Setter,
1020 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1021 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
1022 : false, /* isInfallible. False in setters. */
1023 : false, /* isMovable. Not relevant for setters. */
1024 : false, /* isEliminatable. Not relevant for setters. */
1025 : false, /* isAlwaysInSlot. Only relevant for getters. */
1026 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1027 : false, /* isTypedMethod. Only relevant for methods. */
1028 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1029 : };
1030 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1031 : static_assert(0 < 1, "There is no slot for us");
1032 :
1033 : static bool
1034 0 : get_host(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLAreaElement* self, JSJitGetterCallArgs args)
1035 : {
1036 0 : DOMString result;
1037 0 : self->GetHost(result);
1038 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1039 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
1040 0 : return false;
1041 : }
1042 0 : return true;
1043 : }
1044 :
1045 : static bool
1046 0 : set_host(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLAreaElement* self, JSJitSetterCallArgs args)
1047 : {
1048 0 : binding_detail::FakeString arg0;
1049 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
1050 0 : return false;
1051 : }
1052 0 : NormalizeUSVString(arg0);
1053 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
1054 0 : Maybe<AutoCEReaction> ceReaction;
1055 0 : if (reactionsStack) {
1056 0 : ceReaction.emplace(reactionsStack);
1057 : }
1058 0 : self->SetHost(Constify(arg0));
1059 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1060 :
1061 0 : return true;
1062 : }
1063 :
1064 : static const JSJitInfo host_getterinfo = {
1065 : { (JSJitGetterOp)get_host },
1066 : { prototypes::id::HTMLAreaElement },
1067 : { PrototypeTraits<prototypes::id::HTMLAreaElement>::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 host_setterinfo = {
1082 : { (JSJitGetterOp)set_host },
1083 : { prototypes::id::HTMLAreaElement },
1084 : { PrototypeTraits<prototypes::id::HTMLAreaElement>::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 : static bool
1100 0 : get_hostname(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLAreaElement* self, JSJitGetterCallArgs args)
1101 : {
1102 0 : DOMString result;
1103 0 : self->GetHostname(result);
1104 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1105 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
1106 0 : return false;
1107 : }
1108 0 : return true;
1109 : }
1110 :
1111 : static bool
1112 0 : set_hostname(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLAreaElement* self, JSJitSetterCallArgs args)
1113 : {
1114 0 : binding_detail::FakeString arg0;
1115 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
1116 0 : return false;
1117 : }
1118 0 : NormalizeUSVString(arg0);
1119 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
1120 0 : Maybe<AutoCEReaction> ceReaction;
1121 0 : if (reactionsStack) {
1122 0 : ceReaction.emplace(reactionsStack);
1123 : }
1124 0 : self->SetHostname(Constify(arg0));
1125 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1126 :
1127 0 : return true;
1128 : }
1129 :
1130 : static const JSJitInfo hostname_getterinfo = {
1131 : { (JSJitGetterOp)get_hostname },
1132 : { prototypes::id::HTMLAreaElement },
1133 : { PrototypeTraits<prototypes::id::HTMLAreaElement>::Depth },
1134 : JSJitInfo::Getter,
1135 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1136 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
1137 : false, /* isInfallible. False in setters. */
1138 : false, /* isMovable. Not relevant for setters. */
1139 : false, /* isEliminatable. Not relevant for setters. */
1140 : false, /* isAlwaysInSlot. Only relevant for getters. */
1141 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1142 : false, /* isTypedMethod. Only relevant for methods. */
1143 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1144 : };
1145 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1146 : static_assert(0 < 1, "There is no slot for us");
1147 : static const JSJitInfo hostname_setterinfo = {
1148 : { (JSJitGetterOp)set_hostname },
1149 : { prototypes::id::HTMLAreaElement },
1150 : { PrototypeTraits<prototypes::id::HTMLAreaElement>::Depth },
1151 : JSJitInfo::Setter,
1152 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1153 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
1154 : false, /* isInfallible. False in setters. */
1155 : false, /* isMovable. Not relevant for setters. */
1156 : false, /* isEliminatable. Not relevant for setters. */
1157 : false, /* isAlwaysInSlot. Only relevant for getters. */
1158 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1159 : false, /* isTypedMethod. Only relevant for methods. */
1160 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1161 : };
1162 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1163 : static_assert(0 < 1, "There is no slot for us");
1164 :
1165 : static bool
1166 0 : get_port(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLAreaElement* self, JSJitGetterCallArgs args)
1167 : {
1168 0 : DOMString result;
1169 0 : self->GetPort(result);
1170 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1171 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
1172 0 : return false;
1173 : }
1174 0 : return true;
1175 : }
1176 :
1177 : static bool
1178 0 : set_port(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLAreaElement* self, JSJitSetterCallArgs args)
1179 : {
1180 0 : binding_detail::FakeString arg0;
1181 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
1182 0 : return false;
1183 : }
1184 0 : NormalizeUSVString(arg0);
1185 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
1186 0 : Maybe<AutoCEReaction> ceReaction;
1187 0 : if (reactionsStack) {
1188 0 : ceReaction.emplace(reactionsStack);
1189 : }
1190 0 : self->SetPort(Constify(arg0));
1191 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1192 :
1193 0 : return true;
1194 : }
1195 :
1196 : static const JSJitInfo port_getterinfo = {
1197 : { (JSJitGetterOp)get_port },
1198 : { prototypes::id::HTMLAreaElement },
1199 : { PrototypeTraits<prototypes::id::HTMLAreaElement>::Depth },
1200 : JSJitInfo::Getter,
1201 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1202 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
1203 : false, /* isInfallible. False in setters. */
1204 : false, /* isMovable. Not relevant for setters. */
1205 : false, /* isEliminatable. Not relevant for setters. */
1206 : false, /* isAlwaysInSlot. Only relevant for getters. */
1207 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1208 : false, /* isTypedMethod. Only relevant for methods. */
1209 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1210 : };
1211 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1212 : static_assert(0 < 1, "There is no slot for us");
1213 : static const JSJitInfo port_setterinfo = {
1214 : { (JSJitGetterOp)set_port },
1215 : { prototypes::id::HTMLAreaElement },
1216 : { PrototypeTraits<prototypes::id::HTMLAreaElement>::Depth },
1217 : JSJitInfo::Setter,
1218 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1219 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
1220 : false, /* isInfallible. False in setters. */
1221 : false, /* isMovable. Not relevant for setters. */
1222 : false, /* isEliminatable. Not relevant for setters. */
1223 : false, /* isAlwaysInSlot. Only relevant for getters. */
1224 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1225 : false, /* isTypedMethod. Only relevant for methods. */
1226 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1227 : };
1228 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1229 : static_assert(0 < 1, "There is no slot for us");
1230 :
1231 : static bool
1232 0 : get_pathname(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLAreaElement* self, JSJitGetterCallArgs args)
1233 : {
1234 0 : DOMString result;
1235 0 : self->GetPathname(result);
1236 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1237 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
1238 0 : return false;
1239 : }
1240 0 : return true;
1241 : }
1242 :
1243 : static bool
1244 0 : set_pathname(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLAreaElement* self, JSJitSetterCallArgs args)
1245 : {
1246 0 : binding_detail::FakeString arg0;
1247 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
1248 0 : return false;
1249 : }
1250 0 : NormalizeUSVString(arg0);
1251 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
1252 0 : Maybe<AutoCEReaction> ceReaction;
1253 0 : if (reactionsStack) {
1254 0 : ceReaction.emplace(reactionsStack);
1255 : }
1256 0 : self->SetPathname(Constify(arg0));
1257 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1258 :
1259 0 : return true;
1260 : }
1261 :
1262 : static const JSJitInfo pathname_getterinfo = {
1263 : { (JSJitGetterOp)get_pathname },
1264 : { prototypes::id::HTMLAreaElement },
1265 : { PrototypeTraits<prototypes::id::HTMLAreaElement>::Depth },
1266 : JSJitInfo::Getter,
1267 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1268 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
1269 : false, /* isInfallible. False in setters. */
1270 : false, /* isMovable. Not relevant for setters. */
1271 : false, /* isEliminatable. Not relevant for setters. */
1272 : false, /* isAlwaysInSlot. Only relevant for getters. */
1273 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1274 : false, /* isTypedMethod. Only relevant for methods. */
1275 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1276 : };
1277 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1278 : static_assert(0 < 1, "There is no slot for us");
1279 : static const JSJitInfo pathname_setterinfo = {
1280 : { (JSJitGetterOp)set_pathname },
1281 : { prototypes::id::HTMLAreaElement },
1282 : { PrototypeTraits<prototypes::id::HTMLAreaElement>::Depth },
1283 : JSJitInfo::Setter,
1284 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1285 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
1286 : false, /* isInfallible. False in setters. */
1287 : false, /* isMovable. Not relevant for setters. */
1288 : false, /* isEliminatable. Not relevant for setters. */
1289 : false, /* isAlwaysInSlot. Only relevant for getters. */
1290 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1291 : false, /* isTypedMethod. Only relevant for methods. */
1292 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1293 : };
1294 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1295 : static_assert(0 < 1, "There is no slot for us");
1296 :
1297 : static bool
1298 0 : get_search(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLAreaElement* self, JSJitGetterCallArgs args)
1299 : {
1300 0 : DOMString result;
1301 0 : self->GetSearch(result);
1302 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1303 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
1304 0 : return false;
1305 : }
1306 0 : return true;
1307 : }
1308 :
1309 : static bool
1310 0 : set_search(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLAreaElement* self, JSJitSetterCallArgs args)
1311 : {
1312 0 : binding_detail::FakeString arg0;
1313 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
1314 0 : return false;
1315 : }
1316 0 : NormalizeUSVString(arg0);
1317 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
1318 0 : Maybe<AutoCEReaction> ceReaction;
1319 0 : if (reactionsStack) {
1320 0 : ceReaction.emplace(reactionsStack);
1321 : }
1322 0 : self->SetSearch(Constify(arg0));
1323 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1324 :
1325 0 : return true;
1326 : }
1327 :
1328 : static const JSJitInfo search_getterinfo = {
1329 : { (JSJitGetterOp)get_search },
1330 : { prototypes::id::HTMLAreaElement },
1331 : { PrototypeTraits<prototypes::id::HTMLAreaElement>::Depth },
1332 : JSJitInfo::Getter,
1333 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1334 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
1335 : false, /* isInfallible. False in setters. */
1336 : false, /* isMovable. Not relevant for setters. */
1337 : false, /* isEliminatable. Not relevant for setters. */
1338 : false, /* isAlwaysInSlot. Only relevant for getters. */
1339 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1340 : false, /* isTypedMethod. Only relevant for methods. */
1341 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1342 : };
1343 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1344 : static_assert(0 < 1, "There is no slot for us");
1345 : static const JSJitInfo search_setterinfo = {
1346 : { (JSJitGetterOp)set_search },
1347 : { prototypes::id::HTMLAreaElement },
1348 : { PrototypeTraits<prototypes::id::HTMLAreaElement>::Depth },
1349 : JSJitInfo::Setter,
1350 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1351 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
1352 : false, /* isInfallible. False in setters. */
1353 : false, /* isMovable. Not relevant for setters. */
1354 : false, /* isEliminatable. Not relevant for setters. */
1355 : false, /* isAlwaysInSlot. Only relevant for getters. */
1356 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1357 : false, /* isTypedMethod. Only relevant for methods. */
1358 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1359 : };
1360 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1361 : static_assert(0 < 1, "There is no slot for us");
1362 :
1363 : static bool
1364 0 : get_hash(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLAreaElement* self, JSJitGetterCallArgs args)
1365 : {
1366 0 : DOMString result;
1367 0 : self->GetHash(result);
1368 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1369 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
1370 0 : return false;
1371 : }
1372 0 : return true;
1373 : }
1374 :
1375 : static bool
1376 0 : set_hash(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLAreaElement* self, JSJitSetterCallArgs args)
1377 : {
1378 0 : binding_detail::FakeString arg0;
1379 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
1380 0 : return false;
1381 : }
1382 0 : NormalizeUSVString(arg0);
1383 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
1384 0 : Maybe<AutoCEReaction> ceReaction;
1385 0 : if (reactionsStack) {
1386 0 : ceReaction.emplace(reactionsStack);
1387 : }
1388 0 : self->SetHash(Constify(arg0));
1389 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1390 :
1391 0 : return true;
1392 : }
1393 :
1394 : static const JSJitInfo hash_getterinfo = {
1395 : { (JSJitGetterOp)get_hash },
1396 : { prototypes::id::HTMLAreaElement },
1397 : { PrototypeTraits<prototypes::id::HTMLAreaElement>::Depth },
1398 : JSJitInfo::Getter,
1399 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1400 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
1401 : false, /* isInfallible. False in setters. */
1402 : false, /* isMovable. Not relevant for setters. */
1403 : false, /* isEliminatable. Not relevant for setters. */
1404 : false, /* isAlwaysInSlot. Only relevant for getters. */
1405 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1406 : false, /* isTypedMethod. Only relevant for methods. */
1407 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1408 : };
1409 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1410 : static_assert(0 < 1, "There is no slot for us");
1411 : static const JSJitInfo hash_setterinfo = {
1412 : { (JSJitGetterOp)set_hash },
1413 : { prototypes::id::HTMLAreaElement },
1414 : { PrototypeTraits<prototypes::id::HTMLAreaElement>::Depth },
1415 : JSJitInfo::Setter,
1416 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1417 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
1418 : false, /* isInfallible. False in setters. */
1419 : false, /* isMovable. Not relevant for setters. */
1420 : false, /* isEliminatable. Not relevant for setters. */
1421 : false, /* isAlwaysInSlot. Only relevant for getters. */
1422 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1423 : false, /* isTypedMethod. Only relevant for methods. */
1424 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1425 : };
1426 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1427 : static_assert(0 < 1, "There is no slot for us");
1428 :
1429 : static bool
1430 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
1431 : {
1432 0 : mozilla::dom::HTMLAreaElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLAreaElement>(obj);
1433 : // We don't want to preserve if we don't have a wrapper, and we
1434 : // obviously can't preserve if we're not initialized.
1435 0 : if (self && self->GetWrapperPreserveColor()) {
1436 0 : PreserveWrapper(self);
1437 : }
1438 0 : return true;
1439 : }
1440 :
1441 : static void
1442 0 : _finalize(js::FreeOp* fop, JSObject* obj)
1443 : {
1444 0 : mozilla::dom::HTMLAreaElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLAreaElement>(obj);
1445 0 : if (self) {
1446 0 : ClearWrapper(self, self, obj);
1447 0 : AddForDeferredFinalization<mozilla::dom::HTMLAreaElement>(self);
1448 : }
1449 0 : }
1450 :
1451 : static void
1452 0 : _objectMoved(JSObject* obj, const JSObject* old)
1453 : {
1454 0 : mozilla::dom::HTMLAreaElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLAreaElement>(obj);
1455 0 : if (self) {
1456 0 : UpdateWrapper(self, self, obj, old);
1457 : }
1458 0 : }
1459 :
1460 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
1461 : #if defined(__clang__)
1462 : #pragma clang diagnostic push
1463 : #pragma clang diagnostic ignored "-Wmissing-braces"
1464 : #endif
1465 : static const JSFunctionSpec sMethods_specs[] = {
1466 : JS_FNSPEC("toString", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&__stringifier_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
1467 : JS_FS_END
1468 : };
1469 : #if defined(__clang__)
1470 : #pragma clang diagnostic pop
1471 : #endif
1472 :
1473 :
1474 : // Can't be const because the pref-enabled boolean needs to be writable
1475 : static Prefable<const JSFunctionSpec> sMethods[] = {
1476 : { nullptr, &sMethods_specs[0] },
1477 : { nullptr, nullptr }
1478 : };
1479 :
1480 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
1481 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
1482 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
1483 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
1484 :
1485 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
1486 : #if defined(__clang__)
1487 : #pragma clang diagnostic push
1488 : #pragma clang diagnostic ignored "-Wmissing-braces"
1489 : #endif
1490 : static const JSPropertySpec sAttributes_specs[] = {
1491 : { "alt", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &alt_getterinfo, GenericBindingSetter, &alt_setterinfo },
1492 : { "coords", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &coords_getterinfo, GenericBindingSetter, &coords_setterinfo },
1493 : { "shape", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &shape_getterinfo, GenericBindingSetter, &shape_setterinfo },
1494 : { "target", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &target_getterinfo, GenericBindingSetter, &target_setterinfo },
1495 : { "download", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &download_getterinfo, GenericBindingSetter, &download_setterinfo },
1496 : { "ping", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &ping_getterinfo, GenericBindingSetter, &ping_setterinfo },
1497 : { "rel", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &rel_getterinfo, GenericBindingSetter, &rel_setterinfo },
1498 : { "referrerPolicy", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &referrerPolicy_getterinfo, GenericBindingSetter, &referrerPolicy_setterinfo },
1499 : { "relList", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &relList_getterinfo, GenericBindingSetter, &relList_setterinfo },
1500 : { "noHref", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &noHref_getterinfo, GenericBindingSetter, &noHref_setterinfo },
1501 : { "href", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &href_getterinfo, GenericBindingSetter, &href_setterinfo },
1502 : { "origin", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &origin_getterinfo, nullptr, nullptr },
1503 : { "protocol", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &protocol_getterinfo, GenericBindingSetter, &protocol_setterinfo },
1504 : { "username", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &username_getterinfo, GenericBindingSetter, &username_setterinfo },
1505 : { "password", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &password_getterinfo, GenericBindingSetter, &password_setterinfo },
1506 : { "host", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &host_getterinfo, GenericBindingSetter, &host_setterinfo },
1507 : { "hostname", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &hostname_getterinfo, GenericBindingSetter, &hostname_setterinfo },
1508 : { "port", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &port_getterinfo, GenericBindingSetter, &port_setterinfo },
1509 : { "pathname", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &pathname_getterinfo, GenericBindingSetter, &pathname_setterinfo },
1510 : { "search", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &search_getterinfo, GenericBindingSetter, &search_setterinfo },
1511 : { "hash", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &hash_getterinfo, GenericBindingSetter, &hash_setterinfo },
1512 : { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
1513 : };
1514 : #if defined(__clang__)
1515 : #pragma clang diagnostic pop
1516 : #endif
1517 :
1518 :
1519 : // Can't be const because the pref-enabled boolean needs to be writable
1520 : static Prefable<const JSPropertySpec> sAttributes[] = {
1521 : { nullptr, &sAttributes_specs[0] },
1522 : { nullptr, nullptr }
1523 : };
1524 :
1525 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
1526 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
1527 : static_assert(21 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
1528 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
1529 :
1530 :
1531 : static uint16_t sNativeProperties_sortedPropertyIndices[22];
1532 : static PropertyInfo sNativeProperties_propertyInfos[22];
1533 :
1534 : static const NativePropertiesN<2> sNativeProperties = {
1535 : false, 0,
1536 : false, 0,
1537 : true, 0 /* sMethods */,
1538 : true, 1 /* sAttributes */,
1539 : false, 0,
1540 : false, 0,
1541 : false, 0,
1542 : -1,
1543 : 22,
1544 : sNativeProperties_sortedPropertyIndices,
1545 : {
1546 : { sMethods, &sNativeProperties_propertyInfos[0] },
1547 : { sAttributes, &sNativeProperties_propertyInfos[1] }
1548 : }
1549 : };
1550 : static_assert(22 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
1551 : "We have a property info count that is oversized");
1552 :
1553 : static bool
1554 0 : _constructor(JSContext* cx, unsigned argc, JS::Value* vp)
1555 : {
1556 0 : JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
1557 0 : JS::Rooted<JSObject*> obj(cx, &args.callee());
1558 0 : if (!args.isConstructing()) {
1559 : // XXXbz wish I could get the name from the callee instead of
1560 : // Adding more relocations
1561 0 : return ThrowConstructorWithoutNew(cx, "HTMLAreaElement");
1562 : }
1563 :
1564 0 : GlobalObject global(cx, obj);
1565 0 : if (global.Failed()) {
1566 0 : return false;
1567 : }
1568 :
1569 : // The newTarget might be a cross-compartment wrapper. Get the underlying object
1570 : // so we can do the spec's object-identity checks.
1571 0 : JS::Rooted<JSObject*> newTarget(cx, js::CheckedUnwrap(&args.newTarget().toObject()));
1572 0 : if (!newTarget) {
1573 0 : return ThrowErrorMessage(cx, MSG_ILLEGAL_CONSTRUCTOR);
1574 : }
1575 :
1576 : // Step 2 of https://html.spec.whatwg.org/multipage/dom.html#htmlconstructor.
1577 : // Enter the compartment of our underlying newTarget object, so we end
1578 : // up comparing to the constructor object for our interface from that global.
1579 : {
1580 0 : JSAutoCompartment ac(cx, newTarget);
1581 0 : JS::Handle<JSObject*> constructor(GetConstructorObjectHandle(cx));
1582 0 : if (!constructor) {
1583 0 : return false;
1584 : }
1585 0 : if (newTarget == constructor) {
1586 0 : return ThrowErrorMessage(cx, MSG_ILLEGAL_CONSTRUCTOR);
1587 : }
1588 : }
1589 :
1590 0 : JS::Rooted<JSObject*> desiredProto(cx);
1591 0 : if (!GetDesiredProto(cx, args, &desiredProto)) {
1592 0 : return false;
1593 : }
1594 0 : if (!desiredProto) {
1595 : // Step 7 of https://html.spec.whatwg.org/multipage/dom.html#htmlconstructor.
1596 : // This fallback behavior is designed to match analogous behavior for the
1597 : // JavaScript built-ins. So we enter the compartment of our underlying
1598 : // newTarget object and fall back to the prototype object from that global.
1599 : // XXX The spec says to use GetFunctionRealm(), which is not actually
1600 : // the same thing as what we have here (e.g. in the case of scripted callable proxies
1601 : // whose target is not same-compartment with the proxy, or bound functions, etc).
1602 : // https://bugzilla.mozilla.org/show_bug.cgi?id=1317658
1603 : {
1604 0 : JSAutoCompartment ac(cx, newTarget);
1605 0 : desiredProto = GetProtoObjectHandle(cx);
1606 0 : if (!desiredProto) {
1607 0 : return false;
1608 : }
1609 : }
1610 :
1611 : // desiredProto is in the compartment of the underlying newTarget object.
1612 : // Wrap it into the context compartment.
1613 0 : if (!JS_WrapObject(cx, &desiredProto)) {
1614 0 : return false;
1615 : }
1616 : }
1617 :
1618 0 : bool objIsXray = xpc::WrapperFactory::IsXrayWrapper(obj);
1619 0 : Maybe<JSAutoCompartment> ac;
1620 0 : if (objIsXray) {
1621 0 : obj = js::CheckedUnwrap(obj);
1622 0 : if (!obj) {
1623 0 : return false;
1624 : }
1625 0 : ac.emplace(cx, obj);
1626 0 : if (!JS_WrapObject(cx, &desiredProto)) {
1627 0 : return false;
1628 : }
1629 : }
1630 0 : binding_detail::FastErrorResult rv;
1631 0 : auto result(StrongOrRawPtr<mozilla::dom::HTMLAreaElement>(CreateHTMLElement(global, args, rv)));
1632 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
1633 0 : return false;
1634 : }
1635 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1636 : static_assert(!IsPointer<decltype(result)>::value,
1637 : "NewObject implies that we need to keep the object alive with a strong reference.");
1638 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval(), desiredProto)) {
1639 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
1640 0 : return false;
1641 : }
1642 0 : return true;
1643 : }
1644 :
1645 : static const js::ClassOps sInterfaceObjectClassOps = {
1646 : nullptr, /* addProperty */
1647 : nullptr, /* delProperty */
1648 : nullptr, /* getProperty */
1649 : nullptr, /* setProperty */
1650 : nullptr, /* enumerate */
1651 : nullptr, /* newEnumerate */
1652 : nullptr, /* resolve */
1653 : nullptr, /* mayResolve */
1654 : nullptr, /* finalize */
1655 : _constructor, /* call */
1656 : nullptr, /* hasInstance */
1657 : _constructor, /* construct */
1658 : nullptr, /* trace */
1659 : };
1660 :
1661 : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
1662 : {
1663 : "Function",
1664 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
1665 : &sInterfaceObjectClassOps,
1666 : JS_NULL_CLASS_SPEC,
1667 : JS_NULL_CLASS_EXT,
1668 : &sInterfaceObjectClassObjectOps
1669 : },
1670 : eInterface,
1671 : true,
1672 : prototypes::id::HTMLAreaElement,
1673 : PrototypeTraits<prototypes::id::HTMLAreaElement>::Depth,
1674 : sNativePropertyHooks,
1675 : "function HTMLAreaElement() {\n [native code]\n}",
1676 : HTMLElementBinding::GetConstructorObject
1677 : };
1678 :
1679 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
1680 : {
1681 : "HTMLAreaElementPrototype",
1682 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
1683 : JS_NULL_CLASS_OPS,
1684 : JS_NULL_CLASS_SPEC,
1685 : JS_NULL_CLASS_EXT,
1686 : JS_NULL_OBJECT_OPS
1687 : },
1688 : eInterfacePrototype,
1689 : false,
1690 : prototypes::id::HTMLAreaElement,
1691 : PrototypeTraits<prototypes::id::HTMLAreaElement>::Depth,
1692 : sNativePropertyHooks,
1693 : "[object HTMLAreaElementPrototype]",
1694 : HTMLElementBinding::GetProtoObject
1695 : };
1696 :
1697 : JSObject*
1698 0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
1699 : {
1700 0 : return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
1701 : }
1702 :
1703 : static const js::ClassOps sClassOps = {
1704 : _addProperty, /* addProperty */
1705 : nullptr, /* delProperty */
1706 : nullptr, /* getProperty */
1707 : nullptr, /* setProperty */
1708 : nullptr, /* enumerate */
1709 : nullptr, /* newEnumerate */
1710 : nullptr, /* resolve */
1711 : nullptr, /* mayResolve */
1712 : _finalize, /* finalize */
1713 : nullptr, /* call */
1714 : nullptr, /* hasInstance */
1715 : nullptr, /* construct */
1716 : nullptr, /* trace */
1717 : };
1718 :
1719 : static const js::ClassExtension sClassExtension = {
1720 : nullptr, /* weakmapKeyDelegateOp */
1721 : _objectMoved /* objectMovedOp */
1722 : };
1723 :
1724 : static const DOMJSClass sClass = {
1725 : { "HTMLAreaElement",
1726 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
1727 : &sClassOps,
1728 : JS_NULL_CLASS_SPEC,
1729 : &sClassExtension,
1730 : JS_NULL_OBJECT_OPS
1731 : },
1732 : { prototypes::id::EventTarget, prototypes::id::Node, prototypes::id::Element, prototypes::id::HTMLElement, prototypes::id::HTMLAreaElement, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
1733 : IsBaseOf<nsISupports, mozilla::dom::HTMLAreaElement >::value,
1734 : sNativePropertyHooks,
1735 : FindAssociatedGlobalForNative<mozilla::dom::HTMLAreaElement>::Get,
1736 : GetProtoObjectHandle,
1737 : GetCCParticipant<mozilla::dom::HTMLAreaElement>::Get()
1738 : };
1739 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
1740 : "Must have the right minimal number of reserved slots.");
1741 : static_assert(1 >= 1,
1742 : "Must have enough reserved slots.");
1743 :
1744 : const JSClass*
1745 0 : GetJSClass()
1746 : {
1747 0 : return sClass.ToJSClass();
1748 : }
1749 :
1750 : bool
1751 0 : Wrap(JSContext* aCx, mozilla::dom::HTMLAreaElement* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
1752 : {
1753 : MOZ_ASSERT(static_cast<mozilla::dom::HTMLAreaElement*>(aObject) ==
1754 : reinterpret_cast<mozilla::dom::HTMLAreaElement*>(aObject),
1755 : "Multiple inheritance for mozilla::dom::HTMLAreaElement is broken.");
1756 : MOZ_ASSERT(static_cast<nsGenericHTMLElement*>(aObject) ==
1757 : reinterpret_cast<nsGenericHTMLElement*>(aObject),
1758 : "Multiple inheritance for nsGenericHTMLElement is broken.");
1759 : MOZ_ASSERT(static_cast<mozilla::dom::Element*>(aObject) ==
1760 : reinterpret_cast<mozilla::dom::Element*>(aObject),
1761 : "Multiple inheritance for mozilla::dom::Element is broken.");
1762 : MOZ_ASSERT(static_cast<nsINode*>(aObject) ==
1763 : reinterpret_cast<nsINode*>(aObject),
1764 : "Multiple inheritance for nsINode is broken.");
1765 : MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) ==
1766 : reinterpret_cast<mozilla::dom::EventTarget*>(aObject),
1767 : "Multiple inheritance for mozilla::dom::EventTarget is broken.");
1768 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
1769 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
1770 0 : MOZ_ASSERT(!aCache->GetWrapper(),
1771 : "You should probably not be using Wrap() directly; use "
1772 : "GetOrCreateDOMReflector instead");
1773 :
1774 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
1775 : "nsISupports must be on our primary inheritance chain");
1776 :
1777 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
1778 0 : if (!global) {
1779 0 : return false;
1780 : }
1781 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
1782 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
1783 :
1784 : // That might have ended up wrapping us already, due to the wonders
1785 : // of XBL. Check for that, and bail out as needed.
1786 0 : aReflector.set(aCache->GetWrapper());
1787 0 : if (aReflector) {
1788 : #ifdef DEBUG
1789 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
1790 : #endif // DEBUG
1791 0 : return true;
1792 : }
1793 :
1794 0 : JSAutoCompartment ac(aCx, global);
1795 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
1796 0 : if (!canonicalProto) {
1797 0 : return false;
1798 : }
1799 0 : JS::Rooted<JSObject*> proto(aCx);
1800 0 : if (aGivenProto) {
1801 0 : proto = aGivenProto;
1802 : // Unfortunately, while aGivenProto was in the compartment of aCx
1803 : // coming in, we changed compartments to that of "parent" so may need
1804 : // to wrap the proto here.
1805 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
1806 0 : if (!JS_WrapObject(aCx, &proto)) {
1807 0 : return false;
1808 : }
1809 : }
1810 : } else {
1811 0 : proto = canonicalProto;
1812 : }
1813 :
1814 0 : BindingJSObjectCreator<mozilla::dom::HTMLAreaElement> creator(aCx);
1815 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
1816 0 : if (!aReflector) {
1817 0 : return false;
1818 : }
1819 :
1820 0 : aCache->SetWrapper(aReflector);
1821 0 : creator.InitializationSucceeded();
1822 :
1823 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
1824 : aCache->GetWrapperPreserveColor() == aReflector);
1825 : // If proto != canonicalProto, we have to preserve our wrapper;
1826 : // otherwise we won't be able to properly recreate it later, since
1827 : // we won't know what proto to use. Note that we don't check
1828 : // aGivenProto here, since it's entirely possible (and even
1829 : // somewhat common) to have a non-null aGivenProto which is the
1830 : // same as canonicalProto.
1831 0 : if (proto != canonicalProto) {
1832 0 : PreserveWrapper(aObject);
1833 : }
1834 :
1835 0 : return true;
1836 : }
1837 :
1838 : const NativePropertyHooks sNativePropertyHooks[] = { {
1839 : nullptr,
1840 : nullptr,
1841 : nullptr,
1842 : { sNativeProperties.Upcast(), nullptr },
1843 : prototypes::id::HTMLAreaElement,
1844 : constructors::id::HTMLAreaElement,
1845 : HTMLElementBinding::sNativePropertyHooks,
1846 : &DefaultXrayExpandoObjectClass
1847 : } };
1848 :
1849 : void
1850 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
1851 : {
1852 0 : JS::Handle<JSObject*> parentProto(HTMLElementBinding::GetProtoObjectHandle(aCx));
1853 0 : if (!parentProto) {
1854 0 : return;
1855 : }
1856 :
1857 0 : JS::Handle<JSObject*> constructorProto(HTMLElementBinding::GetConstructorObjectHandle(aCx));
1858 0 : if (!constructorProto) {
1859 0 : return;
1860 : }
1861 :
1862 : static bool sIdsInited = false;
1863 0 : if (!sIdsInited && NS_IsMainThread()) {
1864 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
1865 0 : return;
1866 : }
1867 0 : sIdsInited = true;
1868 : }
1869 :
1870 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::HTMLAreaElement);
1871 0 : JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::HTMLAreaElement);
1872 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
1873 : &sPrototypeClass.mBase, protoCache,
1874 : constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
1875 : interfaceCache,
1876 : sNativeProperties.Upcast(),
1877 : nullptr,
1878 : "HTMLAreaElement", aDefineOnGlobal,
1879 : nullptr,
1880 0 : false);
1881 : }
1882 :
1883 : JS::Handle<JSObject*>
1884 0 : GetProtoObjectHandle(JSContext* aCx)
1885 : {
1886 : /* Get the interface prototype object for this class. This will create the
1887 : object as needed. */
1888 0 : bool aDefineOnGlobal = true;
1889 :
1890 : /* Make sure our global is sane. Hopefully we can remove this sometime */
1891 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
1892 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
1893 0 : return nullptr;
1894 : }
1895 :
1896 : /* Check to see whether the interface objects are already installed */
1897 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
1898 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::HTMLAreaElement)) {
1899 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
1900 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
1901 : }
1902 :
1903 : /*
1904 : * The object might _still_ be null, but that's OK.
1905 : *
1906 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
1907 : * traced by TraceProtoAndIfaceCache() and its contents are never
1908 : * changed after they have been set.
1909 : *
1910 : * Calling address() avoids the read read barrier that does gray
1911 : * unmarking, but it's not possible for the object to be gray here.
1912 : */
1913 :
1914 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::HTMLAreaElement);
1915 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
1916 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
1917 : }
1918 :
1919 : JS::Handle<JSObject*>
1920 0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
1921 : {
1922 : /* Get the interface object for this class. This will create the object as
1923 : needed. */
1924 :
1925 : /* Make sure our global is sane. Hopefully we can remove this sometime */
1926 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
1927 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
1928 0 : return nullptr;
1929 : }
1930 :
1931 : /* Check to see whether the interface objects are already installed */
1932 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
1933 0 : if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::HTMLAreaElement)) {
1934 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
1935 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
1936 : }
1937 :
1938 : /*
1939 : * The object might _still_ be null, but that's OK.
1940 : *
1941 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
1942 : * traced by TraceProtoAndIfaceCache() and its contents are never
1943 : * changed after they have been set.
1944 : *
1945 : * Calling address() avoids the read read barrier that does gray
1946 : * unmarking, but it's not possible for the object to be gray here.
1947 : */
1948 :
1949 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::HTMLAreaElement);
1950 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
1951 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
1952 : }
1953 :
1954 : JSObject*
1955 0 : GetConstructorObject(JSContext* aCx)
1956 : {
1957 0 : return GetConstructorObjectHandle(aCx);
1958 : }
1959 :
1960 : } // namespace HTMLAreaElementBinding
1961 :
1962 :
1963 :
1964 : } // namespace dom
1965 : } // namespace mozilla
|