Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM HTMLTextAreaElement.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #include "HTMLElementBinding.h"
4 : #include "HTMLTextAreaElementBinding.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/HTMLFormElement.h"
11 : #include "mozilla/dom/HTMLTextAreaElement.h"
12 : #include "mozilla/dom/NonRefcountedDOMObject.h"
13 : #include "mozilla/dom/Nullable.h"
14 : #include "mozilla/dom/PrimitiveConversions.h"
15 : #include "mozilla/dom/ValidityState.h"
16 : #include "mozilla/dom/XrayExpandoClass.h"
17 : #include "nsContentUtils.h"
18 : #include "nsIControllers.h"
19 : #include "nsIEditor.h"
20 : #include "nsINodeList.h"
21 :
22 : namespace mozilla {
23 : namespace dom {
24 :
25 : namespace HTMLTextAreaElementBinding {
26 :
27 : static_assert(IsRefcounted<NativeType>::value == IsRefcounted<HTMLElementBinding::NativeType>::value,
28 : "Can't inherit from an interface with a different ownership model.");
29 :
30 : static bool
31 0 : get_autofocus(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitGetterCallArgs args)
32 : {
33 0 : bool result(self->Autofocus());
34 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
35 0 : args.rval().setBoolean(result);
36 0 : return true;
37 : }
38 :
39 : static bool
40 0 : set_autofocus(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitSetterCallArgs args)
41 : {
42 : bool arg0;
43 0 : if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) {
44 0 : return false;
45 : }
46 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
47 0 : Maybe<AutoCEReaction> ceReaction;
48 0 : if (reactionsStack) {
49 0 : ceReaction.emplace(reactionsStack);
50 : }
51 0 : binding_detail::FastErrorResult rv;
52 0 : self->SetAutofocus(arg0, rv);
53 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
54 0 : return false;
55 : }
56 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
57 :
58 0 : return true;
59 : }
60 :
61 : static const JSJitInfo autofocus_getterinfo = {
62 : { (JSJitGetterOp)get_autofocus },
63 : { prototypes::id::HTMLTextAreaElement },
64 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
65 : JSJitInfo::Getter,
66 : JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */
67 : JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */
68 : true, /* isInfallible. False in setters. */
69 : true, /* isMovable. Not relevant for setters. */
70 : true, /* isEliminatable. Not relevant for setters. */
71 : false, /* isAlwaysInSlot. Only relevant for getters. */
72 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
73 : false, /* isTypedMethod. Only relevant for methods. */
74 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
75 : };
76 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
77 : static_assert(0 < 1, "There is no slot for us");
78 : static const JSJitInfo autofocus_setterinfo = {
79 : { (JSJitGetterOp)set_autofocus },
80 : { prototypes::id::HTMLTextAreaElement },
81 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
82 : JSJitInfo::Setter,
83 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
84 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
85 : false, /* isInfallible. False in setters. */
86 : false, /* isMovable. Not relevant for setters. */
87 : false, /* isEliminatable. Not relevant for setters. */
88 : false, /* isAlwaysInSlot. Only relevant for getters. */
89 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
90 : false, /* isTypedMethod. Only relevant for methods. */
91 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
92 : };
93 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
94 : static_assert(0 < 1, "There is no slot for us");
95 :
96 : static bool
97 0 : get_cols(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitGetterCallArgs args)
98 : {
99 0 : uint32_t result(self->Cols());
100 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
101 0 : args.rval().setNumber(result);
102 0 : return true;
103 : }
104 :
105 : static bool
106 0 : set_cols(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitSetterCallArgs args)
107 : {
108 : uint32_t arg0;
109 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &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->SetCols(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 cols_getterinfo = {
128 : { (JSJitGetterOp)get_cols },
129 : { prototypes::id::HTMLTextAreaElement },
130 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
131 : JSJitInfo::Getter,
132 : JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */
133 : JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */
134 : true, /* isInfallible. False in setters. */
135 : true, /* isMovable. Not relevant for setters. */
136 : true, /* 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 cols_setterinfo = {
145 : { (JSJitGetterOp)set_cols },
146 : { prototypes::id::HTMLTextAreaElement },
147 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::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_disabled(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitGetterCallArgs args)
164 : {
165 0 : bool result(self->Disabled());
166 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
167 0 : args.rval().setBoolean(result);
168 0 : return true;
169 : }
170 :
171 : static bool
172 0 : set_disabled(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitSetterCallArgs args)
173 : {
174 : bool arg0;
175 0 : if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) {
176 0 : return false;
177 : }
178 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
179 0 : Maybe<AutoCEReaction> ceReaction;
180 0 : if (reactionsStack) {
181 0 : ceReaction.emplace(reactionsStack);
182 : }
183 0 : binding_detail::FastErrorResult rv;
184 0 : self->SetDisabled(arg0, rv);
185 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
186 0 : return false;
187 : }
188 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
189 :
190 0 : return true;
191 : }
192 :
193 : static const JSJitInfo disabled_getterinfo = {
194 : { (JSJitGetterOp)get_disabled },
195 : { prototypes::id::HTMLTextAreaElement },
196 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
197 : JSJitInfo::Getter,
198 : JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */
199 : JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */
200 : true, /* isInfallible. False in setters. */
201 : true, /* isMovable. Not relevant for setters. */
202 : true, /* isEliminatable. Not relevant for setters. */
203 : false, /* isAlwaysInSlot. Only relevant for getters. */
204 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
205 : false, /* isTypedMethod. Only relevant for methods. */
206 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
207 : };
208 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
209 : static_assert(0 < 1, "There is no slot for us");
210 : static const JSJitInfo disabled_setterinfo = {
211 : { (JSJitGetterOp)set_disabled },
212 : { prototypes::id::HTMLTextAreaElement },
213 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
214 : JSJitInfo::Setter,
215 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
216 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
217 : false, /* isInfallible. False in setters. */
218 : false, /* isMovable. Not relevant for setters. */
219 : false, /* isEliminatable. Not relevant for setters. */
220 : false, /* isAlwaysInSlot. Only relevant for getters. */
221 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
222 : false, /* isTypedMethod. Only relevant for methods. */
223 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
224 : };
225 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
226 : static_assert(0 < 1, "There is no slot for us");
227 :
228 : static bool
229 0 : get_form(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitGetterCallArgs args)
230 : {
231 0 : auto result(StrongOrRawPtr<mozilla::dom::HTMLFormElement>(self->GetForm()));
232 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
233 0 : if (!result) {
234 0 : args.rval().setNull();
235 0 : return true;
236 : }
237 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
238 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
239 0 : return false;
240 : }
241 0 : return true;
242 : }
243 :
244 : static const JSJitInfo form_getterinfo = {
245 : { (JSJitGetterOp)get_form },
246 : { prototypes::id::HTMLTextAreaElement },
247 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
248 : JSJitInfo::Getter,
249 : JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */
250 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
251 : false, /* isInfallible. False in setters. */
252 : true, /* isMovable. Not relevant for setters. */
253 : true, /* isEliminatable. Not relevant for setters. */
254 : false, /* isAlwaysInSlot. Only relevant for getters. */
255 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
256 : false, /* isTypedMethod. Only relevant for methods. */
257 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
258 : };
259 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
260 : static_assert(0 < 1, "There is no slot for us");
261 :
262 : static bool
263 0 : get_maxLength(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitGetterCallArgs args)
264 : {
265 0 : int32_t result(self->MaxLength());
266 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
267 0 : args.rval().setInt32(int32_t(result));
268 0 : return true;
269 : }
270 :
271 : static bool
272 0 : set_maxLength(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitSetterCallArgs args)
273 : {
274 : int32_t arg0;
275 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) {
276 0 : return false;
277 : }
278 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
279 0 : Maybe<AutoCEReaction> ceReaction;
280 0 : if (reactionsStack) {
281 0 : ceReaction.emplace(reactionsStack);
282 : }
283 0 : binding_detail::FastErrorResult rv;
284 0 : self->SetMaxLength(arg0, rv);
285 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
286 0 : return false;
287 : }
288 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
289 :
290 0 : return true;
291 : }
292 :
293 : static const JSJitInfo maxLength_getterinfo = {
294 : { (JSJitGetterOp)get_maxLength },
295 : { prototypes::id::HTMLTextAreaElement },
296 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
297 : JSJitInfo::Getter,
298 : JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */
299 : JSVAL_TYPE_INT32, /* returnType. Not relevant for setters. */
300 : true, /* isInfallible. False in setters. */
301 : true, /* isMovable. Not relevant for setters. */
302 : true, /* isEliminatable. Not relevant for setters. */
303 : false, /* isAlwaysInSlot. Only relevant for getters. */
304 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
305 : false, /* isTypedMethod. Only relevant for methods. */
306 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
307 : };
308 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
309 : static_assert(0 < 1, "There is no slot for us");
310 : static const JSJitInfo maxLength_setterinfo = {
311 : { (JSJitGetterOp)set_maxLength },
312 : { prototypes::id::HTMLTextAreaElement },
313 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
314 : JSJitInfo::Setter,
315 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
316 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
317 : false, /* isInfallible. False in setters. */
318 : false, /* isMovable. Not relevant for setters. */
319 : false, /* isEliminatable. Not relevant for setters. */
320 : false, /* isAlwaysInSlot. Only relevant for getters. */
321 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
322 : false, /* isTypedMethod. Only relevant for methods. */
323 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
324 : };
325 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
326 : static_assert(0 < 1, "There is no slot for us");
327 :
328 : static bool
329 0 : get_minLength(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitGetterCallArgs args)
330 : {
331 0 : int32_t result(self->MinLength());
332 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
333 0 : args.rval().setInt32(int32_t(result));
334 0 : return true;
335 : }
336 :
337 : static bool
338 0 : set_minLength(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitSetterCallArgs args)
339 : {
340 : int32_t arg0;
341 0 : if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) {
342 0 : return false;
343 : }
344 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
345 0 : Maybe<AutoCEReaction> ceReaction;
346 0 : if (reactionsStack) {
347 0 : ceReaction.emplace(reactionsStack);
348 : }
349 0 : binding_detail::FastErrorResult rv;
350 0 : self->SetMinLength(arg0, rv);
351 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
352 0 : return false;
353 : }
354 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
355 :
356 0 : return true;
357 : }
358 :
359 : static const JSJitInfo minLength_getterinfo = {
360 : { (JSJitGetterOp)get_minLength },
361 : { prototypes::id::HTMLTextAreaElement },
362 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
363 : JSJitInfo::Getter,
364 : JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */
365 : JSVAL_TYPE_INT32, /* returnType. Not relevant for setters. */
366 : true, /* isInfallible. False in setters. */
367 : true, /* isMovable. Not relevant for setters. */
368 : true, /* isEliminatable. Not relevant for setters. */
369 : false, /* isAlwaysInSlot. Only relevant for getters. */
370 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
371 : false, /* isTypedMethod. Only relevant for methods. */
372 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
373 : };
374 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
375 : static_assert(0 < 1, "There is no slot for us");
376 : static const JSJitInfo minLength_setterinfo = {
377 : { (JSJitGetterOp)set_minLength },
378 : { prototypes::id::HTMLTextAreaElement },
379 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
380 : JSJitInfo::Setter,
381 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
382 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
383 : false, /* isInfallible. False in setters. */
384 : false, /* isMovable. Not relevant for setters. */
385 : false, /* isEliminatable. Not relevant for setters. */
386 : false, /* isAlwaysInSlot. Only relevant for getters. */
387 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
388 : false, /* isTypedMethod. Only relevant for methods. */
389 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
390 : };
391 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
392 : static_assert(0 < 1, "There is no slot for us");
393 :
394 : static bool
395 0 : get_name(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitGetterCallArgs args)
396 : {
397 0 : DOMString result;
398 0 : self->GetName(result);
399 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
400 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
401 0 : return false;
402 : }
403 0 : return true;
404 : }
405 :
406 : static bool
407 0 : set_name(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitSetterCallArgs args)
408 : {
409 0 : binding_detail::FakeString arg0;
410 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
411 0 : return false;
412 : }
413 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
414 0 : Maybe<AutoCEReaction> ceReaction;
415 0 : if (reactionsStack) {
416 0 : ceReaction.emplace(reactionsStack);
417 : }
418 0 : binding_detail::FastErrorResult rv;
419 0 : self->SetName(NonNullHelper(Constify(arg0)), rv);
420 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
421 0 : return false;
422 : }
423 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
424 :
425 0 : return true;
426 : }
427 :
428 : static const JSJitInfo name_getterinfo = {
429 : { (JSJitGetterOp)get_name },
430 : { prototypes::id::HTMLTextAreaElement },
431 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
432 : JSJitInfo::Getter,
433 : JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */
434 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
435 : false, /* isInfallible. False in setters. */
436 : true, /* isMovable. Not relevant for setters. */
437 : true, /* isEliminatable. Not relevant for setters. */
438 : false, /* isAlwaysInSlot. Only relevant for getters. */
439 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
440 : false, /* isTypedMethod. Only relevant for methods. */
441 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
442 : };
443 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
444 : static_assert(0 < 1, "There is no slot for us");
445 : static const JSJitInfo name_setterinfo = {
446 : { (JSJitGetterOp)set_name },
447 : { prototypes::id::HTMLTextAreaElement },
448 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
449 : JSJitInfo::Setter,
450 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
451 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
452 : false, /* isInfallible. False in setters. */
453 : false, /* isMovable. Not relevant for setters. */
454 : false, /* isEliminatable. Not relevant for setters. */
455 : false, /* isAlwaysInSlot. Only relevant for getters. */
456 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
457 : false, /* isTypedMethod. Only relevant for methods. */
458 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
459 : };
460 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
461 : static_assert(0 < 1, "There is no slot for us");
462 :
463 : static bool
464 0 : get_placeholder(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitGetterCallArgs args)
465 : {
466 0 : DOMString result;
467 0 : self->GetPlaceholder(result);
468 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
469 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
470 0 : return false;
471 : }
472 0 : return true;
473 : }
474 :
475 : static bool
476 0 : set_placeholder(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitSetterCallArgs args)
477 : {
478 0 : binding_detail::FakeString arg0;
479 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
480 0 : return false;
481 : }
482 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
483 0 : Maybe<AutoCEReaction> ceReaction;
484 0 : if (reactionsStack) {
485 0 : ceReaction.emplace(reactionsStack);
486 : }
487 0 : binding_detail::FastErrorResult rv;
488 0 : self->SetPlaceholder(NonNullHelper(Constify(arg0)), rv);
489 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
490 0 : return false;
491 : }
492 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
493 :
494 0 : return true;
495 : }
496 :
497 : static const JSJitInfo placeholder_getterinfo = {
498 : { (JSJitGetterOp)get_placeholder },
499 : { prototypes::id::HTMLTextAreaElement },
500 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
501 : JSJitInfo::Getter,
502 : JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */
503 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
504 : false, /* isInfallible. False in setters. */
505 : true, /* isMovable. Not relevant for setters. */
506 : true, /* isEliminatable. Not relevant for setters. */
507 : false, /* isAlwaysInSlot. Only relevant for getters. */
508 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
509 : false, /* isTypedMethod. Only relevant for methods. */
510 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
511 : };
512 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
513 : static_assert(0 < 1, "There is no slot for us");
514 : static const JSJitInfo placeholder_setterinfo = {
515 : { (JSJitGetterOp)set_placeholder },
516 : { prototypes::id::HTMLTextAreaElement },
517 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
518 : JSJitInfo::Setter,
519 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
520 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
521 : false, /* isInfallible. False in setters. */
522 : false, /* isMovable. Not relevant for setters. */
523 : false, /* isEliminatable. Not relevant for setters. */
524 : false, /* isAlwaysInSlot. Only relevant for getters. */
525 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
526 : false, /* isTypedMethod. Only relevant for methods. */
527 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
528 : };
529 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
530 : static_assert(0 < 1, "There is no slot for us");
531 :
532 : static bool
533 0 : get_readOnly(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitGetterCallArgs args)
534 : {
535 0 : bool result(self->ReadOnly());
536 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
537 0 : args.rval().setBoolean(result);
538 0 : return true;
539 : }
540 :
541 : static bool
542 0 : set_readOnly(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitSetterCallArgs args)
543 : {
544 : bool arg0;
545 0 : if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) {
546 0 : return false;
547 : }
548 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
549 0 : Maybe<AutoCEReaction> ceReaction;
550 0 : if (reactionsStack) {
551 0 : ceReaction.emplace(reactionsStack);
552 : }
553 0 : binding_detail::FastErrorResult rv;
554 0 : self->SetReadOnly(arg0, rv);
555 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
556 0 : return false;
557 : }
558 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
559 :
560 0 : return true;
561 : }
562 :
563 : static const JSJitInfo readOnly_getterinfo = {
564 : { (JSJitGetterOp)get_readOnly },
565 : { prototypes::id::HTMLTextAreaElement },
566 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
567 : JSJitInfo::Getter,
568 : JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */
569 : JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */
570 : true, /* isInfallible. False in setters. */
571 : true, /* isMovable. Not relevant for setters. */
572 : true, /* isEliminatable. Not relevant for setters. */
573 : false, /* isAlwaysInSlot. Only relevant for getters. */
574 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
575 : false, /* isTypedMethod. Only relevant for methods. */
576 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
577 : };
578 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
579 : static_assert(0 < 1, "There is no slot for us");
580 : static const JSJitInfo readOnly_setterinfo = {
581 : { (JSJitGetterOp)set_readOnly },
582 : { prototypes::id::HTMLTextAreaElement },
583 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
584 : JSJitInfo::Setter,
585 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
586 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
587 : false, /* isInfallible. False in setters. */
588 : false, /* isMovable. Not relevant for setters. */
589 : false, /* isEliminatable. Not relevant for setters. */
590 : false, /* isAlwaysInSlot. Only relevant for getters. */
591 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
592 : false, /* isTypedMethod. Only relevant for methods. */
593 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
594 : };
595 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
596 : static_assert(0 < 1, "There is no slot for us");
597 :
598 : static bool
599 0 : get_required(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitGetterCallArgs args)
600 : {
601 0 : bool result(self->Required());
602 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
603 0 : args.rval().setBoolean(result);
604 0 : return true;
605 : }
606 :
607 : static bool
608 0 : set_required(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitSetterCallArgs args)
609 : {
610 : bool arg0;
611 0 : if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) {
612 0 : return false;
613 : }
614 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
615 0 : Maybe<AutoCEReaction> ceReaction;
616 0 : if (reactionsStack) {
617 0 : ceReaction.emplace(reactionsStack);
618 : }
619 0 : binding_detail::FastErrorResult rv;
620 0 : self->SetRequired(arg0, rv);
621 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
622 0 : return false;
623 : }
624 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
625 :
626 0 : return true;
627 : }
628 :
629 : static const JSJitInfo required_getterinfo = {
630 : { (JSJitGetterOp)get_required },
631 : { prototypes::id::HTMLTextAreaElement },
632 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
633 : JSJitInfo::Getter,
634 : JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */
635 : JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */
636 : true, /* isInfallible. False in setters. */
637 : true, /* isMovable. Not relevant for setters. */
638 : true, /* isEliminatable. Not relevant for setters. */
639 : false, /* isAlwaysInSlot. Only relevant for getters. */
640 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
641 : false, /* isTypedMethod. Only relevant for methods. */
642 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
643 : };
644 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
645 : static_assert(0 < 1, "There is no slot for us");
646 : static const JSJitInfo required_setterinfo = {
647 : { (JSJitGetterOp)set_required },
648 : { prototypes::id::HTMLTextAreaElement },
649 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
650 : JSJitInfo::Setter,
651 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
652 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
653 : false, /* isInfallible. False in setters. */
654 : false, /* isMovable. Not relevant for setters. */
655 : false, /* isEliminatable. Not relevant for setters. */
656 : false, /* isAlwaysInSlot. Only relevant for getters. */
657 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
658 : false, /* isTypedMethod. Only relevant for methods. */
659 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
660 : };
661 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
662 : static_assert(0 < 1, "There is no slot for us");
663 :
664 : static bool
665 0 : get_rows(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitGetterCallArgs args)
666 : {
667 0 : uint32_t result(self->Rows());
668 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
669 0 : args.rval().setNumber(result);
670 0 : return true;
671 : }
672 :
673 : static bool
674 0 : set_rows(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitSetterCallArgs args)
675 : {
676 : uint32_t arg0;
677 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
678 0 : return false;
679 : }
680 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
681 0 : Maybe<AutoCEReaction> ceReaction;
682 0 : if (reactionsStack) {
683 0 : ceReaction.emplace(reactionsStack);
684 : }
685 0 : binding_detail::FastErrorResult rv;
686 0 : self->SetRows(arg0, rv);
687 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
688 0 : return false;
689 : }
690 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
691 :
692 0 : return true;
693 : }
694 :
695 : static const JSJitInfo rows_getterinfo = {
696 : { (JSJitGetterOp)get_rows },
697 : { prototypes::id::HTMLTextAreaElement },
698 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
699 : JSJitInfo::Getter,
700 : JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */
701 : JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */
702 : true, /* isInfallible. False in setters. */
703 : true, /* isMovable. Not relevant for setters. */
704 : true, /* isEliminatable. Not relevant for setters. */
705 : false, /* isAlwaysInSlot. Only relevant for getters. */
706 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
707 : false, /* isTypedMethod. Only relevant for methods. */
708 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
709 : };
710 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
711 : static_assert(0 < 1, "There is no slot for us");
712 : static const JSJitInfo rows_setterinfo = {
713 : { (JSJitGetterOp)set_rows },
714 : { prototypes::id::HTMLTextAreaElement },
715 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
716 : JSJitInfo::Setter,
717 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
718 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
719 : false, /* isInfallible. False in setters. */
720 : false, /* isMovable. Not relevant for setters. */
721 : false, /* isEliminatable. Not relevant for setters. */
722 : false, /* isAlwaysInSlot. Only relevant for getters. */
723 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
724 : false, /* isTypedMethod. Only relevant for methods. */
725 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
726 : };
727 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
728 : static_assert(0 < 1, "There is no slot for us");
729 :
730 : static bool
731 0 : get_wrap(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitGetterCallArgs args)
732 : {
733 0 : DOMString result;
734 0 : self->GetWrap(result);
735 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
736 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
737 0 : return false;
738 : }
739 0 : return true;
740 : }
741 :
742 : static bool
743 0 : set_wrap(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitSetterCallArgs args)
744 : {
745 0 : binding_detail::FakeString arg0;
746 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
747 0 : return false;
748 : }
749 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
750 0 : Maybe<AutoCEReaction> ceReaction;
751 0 : if (reactionsStack) {
752 0 : ceReaction.emplace(reactionsStack);
753 : }
754 0 : binding_detail::FastErrorResult rv;
755 0 : self->SetWrap(NonNullHelper(Constify(arg0)), rv);
756 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
757 0 : return false;
758 : }
759 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
760 :
761 0 : return true;
762 : }
763 :
764 : static const JSJitInfo wrap_getterinfo = {
765 : { (JSJitGetterOp)get_wrap },
766 : { prototypes::id::HTMLTextAreaElement },
767 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
768 : JSJitInfo::Getter,
769 : JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */
770 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
771 : false, /* isInfallible. False in setters. */
772 : true, /* isMovable. Not relevant for setters. */
773 : true, /* isEliminatable. Not relevant for setters. */
774 : false, /* isAlwaysInSlot. Only relevant for getters. */
775 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
776 : false, /* isTypedMethod. Only relevant for methods. */
777 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
778 : };
779 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
780 : static_assert(0 < 1, "There is no slot for us");
781 : static const JSJitInfo wrap_setterinfo = {
782 : { (JSJitGetterOp)set_wrap },
783 : { prototypes::id::HTMLTextAreaElement },
784 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
785 : JSJitInfo::Setter,
786 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
787 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
788 : false, /* isInfallible. False in setters. */
789 : false, /* isMovable. Not relevant for setters. */
790 : false, /* isEliminatable. Not relevant for setters. */
791 : false, /* isAlwaysInSlot. Only relevant for getters. */
792 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
793 : false, /* isTypedMethod. Only relevant for methods. */
794 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
795 : };
796 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
797 : static_assert(0 < 1, "There is no slot for us");
798 :
799 : static bool
800 0 : get_type(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitGetterCallArgs args)
801 : {
802 0 : DOMString result;
803 0 : self->GetType(result);
804 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
805 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
806 0 : return false;
807 : }
808 0 : return true;
809 : }
810 :
811 : static const JSJitInfo type_getterinfo = {
812 : { (JSJitGetterOp)get_type },
813 : { prototypes::id::HTMLTextAreaElement },
814 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
815 : JSJitInfo::Getter,
816 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
817 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
818 : false, /* isInfallible. False in setters. */
819 : true, /* isMovable. Not relevant for setters. */
820 : true, /* isEliminatable. Not relevant for setters. */
821 : false, /* isAlwaysInSlot. Only relevant for getters. */
822 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
823 : false, /* isTypedMethod. Only relevant for methods. */
824 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
825 : };
826 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
827 : static_assert(0 < 1, "There is no slot for us");
828 :
829 : static bool
830 0 : get_defaultValue(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitGetterCallArgs args)
831 : {
832 0 : DOMString result;
833 0 : self->GetDefaultValue(result);
834 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
835 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
836 0 : return false;
837 : }
838 0 : return true;
839 : }
840 :
841 : static bool
842 0 : set_defaultValue(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitSetterCallArgs args)
843 : {
844 0 : binding_detail::FakeString arg0;
845 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
846 0 : return false;
847 : }
848 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
849 0 : Maybe<AutoCEReaction> ceReaction;
850 0 : if (reactionsStack) {
851 0 : ceReaction.emplace(reactionsStack);
852 : }
853 0 : binding_detail::FastErrorResult rv;
854 0 : self->SetDefaultValue(NonNullHelper(Constify(arg0)), rv);
855 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
856 0 : return false;
857 : }
858 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
859 :
860 0 : return true;
861 : }
862 :
863 : static const JSJitInfo defaultValue_getterinfo = {
864 : { (JSJitGetterOp)get_defaultValue },
865 : { prototypes::id::HTMLTextAreaElement },
866 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
867 : JSJitInfo::Getter,
868 : JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */
869 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
870 : false, /* isInfallible. False in setters. */
871 : true, /* isMovable. Not relevant for setters. */
872 : true, /* isEliminatable. Not relevant for setters. */
873 : false, /* isAlwaysInSlot. Only relevant for getters. */
874 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
875 : false, /* isTypedMethod. Only relevant for methods. */
876 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
877 : };
878 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
879 : static_assert(0 < 1, "There is no slot for us");
880 : static const JSJitInfo defaultValue_setterinfo = {
881 : { (JSJitGetterOp)set_defaultValue },
882 : { prototypes::id::HTMLTextAreaElement },
883 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
884 : JSJitInfo::Setter,
885 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
886 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
887 : false, /* isInfallible. False in setters. */
888 : false, /* isMovable. Not relevant for setters. */
889 : false, /* isEliminatable. Not relevant for setters. */
890 : false, /* isAlwaysInSlot. Only relevant for getters. */
891 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
892 : false, /* isTypedMethod. Only relevant for methods. */
893 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
894 : };
895 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
896 : static_assert(0 < 1, "There is no slot for us");
897 :
898 : static bool
899 0 : get_value(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitGetterCallArgs args)
900 : {
901 0 : DOMString result;
902 0 : self->GetValue(result);
903 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
904 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
905 0 : return false;
906 : }
907 0 : return true;
908 : }
909 :
910 : static bool
911 0 : set_value(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitSetterCallArgs args)
912 : {
913 0 : binding_detail::FakeString arg0;
914 0 : if (!ConvertJSValueToString(cx, args[0], eEmpty, eStringify, arg0)) {
915 0 : return false;
916 : }
917 0 : CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(obj);
918 0 : Maybe<AutoCEReaction> ceReaction;
919 0 : if (reactionsStack) {
920 0 : ceReaction.emplace(reactionsStack);
921 : }
922 0 : self->SetValue(NonNullHelper(Constify(arg0)));
923 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
924 :
925 0 : return true;
926 : }
927 :
928 : static const JSJitInfo value_getterinfo = {
929 : { (JSJitGetterOp)get_value },
930 : { prototypes::id::HTMLTextAreaElement },
931 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
932 : JSJitInfo::Getter,
933 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
934 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
935 : false, /* isInfallible. False in setters. */
936 : false, /* isMovable. Not relevant for setters. */
937 : false, /* isEliminatable. Not relevant for setters. */
938 : false, /* isAlwaysInSlot. Only relevant for getters. */
939 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
940 : false, /* isTypedMethod. Only relevant for methods. */
941 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
942 : };
943 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
944 : static_assert(0 < 1, "There is no slot for us");
945 : static const JSJitInfo value_setterinfo = {
946 : { (JSJitGetterOp)set_value },
947 : { prototypes::id::HTMLTextAreaElement },
948 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
949 : JSJitInfo::Setter,
950 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
951 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
952 : false, /* isInfallible. False in setters. */
953 : false, /* isMovable. Not relevant for setters. */
954 : false, /* isEliminatable. Not relevant for setters. */
955 : false, /* isAlwaysInSlot. Only relevant for getters. */
956 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
957 : false, /* isTypedMethod. Only relevant for methods. */
958 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
959 : };
960 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
961 : static_assert(0 < 1, "There is no slot for us");
962 :
963 : static bool
964 0 : get_textLength(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitGetterCallArgs args)
965 : {
966 0 : uint32_t result(self->GetTextLength());
967 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
968 0 : args.rval().setNumber(result);
969 0 : return true;
970 : }
971 :
972 : static const JSJitInfo textLength_getterinfo = {
973 : { (JSJitGetterOp)get_textLength },
974 : { prototypes::id::HTMLTextAreaElement },
975 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
976 : JSJitInfo::Getter,
977 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
978 : JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */
979 : true, /* isInfallible. False in setters. */
980 : false, /* isMovable. Not relevant for setters. */
981 : false, /* isEliminatable. Not relevant for setters. */
982 : false, /* isAlwaysInSlot. Only relevant for getters. */
983 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
984 : false, /* isTypedMethod. Only relevant for methods. */
985 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
986 : };
987 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
988 : static_assert(0 < 1, "There is no slot for us");
989 :
990 : static bool
991 0 : get_willValidate(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitGetterCallArgs args)
992 : {
993 0 : bool result(self->WillValidate());
994 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
995 0 : args.rval().setBoolean(result);
996 0 : return true;
997 : }
998 :
999 : static const JSJitInfo willValidate_getterinfo = {
1000 : { (JSJitGetterOp)get_willValidate },
1001 : { prototypes::id::HTMLTextAreaElement },
1002 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
1003 : JSJitInfo::Getter,
1004 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1005 : JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */
1006 : true, /* isInfallible. False in setters. */
1007 : false, /* isMovable. Not relevant for setters. */
1008 : false, /* isEliminatable. Not relevant for setters. */
1009 : false, /* isAlwaysInSlot. Only relevant for getters. */
1010 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1011 : false, /* isTypedMethod. Only relevant for methods. */
1012 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1013 : };
1014 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1015 : static_assert(0 < 1, "There is no slot for us");
1016 :
1017 : static bool
1018 0 : get_validity(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitGetterCallArgs args)
1019 : {
1020 0 : auto result(StrongOrRawPtr<mozilla::dom::ValidityState>(self->Validity()));
1021 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1022 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
1023 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
1024 0 : return false;
1025 : }
1026 0 : return true;
1027 : }
1028 :
1029 : static const JSJitInfo validity_getterinfo = {
1030 : { (JSJitGetterOp)get_validity },
1031 : { prototypes::id::HTMLTextAreaElement },
1032 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
1033 : JSJitInfo::Getter,
1034 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1035 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
1036 : false, /* isInfallible. False in setters. */
1037 : false, /* isMovable. Not relevant for setters. */
1038 : false, /* isEliminatable. Not relevant for setters. */
1039 : false, /* isAlwaysInSlot. Only relevant for getters. */
1040 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1041 : false, /* isTypedMethod. Only relevant for methods. */
1042 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1043 : };
1044 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1045 : static_assert(0 < 1, "There is no slot for us");
1046 :
1047 : static bool
1048 0 : get_validationMessage(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitGetterCallArgs args)
1049 : {
1050 0 : DOMString result;
1051 0 : self->GetValidationMessage(result);
1052 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1053 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
1054 0 : return false;
1055 : }
1056 0 : return true;
1057 : }
1058 :
1059 : static const JSJitInfo validationMessage_getterinfo = {
1060 : { (JSJitGetterOp)get_validationMessage },
1061 : { prototypes::id::HTMLTextAreaElement },
1062 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
1063 : JSJitInfo::Getter,
1064 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1065 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
1066 : false, /* isInfallible. False in setters. */
1067 : false, /* isMovable. Not relevant for setters. */
1068 : false, /* isEliminatable. Not relevant for setters. */
1069 : false, /* isAlwaysInSlot. Only relevant for getters. */
1070 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1071 : false, /* isTypedMethod. Only relevant for methods. */
1072 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1073 : };
1074 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1075 : static_assert(0 < 1, "There is no slot for us");
1076 :
1077 : static bool
1078 0 : checkValidity(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, const JSJitMethodCallArgs& args)
1079 : {
1080 0 : bool result(self->CheckValidity());
1081 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1082 0 : args.rval().setBoolean(result);
1083 0 : return true;
1084 : }
1085 :
1086 : static const JSJitInfo checkValidity_methodinfo = {
1087 : { (JSJitGetterOp)checkValidity },
1088 : { prototypes::id::HTMLTextAreaElement },
1089 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
1090 : JSJitInfo::Method,
1091 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1092 : JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */
1093 : true, /* isInfallible. False in setters. */
1094 : false, /* isMovable. Not relevant for setters. */
1095 : false, /* isEliminatable. Not relevant for setters. */
1096 : false, /* isAlwaysInSlot. Only relevant for getters. */
1097 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1098 : false, /* isTypedMethod. Only relevant for methods. */
1099 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1100 : };
1101 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1102 : static_assert(0 < 1, "There is no slot for us");
1103 :
1104 : static bool
1105 0 : reportValidity(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, const JSJitMethodCallArgs& args)
1106 : {
1107 0 : bool result(self->ReportValidity());
1108 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1109 0 : args.rval().setBoolean(result);
1110 0 : return true;
1111 : }
1112 :
1113 : static const JSJitInfo reportValidity_methodinfo = {
1114 : { (JSJitGetterOp)reportValidity },
1115 : { prototypes::id::HTMLTextAreaElement },
1116 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
1117 : JSJitInfo::Method,
1118 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1119 : JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */
1120 : true, /* isInfallible. False in setters. */
1121 : false, /* isMovable. Not relevant for setters. */
1122 : false, /* isEliminatable. Not relevant for setters. */
1123 : false, /* isAlwaysInSlot. Only relevant for getters. */
1124 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1125 : false, /* isTypedMethod. Only relevant for methods. */
1126 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1127 : };
1128 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1129 : static_assert(0 < 1, "There is no slot for us");
1130 :
1131 : static bool
1132 0 : setCustomValidity(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, const JSJitMethodCallArgs& args)
1133 : {
1134 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
1135 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLTextAreaElement.setCustomValidity");
1136 : }
1137 0 : binding_detail::FakeString arg0;
1138 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
1139 0 : return false;
1140 : }
1141 0 : self->SetCustomValidity(NonNullHelper(Constify(arg0)));
1142 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1143 0 : args.rval().setUndefined();
1144 0 : return true;
1145 : }
1146 :
1147 : static const JSJitInfo setCustomValidity_methodinfo = {
1148 : { (JSJitGetterOp)setCustomValidity },
1149 : { prototypes::id::HTMLTextAreaElement },
1150 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
1151 : JSJitInfo::Method,
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_labels(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitGetterCallArgs args)
1167 : {
1168 0 : auto result(StrongOrRawPtr<nsINodeList>(self->Labels()));
1169 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1170 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
1171 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
1172 0 : return false;
1173 : }
1174 0 : return true;
1175 : }
1176 :
1177 : static const JSJitInfo labels_getterinfo = {
1178 : { (JSJitGetterOp)get_labels },
1179 : { prototypes::id::HTMLTextAreaElement },
1180 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
1181 : JSJitInfo::Getter,
1182 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1183 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
1184 : false, /* isInfallible. False in setters. */
1185 : false, /* isMovable. Not relevant for setters. */
1186 : false, /* isEliminatable. Not relevant for setters. */
1187 : false, /* isAlwaysInSlot. Only relevant for getters. */
1188 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1189 : false, /* isTypedMethod. Only relevant for methods. */
1190 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1191 : };
1192 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1193 : static_assert(0 < 1, "There is no slot for us");
1194 :
1195 : static bool
1196 0 : select(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, const JSJitMethodCallArgs& args)
1197 : {
1198 0 : self->Select();
1199 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1200 0 : args.rval().setUndefined();
1201 0 : return true;
1202 : }
1203 :
1204 : static const JSJitInfo select_methodinfo = {
1205 : { (JSJitGetterOp)select },
1206 : { prototypes::id::HTMLTextAreaElement },
1207 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
1208 : JSJitInfo::Method,
1209 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1210 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
1211 : true, /* isInfallible. False in setters. */
1212 : false, /* isMovable. Not relevant for setters. */
1213 : false, /* isEliminatable. Not relevant for setters. */
1214 : false, /* isAlwaysInSlot. Only relevant for getters. */
1215 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1216 : false, /* isTypedMethod. Only relevant for methods. */
1217 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1218 : };
1219 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1220 : static_assert(0 < 1, "There is no slot for us");
1221 :
1222 : static bool
1223 0 : get_selectionStart(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitGetterCallArgs args)
1224 : {
1225 0 : binding_detail::FastErrorResult rv;
1226 0 : Nullable<uint32_t> result(self->GetSelectionStart(rv));
1227 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
1228 0 : return false;
1229 : }
1230 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1231 0 : if (result.IsNull()) {
1232 0 : args.rval().setNull();
1233 0 : return true;
1234 : }
1235 0 : args.rval().setNumber(result.Value());
1236 0 : return true;
1237 : }
1238 :
1239 : static bool
1240 0 : set_selectionStart(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitSetterCallArgs args)
1241 : {
1242 0 : Nullable<uint32_t> arg0;
1243 0 : if (args[0].isNullOrUndefined()) {
1244 0 : arg0.SetNull();
1245 0 : } else if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0.SetValue())) {
1246 0 : return false;
1247 : }
1248 0 : binding_detail::FastErrorResult rv;
1249 0 : self->SetSelectionStart(Constify(arg0), rv);
1250 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
1251 0 : return false;
1252 : }
1253 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1254 :
1255 0 : return true;
1256 : }
1257 :
1258 : static const JSJitInfo selectionStart_getterinfo = {
1259 : { (JSJitGetterOp)get_selectionStart },
1260 : { prototypes::id::HTMLTextAreaElement },
1261 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
1262 : JSJitInfo::Getter,
1263 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1264 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
1265 : false, /* isInfallible. False in setters. */
1266 : false, /* isMovable. Not relevant for setters. */
1267 : false, /* isEliminatable. Not relevant for setters. */
1268 : false, /* isAlwaysInSlot. Only relevant for getters. */
1269 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1270 : false, /* isTypedMethod. Only relevant for methods. */
1271 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1272 : };
1273 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1274 : static_assert(0 < 1, "There is no slot for us");
1275 : static const JSJitInfo selectionStart_setterinfo = {
1276 : { (JSJitGetterOp)set_selectionStart },
1277 : { prototypes::id::HTMLTextAreaElement },
1278 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
1279 : JSJitInfo::Setter,
1280 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1281 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
1282 : false, /* isInfallible. False in setters. */
1283 : false, /* isMovable. Not relevant for setters. */
1284 : false, /* isEliminatable. Not relevant for setters. */
1285 : false, /* isAlwaysInSlot. Only relevant for getters. */
1286 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1287 : false, /* isTypedMethod. Only relevant for methods. */
1288 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1289 : };
1290 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1291 : static_assert(0 < 1, "There is no slot for us");
1292 :
1293 : static bool
1294 0 : get_selectionEnd(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitGetterCallArgs args)
1295 : {
1296 0 : binding_detail::FastErrorResult rv;
1297 0 : Nullable<uint32_t> result(self->GetSelectionEnd(rv));
1298 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
1299 0 : return false;
1300 : }
1301 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1302 0 : if (result.IsNull()) {
1303 0 : args.rval().setNull();
1304 0 : return true;
1305 : }
1306 0 : args.rval().setNumber(result.Value());
1307 0 : return true;
1308 : }
1309 :
1310 : static bool
1311 0 : set_selectionEnd(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitSetterCallArgs args)
1312 : {
1313 0 : Nullable<uint32_t> arg0;
1314 0 : if (args[0].isNullOrUndefined()) {
1315 0 : arg0.SetNull();
1316 0 : } else if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0.SetValue())) {
1317 0 : return false;
1318 : }
1319 0 : binding_detail::FastErrorResult rv;
1320 0 : self->SetSelectionEnd(Constify(arg0), rv);
1321 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
1322 0 : return false;
1323 : }
1324 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1325 :
1326 0 : return true;
1327 : }
1328 :
1329 : static const JSJitInfo selectionEnd_getterinfo = {
1330 : { (JSJitGetterOp)get_selectionEnd },
1331 : { prototypes::id::HTMLTextAreaElement },
1332 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
1333 : JSJitInfo::Getter,
1334 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1335 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
1336 : false, /* isInfallible. False in setters. */
1337 : false, /* isMovable. Not relevant for setters. */
1338 : false, /* isEliminatable. Not relevant for setters. */
1339 : false, /* isAlwaysInSlot. Only relevant for getters. */
1340 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1341 : false, /* isTypedMethod. Only relevant for methods. */
1342 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1343 : };
1344 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1345 : static_assert(0 < 1, "There is no slot for us");
1346 : static const JSJitInfo selectionEnd_setterinfo = {
1347 : { (JSJitGetterOp)set_selectionEnd },
1348 : { prototypes::id::HTMLTextAreaElement },
1349 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
1350 : JSJitInfo::Setter,
1351 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1352 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
1353 : false, /* isInfallible. False in setters. */
1354 : false, /* isMovable. Not relevant for setters. */
1355 : false, /* isEliminatable. Not relevant for setters. */
1356 : false, /* isAlwaysInSlot. Only relevant for getters. */
1357 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1358 : false, /* isTypedMethod. Only relevant for methods. */
1359 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1360 : };
1361 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1362 : static_assert(0 < 1, "There is no slot for us");
1363 :
1364 : static bool
1365 0 : get_selectionDirection(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitGetterCallArgs args)
1366 : {
1367 0 : binding_detail::FastErrorResult rv;
1368 0 : DOMString result;
1369 0 : self->GetSelectionDirection(result, rv);
1370 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
1371 0 : return false;
1372 : }
1373 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1374 0 : if (!xpc::StringToJsval(cx, result, args.rval())) {
1375 0 : return false;
1376 : }
1377 0 : return true;
1378 : }
1379 :
1380 : static bool
1381 0 : set_selectionDirection(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitSetterCallArgs args)
1382 : {
1383 0 : binding_detail::FakeString arg0;
1384 0 : if (!ConvertJSValueToString(cx, args[0], eNull, eNull, arg0)) {
1385 0 : return false;
1386 : }
1387 0 : binding_detail::FastErrorResult rv;
1388 0 : self->SetSelectionDirection(NonNullHelper(Constify(arg0)), rv);
1389 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
1390 0 : return false;
1391 : }
1392 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1393 :
1394 0 : return true;
1395 : }
1396 :
1397 : static const JSJitInfo selectionDirection_getterinfo = {
1398 : { (JSJitGetterOp)get_selectionDirection },
1399 : { prototypes::id::HTMLTextAreaElement },
1400 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
1401 : JSJitInfo::Getter,
1402 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1403 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
1404 : false, /* isInfallible. False in setters. */
1405 : false, /* isMovable. Not relevant for setters. */
1406 : false, /* isEliminatable. Not relevant for setters. */
1407 : false, /* isAlwaysInSlot. Only relevant for getters. */
1408 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1409 : false, /* isTypedMethod. Only relevant for methods. */
1410 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1411 : };
1412 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1413 : static_assert(0 < 1, "There is no slot for us");
1414 : static const JSJitInfo selectionDirection_setterinfo = {
1415 : { (JSJitGetterOp)set_selectionDirection },
1416 : { prototypes::id::HTMLTextAreaElement },
1417 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
1418 : JSJitInfo::Setter,
1419 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1420 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
1421 : false, /* isInfallible. False in setters. */
1422 : false, /* isMovable. Not relevant for setters. */
1423 : false, /* isEliminatable. Not relevant for setters. */
1424 : false, /* isAlwaysInSlot. Only relevant for getters. */
1425 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1426 : false, /* isTypedMethod. Only relevant for methods. */
1427 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1428 : };
1429 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1430 : static_assert(0 < 1, "There is no slot for us");
1431 :
1432 : static bool
1433 0 : setRangeText(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, const JSJitMethodCallArgs& args)
1434 : {
1435 0 : unsigned argcount = std::min(args.length(), 4u);
1436 0 : switch (argcount) {
1437 : case 1: {
1438 0 : binding_detail::FakeString arg0;
1439 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
1440 0 : return false;
1441 : }
1442 0 : binding_detail::FastErrorResult rv;
1443 0 : self->SetRangeText(NonNullHelper(Constify(arg0)), rv);
1444 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
1445 0 : return false;
1446 : }
1447 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1448 0 : args.rval().setUndefined();
1449 0 : return true;
1450 : break;
1451 : }
1452 : case 3: {
1453 : MOZ_FALLTHROUGH;
1454 : }
1455 : case 4: {
1456 0 : binding_detail::FakeString arg0;
1457 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
1458 0 : return false;
1459 : }
1460 : uint32_t arg1;
1461 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) {
1462 0 : return false;
1463 : }
1464 : uint32_t arg2;
1465 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[2], &arg2)) {
1466 0 : return false;
1467 : }
1468 : SelectionMode arg3;
1469 0 : if (args.hasDefined(3)) {
1470 : {
1471 : int index;
1472 0 : if (!FindEnumStringIndex<true>(cx, args[3], SelectionModeValues::strings, "SelectionMode", "Argument 4 of HTMLTextAreaElement.setRangeText", &index)) {
1473 0 : return false;
1474 : }
1475 0 : MOZ_ASSERT(index >= 0);
1476 0 : arg3 = static_cast<SelectionMode>(index);
1477 : }
1478 : } else {
1479 0 : arg3 = SelectionMode::Preserve;
1480 : }
1481 0 : binding_detail::FastErrorResult rv;
1482 0 : self->SetRangeText(NonNullHelper(Constify(arg0)), arg1, arg2, arg3, rv);
1483 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
1484 0 : return false;
1485 : }
1486 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1487 0 : args.rval().setUndefined();
1488 0 : return true;
1489 : break;
1490 : }
1491 : default: {
1492 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLTextAreaElement.setRangeText");
1493 : break;
1494 : }
1495 : }
1496 : MOZ_CRASH("We have an always-returning default case");
1497 : return false;
1498 : }
1499 :
1500 : static const JSJitInfo setRangeText_methodinfo = {
1501 : { (JSJitGetterOp)setRangeText },
1502 : { prototypes::id::HTMLTextAreaElement },
1503 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
1504 : JSJitInfo::Method,
1505 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1506 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
1507 : false, /* isInfallible. False in setters. */
1508 : false, /* isMovable. Not relevant for setters. */
1509 : false, /* isEliminatable. Not relevant for setters. */
1510 : false, /* isAlwaysInSlot. Only relevant for getters. */
1511 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1512 : false, /* isTypedMethod. Only relevant for methods. */
1513 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1514 : };
1515 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1516 : static_assert(0 < 1, "There is no slot for us");
1517 :
1518 : static bool
1519 0 : setSelectionRange(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, const JSJitMethodCallArgs& args)
1520 : {
1521 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
1522 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLTextAreaElement.setSelectionRange");
1523 : }
1524 : uint32_t arg0;
1525 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
1526 0 : return false;
1527 : }
1528 : uint32_t arg1;
1529 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) {
1530 0 : return false;
1531 : }
1532 0 : Optional<nsAString> arg2;
1533 0 : binding_detail::FakeString arg2_holder;
1534 0 : if (args.hasDefined(2)) {
1535 0 : if (!ConvertJSValueToString(cx, args[2], eStringify, eStringify, arg2_holder)) {
1536 0 : return false;
1537 : }
1538 0 : arg2 = &arg2_holder;
1539 : }
1540 0 : binding_detail::FastErrorResult rv;
1541 0 : self->SetSelectionRange(arg0, arg1, NonNullHelper(Constify(arg2)), rv);
1542 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
1543 0 : return false;
1544 : }
1545 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1546 0 : args.rval().setUndefined();
1547 0 : return true;
1548 : }
1549 :
1550 : static const JSJitInfo setSelectionRange_methodinfo = {
1551 : { (JSJitGetterOp)setSelectionRange },
1552 : { prototypes::id::HTMLTextAreaElement },
1553 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
1554 : JSJitInfo::Method,
1555 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1556 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
1557 : false, /* isInfallible. False in setters. */
1558 : false, /* isMovable. Not relevant for setters. */
1559 : false, /* isEliminatable. Not relevant for setters. */
1560 : false, /* isAlwaysInSlot. Only relevant for getters. */
1561 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1562 : false, /* isTypedMethod. Only relevant for methods. */
1563 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1564 : };
1565 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1566 : static_assert(0 < 1, "There is no slot for us");
1567 :
1568 : static bool
1569 0 : get_controllers(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitGetterCallArgs args)
1570 : {
1571 0 : binding_detail::FastErrorResult rv;
1572 0 : auto result(StrongOrRawPtr<nsIControllers>(self->GetControllers(rv)));
1573 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
1574 0 : return false;
1575 : }
1576 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1577 0 : if (!WrapObject(cx, result, &NS_GET_IID(nsIControllers), args.rval())) {
1578 0 : return false;
1579 : }
1580 0 : return true;
1581 : }
1582 :
1583 : static const JSJitInfo controllers_getterinfo = {
1584 : { (JSJitGetterOp)get_controllers },
1585 : { prototypes::id::HTMLTextAreaElement },
1586 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
1587 : JSJitInfo::Getter,
1588 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1589 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
1590 : false, /* isInfallible. False in setters. */
1591 : false, /* isMovable. Not relevant for setters. */
1592 : false, /* isEliminatable. Not relevant for setters. */
1593 : false, /* isAlwaysInSlot. Only relevant for getters. */
1594 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1595 : false, /* isTypedMethod. Only relevant for methods. */
1596 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1597 : };
1598 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1599 : static_assert(0 < 1, "There is no slot for us");
1600 :
1601 : static bool
1602 0 : get_editor(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitGetterCallArgs args)
1603 : {
1604 0 : auto result(StrongOrRawPtr<nsIEditor>(self->GetEditor()));
1605 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1606 0 : if (!result) {
1607 0 : args.rval().setNull();
1608 0 : return true;
1609 : }
1610 0 : if (!WrapObject(cx, result, &NS_GET_IID(nsIEditor), args.rval())) {
1611 0 : return false;
1612 : }
1613 0 : return true;
1614 : }
1615 :
1616 : static const JSJitInfo editor_getterinfo = {
1617 : { (JSJitGetterOp)get_editor },
1618 : { prototypes::id::HTMLTextAreaElement },
1619 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
1620 : JSJitInfo::Getter,
1621 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1622 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
1623 : false, /* isInfallible. False in setters. */
1624 : false, /* isMovable. Not relevant for setters. */
1625 : false, /* isEliminatable. Not relevant for setters. */
1626 : false, /* isAlwaysInSlot. Only relevant for getters. */
1627 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1628 : false, /* isTypedMethod. Only relevant for methods. */
1629 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1630 : };
1631 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1632 : static_assert(0 < 1, "There is no slot for us");
1633 :
1634 : static bool
1635 0 : setUserInput(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, const JSJitMethodCallArgs& args)
1636 : {
1637 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
1638 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLTextAreaElement.setUserInput");
1639 : }
1640 0 : binding_detail::FakeString arg0;
1641 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
1642 0 : return false;
1643 : }
1644 0 : self->SetUserInput(NonNullHelper(Constify(arg0)));
1645 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1646 0 : args.rval().setUndefined();
1647 0 : return true;
1648 : }
1649 :
1650 : static const JSJitInfo setUserInput_methodinfo = {
1651 : { (JSJitGetterOp)setUserInput },
1652 : { prototypes::id::HTMLTextAreaElement },
1653 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
1654 : JSJitInfo::Method,
1655 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1656 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
1657 : false, /* isInfallible. False in setters. */
1658 : false, /* isMovable. Not relevant for setters. */
1659 : false, /* isEliminatable. Not relevant for setters. */
1660 : false, /* isAlwaysInSlot. Only relevant for getters. */
1661 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1662 : false, /* isTypedMethod. Only relevant for methods. */
1663 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1664 : };
1665 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1666 : static_assert(0 < 1, "There is no slot for us");
1667 :
1668 : static bool
1669 0 : get_previewValue(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitGetterCallArgs args)
1670 : {
1671 0 : DOMString result;
1672 0 : self->GetPreviewValue(result);
1673 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1674 0 : if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
1675 0 : return false;
1676 : }
1677 0 : return true;
1678 : }
1679 :
1680 : static bool
1681 0 : set_previewValue(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLTextAreaElement* self, JSJitSetterCallArgs args)
1682 : {
1683 0 : binding_detail::FakeString arg0;
1684 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
1685 0 : return false;
1686 : }
1687 0 : self->SetPreviewValue(NonNullHelper(Constify(arg0)));
1688 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1689 :
1690 0 : return true;
1691 : }
1692 :
1693 : static const JSJitInfo previewValue_getterinfo = {
1694 : { (JSJitGetterOp)get_previewValue },
1695 : { prototypes::id::HTMLTextAreaElement },
1696 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
1697 : JSJitInfo::Getter,
1698 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1699 : JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */
1700 : false, /* isInfallible. False in setters. */
1701 : false, /* isMovable. Not relevant for setters. */
1702 : false, /* isEliminatable. Not relevant for setters. */
1703 : false, /* isAlwaysInSlot. Only relevant for getters. */
1704 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1705 : false, /* isTypedMethod. Only relevant for methods. */
1706 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1707 : };
1708 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1709 : static_assert(0 < 1, "There is no slot for us");
1710 : static const JSJitInfo previewValue_setterinfo = {
1711 : { (JSJitGetterOp)set_previewValue },
1712 : { prototypes::id::HTMLTextAreaElement },
1713 : { PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth },
1714 : JSJitInfo::Setter,
1715 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1716 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
1717 : false, /* isInfallible. False in setters. */
1718 : false, /* isMovable. Not relevant for setters. */
1719 : false, /* isEliminatable. Not relevant for setters. */
1720 : false, /* isAlwaysInSlot. Only relevant for getters. */
1721 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1722 : false, /* isTypedMethod. Only relevant for methods. */
1723 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1724 : };
1725 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1726 : static_assert(0 < 1, "There is no slot for us");
1727 :
1728 : static bool
1729 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
1730 : {
1731 0 : mozilla::dom::HTMLTextAreaElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLTextAreaElement>(obj);
1732 : // We don't want to preserve if we don't have a wrapper, and we
1733 : // obviously can't preserve if we're not initialized.
1734 0 : if (self && self->GetWrapperPreserveColor()) {
1735 0 : PreserveWrapper(self);
1736 : }
1737 0 : return true;
1738 : }
1739 :
1740 : static void
1741 0 : _finalize(js::FreeOp* fop, JSObject* obj)
1742 : {
1743 0 : mozilla::dom::HTMLTextAreaElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLTextAreaElement>(obj);
1744 0 : if (self) {
1745 0 : ClearWrapper(self, self, obj);
1746 0 : AddForDeferredFinalization<mozilla::dom::HTMLTextAreaElement>(self);
1747 : }
1748 0 : }
1749 :
1750 : static void
1751 0 : _objectMoved(JSObject* obj, const JSObject* old)
1752 : {
1753 0 : mozilla::dom::HTMLTextAreaElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLTextAreaElement>(obj);
1754 0 : if (self) {
1755 0 : UpdateWrapper(self, self, obj, old);
1756 : }
1757 0 : }
1758 :
1759 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
1760 : #if defined(__clang__)
1761 : #pragma clang diagnostic push
1762 : #pragma clang diagnostic ignored "-Wmissing-braces"
1763 : #endif
1764 : static const JSFunctionSpec sMethods_specs[] = {
1765 : JS_FNSPEC("checkValidity", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&checkValidity_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
1766 : JS_FNSPEC("reportValidity", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&reportValidity_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
1767 : JS_FNSPEC("setCustomValidity", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&setCustomValidity_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
1768 : JS_FNSPEC("select", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&select_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
1769 : JS_FNSPEC("setRangeText", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&setRangeText_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
1770 : JS_FNSPEC("setSelectionRange", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&setSelectionRange_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
1771 : JS_FS_END
1772 : };
1773 : #if defined(__clang__)
1774 : #pragma clang diagnostic pop
1775 : #endif
1776 :
1777 :
1778 : // Can't be const because the pref-enabled boolean needs to be writable
1779 : static Prefable<const JSFunctionSpec> sMethods[] = {
1780 : { nullptr, &sMethods_specs[0] },
1781 : { nullptr, nullptr }
1782 : };
1783 :
1784 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
1785 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
1786 : static_assert(6 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
1787 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
1788 :
1789 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
1790 : #if defined(__clang__)
1791 : #pragma clang diagnostic push
1792 : #pragma clang diagnostic ignored "-Wmissing-braces"
1793 : #endif
1794 : static const JSFunctionSpec sChromeMethods_specs[] = {
1795 : JS_FNSPEC("setUserInput", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&setUserInput_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
1796 : JS_FS_END
1797 : };
1798 : #if defined(__clang__)
1799 : #pragma clang diagnostic pop
1800 : #endif
1801 :
1802 :
1803 : // Can't be const because the pref-enabled boolean needs to be writable
1804 : static Prefable<const JSFunctionSpec> sChromeMethods[] = {
1805 : { nullptr, &sChromeMethods_specs[0] },
1806 : { nullptr, nullptr }
1807 : };
1808 :
1809 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
1810 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
1811 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
1812 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
1813 :
1814 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
1815 : #if defined(__clang__)
1816 : #pragma clang diagnostic push
1817 : #pragma clang diagnostic ignored "-Wmissing-braces"
1818 : #endif
1819 : static const JSPropertySpec sAttributes_specs[] = {
1820 : { "autofocus", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &autofocus_getterinfo, GenericBindingSetter, &autofocus_setterinfo },
1821 : { "cols", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &cols_getterinfo, GenericBindingSetter, &cols_setterinfo },
1822 : { "disabled", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &disabled_getterinfo, GenericBindingSetter, &disabled_setterinfo },
1823 : { "form", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &form_getterinfo, nullptr, nullptr },
1824 : { "maxLength", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &maxLength_getterinfo, GenericBindingSetter, &maxLength_setterinfo },
1825 : { "minLength", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &minLength_getterinfo, GenericBindingSetter, &minLength_setterinfo },
1826 : { "name", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &name_getterinfo, GenericBindingSetter, &name_setterinfo },
1827 : { "placeholder", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &placeholder_getterinfo, GenericBindingSetter, &placeholder_setterinfo },
1828 : { "readOnly", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &readOnly_getterinfo, GenericBindingSetter, &readOnly_setterinfo },
1829 : { "required", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &required_getterinfo, GenericBindingSetter, &required_setterinfo },
1830 : { "rows", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &rows_getterinfo, GenericBindingSetter, &rows_setterinfo },
1831 : { "wrap", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &wrap_getterinfo, GenericBindingSetter, &wrap_setterinfo },
1832 : { "type", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &type_getterinfo, nullptr, nullptr },
1833 : { "defaultValue", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &defaultValue_getterinfo, GenericBindingSetter, &defaultValue_setterinfo },
1834 : { "value", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &value_getterinfo, GenericBindingSetter, &value_setterinfo },
1835 : { "textLength", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &textLength_getterinfo, nullptr, nullptr },
1836 : { "willValidate", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &willValidate_getterinfo, nullptr, nullptr },
1837 : { "validity", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &validity_getterinfo, nullptr, nullptr },
1838 : { "validationMessage", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &validationMessage_getterinfo, nullptr, nullptr },
1839 : { "labels", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &labels_getterinfo, nullptr, nullptr },
1840 : { "selectionStart", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &selectionStart_getterinfo, GenericBindingSetter, &selectionStart_setterinfo },
1841 : { "selectionEnd", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &selectionEnd_getterinfo, GenericBindingSetter, &selectionEnd_setterinfo },
1842 : { "selectionDirection", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &selectionDirection_getterinfo, GenericBindingSetter, &selectionDirection_setterinfo },
1843 : { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
1844 : };
1845 : #if defined(__clang__)
1846 : #pragma clang diagnostic pop
1847 : #endif
1848 :
1849 :
1850 : // Can't be const because the pref-enabled boolean needs to be writable
1851 : static Prefable<const JSPropertySpec> sAttributes[] = {
1852 : { nullptr, &sAttributes_specs[0] },
1853 : { nullptr, nullptr }
1854 : };
1855 :
1856 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
1857 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
1858 : static_assert(23 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
1859 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
1860 :
1861 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
1862 : #if defined(__clang__)
1863 : #pragma clang diagnostic push
1864 : #pragma clang diagnostic ignored "-Wmissing-braces"
1865 : #endif
1866 : static const JSPropertySpec sChromeAttributes_specs[] = {
1867 : { "controllers", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &controllers_getterinfo, nullptr, nullptr },
1868 : { "editor", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &editor_getterinfo, nullptr, nullptr },
1869 : { "previewValue", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &previewValue_getterinfo, GenericBindingSetter, &previewValue_setterinfo },
1870 : { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
1871 : };
1872 : #if defined(__clang__)
1873 : #pragma clang diagnostic pop
1874 : #endif
1875 :
1876 :
1877 : // Can't be const because the pref-enabled boolean needs to be writable
1878 : static Prefable<const JSPropertySpec> sChromeAttributes[] = {
1879 : { nullptr, &sChromeAttributes_specs[0] },
1880 : { nullptr, nullptr }
1881 : };
1882 :
1883 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
1884 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
1885 : static_assert(3 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
1886 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
1887 :
1888 :
1889 : static uint16_t sNativeProperties_sortedPropertyIndices[29];
1890 : static PropertyInfo sNativeProperties_propertyInfos[29];
1891 :
1892 : static const NativePropertiesN<2> sNativeProperties = {
1893 : false, 0,
1894 : false, 0,
1895 : true, 0 /* sMethods */,
1896 : true, 1 /* sAttributes */,
1897 : false, 0,
1898 : false, 0,
1899 : false, 0,
1900 : -1,
1901 : 29,
1902 : sNativeProperties_sortedPropertyIndices,
1903 : {
1904 : { sMethods, &sNativeProperties_propertyInfos[0] },
1905 : { sAttributes, &sNativeProperties_propertyInfos[6] }
1906 : }
1907 : };
1908 : static_assert(29 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
1909 : "We have a property info count that is oversized");
1910 :
1911 : static uint16_t sChromeOnlyNativeProperties_sortedPropertyIndices[4];
1912 : static PropertyInfo sChromeOnlyNativeProperties_propertyInfos[4];
1913 :
1914 : static const NativePropertiesN<2> sChromeOnlyNativeProperties = {
1915 : false, 0,
1916 : false, 0,
1917 : true, 0 /* sChromeMethods */,
1918 : true, 1 /* sChromeAttributes */,
1919 : false, 0,
1920 : false, 0,
1921 : false, 0,
1922 : -1,
1923 : 4,
1924 : sChromeOnlyNativeProperties_sortedPropertyIndices,
1925 : {
1926 : { sChromeMethods, &sChromeOnlyNativeProperties_propertyInfos[0] },
1927 : { sChromeAttributes, &sChromeOnlyNativeProperties_propertyInfos[1] }
1928 : }
1929 : };
1930 : static_assert(4 < 1ull << CHAR_BIT * sizeof(sChromeOnlyNativeProperties.propertyInfoCount),
1931 : "We have a property info count that is oversized");
1932 :
1933 : static bool
1934 0 : _constructor(JSContext* cx, unsigned argc, JS::Value* vp)
1935 : {
1936 0 : JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
1937 0 : JS::Rooted<JSObject*> obj(cx, &args.callee());
1938 0 : if (!args.isConstructing()) {
1939 : // XXXbz wish I could get the name from the callee instead of
1940 : // Adding more relocations
1941 0 : return ThrowConstructorWithoutNew(cx, "HTMLTextAreaElement");
1942 : }
1943 :
1944 0 : GlobalObject global(cx, obj);
1945 0 : if (global.Failed()) {
1946 0 : return false;
1947 : }
1948 :
1949 : // The newTarget might be a cross-compartment wrapper. Get the underlying object
1950 : // so we can do the spec's object-identity checks.
1951 0 : JS::Rooted<JSObject*> newTarget(cx, js::CheckedUnwrap(&args.newTarget().toObject()));
1952 0 : if (!newTarget) {
1953 0 : return ThrowErrorMessage(cx, MSG_ILLEGAL_CONSTRUCTOR);
1954 : }
1955 :
1956 : // Step 2 of https://html.spec.whatwg.org/multipage/dom.html#htmlconstructor.
1957 : // Enter the compartment of our underlying newTarget object, so we end
1958 : // up comparing to the constructor object for our interface from that global.
1959 : {
1960 0 : JSAutoCompartment ac(cx, newTarget);
1961 0 : JS::Handle<JSObject*> constructor(GetConstructorObjectHandle(cx));
1962 0 : if (!constructor) {
1963 0 : return false;
1964 : }
1965 0 : if (newTarget == constructor) {
1966 0 : return ThrowErrorMessage(cx, MSG_ILLEGAL_CONSTRUCTOR);
1967 : }
1968 : }
1969 :
1970 0 : JS::Rooted<JSObject*> desiredProto(cx);
1971 0 : if (!GetDesiredProto(cx, args, &desiredProto)) {
1972 0 : return false;
1973 : }
1974 0 : if (!desiredProto) {
1975 : // Step 7 of https://html.spec.whatwg.org/multipage/dom.html#htmlconstructor.
1976 : // This fallback behavior is designed to match analogous behavior for the
1977 : // JavaScript built-ins. So we enter the compartment of our underlying
1978 : // newTarget object and fall back to the prototype object from that global.
1979 : // XXX The spec says to use GetFunctionRealm(), which is not actually
1980 : // the same thing as what we have here (e.g. in the case of scripted callable proxies
1981 : // whose target is not same-compartment with the proxy, or bound functions, etc).
1982 : // https://bugzilla.mozilla.org/show_bug.cgi?id=1317658
1983 : {
1984 0 : JSAutoCompartment ac(cx, newTarget);
1985 0 : desiredProto = GetProtoObjectHandle(cx);
1986 0 : if (!desiredProto) {
1987 0 : return false;
1988 : }
1989 : }
1990 :
1991 : // desiredProto is in the compartment of the underlying newTarget object.
1992 : // Wrap it into the context compartment.
1993 0 : if (!JS_WrapObject(cx, &desiredProto)) {
1994 0 : return false;
1995 : }
1996 : }
1997 :
1998 0 : bool objIsXray = xpc::WrapperFactory::IsXrayWrapper(obj);
1999 0 : Maybe<JSAutoCompartment> ac;
2000 0 : if (objIsXray) {
2001 0 : obj = js::CheckedUnwrap(obj);
2002 0 : if (!obj) {
2003 0 : return false;
2004 : }
2005 0 : ac.emplace(cx, obj);
2006 0 : if (!JS_WrapObject(cx, &desiredProto)) {
2007 0 : return false;
2008 : }
2009 : }
2010 0 : binding_detail::FastErrorResult rv;
2011 0 : auto result(StrongOrRawPtr<mozilla::dom::HTMLTextAreaElement>(CreateHTMLElement(global, args, rv)));
2012 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
2013 0 : return false;
2014 : }
2015 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
2016 : static_assert(!IsPointer<decltype(result)>::value,
2017 : "NewObject implies that we need to keep the object alive with a strong reference.");
2018 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval(), desiredProto)) {
2019 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
2020 0 : return false;
2021 : }
2022 0 : return true;
2023 : }
2024 :
2025 : static const js::ClassOps sInterfaceObjectClassOps = {
2026 : nullptr, /* addProperty */
2027 : nullptr, /* delProperty */
2028 : nullptr, /* getProperty */
2029 : nullptr, /* setProperty */
2030 : nullptr, /* enumerate */
2031 : nullptr, /* newEnumerate */
2032 : nullptr, /* resolve */
2033 : nullptr, /* mayResolve */
2034 : nullptr, /* finalize */
2035 : _constructor, /* call */
2036 : nullptr, /* hasInstance */
2037 : _constructor, /* construct */
2038 : nullptr, /* trace */
2039 : };
2040 :
2041 : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
2042 : {
2043 : "Function",
2044 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
2045 : &sInterfaceObjectClassOps,
2046 : JS_NULL_CLASS_SPEC,
2047 : JS_NULL_CLASS_EXT,
2048 : &sInterfaceObjectClassObjectOps
2049 : },
2050 : eInterface,
2051 : true,
2052 : prototypes::id::HTMLTextAreaElement,
2053 : PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth,
2054 : sNativePropertyHooks,
2055 : "function HTMLTextAreaElement() {\n [native code]\n}",
2056 : HTMLElementBinding::GetConstructorObject
2057 : };
2058 :
2059 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
2060 : {
2061 : "HTMLTextAreaElementPrototype",
2062 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
2063 : JS_NULL_CLASS_OPS,
2064 : JS_NULL_CLASS_SPEC,
2065 : JS_NULL_CLASS_EXT,
2066 : JS_NULL_OBJECT_OPS
2067 : },
2068 : eInterfacePrototype,
2069 : false,
2070 : prototypes::id::HTMLTextAreaElement,
2071 : PrototypeTraits<prototypes::id::HTMLTextAreaElement>::Depth,
2072 : sNativePropertyHooks,
2073 : "[object HTMLTextAreaElementPrototype]",
2074 : HTMLElementBinding::GetProtoObject
2075 : };
2076 :
2077 : JSObject*
2078 0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
2079 : {
2080 0 : return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
2081 : }
2082 :
2083 : static const js::ClassOps sClassOps = {
2084 : _addProperty, /* addProperty */
2085 : nullptr, /* delProperty */
2086 : nullptr, /* getProperty */
2087 : nullptr, /* setProperty */
2088 : nullptr, /* enumerate */
2089 : nullptr, /* newEnumerate */
2090 : nullptr, /* resolve */
2091 : nullptr, /* mayResolve */
2092 : _finalize, /* finalize */
2093 : nullptr, /* call */
2094 : nullptr, /* hasInstance */
2095 : nullptr, /* construct */
2096 : nullptr, /* trace */
2097 : };
2098 :
2099 : static const js::ClassExtension sClassExtension = {
2100 : nullptr, /* weakmapKeyDelegateOp */
2101 : _objectMoved /* objectMovedOp */
2102 : };
2103 :
2104 : static const DOMJSClass sClass = {
2105 : { "HTMLTextAreaElement",
2106 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
2107 : &sClassOps,
2108 : JS_NULL_CLASS_SPEC,
2109 : &sClassExtension,
2110 : JS_NULL_OBJECT_OPS
2111 : },
2112 : { prototypes::id::EventTarget, prototypes::id::Node, prototypes::id::Element, prototypes::id::HTMLElement, prototypes::id::HTMLTextAreaElement, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
2113 : IsBaseOf<nsISupports, mozilla::dom::HTMLTextAreaElement >::value,
2114 : sNativePropertyHooks,
2115 : FindAssociatedGlobalForNative<mozilla::dom::HTMLTextAreaElement>::Get,
2116 : GetProtoObjectHandle,
2117 : GetCCParticipant<mozilla::dom::HTMLTextAreaElement>::Get()
2118 : };
2119 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
2120 : "Must have the right minimal number of reserved slots.");
2121 : static_assert(1 >= 1,
2122 : "Must have enough reserved slots.");
2123 :
2124 : const JSClass*
2125 0 : GetJSClass()
2126 : {
2127 0 : return sClass.ToJSClass();
2128 : }
2129 :
2130 : bool
2131 0 : Wrap(JSContext* aCx, mozilla::dom::HTMLTextAreaElement* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
2132 : {
2133 : MOZ_ASSERT(static_cast<mozilla::dom::HTMLTextAreaElement*>(aObject) ==
2134 : reinterpret_cast<mozilla::dom::HTMLTextAreaElement*>(aObject),
2135 : "Multiple inheritance for mozilla::dom::HTMLTextAreaElement is broken.");
2136 : MOZ_ASSERT(static_cast<nsGenericHTMLElement*>(aObject) ==
2137 : reinterpret_cast<nsGenericHTMLElement*>(aObject),
2138 : "Multiple inheritance for nsGenericHTMLElement is broken.");
2139 : MOZ_ASSERT(static_cast<mozilla::dom::Element*>(aObject) ==
2140 : reinterpret_cast<mozilla::dom::Element*>(aObject),
2141 : "Multiple inheritance for mozilla::dom::Element is broken.");
2142 : MOZ_ASSERT(static_cast<nsINode*>(aObject) ==
2143 : reinterpret_cast<nsINode*>(aObject),
2144 : "Multiple inheritance for nsINode is broken.");
2145 : MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) ==
2146 : reinterpret_cast<mozilla::dom::EventTarget*>(aObject),
2147 : "Multiple inheritance for mozilla::dom::EventTarget is broken.");
2148 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
2149 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
2150 0 : MOZ_ASSERT(!aCache->GetWrapper(),
2151 : "You should probably not be using Wrap() directly; use "
2152 : "GetOrCreateDOMReflector instead");
2153 :
2154 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
2155 : "nsISupports must be on our primary inheritance chain");
2156 :
2157 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
2158 0 : if (!global) {
2159 0 : return false;
2160 : }
2161 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
2162 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
2163 :
2164 : // That might have ended up wrapping us already, due to the wonders
2165 : // of XBL. Check for that, and bail out as needed.
2166 0 : aReflector.set(aCache->GetWrapper());
2167 0 : if (aReflector) {
2168 : #ifdef DEBUG
2169 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
2170 : #endif // DEBUG
2171 0 : return true;
2172 : }
2173 :
2174 0 : JSAutoCompartment ac(aCx, global);
2175 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
2176 0 : if (!canonicalProto) {
2177 0 : return false;
2178 : }
2179 0 : JS::Rooted<JSObject*> proto(aCx);
2180 0 : if (aGivenProto) {
2181 0 : proto = aGivenProto;
2182 : // Unfortunately, while aGivenProto was in the compartment of aCx
2183 : // coming in, we changed compartments to that of "parent" so may need
2184 : // to wrap the proto here.
2185 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
2186 0 : if (!JS_WrapObject(aCx, &proto)) {
2187 0 : return false;
2188 : }
2189 : }
2190 : } else {
2191 0 : proto = canonicalProto;
2192 : }
2193 :
2194 0 : BindingJSObjectCreator<mozilla::dom::HTMLTextAreaElement> creator(aCx);
2195 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
2196 0 : if (!aReflector) {
2197 0 : return false;
2198 : }
2199 :
2200 0 : aCache->SetWrapper(aReflector);
2201 0 : creator.InitializationSucceeded();
2202 :
2203 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
2204 : aCache->GetWrapperPreserveColor() == aReflector);
2205 : // If proto != canonicalProto, we have to preserve our wrapper;
2206 : // otherwise we won't be able to properly recreate it later, since
2207 : // we won't know what proto to use. Note that we don't check
2208 : // aGivenProto here, since it's entirely possible (and even
2209 : // somewhat common) to have a non-null aGivenProto which is the
2210 : // same as canonicalProto.
2211 0 : if (proto != canonicalProto) {
2212 0 : PreserveWrapper(aObject);
2213 : }
2214 :
2215 0 : return true;
2216 : }
2217 :
2218 : const NativePropertyHooks sNativePropertyHooks[] = { {
2219 : nullptr,
2220 : nullptr,
2221 : nullptr,
2222 : { sNativeProperties.Upcast(), sChromeOnlyNativeProperties.Upcast() },
2223 : prototypes::id::HTMLTextAreaElement,
2224 : constructors::id::HTMLTextAreaElement,
2225 : HTMLElementBinding::sNativePropertyHooks,
2226 : &DefaultXrayExpandoObjectClass
2227 : } };
2228 :
2229 : void
2230 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
2231 : {
2232 0 : JS::Handle<JSObject*> parentProto(HTMLElementBinding::GetProtoObjectHandle(aCx));
2233 0 : if (!parentProto) {
2234 0 : return;
2235 : }
2236 :
2237 0 : JS::Handle<JSObject*> constructorProto(HTMLElementBinding::GetConstructorObjectHandle(aCx));
2238 0 : if (!constructorProto) {
2239 0 : return;
2240 : }
2241 :
2242 : static bool sIdsInited = false;
2243 0 : if (!sIdsInited && NS_IsMainThread()) {
2244 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
2245 0 : return;
2246 : }
2247 0 : if (!InitIds(aCx, sChromeOnlyNativeProperties.Upcast())) {
2248 0 : return;
2249 : }
2250 0 : sIdsInited = true;
2251 : }
2252 :
2253 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::HTMLTextAreaElement);
2254 0 : JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::HTMLTextAreaElement);
2255 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
2256 : &sPrototypeClass.mBase, protoCache,
2257 : constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
2258 : interfaceCache,
2259 : sNativeProperties.Upcast(),
2260 0 : nsContentUtils::ThreadsafeIsSystemCaller(aCx) ? sChromeOnlyNativeProperties.Upcast() : nullptr,
2261 : "HTMLTextAreaElement", aDefineOnGlobal,
2262 : nullptr,
2263 0 : false);
2264 : }
2265 :
2266 : JS::Handle<JSObject*>
2267 0 : GetProtoObjectHandle(JSContext* aCx)
2268 : {
2269 : /* Get the interface prototype object for this class. This will create the
2270 : object as needed. */
2271 0 : bool aDefineOnGlobal = true;
2272 :
2273 : /* Make sure our global is sane. Hopefully we can remove this sometime */
2274 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
2275 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
2276 0 : return nullptr;
2277 : }
2278 :
2279 : /* Check to see whether the interface objects are already installed */
2280 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
2281 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::HTMLTextAreaElement)) {
2282 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
2283 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
2284 : }
2285 :
2286 : /*
2287 : * The object might _still_ be null, but that's OK.
2288 : *
2289 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
2290 : * traced by TraceProtoAndIfaceCache() and its contents are never
2291 : * changed after they have been set.
2292 : *
2293 : * Calling address() avoids the read read barrier that does gray
2294 : * unmarking, but it's not possible for the object to be gray here.
2295 : */
2296 :
2297 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::HTMLTextAreaElement);
2298 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
2299 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
2300 : }
2301 :
2302 : JS::Handle<JSObject*>
2303 0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
2304 : {
2305 : /* Get the interface object for this class. This will create the object as
2306 : needed. */
2307 :
2308 : /* Make sure our global is sane. Hopefully we can remove this sometime */
2309 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
2310 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
2311 0 : return nullptr;
2312 : }
2313 :
2314 : /* Check to see whether the interface objects are already installed */
2315 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
2316 0 : if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::HTMLTextAreaElement)) {
2317 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
2318 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
2319 : }
2320 :
2321 : /*
2322 : * The object might _still_ be null, but that's OK.
2323 : *
2324 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
2325 : * traced by TraceProtoAndIfaceCache() and its contents are never
2326 : * changed after they have been set.
2327 : *
2328 : * Calling address() avoids the read read barrier that does gray
2329 : * unmarking, but it's not possible for the object to be gray here.
2330 : */
2331 :
2332 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::HTMLTextAreaElement);
2333 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
2334 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
2335 : }
2336 :
2337 : JSObject*
2338 0 : GetConstructorObject(JSContext* aCx)
2339 : {
2340 0 : return GetConstructorObjectHandle(aCx);
2341 : }
2342 :
2343 : } // namespace HTMLTextAreaElementBinding
2344 :
2345 :
2346 :
2347 : } // namespace dom
2348 : } // namespace mozilla
|