/work/obj-fuzz/dom/bindings/HTMLInputElementBinding.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* THIS FILE IS AUTOGENERATED FROM HTMLInputElement.webidl BY Codegen.py - DO NOT EDIT */ |
2 | | |
3 | | #include "AtomList.h" |
4 | | #include "AutocompleteInfoBinding.h" |
5 | | #include "HTMLElementBinding.h" |
6 | | #include "HTMLInputElement.h" |
7 | | #include "HTMLInputElementBinding.h" |
8 | | #include "WrapperFactory.h" |
9 | | #include "XrayWrapper.h" |
10 | | #include "imgINotificationObserver.h" |
11 | | #include "imgIRequest.h" |
12 | | #include "jsapi.h" |
13 | | #include "mozilla/FloatingPoint.h" |
14 | | #include "mozilla/OwningNonNull.h" |
15 | | #include "mozilla/Preferences.h" |
16 | | #include "mozilla/dom/BindingUtils.h" |
17 | | #include "mozilla/dom/CustomElementRegistry.h" |
18 | | #include "mozilla/dom/DOMJSClass.h" |
19 | | #include "mozilla/dom/Date.h" |
20 | | #include "mozilla/dom/DocGroup.h" |
21 | | #include "mozilla/dom/File.h" |
22 | | #include "mozilla/dom/FileList.h" |
23 | | #include "mozilla/dom/FileSystemEntry.h" |
24 | | #include "mozilla/dom/HTMLFormElement.h" |
25 | | #include "mozilla/dom/HTMLInputElement.h" |
26 | | #include "mozilla/dom/NonRefcountedDOMObject.h" |
27 | | #include "mozilla/dom/Nullable.h" |
28 | | #include "mozilla/dom/PrimitiveConversions.h" |
29 | | #include "mozilla/dom/Promise.h" |
30 | | #include "mozilla/dom/ScriptSettings.h" |
31 | | #include "mozilla/dom/SimpleGlobalObject.h" |
32 | | #include "mozilla/dom/ToJSValue.h" |
33 | | #include "mozilla/dom/UnionConversions.h" |
34 | | #include "mozilla/dom/UnionTypes.h" |
35 | | #include "mozilla/dom/ValidityState.h" |
36 | | #include "mozilla/dom/XrayExpandoClass.h" |
37 | | #include "nsContentUtils.h" |
38 | | #include "nsGenericHTMLElement.h" |
39 | | #include "nsIControllers.h" |
40 | | #include "nsIEditor.h" |
41 | | #include "nsINodeList.h" |
42 | | #include "nsIURI.h" |
43 | | |
44 | | namespace mozilla { |
45 | | namespace dom { |
46 | | |
47 | | namespace binding_detail {}; // Just to make sure it's known as a namespace |
48 | | using namespace mozilla::dom::binding_detail; |
49 | | |
50 | | |
51 | | namespace SelectionModeValues { |
52 | | extern const EnumEntry strings[5] = { |
53 | | {"select", 6}, |
54 | | {"start", 5}, |
55 | | {"end", 3}, |
56 | | {"preserve", 8}, |
57 | | { nullptr, 0 } |
58 | | }; |
59 | | } // namespace SelectionModeValues |
60 | | |
61 | | bool |
62 | | ToJSValue(JSContext* aCx, SelectionMode aArgument, JS::MutableHandle<JS::Value> aValue) |
63 | 0 | { |
64 | 0 | MOZ_ASSERT(uint32_t(aArgument) < ArrayLength(SelectionModeValues::strings)); |
65 | 0 | JSString* resultStr = |
66 | 0 | JS_NewStringCopyN(aCx, SelectionModeValues::strings[uint32_t(aArgument)].value, |
67 | 0 | SelectionModeValues::strings[uint32_t(aArgument)].length); |
68 | 0 | if (!resultStr) { |
69 | 0 | return false; |
70 | 0 | } |
71 | 0 | aValue.setString(resultStr); |
72 | 0 | return true; |
73 | 0 | } |
74 | | |
75 | | |
76 | | |
77 | | DateTimeValue::DateTimeValue() |
78 | 0 | { |
79 | 0 | // Safe to pass a null context if we pass a null value |
80 | 0 | Init(nullptr, JS::NullHandleValue); |
81 | 0 | } |
82 | | |
83 | | |
84 | | |
85 | | bool |
86 | | DateTimeValue::InitIds(JSContext* cx, DateTimeValueAtoms* atomsCache) |
87 | 0 | { |
88 | 0 | MOZ_ASSERT(!*reinterpret_cast<jsid**>(atomsCache)); |
89 | 0 |
|
90 | 0 | // Initialize these in reverse order so that any failure leaves the first one |
91 | 0 | // uninitialized. |
92 | 0 | if (!atomsCache->year_id.init(cx, "year") || |
93 | 0 | !atomsCache->month_id.init(cx, "month") || |
94 | 0 | !atomsCache->minute_id.init(cx, "minute") || |
95 | 0 | !atomsCache->hour_id.init(cx, "hour") || |
96 | 0 | !atomsCache->day_id.init(cx, "day")) { |
97 | 0 | return false; |
98 | 0 | } |
99 | 0 | return true; |
100 | 0 | } |
101 | | |
102 | | bool |
103 | | DateTimeValue::Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription, bool passedToJSImpl) |
104 | 0 | { |
105 | 0 | // Passing a null JSContext is OK only if we're initing from null, |
106 | 0 | // Since in that case we will not have to do any property gets |
107 | 0 | // Also evaluate isNullOrUndefined in order to avoid false-positive |
108 | 0 | // checkers by static analysis tools |
109 | 0 | MOZ_ASSERT_IF(!cx, val.isNull() && val.isNullOrUndefined()); |
110 | 0 | DateTimeValueAtoms* atomsCache = nullptr; |
111 | 0 | if (cx) { |
112 | 0 | atomsCache = GetAtomCache<DateTimeValueAtoms>(cx); |
113 | 0 | if (!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) { |
114 | 0 | return false; |
115 | 0 | } |
116 | 0 | } |
117 | 0 | |
118 | 0 | if (!IsConvertibleToDictionary(val)) { |
119 | 0 | return ThrowErrorMessage(cx, MSG_NOT_DICTIONARY, sourceDescription); |
120 | 0 | } |
121 | 0 | |
122 | 0 | bool isNull = val.isNullOrUndefined(); |
123 | 0 | // We only need these if !isNull, in which case we have |cx|. |
124 | 0 | Maybe<JS::Rooted<JSObject *> > object; |
125 | 0 | Maybe<JS::Rooted<JS::Value> > temp; |
126 | 0 | if (!isNull) { |
127 | 0 | MOZ_ASSERT(cx); |
128 | 0 | object.emplace(cx, &val.toObject()); |
129 | 0 | temp.emplace(cx); |
130 | 0 | } |
131 | 0 | if (!isNull) { |
132 | 0 | if (!JS_GetPropertyById(cx, *object, atomsCache->day_id, temp.ptr())) { |
133 | 0 | return false; |
134 | 0 | } |
135 | 0 | } |
136 | 0 | if (!isNull && !temp->isUndefined()) { |
137 | 0 | mDay.Construct(); |
138 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, temp.ref(), &(mDay.Value()))) { |
139 | 0 | return false; |
140 | 0 | } |
141 | 0 | mIsAnyMemberPresent = true; |
142 | 0 | } |
143 | 0 |
|
144 | 0 | if (!isNull) { |
145 | 0 | if (!JS_GetPropertyById(cx, *object, atomsCache->hour_id, temp.ptr())) { |
146 | 0 | return false; |
147 | 0 | } |
148 | 0 | } |
149 | 0 | if (!isNull && !temp->isUndefined()) { |
150 | 0 | mHour.Construct(); |
151 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, temp.ref(), &(mHour.Value()))) { |
152 | 0 | return false; |
153 | 0 | } |
154 | 0 | mIsAnyMemberPresent = true; |
155 | 0 | } |
156 | 0 |
|
157 | 0 | if (!isNull) { |
158 | 0 | if (!JS_GetPropertyById(cx, *object, atomsCache->minute_id, temp.ptr())) { |
159 | 0 | return false; |
160 | 0 | } |
161 | 0 | } |
162 | 0 | if (!isNull && !temp->isUndefined()) { |
163 | 0 | mMinute.Construct(); |
164 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, temp.ref(), &(mMinute.Value()))) { |
165 | 0 | return false; |
166 | 0 | } |
167 | 0 | mIsAnyMemberPresent = true; |
168 | 0 | } |
169 | 0 |
|
170 | 0 | if (!isNull) { |
171 | 0 | if (!JS_GetPropertyById(cx, *object, atomsCache->month_id, temp.ptr())) { |
172 | 0 | return false; |
173 | 0 | } |
174 | 0 | } |
175 | 0 | if (!isNull && !temp->isUndefined()) { |
176 | 0 | mMonth.Construct(); |
177 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, temp.ref(), &(mMonth.Value()))) { |
178 | 0 | return false; |
179 | 0 | } |
180 | 0 | mIsAnyMemberPresent = true; |
181 | 0 | } |
182 | 0 |
|
183 | 0 | if (!isNull) { |
184 | 0 | if (!JS_GetPropertyById(cx, *object, atomsCache->year_id, temp.ptr())) { |
185 | 0 | return false; |
186 | 0 | } |
187 | 0 | } |
188 | 0 | if (!isNull && !temp->isUndefined()) { |
189 | 0 | mYear.Construct(); |
190 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, temp.ref(), &(mYear.Value()))) { |
191 | 0 | return false; |
192 | 0 | } |
193 | 0 | mIsAnyMemberPresent = true; |
194 | 0 | } |
195 | 0 | return true; |
196 | 0 | } |
197 | | |
198 | | bool |
199 | | DateTimeValue::Init(const nsAString& aJSON) |
200 | 0 | { |
201 | 0 | AutoJSAPI jsapi; |
202 | 0 | JSObject* cleanGlobal = SimpleGlobalObject::Create(SimpleGlobalObject::GlobalType::BindingDetail); |
203 | 0 | if (!cleanGlobal) { |
204 | 0 | return false; |
205 | 0 | } |
206 | 0 | if (!jsapi.Init(cleanGlobal)) { |
207 | 0 | return false; |
208 | 0 | } |
209 | 0 | JSContext* cx = jsapi.cx(); |
210 | 0 | JS::Rooted<JS::Value> json(cx); |
211 | 0 | bool ok = ParseJSON(cx, aJSON, &json); |
212 | 0 | NS_ENSURE_TRUE(ok, false); |
213 | 0 | return Init(cx, json); |
214 | 0 | } |
215 | | |
216 | | bool |
217 | | DateTimeValue::ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const |
218 | 0 | { |
219 | 0 | DateTimeValueAtoms* atomsCache = GetAtomCache<DateTimeValueAtoms>(cx); |
220 | 0 | if (!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) { |
221 | 0 | return false; |
222 | 0 | } |
223 | 0 | |
224 | 0 | JS::Rooted<JSObject*> obj(cx, JS_NewPlainObject(cx)); |
225 | 0 | if (!obj) { |
226 | 0 | return false; |
227 | 0 | } |
228 | 0 | rval.set(JS::ObjectValue(*obj)); |
229 | 0 |
|
230 | 0 | if (mDay.WasPassed()) { |
231 | 0 | do { |
232 | 0 | // block for our 'break' successCode and scope for 'temp' and 'currentValue' |
233 | 0 | JS::Rooted<JS::Value> temp(cx); |
234 | 0 | int32_t const & currentValue = mDay.InternalValue(); |
235 | 0 | temp.setInt32(int32_t(currentValue)); |
236 | 0 | if (!JS_DefinePropertyById(cx, obj, atomsCache->day_id, temp, JSPROP_ENUMERATE)) { |
237 | 0 | return false; |
238 | 0 | } |
239 | 0 | break; |
240 | 0 | } while(false); |
241 | 0 | } |
242 | 0 |
|
243 | 0 | if (mHour.WasPassed()) { |
244 | 0 | do { |
245 | 0 | // block for our 'break' successCode and scope for 'temp' and 'currentValue' |
246 | 0 | JS::Rooted<JS::Value> temp(cx); |
247 | 0 | int32_t const & currentValue = mHour.InternalValue(); |
248 | 0 | temp.setInt32(int32_t(currentValue)); |
249 | 0 | if (!JS_DefinePropertyById(cx, obj, atomsCache->hour_id, temp, JSPROP_ENUMERATE)) { |
250 | 0 | return false; |
251 | 0 | } |
252 | 0 | break; |
253 | 0 | } while(false); |
254 | 0 | } |
255 | 0 |
|
256 | 0 | if (mMinute.WasPassed()) { |
257 | 0 | do { |
258 | 0 | // block for our 'break' successCode and scope for 'temp' and 'currentValue' |
259 | 0 | JS::Rooted<JS::Value> temp(cx); |
260 | 0 | int32_t const & currentValue = mMinute.InternalValue(); |
261 | 0 | temp.setInt32(int32_t(currentValue)); |
262 | 0 | if (!JS_DefinePropertyById(cx, obj, atomsCache->minute_id, temp, JSPROP_ENUMERATE)) { |
263 | 0 | return false; |
264 | 0 | } |
265 | 0 | break; |
266 | 0 | } while(false); |
267 | 0 | } |
268 | 0 |
|
269 | 0 | if (mMonth.WasPassed()) { |
270 | 0 | do { |
271 | 0 | // block for our 'break' successCode and scope for 'temp' and 'currentValue' |
272 | 0 | JS::Rooted<JS::Value> temp(cx); |
273 | 0 | int32_t const & currentValue = mMonth.InternalValue(); |
274 | 0 | temp.setInt32(int32_t(currentValue)); |
275 | 0 | if (!JS_DefinePropertyById(cx, obj, atomsCache->month_id, temp, JSPROP_ENUMERATE)) { |
276 | 0 | return false; |
277 | 0 | } |
278 | 0 | break; |
279 | 0 | } while(false); |
280 | 0 | } |
281 | 0 |
|
282 | 0 | if (mYear.WasPassed()) { |
283 | 0 | do { |
284 | 0 | // block for our 'break' successCode and scope for 'temp' and 'currentValue' |
285 | 0 | JS::Rooted<JS::Value> temp(cx); |
286 | 0 | int32_t const & currentValue = mYear.InternalValue(); |
287 | 0 | temp.setInt32(int32_t(currentValue)); |
288 | 0 | if (!JS_DefinePropertyById(cx, obj, atomsCache->year_id, temp, JSPROP_ENUMERATE)) { |
289 | 0 | return false; |
290 | 0 | } |
291 | 0 | break; |
292 | 0 | } while(false); |
293 | 0 | } |
294 | 0 |
|
295 | 0 | return true; |
296 | 0 | } |
297 | | |
298 | | bool |
299 | | DateTimeValue::ToJSON(nsAString& aJSON) const |
300 | 0 | { |
301 | 0 | AutoJSAPI jsapi; |
302 | 0 | jsapi.Init(); |
303 | 0 | JSContext *cx = jsapi.cx(); |
304 | 0 | // It's safe to use UnprivilegedJunkScopeOrWorkerGlobal here |
305 | 0 | // because we'll only be creating objects, in ways that have no |
306 | 0 | // side-effects, followed by a call to JS::ToJSONMaybeSafely, |
307 | 0 | // which likewise guarantees no side-effects for the sorts of |
308 | 0 | // things we will pass it. |
309 | 0 | JSAutoRealm ar(cx, UnprivilegedJunkScopeOrWorkerGlobal()); |
310 | 0 | JS::Rooted<JS::Value> val(cx); |
311 | 0 | if (!ToObjectInternal(cx, &val)) { |
312 | 0 | return false; |
313 | 0 | } |
314 | 0 | JS::Rooted<JSObject*> obj(cx, &val.toObject()); |
315 | 0 | return StringifyToJSON(cx, obj, aJSON); |
316 | 0 | } |
317 | | |
318 | | void |
319 | | DateTimeValue::TraceDictionary(JSTracer* trc) |
320 | 0 | { |
321 | 0 | } |
322 | | |
323 | | DateTimeValue& |
324 | | DateTimeValue::operator=(const DateTimeValue& aOther) |
325 | 0 | { |
326 | 0 | DictionaryBase::operator=(aOther); |
327 | 0 | mDay.Reset(); |
328 | 0 | if (aOther.mDay.WasPassed()) { |
329 | 0 | mDay.Construct(aOther.mDay.Value()); |
330 | 0 | } |
331 | 0 | mHour.Reset(); |
332 | 0 | if (aOther.mHour.WasPassed()) { |
333 | 0 | mHour.Construct(aOther.mHour.Value()); |
334 | 0 | } |
335 | 0 | mMinute.Reset(); |
336 | 0 | if (aOther.mMinute.WasPassed()) { |
337 | 0 | mMinute.Construct(aOther.mMinute.Value()); |
338 | 0 | } |
339 | 0 | mMonth.Reset(); |
340 | 0 | if (aOther.mMonth.WasPassed()) { |
341 | 0 | mMonth.Construct(aOther.mMonth.Value()); |
342 | 0 | } |
343 | 0 | mYear.Reset(); |
344 | 0 | if (aOther.mYear.WasPassed()) { |
345 | 0 | mYear.Construct(aOther.mYear.Value()); |
346 | 0 | } |
347 | 0 | return *this; |
348 | 0 | } |
349 | | |
350 | | namespace binding_detail { |
351 | | } // namespace binding_detail |
352 | | |
353 | | |
354 | | namespace HTMLInputElement_Binding { |
355 | | |
356 | | static_assert(IsRefcounted<NativeType>::value == IsRefcounted<HTMLElement_Binding::NativeType>::value, |
357 | | "Can't inherit from an interface with a different ownership model."); |
358 | | |
359 | | MOZ_CAN_RUN_SCRIPT static bool |
360 | | get_accept(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
361 | 0 | { |
362 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.accept", DOM, cx); |
363 | 0 |
|
364 | 0 | DOMString result; |
365 | 0 | self->GetAccept(result); |
366 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
367 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
368 | 0 | return false; |
369 | 0 | } |
370 | 0 | return true; |
371 | 0 | } |
372 | | |
373 | | MOZ_CAN_RUN_SCRIPT static bool |
374 | | set_accept(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
375 | 0 | { |
376 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.accept", DOM, cx); |
377 | 0 |
|
378 | 0 | binding_detail::FakeString arg0; |
379 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
380 | 0 | return false; |
381 | 0 | } |
382 | 0 | Maybe<AutoCEReaction> ceReaction; |
383 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
384 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
385 | 0 | if (docGroup) { |
386 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
387 | 0 | } |
388 | 0 | } |
389 | 0 | FastErrorResult rv; |
390 | 0 | self->SetAccept(NonNullHelper(Constify(arg0)), rv); |
391 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
392 | 0 | return false; |
393 | 0 | } |
394 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
395 | 0 |
|
396 | 0 | return true; |
397 | 0 | } |
398 | | |
399 | | static const JSJitInfo accept_getterinfo = { |
400 | | { (JSJitGetterOp)get_accept }, |
401 | | { prototypes::id::HTMLInputElement }, |
402 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
403 | | JSJitInfo::Getter, |
404 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
405 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
406 | | false, /* isInfallible. False in setters. */ |
407 | | true, /* isMovable. Not relevant for setters. */ |
408 | | true, /* isEliminatable. Not relevant for setters. */ |
409 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
410 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
411 | | false, /* isTypedMethod. Only relevant for methods. */ |
412 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
413 | | }; |
414 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
415 | | static_assert(0 < 2, "There is no slot for us"); |
416 | | static const JSJitInfo accept_setterinfo = { |
417 | | { (JSJitGetterOp)set_accept }, |
418 | | { prototypes::id::HTMLInputElement }, |
419 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
420 | | JSJitInfo::Setter, |
421 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
422 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
423 | | false, /* isInfallible. False in setters. */ |
424 | | false, /* isMovable. Not relevant for setters. */ |
425 | | false, /* isEliminatable. Not relevant for setters. */ |
426 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
427 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
428 | | false, /* isTypedMethod. Only relevant for methods. */ |
429 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
430 | | }; |
431 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
432 | | static_assert(0 < 2, "There is no slot for us"); |
433 | | |
434 | | MOZ_CAN_RUN_SCRIPT static bool |
435 | | get_alt(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
436 | 0 | { |
437 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.alt", DOM, cx); |
438 | 0 |
|
439 | 0 | DOMString result; |
440 | 0 | self->GetAlt(result); |
441 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
442 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
443 | 0 | return false; |
444 | 0 | } |
445 | 0 | return true; |
446 | 0 | } |
447 | | |
448 | | MOZ_CAN_RUN_SCRIPT static bool |
449 | | set_alt(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
450 | 0 | { |
451 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.alt", DOM, cx); |
452 | 0 |
|
453 | 0 | binding_detail::FakeString arg0; |
454 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
455 | 0 | return false; |
456 | 0 | } |
457 | 0 | Maybe<AutoCEReaction> ceReaction; |
458 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
459 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
460 | 0 | if (docGroup) { |
461 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
462 | 0 | } |
463 | 0 | } |
464 | 0 | FastErrorResult rv; |
465 | 0 | self->SetAlt(NonNullHelper(Constify(arg0)), rv); |
466 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
467 | 0 | return false; |
468 | 0 | } |
469 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
470 | 0 |
|
471 | 0 | return true; |
472 | 0 | } |
473 | | |
474 | | static const JSJitInfo alt_getterinfo = { |
475 | | { (JSJitGetterOp)get_alt }, |
476 | | { prototypes::id::HTMLInputElement }, |
477 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
478 | | JSJitInfo::Getter, |
479 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
480 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
481 | | false, /* isInfallible. False in setters. */ |
482 | | true, /* isMovable. Not relevant for setters. */ |
483 | | true, /* isEliminatable. Not relevant for setters. */ |
484 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
485 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
486 | | false, /* isTypedMethod. Only relevant for methods. */ |
487 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
488 | | }; |
489 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
490 | | static_assert(0 < 2, "There is no slot for us"); |
491 | | static const JSJitInfo alt_setterinfo = { |
492 | | { (JSJitGetterOp)set_alt }, |
493 | | { prototypes::id::HTMLInputElement }, |
494 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
495 | | JSJitInfo::Setter, |
496 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
497 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
498 | | false, /* isInfallible. False in setters. */ |
499 | | false, /* isMovable. Not relevant for setters. */ |
500 | | false, /* isEliminatable. Not relevant for setters. */ |
501 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
502 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
503 | | false, /* isTypedMethod. Only relevant for methods. */ |
504 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
505 | | }; |
506 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
507 | | static_assert(0 < 2, "There is no slot for us"); |
508 | | |
509 | | MOZ_CAN_RUN_SCRIPT static bool |
510 | | get_autocomplete(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
511 | 0 | { |
512 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.autocomplete", DOM, cx); |
513 | 0 |
|
514 | 0 | DOMString result; |
515 | 0 | self->GetAutocomplete(result); |
516 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
517 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
518 | 0 | return false; |
519 | 0 | } |
520 | 0 | return true; |
521 | 0 | } |
522 | | |
523 | | MOZ_CAN_RUN_SCRIPT static bool |
524 | | set_autocomplete(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
525 | 0 | { |
526 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.autocomplete", DOM, cx); |
527 | 0 |
|
528 | 0 | binding_detail::FakeString arg0; |
529 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
530 | 0 | return false; |
531 | 0 | } |
532 | 0 | Maybe<AutoCEReaction> ceReaction; |
533 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
534 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
535 | 0 | if (docGroup) { |
536 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
537 | 0 | } |
538 | 0 | } |
539 | 0 | FastErrorResult rv; |
540 | 0 | self->SetAutocomplete(NonNullHelper(Constify(arg0)), rv); |
541 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
542 | 0 | return false; |
543 | 0 | } |
544 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
545 | 0 |
|
546 | 0 | return true; |
547 | 0 | } |
548 | | |
549 | | static const JSJitInfo autocomplete_getterinfo = { |
550 | | { (JSJitGetterOp)get_autocomplete }, |
551 | | { prototypes::id::HTMLInputElement }, |
552 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
553 | | JSJitInfo::Getter, |
554 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
555 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
556 | | false, /* isInfallible. False in setters. */ |
557 | | true, /* isMovable. Not relevant for setters. */ |
558 | | true, /* isEliminatable. Not relevant for setters. */ |
559 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
560 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
561 | | false, /* isTypedMethod. Only relevant for methods. */ |
562 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
563 | | }; |
564 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
565 | | static_assert(0 < 2, "There is no slot for us"); |
566 | | static const JSJitInfo autocomplete_setterinfo = { |
567 | | { (JSJitGetterOp)set_autocomplete }, |
568 | | { prototypes::id::HTMLInputElement }, |
569 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
570 | | JSJitInfo::Setter, |
571 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
572 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
573 | | false, /* isInfallible. False in setters. */ |
574 | | false, /* isMovable. Not relevant for setters. */ |
575 | | false, /* isEliminatable. Not relevant for setters. */ |
576 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
577 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
578 | | false, /* isTypedMethod. Only relevant for methods. */ |
579 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
580 | | }; |
581 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
582 | | static_assert(0 < 2, "There is no slot for us"); |
583 | | |
584 | | MOZ_CAN_RUN_SCRIPT static bool |
585 | | get_autofocus(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
586 | 0 | { |
587 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.autofocus", DOM, cx); |
588 | 0 |
|
589 | 0 | bool result(self->Autofocus()); |
590 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
591 | 0 | args.rval().setBoolean(result); |
592 | 0 | return true; |
593 | 0 | } |
594 | | |
595 | | MOZ_CAN_RUN_SCRIPT static bool |
596 | | set_autofocus(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
597 | 0 | { |
598 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.autofocus", DOM, cx); |
599 | 0 |
|
600 | 0 | bool arg0; |
601 | 0 | if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) { |
602 | 0 | return false; |
603 | 0 | } |
604 | 0 | Maybe<AutoCEReaction> ceReaction; |
605 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
606 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
607 | 0 | if (docGroup) { |
608 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
609 | 0 | } |
610 | 0 | } |
611 | 0 | FastErrorResult rv; |
612 | 0 | self->SetAutofocus(arg0, rv); |
613 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
614 | 0 | return false; |
615 | 0 | } |
616 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
617 | 0 |
|
618 | 0 | return true; |
619 | 0 | } |
620 | | |
621 | | static const JSJitInfo autofocus_getterinfo = { |
622 | | { (JSJitGetterOp)get_autofocus }, |
623 | | { prototypes::id::HTMLInputElement }, |
624 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
625 | | JSJitInfo::Getter, |
626 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
627 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
628 | | true, /* isInfallible. False in setters. */ |
629 | | true, /* isMovable. Not relevant for setters. */ |
630 | | true, /* isEliminatable. Not relevant for setters. */ |
631 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
632 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
633 | | false, /* isTypedMethod. Only relevant for methods. */ |
634 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
635 | | }; |
636 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
637 | | static_assert(0 < 2, "There is no slot for us"); |
638 | | static const JSJitInfo autofocus_setterinfo = { |
639 | | { (JSJitGetterOp)set_autofocus }, |
640 | | { prototypes::id::HTMLInputElement }, |
641 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
642 | | JSJitInfo::Setter, |
643 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
644 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
645 | | false, /* isInfallible. False in setters. */ |
646 | | false, /* isMovable. Not relevant for setters. */ |
647 | | false, /* isEliminatable. Not relevant for setters. */ |
648 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
649 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
650 | | false, /* isTypedMethod. Only relevant for methods. */ |
651 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
652 | | }; |
653 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
654 | | static_assert(0 < 2, "There is no slot for us"); |
655 | | |
656 | | MOZ_CAN_RUN_SCRIPT static bool |
657 | | get_defaultChecked(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
658 | 0 | { |
659 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.defaultChecked", DOM, cx); |
660 | 0 |
|
661 | 0 | bool result(self->DefaultChecked()); |
662 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
663 | 0 | args.rval().setBoolean(result); |
664 | 0 | return true; |
665 | 0 | } |
666 | | |
667 | | MOZ_CAN_RUN_SCRIPT static bool |
668 | | set_defaultChecked(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
669 | 0 | { |
670 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.defaultChecked", DOM, cx); |
671 | 0 |
|
672 | 0 | bool arg0; |
673 | 0 | if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) { |
674 | 0 | return false; |
675 | 0 | } |
676 | 0 | Maybe<AutoCEReaction> ceReaction; |
677 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
678 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
679 | 0 | if (docGroup) { |
680 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
681 | 0 | } |
682 | 0 | } |
683 | 0 | FastErrorResult rv; |
684 | 0 | self->SetDefaultChecked(arg0, rv); |
685 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
686 | 0 | return false; |
687 | 0 | } |
688 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
689 | 0 |
|
690 | 0 | return true; |
691 | 0 | } |
692 | | |
693 | | static const JSJitInfo defaultChecked_getterinfo = { |
694 | | { (JSJitGetterOp)get_defaultChecked }, |
695 | | { prototypes::id::HTMLInputElement }, |
696 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
697 | | JSJitInfo::Getter, |
698 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
699 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
700 | | true, /* isInfallible. False in setters. */ |
701 | | true, /* isMovable. Not relevant for setters. */ |
702 | | true, /* isEliminatable. Not relevant for setters. */ |
703 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
704 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
705 | | false, /* isTypedMethod. Only relevant for methods. */ |
706 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
707 | | }; |
708 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
709 | | static_assert(0 < 2, "There is no slot for us"); |
710 | | static const JSJitInfo defaultChecked_setterinfo = { |
711 | | { (JSJitGetterOp)set_defaultChecked }, |
712 | | { prototypes::id::HTMLInputElement }, |
713 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
714 | | JSJitInfo::Setter, |
715 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
716 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
717 | | false, /* isInfallible. False in setters. */ |
718 | | false, /* isMovable. Not relevant for setters. */ |
719 | | false, /* isEliminatable. Not relevant for setters. */ |
720 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
721 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
722 | | false, /* isTypedMethod. Only relevant for methods. */ |
723 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
724 | | }; |
725 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
726 | | static_assert(0 < 2, "There is no slot for us"); |
727 | | |
728 | | MOZ_CAN_RUN_SCRIPT static bool |
729 | | get_checked(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
730 | 0 | { |
731 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.checked", DOM, cx); |
732 | 0 |
|
733 | 0 | bool result(self->Checked()); |
734 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
735 | 0 | args.rval().setBoolean(result); |
736 | 0 | return true; |
737 | 0 | } |
738 | | |
739 | | MOZ_CAN_RUN_SCRIPT static bool |
740 | | set_checked(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
741 | 0 | { |
742 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.checked", DOM, cx); |
743 | 0 |
|
744 | 0 | bool arg0; |
745 | 0 | if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) { |
746 | 0 | return false; |
747 | 0 | } |
748 | 0 | self->SetChecked(arg0); |
749 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
750 | 0 |
|
751 | 0 | return true; |
752 | 0 | } |
753 | | |
754 | | static const JSJitInfo checked_getterinfo = { |
755 | | { (JSJitGetterOp)get_checked }, |
756 | | { prototypes::id::HTMLInputElement }, |
757 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
758 | | JSJitInfo::Getter, |
759 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
760 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
761 | | true, /* isInfallible. False in setters. */ |
762 | | true, /* isMovable. Not relevant for setters. */ |
763 | | true, /* isEliminatable. Not relevant for setters. */ |
764 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
765 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
766 | | false, /* isTypedMethod. Only relevant for methods. */ |
767 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
768 | | }; |
769 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
770 | | static_assert(0 < 2, "There is no slot for us"); |
771 | | static const JSJitInfo checked_setterinfo = { |
772 | | { (JSJitGetterOp)set_checked }, |
773 | | { prototypes::id::HTMLInputElement }, |
774 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
775 | | JSJitInfo::Setter, |
776 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
777 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
778 | | false, /* isInfallible. False in setters. */ |
779 | | false, /* isMovable. Not relevant for setters. */ |
780 | | false, /* isEliminatable. Not relevant for setters. */ |
781 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
782 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
783 | | false, /* isTypedMethod. Only relevant for methods. */ |
784 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
785 | | }; |
786 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
787 | | static_assert(0 < 2, "There is no slot for us"); |
788 | | |
789 | | MOZ_CAN_RUN_SCRIPT static bool |
790 | | get_disabled(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
791 | 0 | { |
792 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.disabled", DOM, cx); |
793 | 0 |
|
794 | 0 | bool result(self->Disabled()); |
795 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
796 | 0 | args.rval().setBoolean(result); |
797 | 0 | return true; |
798 | 0 | } |
799 | | |
800 | | MOZ_CAN_RUN_SCRIPT static bool |
801 | | set_disabled(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
802 | 0 | { |
803 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.disabled", DOM, cx); |
804 | 0 |
|
805 | 0 | bool arg0; |
806 | 0 | if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) { |
807 | 0 | return false; |
808 | 0 | } |
809 | 0 | Maybe<AutoCEReaction> ceReaction; |
810 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
811 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
812 | 0 | if (docGroup) { |
813 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
814 | 0 | } |
815 | 0 | } |
816 | 0 | FastErrorResult rv; |
817 | 0 | self->SetDisabled(arg0, rv); |
818 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
819 | 0 | return false; |
820 | 0 | } |
821 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
822 | 0 |
|
823 | 0 | return true; |
824 | 0 | } |
825 | | |
826 | | static const JSJitInfo disabled_getterinfo = { |
827 | | { (JSJitGetterOp)get_disabled }, |
828 | | { prototypes::id::HTMLInputElement }, |
829 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
830 | | JSJitInfo::Getter, |
831 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
832 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
833 | | true, /* isInfallible. False in setters. */ |
834 | | true, /* isMovable. Not relevant for setters. */ |
835 | | true, /* isEliminatable. Not relevant for setters. */ |
836 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
837 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
838 | | false, /* isTypedMethod. Only relevant for methods. */ |
839 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
840 | | }; |
841 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
842 | | static_assert(0 < 2, "There is no slot for us"); |
843 | | static const JSJitInfo disabled_setterinfo = { |
844 | | { (JSJitGetterOp)set_disabled }, |
845 | | { prototypes::id::HTMLInputElement }, |
846 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
847 | | JSJitInfo::Setter, |
848 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
849 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
850 | | false, /* isInfallible. False in setters. */ |
851 | | false, /* isMovable. Not relevant for setters. */ |
852 | | false, /* isEliminatable. Not relevant for setters. */ |
853 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
854 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
855 | | false, /* isTypedMethod. Only relevant for methods. */ |
856 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
857 | | }; |
858 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
859 | | static_assert(0 < 2, "There is no slot for us"); |
860 | | |
861 | | MOZ_CAN_RUN_SCRIPT static bool |
862 | | get_form(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
863 | 0 | { |
864 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.form", DOM, cx); |
865 | 0 |
|
866 | 0 | auto result(StrongOrRawPtr<mozilla::dom::HTMLFormElement>(self->GetForm())); |
867 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
868 | 0 | if (!result) { |
869 | 0 | args.rval().setNull(); |
870 | 0 | return true; |
871 | 0 | } |
872 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
873 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
874 | 0 | return false; |
875 | 0 | } |
876 | 0 | return true; |
877 | 0 | } |
878 | | |
879 | | static const JSJitInfo form_getterinfo = { |
880 | | { (JSJitGetterOp)get_form }, |
881 | | { prototypes::id::HTMLInputElement }, |
882 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
883 | | JSJitInfo::Getter, |
884 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
885 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
886 | | false, /* isInfallible. False in setters. */ |
887 | | false, /* isMovable. Not relevant for setters. */ |
888 | | false, /* isEliminatable. Not relevant for setters. */ |
889 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
890 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
891 | | false, /* isTypedMethod. Only relevant for methods. */ |
892 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
893 | | }; |
894 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
895 | | static_assert(0 < 2, "There is no slot for us"); |
896 | | |
897 | | MOZ_CAN_RUN_SCRIPT static bool |
898 | | get_files(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
899 | 0 | { |
900 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.files", DOM, cx); |
901 | 0 |
|
902 | 0 | auto result(StrongOrRawPtr<mozilla::dom::FileList>(self->GetFiles())); |
903 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
904 | 0 | if (!result) { |
905 | 0 | args.rval().setNull(); |
906 | 0 | return true; |
907 | 0 | } |
908 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
909 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
910 | 0 | return false; |
911 | 0 | } |
912 | 0 | return true; |
913 | 0 | } |
914 | | |
915 | | MOZ_CAN_RUN_SCRIPT static bool |
916 | | set_files(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
917 | 0 | { |
918 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.files", DOM, cx); |
919 | 0 |
|
920 | 0 | mozilla::dom::FileList* arg0; |
921 | 0 | if (args[0].isObject()) { |
922 | 0 | { |
923 | 0 | nsresult rv = UnwrapObject<prototypes::id::FileList, mozilla::dom::FileList>(args[0], arg0); |
924 | 0 | if (NS_FAILED(rv)) { |
925 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Value being assigned to HTMLInputElement.files", "FileList"); |
926 | 0 | return false; |
927 | 0 | } |
928 | 0 | } |
929 | 0 | } else if (args[0].isNullOrUndefined()) { |
930 | 0 | arg0 = nullptr; |
931 | 0 | } else { |
932 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Value being assigned to HTMLInputElement.files"); |
933 | 0 | return false; |
934 | 0 | } |
935 | 0 | self->SetFiles(MOZ_KnownLive(Constify(arg0))); |
936 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
937 | 0 |
|
938 | 0 | return true; |
939 | 0 | } |
940 | | |
941 | | static const JSJitInfo files_getterinfo = { |
942 | | { (JSJitGetterOp)get_files }, |
943 | | { prototypes::id::HTMLInputElement }, |
944 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
945 | | JSJitInfo::Getter, |
946 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
947 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
948 | | false, /* isInfallible. False in setters. */ |
949 | | true, /* isMovable. Not relevant for setters. */ |
950 | | true, /* isEliminatable. Not relevant for setters. */ |
951 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
952 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
953 | | false, /* isTypedMethod. Only relevant for methods. */ |
954 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
955 | | }; |
956 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
957 | | static_assert(0 < 2, "There is no slot for us"); |
958 | | static const JSJitInfo files_setterinfo = { |
959 | | { (JSJitGetterOp)set_files }, |
960 | | { prototypes::id::HTMLInputElement }, |
961 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
962 | | JSJitInfo::Setter, |
963 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
964 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
965 | | false, /* isInfallible. False in setters. */ |
966 | | false, /* isMovable. Not relevant for setters. */ |
967 | | false, /* isEliminatable. Not relevant for setters. */ |
968 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
969 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
970 | | false, /* isTypedMethod. Only relevant for methods. */ |
971 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
972 | | }; |
973 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
974 | | static_assert(0 < 2, "There is no slot for us"); |
975 | | |
976 | | MOZ_CAN_RUN_SCRIPT static bool |
977 | | get_formAction(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
978 | 0 | { |
979 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.formAction", DOM, cx); |
980 | 0 |
|
981 | 0 | DOMString result; |
982 | 0 | self->GetFormAction(result); |
983 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
984 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
985 | 0 | return false; |
986 | 0 | } |
987 | 0 | return true; |
988 | 0 | } |
989 | | |
990 | | MOZ_CAN_RUN_SCRIPT static bool |
991 | | set_formAction(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
992 | 0 | { |
993 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.formAction", DOM, cx); |
994 | 0 |
|
995 | 0 | binding_detail::FakeString arg0; |
996 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
997 | 0 | return false; |
998 | 0 | } |
999 | 0 | Maybe<AutoCEReaction> ceReaction; |
1000 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
1001 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
1002 | 0 | if (docGroup) { |
1003 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
1004 | 0 | } |
1005 | 0 | } |
1006 | 0 | FastErrorResult rv; |
1007 | 0 | self->SetFormAction(NonNullHelper(Constify(arg0)), rv); |
1008 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1009 | 0 | return false; |
1010 | 0 | } |
1011 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1012 | 0 |
|
1013 | 0 | return true; |
1014 | 0 | } |
1015 | | |
1016 | | static const JSJitInfo formAction_getterinfo = { |
1017 | | { (JSJitGetterOp)get_formAction }, |
1018 | | { prototypes::id::HTMLInputElement }, |
1019 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
1020 | | JSJitInfo::Getter, |
1021 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
1022 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
1023 | | false, /* isInfallible. False in setters. */ |
1024 | | true, /* isMovable. Not relevant for setters. */ |
1025 | | true, /* isEliminatable. Not relevant for setters. */ |
1026 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1027 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1028 | | false, /* isTypedMethod. Only relevant for methods. */ |
1029 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1030 | | }; |
1031 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1032 | | static_assert(0 < 2, "There is no slot for us"); |
1033 | | static const JSJitInfo formAction_setterinfo = { |
1034 | | { (JSJitGetterOp)set_formAction }, |
1035 | | { prototypes::id::HTMLInputElement }, |
1036 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
1037 | | JSJitInfo::Setter, |
1038 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1039 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1040 | | false, /* isInfallible. False in setters. */ |
1041 | | false, /* isMovable. Not relevant for setters. */ |
1042 | | false, /* isEliminatable. Not relevant for setters. */ |
1043 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1044 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1045 | | false, /* isTypedMethod. Only relevant for methods. */ |
1046 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1047 | | }; |
1048 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1049 | | static_assert(0 < 2, "There is no slot for us"); |
1050 | | |
1051 | | MOZ_CAN_RUN_SCRIPT static bool |
1052 | | get_formEnctype(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
1053 | 0 | { |
1054 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.formEnctype", DOM, cx); |
1055 | 0 |
|
1056 | 0 | DOMString result; |
1057 | 0 | self->GetFormEnctype(result); |
1058 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1059 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
1060 | 0 | return false; |
1061 | 0 | } |
1062 | 0 | return true; |
1063 | 0 | } |
1064 | | |
1065 | | MOZ_CAN_RUN_SCRIPT static bool |
1066 | | set_formEnctype(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
1067 | 0 | { |
1068 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.formEnctype", DOM, cx); |
1069 | 0 |
|
1070 | 0 | binding_detail::FakeString arg0; |
1071 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
1072 | 0 | return false; |
1073 | 0 | } |
1074 | 0 | Maybe<AutoCEReaction> ceReaction; |
1075 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
1076 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
1077 | 0 | if (docGroup) { |
1078 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
1079 | 0 | } |
1080 | 0 | } |
1081 | 0 | FastErrorResult rv; |
1082 | 0 | self->SetFormEnctype(NonNullHelper(Constify(arg0)), rv); |
1083 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1084 | 0 | return false; |
1085 | 0 | } |
1086 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1087 | 0 |
|
1088 | 0 | return true; |
1089 | 0 | } |
1090 | | |
1091 | | static const JSJitInfo formEnctype_getterinfo = { |
1092 | | { (JSJitGetterOp)get_formEnctype }, |
1093 | | { prototypes::id::HTMLInputElement }, |
1094 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
1095 | | JSJitInfo::Getter, |
1096 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
1097 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
1098 | | false, /* isInfallible. False in setters. */ |
1099 | | true, /* isMovable. Not relevant for setters. */ |
1100 | | true, /* isEliminatable. Not relevant for setters. */ |
1101 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1102 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1103 | | false, /* isTypedMethod. Only relevant for methods. */ |
1104 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1105 | | }; |
1106 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1107 | | static_assert(0 < 2, "There is no slot for us"); |
1108 | | static const JSJitInfo formEnctype_setterinfo = { |
1109 | | { (JSJitGetterOp)set_formEnctype }, |
1110 | | { prototypes::id::HTMLInputElement }, |
1111 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
1112 | | JSJitInfo::Setter, |
1113 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1114 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1115 | | false, /* isInfallible. False in setters. */ |
1116 | | false, /* isMovable. Not relevant for setters. */ |
1117 | | false, /* isEliminatable. Not relevant for setters. */ |
1118 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1119 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1120 | | false, /* isTypedMethod. Only relevant for methods. */ |
1121 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1122 | | }; |
1123 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1124 | | static_assert(0 < 2, "There is no slot for us"); |
1125 | | |
1126 | | MOZ_CAN_RUN_SCRIPT static bool |
1127 | | get_formMethod(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
1128 | 0 | { |
1129 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.formMethod", DOM, cx); |
1130 | 0 |
|
1131 | 0 | DOMString result; |
1132 | 0 | self->GetFormMethod(result); |
1133 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1134 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
1135 | 0 | return false; |
1136 | 0 | } |
1137 | 0 | return true; |
1138 | 0 | } |
1139 | | |
1140 | | MOZ_CAN_RUN_SCRIPT static bool |
1141 | | set_formMethod(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
1142 | 0 | { |
1143 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.formMethod", DOM, cx); |
1144 | 0 |
|
1145 | 0 | binding_detail::FakeString arg0; |
1146 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
1147 | 0 | return false; |
1148 | 0 | } |
1149 | 0 | Maybe<AutoCEReaction> ceReaction; |
1150 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
1151 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
1152 | 0 | if (docGroup) { |
1153 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
1154 | 0 | } |
1155 | 0 | } |
1156 | 0 | FastErrorResult rv; |
1157 | 0 | self->SetFormMethod(NonNullHelper(Constify(arg0)), rv); |
1158 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1159 | 0 | return false; |
1160 | 0 | } |
1161 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1162 | 0 |
|
1163 | 0 | return true; |
1164 | 0 | } |
1165 | | |
1166 | | static const JSJitInfo formMethod_getterinfo = { |
1167 | | { (JSJitGetterOp)get_formMethod }, |
1168 | | { prototypes::id::HTMLInputElement }, |
1169 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
1170 | | JSJitInfo::Getter, |
1171 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
1172 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
1173 | | false, /* isInfallible. False in setters. */ |
1174 | | true, /* isMovable. Not relevant for setters. */ |
1175 | | true, /* isEliminatable. Not relevant for setters. */ |
1176 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1177 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1178 | | false, /* isTypedMethod. Only relevant for methods. */ |
1179 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1180 | | }; |
1181 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1182 | | static_assert(0 < 2, "There is no slot for us"); |
1183 | | static const JSJitInfo formMethod_setterinfo = { |
1184 | | { (JSJitGetterOp)set_formMethod }, |
1185 | | { prototypes::id::HTMLInputElement }, |
1186 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
1187 | | JSJitInfo::Setter, |
1188 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1189 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1190 | | false, /* isInfallible. False in setters. */ |
1191 | | false, /* isMovable. Not relevant for setters. */ |
1192 | | false, /* isEliminatable. Not relevant for setters. */ |
1193 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1194 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1195 | | false, /* isTypedMethod. Only relevant for methods. */ |
1196 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1197 | | }; |
1198 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1199 | | static_assert(0 < 2, "There is no slot for us"); |
1200 | | |
1201 | | MOZ_CAN_RUN_SCRIPT static bool |
1202 | | get_formNoValidate(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
1203 | 0 | { |
1204 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.formNoValidate", DOM, cx); |
1205 | 0 |
|
1206 | 0 | bool result(self->FormNoValidate()); |
1207 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1208 | 0 | args.rval().setBoolean(result); |
1209 | 0 | return true; |
1210 | 0 | } |
1211 | | |
1212 | | MOZ_CAN_RUN_SCRIPT static bool |
1213 | | set_formNoValidate(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
1214 | 0 | { |
1215 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.formNoValidate", DOM, cx); |
1216 | 0 |
|
1217 | 0 | bool arg0; |
1218 | 0 | if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) { |
1219 | 0 | return false; |
1220 | 0 | } |
1221 | 0 | Maybe<AutoCEReaction> ceReaction; |
1222 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
1223 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
1224 | 0 | if (docGroup) { |
1225 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
1226 | 0 | } |
1227 | 0 | } |
1228 | 0 | FastErrorResult rv; |
1229 | 0 | self->SetFormNoValidate(arg0, rv); |
1230 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1231 | 0 | return false; |
1232 | 0 | } |
1233 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1234 | 0 |
|
1235 | 0 | return true; |
1236 | 0 | } |
1237 | | |
1238 | | static const JSJitInfo formNoValidate_getterinfo = { |
1239 | | { (JSJitGetterOp)get_formNoValidate }, |
1240 | | { prototypes::id::HTMLInputElement }, |
1241 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
1242 | | JSJitInfo::Getter, |
1243 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
1244 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
1245 | | true, /* isInfallible. False in setters. */ |
1246 | | true, /* isMovable. Not relevant for setters. */ |
1247 | | true, /* isEliminatable. Not relevant for setters. */ |
1248 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1249 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1250 | | false, /* isTypedMethod. Only relevant for methods. */ |
1251 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1252 | | }; |
1253 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1254 | | static_assert(0 < 2, "There is no slot for us"); |
1255 | | static const JSJitInfo formNoValidate_setterinfo = { |
1256 | | { (JSJitGetterOp)set_formNoValidate }, |
1257 | | { prototypes::id::HTMLInputElement }, |
1258 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
1259 | | JSJitInfo::Setter, |
1260 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1261 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1262 | | false, /* isInfallible. False in setters. */ |
1263 | | false, /* isMovable. Not relevant for setters. */ |
1264 | | false, /* isEliminatable. Not relevant for setters. */ |
1265 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1266 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1267 | | false, /* isTypedMethod. Only relevant for methods. */ |
1268 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1269 | | }; |
1270 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1271 | | static_assert(0 < 2, "There is no slot for us"); |
1272 | | |
1273 | | MOZ_CAN_RUN_SCRIPT static bool |
1274 | | get_formTarget(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
1275 | 0 | { |
1276 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.formTarget", DOM, cx); |
1277 | 0 |
|
1278 | 0 | DOMString result; |
1279 | 0 | self->GetFormTarget(result); |
1280 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1281 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
1282 | 0 | return false; |
1283 | 0 | } |
1284 | 0 | return true; |
1285 | 0 | } |
1286 | | |
1287 | | MOZ_CAN_RUN_SCRIPT static bool |
1288 | | set_formTarget(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
1289 | 0 | { |
1290 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.formTarget", DOM, cx); |
1291 | 0 |
|
1292 | 0 | binding_detail::FakeString arg0; |
1293 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
1294 | 0 | return false; |
1295 | 0 | } |
1296 | 0 | Maybe<AutoCEReaction> ceReaction; |
1297 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
1298 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
1299 | 0 | if (docGroup) { |
1300 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
1301 | 0 | } |
1302 | 0 | } |
1303 | 0 | FastErrorResult rv; |
1304 | 0 | self->SetFormTarget(NonNullHelper(Constify(arg0)), rv); |
1305 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1306 | 0 | return false; |
1307 | 0 | } |
1308 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1309 | 0 |
|
1310 | 0 | return true; |
1311 | 0 | } |
1312 | | |
1313 | | static const JSJitInfo formTarget_getterinfo = { |
1314 | | { (JSJitGetterOp)get_formTarget }, |
1315 | | { prototypes::id::HTMLInputElement }, |
1316 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
1317 | | JSJitInfo::Getter, |
1318 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
1319 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
1320 | | false, /* isInfallible. False in setters. */ |
1321 | | true, /* isMovable. Not relevant for setters. */ |
1322 | | true, /* isEliminatable. Not relevant for setters. */ |
1323 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1324 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1325 | | false, /* isTypedMethod. Only relevant for methods. */ |
1326 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1327 | | }; |
1328 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1329 | | static_assert(0 < 2, "There is no slot for us"); |
1330 | | static const JSJitInfo formTarget_setterinfo = { |
1331 | | { (JSJitGetterOp)set_formTarget }, |
1332 | | { prototypes::id::HTMLInputElement }, |
1333 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
1334 | | JSJitInfo::Setter, |
1335 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1336 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1337 | | false, /* isInfallible. False in setters. */ |
1338 | | false, /* isMovable. Not relevant for setters. */ |
1339 | | false, /* isEliminatable. Not relevant for setters. */ |
1340 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1341 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1342 | | false, /* isTypedMethod. Only relevant for methods. */ |
1343 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1344 | | }; |
1345 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1346 | | static_assert(0 < 2, "There is no slot for us"); |
1347 | | |
1348 | | MOZ_CAN_RUN_SCRIPT static bool |
1349 | | get_height(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
1350 | 0 | { |
1351 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.height", DOM, cx); |
1352 | 0 |
|
1353 | 0 | uint32_t result(self->Height()); |
1354 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1355 | 0 | args.rval().setNumber(result); |
1356 | 0 | return true; |
1357 | 0 | } |
1358 | | |
1359 | | MOZ_CAN_RUN_SCRIPT static bool |
1360 | | set_height(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
1361 | 0 | { |
1362 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.height", DOM, cx); |
1363 | 0 |
|
1364 | 0 | uint32_t arg0; |
1365 | 0 | if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) { |
1366 | 0 | return false; |
1367 | 0 | } |
1368 | 0 | Maybe<AutoCEReaction> ceReaction; |
1369 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
1370 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
1371 | 0 | if (docGroup) { |
1372 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
1373 | 0 | } |
1374 | 0 | } |
1375 | 0 | FastErrorResult rv; |
1376 | 0 | self->SetHeight(arg0, rv); |
1377 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1378 | 0 | return false; |
1379 | 0 | } |
1380 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1381 | 0 |
|
1382 | 0 | return true; |
1383 | 0 | } |
1384 | | |
1385 | | static const JSJitInfo height_getterinfo = { |
1386 | | { (JSJitGetterOp)get_height }, |
1387 | | { prototypes::id::HTMLInputElement }, |
1388 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
1389 | | JSJitInfo::Getter, |
1390 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
1391 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
1392 | | true, /* isInfallible. False in setters. */ |
1393 | | true, /* isMovable. Not relevant for setters. */ |
1394 | | true, /* isEliminatable. Not relevant for setters. */ |
1395 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1396 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1397 | | false, /* isTypedMethod. Only relevant for methods. */ |
1398 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1399 | | }; |
1400 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1401 | | static_assert(0 < 2, "There is no slot for us"); |
1402 | | static const JSJitInfo height_setterinfo = { |
1403 | | { (JSJitGetterOp)set_height }, |
1404 | | { prototypes::id::HTMLInputElement }, |
1405 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
1406 | | JSJitInfo::Setter, |
1407 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1408 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1409 | | false, /* isInfallible. False in setters. */ |
1410 | | false, /* isMovable. Not relevant for setters. */ |
1411 | | false, /* isEliminatable. Not relevant for setters. */ |
1412 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1413 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1414 | | false, /* isTypedMethod. Only relevant for methods. */ |
1415 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1416 | | }; |
1417 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1418 | | static_assert(0 < 2, "There is no slot for us"); |
1419 | | |
1420 | | MOZ_CAN_RUN_SCRIPT static bool |
1421 | | get_indeterminate(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
1422 | 0 | { |
1423 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.indeterminate", DOM, cx); |
1424 | 0 |
|
1425 | 0 | bool result(self->Indeterminate()); |
1426 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1427 | 0 | args.rval().setBoolean(result); |
1428 | 0 | return true; |
1429 | 0 | } |
1430 | | |
1431 | | MOZ_CAN_RUN_SCRIPT static bool |
1432 | | set_indeterminate(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
1433 | 0 | { |
1434 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.indeterminate", DOM, cx); |
1435 | 0 |
|
1436 | 0 | bool arg0; |
1437 | 0 | if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) { |
1438 | 0 | return false; |
1439 | 0 | } |
1440 | 0 | self->SetIndeterminate(arg0); |
1441 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1442 | 0 |
|
1443 | 0 | return true; |
1444 | 0 | } |
1445 | | |
1446 | | static const JSJitInfo indeterminate_getterinfo = { |
1447 | | { (JSJitGetterOp)get_indeterminate }, |
1448 | | { prototypes::id::HTMLInputElement }, |
1449 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
1450 | | JSJitInfo::Getter, |
1451 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
1452 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
1453 | | true, /* isInfallible. False in setters. */ |
1454 | | true, /* isMovable. Not relevant for setters. */ |
1455 | | true, /* isEliminatable. Not relevant for setters. */ |
1456 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1457 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1458 | | false, /* isTypedMethod. Only relevant for methods. */ |
1459 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1460 | | }; |
1461 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1462 | | static_assert(0 < 2, "There is no slot for us"); |
1463 | | static const JSJitInfo indeterminate_setterinfo = { |
1464 | | { (JSJitGetterOp)set_indeterminate }, |
1465 | | { prototypes::id::HTMLInputElement }, |
1466 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
1467 | | JSJitInfo::Setter, |
1468 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1469 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1470 | | false, /* isInfallible. False in setters. */ |
1471 | | false, /* isMovable. Not relevant for setters. */ |
1472 | | false, /* isEliminatable. Not relevant for setters. */ |
1473 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1474 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1475 | | false, /* isTypedMethod. Only relevant for methods. */ |
1476 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1477 | | }; |
1478 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1479 | | static_assert(0 < 2, "There is no slot for us"); |
1480 | | |
1481 | | MOZ_CAN_RUN_SCRIPT static bool |
1482 | | get_inputMode(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
1483 | 0 | { |
1484 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.inputMode", DOM, cx); |
1485 | 0 |
|
1486 | 0 | DOMString result; |
1487 | 0 | self->GetInputMode(result); |
1488 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1489 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
1490 | 0 | return false; |
1491 | 0 | } |
1492 | 0 | return true; |
1493 | 0 | } |
1494 | | |
1495 | | MOZ_CAN_RUN_SCRIPT static bool |
1496 | | set_inputMode(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
1497 | 0 | { |
1498 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.inputMode", DOM, cx); |
1499 | 0 |
|
1500 | 0 | binding_detail::FakeString arg0; |
1501 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
1502 | 0 | return false; |
1503 | 0 | } |
1504 | 0 | Maybe<AutoCEReaction> ceReaction; |
1505 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
1506 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
1507 | 0 | if (docGroup) { |
1508 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
1509 | 0 | } |
1510 | 0 | } |
1511 | 0 | FastErrorResult rv; |
1512 | 0 | self->SetInputMode(NonNullHelper(Constify(arg0)), rv); |
1513 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1514 | 0 | return false; |
1515 | 0 | } |
1516 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1517 | 0 |
|
1518 | 0 | return true; |
1519 | 0 | } |
1520 | | |
1521 | | static const JSJitInfo inputMode_getterinfo = { |
1522 | | { (JSJitGetterOp)get_inputMode }, |
1523 | | { prototypes::id::HTMLInputElement }, |
1524 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
1525 | | JSJitInfo::Getter, |
1526 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
1527 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
1528 | | false, /* isInfallible. False in setters. */ |
1529 | | true, /* isMovable. Not relevant for setters. */ |
1530 | | true, /* isEliminatable. Not relevant for setters. */ |
1531 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1532 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1533 | | false, /* isTypedMethod. Only relevant for methods. */ |
1534 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1535 | | }; |
1536 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1537 | | static_assert(0 < 2, "There is no slot for us"); |
1538 | | static const JSJitInfo inputMode_setterinfo = { |
1539 | | { (JSJitGetterOp)set_inputMode }, |
1540 | | { prototypes::id::HTMLInputElement }, |
1541 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
1542 | | JSJitInfo::Setter, |
1543 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1544 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1545 | | false, /* isInfallible. False in setters. */ |
1546 | | false, /* isMovable. Not relevant for setters. */ |
1547 | | false, /* isEliminatable. Not relevant for setters. */ |
1548 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1549 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1550 | | false, /* isTypedMethod. Only relevant for methods. */ |
1551 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1552 | | }; |
1553 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1554 | | static_assert(0 < 2, "There is no slot for us"); |
1555 | | |
1556 | | MOZ_CAN_RUN_SCRIPT static bool |
1557 | | get_list(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
1558 | 0 | { |
1559 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.list", DOM, cx); |
1560 | 0 |
|
1561 | 0 | auto result(StrongOrRawPtr<nsGenericHTMLElement>(self->GetList())); |
1562 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1563 | 0 | if (!result) { |
1564 | 0 | args.rval().setNull(); |
1565 | 0 | return true; |
1566 | 0 | } |
1567 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
1568 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
1569 | 0 | return false; |
1570 | 0 | } |
1571 | 0 | return true; |
1572 | 0 | } |
1573 | | |
1574 | | static const JSJitInfo list_getterinfo = { |
1575 | | { (JSJitGetterOp)get_list }, |
1576 | | { prototypes::id::HTMLInputElement }, |
1577 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
1578 | | JSJitInfo::Getter, |
1579 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
1580 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
1581 | | false, /* isInfallible. False in setters. */ |
1582 | | true, /* isMovable. Not relevant for setters. */ |
1583 | | true, /* isEliminatable. Not relevant for setters. */ |
1584 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1585 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1586 | | false, /* isTypedMethod. Only relevant for methods. */ |
1587 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1588 | | }; |
1589 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1590 | | static_assert(0 < 2, "There is no slot for us"); |
1591 | | |
1592 | | MOZ_CAN_RUN_SCRIPT static bool |
1593 | | get_max(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
1594 | 0 | { |
1595 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.max", DOM, cx); |
1596 | 0 |
|
1597 | 0 | DOMString result; |
1598 | 0 | self->GetMax(result); |
1599 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1600 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
1601 | 0 | return false; |
1602 | 0 | } |
1603 | 0 | return true; |
1604 | 0 | } |
1605 | | |
1606 | | MOZ_CAN_RUN_SCRIPT static bool |
1607 | | set_max(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
1608 | 0 | { |
1609 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.max", DOM, cx); |
1610 | 0 |
|
1611 | 0 | binding_detail::FakeString arg0; |
1612 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
1613 | 0 | return false; |
1614 | 0 | } |
1615 | 0 | Maybe<AutoCEReaction> ceReaction; |
1616 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
1617 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
1618 | 0 | if (docGroup) { |
1619 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
1620 | 0 | } |
1621 | 0 | } |
1622 | 0 | FastErrorResult rv; |
1623 | 0 | self->SetMax(NonNullHelper(Constify(arg0)), rv); |
1624 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1625 | 0 | return false; |
1626 | 0 | } |
1627 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1628 | 0 |
|
1629 | 0 | return true; |
1630 | 0 | } |
1631 | | |
1632 | | static const JSJitInfo max_getterinfo = { |
1633 | | { (JSJitGetterOp)get_max }, |
1634 | | { prototypes::id::HTMLInputElement }, |
1635 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
1636 | | JSJitInfo::Getter, |
1637 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
1638 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
1639 | | false, /* isInfallible. False in setters. */ |
1640 | | true, /* isMovable. Not relevant for setters. */ |
1641 | | true, /* isEliminatable. Not relevant for setters. */ |
1642 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1643 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1644 | | false, /* isTypedMethod. Only relevant for methods. */ |
1645 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1646 | | }; |
1647 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1648 | | static_assert(0 < 2, "There is no slot for us"); |
1649 | | static const JSJitInfo max_setterinfo = { |
1650 | | { (JSJitGetterOp)set_max }, |
1651 | | { prototypes::id::HTMLInputElement }, |
1652 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
1653 | | JSJitInfo::Setter, |
1654 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1655 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1656 | | false, /* isInfallible. False in setters. */ |
1657 | | false, /* isMovable. Not relevant for setters. */ |
1658 | | false, /* isEliminatable. Not relevant for setters. */ |
1659 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1660 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1661 | | false, /* isTypedMethod. Only relevant for methods. */ |
1662 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1663 | | }; |
1664 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1665 | | static_assert(0 < 2, "There is no slot for us"); |
1666 | | |
1667 | | MOZ_CAN_RUN_SCRIPT static bool |
1668 | | get_maxLength(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
1669 | 0 | { |
1670 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.maxLength", DOM, cx); |
1671 | 0 |
|
1672 | 0 | int32_t result(self->MaxLength()); |
1673 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1674 | 0 | args.rval().setInt32(int32_t(result)); |
1675 | 0 | return true; |
1676 | 0 | } |
1677 | | |
1678 | | MOZ_CAN_RUN_SCRIPT static bool |
1679 | | set_maxLength(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
1680 | 0 | { |
1681 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.maxLength", DOM, cx); |
1682 | 0 |
|
1683 | 0 | int32_t arg0; |
1684 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
1685 | 0 | return false; |
1686 | 0 | } |
1687 | 0 | Maybe<AutoCEReaction> ceReaction; |
1688 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
1689 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
1690 | 0 | if (docGroup) { |
1691 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
1692 | 0 | } |
1693 | 0 | } |
1694 | 0 | FastErrorResult rv; |
1695 | 0 | self->SetMaxLength(arg0, rv); |
1696 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1697 | 0 | return false; |
1698 | 0 | } |
1699 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1700 | 0 |
|
1701 | 0 | return true; |
1702 | 0 | } |
1703 | | |
1704 | | static const JSJitInfo maxLength_getterinfo = { |
1705 | | { (JSJitGetterOp)get_maxLength }, |
1706 | | { prototypes::id::HTMLInputElement }, |
1707 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
1708 | | JSJitInfo::Getter, |
1709 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
1710 | | JSVAL_TYPE_INT32, /* returnType. Not relevant for setters. */ |
1711 | | true, /* isInfallible. False in setters. */ |
1712 | | true, /* isMovable. Not relevant for setters. */ |
1713 | | true, /* isEliminatable. Not relevant for setters. */ |
1714 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1715 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1716 | | false, /* isTypedMethod. Only relevant for methods. */ |
1717 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1718 | | }; |
1719 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1720 | | static_assert(0 < 2, "There is no slot for us"); |
1721 | | static const JSJitInfo maxLength_setterinfo = { |
1722 | | { (JSJitGetterOp)set_maxLength }, |
1723 | | { prototypes::id::HTMLInputElement }, |
1724 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
1725 | | JSJitInfo::Setter, |
1726 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1727 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1728 | | false, /* isInfallible. False in setters. */ |
1729 | | false, /* isMovable. Not relevant for setters. */ |
1730 | | false, /* isEliminatable. Not relevant for setters. */ |
1731 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1732 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1733 | | false, /* isTypedMethod. Only relevant for methods. */ |
1734 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1735 | | }; |
1736 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1737 | | static_assert(0 < 2, "There is no slot for us"); |
1738 | | |
1739 | | MOZ_CAN_RUN_SCRIPT static bool |
1740 | | get_min(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
1741 | 0 | { |
1742 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.min", DOM, cx); |
1743 | 0 |
|
1744 | 0 | DOMString result; |
1745 | 0 | self->GetMin(result); |
1746 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1747 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
1748 | 0 | return false; |
1749 | 0 | } |
1750 | 0 | return true; |
1751 | 0 | } |
1752 | | |
1753 | | MOZ_CAN_RUN_SCRIPT static bool |
1754 | | set_min(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
1755 | 0 | { |
1756 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.min", DOM, cx); |
1757 | 0 |
|
1758 | 0 | binding_detail::FakeString arg0; |
1759 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
1760 | 0 | return false; |
1761 | 0 | } |
1762 | 0 | Maybe<AutoCEReaction> ceReaction; |
1763 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
1764 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
1765 | 0 | if (docGroup) { |
1766 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
1767 | 0 | } |
1768 | 0 | } |
1769 | 0 | FastErrorResult rv; |
1770 | 0 | self->SetMin(NonNullHelper(Constify(arg0)), rv); |
1771 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1772 | 0 | return false; |
1773 | 0 | } |
1774 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1775 | 0 |
|
1776 | 0 | return true; |
1777 | 0 | } |
1778 | | |
1779 | | static const JSJitInfo min_getterinfo = { |
1780 | | { (JSJitGetterOp)get_min }, |
1781 | | { prototypes::id::HTMLInputElement }, |
1782 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
1783 | | JSJitInfo::Getter, |
1784 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
1785 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
1786 | | false, /* isInfallible. False in setters. */ |
1787 | | true, /* isMovable. Not relevant for setters. */ |
1788 | | true, /* isEliminatable. Not relevant for setters. */ |
1789 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1790 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1791 | | false, /* isTypedMethod. Only relevant for methods. */ |
1792 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1793 | | }; |
1794 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1795 | | static_assert(0 < 2, "There is no slot for us"); |
1796 | | static const JSJitInfo min_setterinfo = { |
1797 | | { (JSJitGetterOp)set_min }, |
1798 | | { prototypes::id::HTMLInputElement }, |
1799 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
1800 | | JSJitInfo::Setter, |
1801 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1802 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1803 | | false, /* isInfallible. False in setters. */ |
1804 | | false, /* isMovable. Not relevant for setters. */ |
1805 | | false, /* isEliminatable. Not relevant for setters. */ |
1806 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1807 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1808 | | false, /* isTypedMethod. Only relevant for methods. */ |
1809 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1810 | | }; |
1811 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1812 | | static_assert(0 < 2, "There is no slot for us"); |
1813 | | |
1814 | | MOZ_CAN_RUN_SCRIPT static bool |
1815 | | get_minLength(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
1816 | 0 | { |
1817 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.minLength", DOM, cx); |
1818 | 0 |
|
1819 | 0 | int32_t result(self->MinLength()); |
1820 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1821 | 0 | args.rval().setInt32(int32_t(result)); |
1822 | 0 | return true; |
1823 | 0 | } |
1824 | | |
1825 | | MOZ_CAN_RUN_SCRIPT static bool |
1826 | | set_minLength(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
1827 | 0 | { |
1828 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.minLength", DOM, cx); |
1829 | 0 |
|
1830 | 0 | int32_t arg0; |
1831 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
1832 | 0 | return false; |
1833 | 0 | } |
1834 | 0 | Maybe<AutoCEReaction> ceReaction; |
1835 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
1836 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
1837 | 0 | if (docGroup) { |
1838 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
1839 | 0 | } |
1840 | 0 | } |
1841 | 0 | FastErrorResult rv; |
1842 | 0 | self->SetMinLength(arg0, rv); |
1843 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1844 | 0 | return false; |
1845 | 0 | } |
1846 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1847 | 0 |
|
1848 | 0 | return true; |
1849 | 0 | } |
1850 | | |
1851 | | static const JSJitInfo minLength_getterinfo = { |
1852 | | { (JSJitGetterOp)get_minLength }, |
1853 | | { prototypes::id::HTMLInputElement }, |
1854 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
1855 | | JSJitInfo::Getter, |
1856 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
1857 | | JSVAL_TYPE_INT32, /* returnType. Not relevant for setters. */ |
1858 | | true, /* isInfallible. False in setters. */ |
1859 | | true, /* isMovable. Not relevant for setters. */ |
1860 | | true, /* isEliminatable. Not relevant for setters. */ |
1861 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1862 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1863 | | false, /* isTypedMethod. Only relevant for methods. */ |
1864 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1865 | | }; |
1866 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1867 | | static_assert(0 < 2, "There is no slot for us"); |
1868 | | static const JSJitInfo minLength_setterinfo = { |
1869 | | { (JSJitGetterOp)set_minLength }, |
1870 | | { prototypes::id::HTMLInputElement }, |
1871 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
1872 | | JSJitInfo::Setter, |
1873 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1874 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1875 | | false, /* isInfallible. False in setters. */ |
1876 | | false, /* isMovable. Not relevant for setters. */ |
1877 | | false, /* isEliminatable. Not relevant for setters. */ |
1878 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1879 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1880 | | false, /* isTypedMethod. Only relevant for methods. */ |
1881 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1882 | | }; |
1883 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1884 | | static_assert(0 < 2, "There is no slot for us"); |
1885 | | |
1886 | | MOZ_CAN_RUN_SCRIPT static bool |
1887 | | get_multiple(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
1888 | 0 | { |
1889 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.multiple", DOM, cx); |
1890 | 0 |
|
1891 | 0 | bool result(self->Multiple()); |
1892 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1893 | 0 | args.rval().setBoolean(result); |
1894 | 0 | return true; |
1895 | 0 | } |
1896 | | |
1897 | | MOZ_CAN_RUN_SCRIPT static bool |
1898 | | set_multiple(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
1899 | 0 | { |
1900 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.multiple", DOM, cx); |
1901 | 0 |
|
1902 | 0 | bool arg0; |
1903 | 0 | if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) { |
1904 | 0 | return false; |
1905 | 0 | } |
1906 | 0 | Maybe<AutoCEReaction> ceReaction; |
1907 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
1908 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
1909 | 0 | if (docGroup) { |
1910 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
1911 | 0 | } |
1912 | 0 | } |
1913 | 0 | FastErrorResult rv; |
1914 | 0 | self->SetMultiple(arg0, rv); |
1915 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1916 | 0 | return false; |
1917 | 0 | } |
1918 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1919 | 0 |
|
1920 | 0 | return true; |
1921 | 0 | } |
1922 | | |
1923 | | static const JSJitInfo multiple_getterinfo = { |
1924 | | { (JSJitGetterOp)get_multiple }, |
1925 | | { prototypes::id::HTMLInputElement }, |
1926 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
1927 | | JSJitInfo::Getter, |
1928 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
1929 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
1930 | | true, /* isInfallible. False in setters. */ |
1931 | | true, /* isMovable. Not relevant for setters. */ |
1932 | | true, /* isEliminatable. Not relevant for setters. */ |
1933 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1934 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1935 | | false, /* isTypedMethod. Only relevant for methods. */ |
1936 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1937 | | }; |
1938 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1939 | | static_assert(0 < 2, "There is no slot for us"); |
1940 | | static const JSJitInfo multiple_setterinfo = { |
1941 | | { (JSJitGetterOp)set_multiple }, |
1942 | | { prototypes::id::HTMLInputElement }, |
1943 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
1944 | | JSJitInfo::Setter, |
1945 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1946 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1947 | | false, /* isInfallible. False in setters. */ |
1948 | | false, /* isMovable. Not relevant for setters. */ |
1949 | | false, /* isEliminatable. Not relevant for setters. */ |
1950 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1951 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1952 | | false, /* isTypedMethod. Only relevant for methods. */ |
1953 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1954 | | }; |
1955 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1956 | | static_assert(0 < 2, "There is no slot for us"); |
1957 | | |
1958 | | MOZ_CAN_RUN_SCRIPT static bool |
1959 | | get_name(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
1960 | 0 | { |
1961 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.name", DOM, cx); |
1962 | 0 |
|
1963 | 0 | DOMString result; |
1964 | 0 | self->GetName(result); |
1965 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1966 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
1967 | 0 | return false; |
1968 | 0 | } |
1969 | 0 | return true; |
1970 | 0 | } |
1971 | | |
1972 | | MOZ_CAN_RUN_SCRIPT static bool |
1973 | | set_name(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
1974 | 0 | { |
1975 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.name", DOM, cx); |
1976 | 0 |
|
1977 | 0 | binding_detail::FakeString arg0; |
1978 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
1979 | 0 | return false; |
1980 | 0 | } |
1981 | 0 | Maybe<AutoCEReaction> ceReaction; |
1982 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
1983 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
1984 | 0 | if (docGroup) { |
1985 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
1986 | 0 | } |
1987 | 0 | } |
1988 | 0 | FastErrorResult rv; |
1989 | 0 | self->SetName(NonNullHelper(Constify(arg0)), rv); |
1990 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1991 | 0 | return false; |
1992 | 0 | } |
1993 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1994 | 0 |
|
1995 | 0 | return true; |
1996 | 0 | } |
1997 | | |
1998 | | static const JSJitInfo name_getterinfo = { |
1999 | | { (JSJitGetterOp)get_name }, |
2000 | | { prototypes::id::HTMLInputElement }, |
2001 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
2002 | | JSJitInfo::Getter, |
2003 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
2004 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
2005 | | false, /* isInfallible. False in setters. */ |
2006 | | true, /* isMovable. Not relevant for setters. */ |
2007 | | true, /* isEliminatable. Not relevant for setters. */ |
2008 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2009 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2010 | | false, /* isTypedMethod. Only relevant for methods. */ |
2011 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2012 | | }; |
2013 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2014 | | static_assert(0 < 2, "There is no slot for us"); |
2015 | | static const JSJitInfo name_setterinfo = { |
2016 | | { (JSJitGetterOp)set_name }, |
2017 | | { prototypes::id::HTMLInputElement }, |
2018 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
2019 | | JSJitInfo::Setter, |
2020 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
2021 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
2022 | | false, /* isInfallible. False in setters. */ |
2023 | | false, /* isMovable. Not relevant for setters. */ |
2024 | | false, /* isEliminatable. Not relevant for setters. */ |
2025 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2026 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2027 | | false, /* isTypedMethod. Only relevant for methods. */ |
2028 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2029 | | }; |
2030 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2031 | | static_assert(0 < 2, "There is no slot for us"); |
2032 | | |
2033 | | MOZ_CAN_RUN_SCRIPT static bool |
2034 | | get_pattern(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
2035 | 0 | { |
2036 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.pattern", DOM, cx); |
2037 | 0 |
|
2038 | 0 | DOMString result; |
2039 | 0 | self->GetPattern(result); |
2040 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2041 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
2042 | 0 | return false; |
2043 | 0 | } |
2044 | 0 | return true; |
2045 | 0 | } |
2046 | | |
2047 | | MOZ_CAN_RUN_SCRIPT static bool |
2048 | | set_pattern(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
2049 | 0 | { |
2050 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.pattern", DOM, cx); |
2051 | 0 |
|
2052 | 0 | binding_detail::FakeString arg0; |
2053 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
2054 | 0 | return false; |
2055 | 0 | } |
2056 | 0 | Maybe<AutoCEReaction> ceReaction; |
2057 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
2058 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
2059 | 0 | if (docGroup) { |
2060 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
2061 | 0 | } |
2062 | 0 | } |
2063 | 0 | FastErrorResult rv; |
2064 | 0 | self->SetPattern(NonNullHelper(Constify(arg0)), rv); |
2065 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
2066 | 0 | return false; |
2067 | 0 | } |
2068 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2069 | 0 |
|
2070 | 0 | return true; |
2071 | 0 | } |
2072 | | |
2073 | | static const JSJitInfo pattern_getterinfo = { |
2074 | | { (JSJitGetterOp)get_pattern }, |
2075 | | { prototypes::id::HTMLInputElement }, |
2076 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
2077 | | JSJitInfo::Getter, |
2078 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
2079 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
2080 | | false, /* isInfallible. False in setters. */ |
2081 | | true, /* isMovable. Not relevant for setters. */ |
2082 | | true, /* isEliminatable. Not relevant for setters. */ |
2083 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2084 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2085 | | false, /* isTypedMethod. Only relevant for methods. */ |
2086 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2087 | | }; |
2088 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2089 | | static_assert(0 < 2, "There is no slot for us"); |
2090 | | static const JSJitInfo pattern_setterinfo = { |
2091 | | { (JSJitGetterOp)set_pattern }, |
2092 | | { prototypes::id::HTMLInputElement }, |
2093 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
2094 | | JSJitInfo::Setter, |
2095 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
2096 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
2097 | | false, /* isInfallible. False in setters. */ |
2098 | | false, /* isMovable. Not relevant for setters. */ |
2099 | | false, /* isEliminatable. Not relevant for setters. */ |
2100 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2101 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2102 | | false, /* isTypedMethod. Only relevant for methods. */ |
2103 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2104 | | }; |
2105 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2106 | | static_assert(0 < 2, "There is no slot for us"); |
2107 | | |
2108 | | MOZ_CAN_RUN_SCRIPT static bool |
2109 | | get_placeholder(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
2110 | 0 | { |
2111 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.placeholder", DOM, cx); |
2112 | 0 |
|
2113 | 0 | DOMString result; |
2114 | 0 | self->GetPlaceholder(result); |
2115 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2116 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
2117 | 0 | return false; |
2118 | 0 | } |
2119 | 0 | return true; |
2120 | 0 | } |
2121 | | |
2122 | | MOZ_CAN_RUN_SCRIPT static bool |
2123 | | set_placeholder(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
2124 | 0 | { |
2125 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.placeholder", DOM, cx); |
2126 | 0 |
|
2127 | 0 | binding_detail::FakeString arg0; |
2128 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
2129 | 0 | return false; |
2130 | 0 | } |
2131 | 0 | Maybe<AutoCEReaction> ceReaction; |
2132 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
2133 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
2134 | 0 | if (docGroup) { |
2135 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
2136 | 0 | } |
2137 | 0 | } |
2138 | 0 | FastErrorResult rv; |
2139 | 0 | self->SetPlaceholder(NonNullHelper(Constify(arg0)), rv); |
2140 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
2141 | 0 | return false; |
2142 | 0 | } |
2143 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2144 | 0 |
|
2145 | 0 | return true; |
2146 | 0 | } |
2147 | | |
2148 | | static const JSJitInfo placeholder_getterinfo = { |
2149 | | { (JSJitGetterOp)get_placeholder }, |
2150 | | { prototypes::id::HTMLInputElement }, |
2151 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
2152 | | JSJitInfo::Getter, |
2153 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
2154 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
2155 | | false, /* isInfallible. False in setters. */ |
2156 | | true, /* isMovable. Not relevant for setters. */ |
2157 | | true, /* isEliminatable. Not relevant for setters. */ |
2158 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2159 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2160 | | false, /* isTypedMethod. Only relevant for methods. */ |
2161 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2162 | | }; |
2163 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2164 | | static_assert(0 < 2, "There is no slot for us"); |
2165 | | static const JSJitInfo placeholder_setterinfo = { |
2166 | | { (JSJitGetterOp)set_placeholder }, |
2167 | | { prototypes::id::HTMLInputElement }, |
2168 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
2169 | | JSJitInfo::Setter, |
2170 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
2171 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
2172 | | false, /* isInfallible. False in setters. */ |
2173 | | false, /* isMovable. Not relevant for setters. */ |
2174 | | false, /* isEliminatable. Not relevant for setters. */ |
2175 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2176 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2177 | | false, /* isTypedMethod. Only relevant for methods. */ |
2178 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2179 | | }; |
2180 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2181 | | static_assert(0 < 2, "There is no slot for us"); |
2182 | | |
2183 | | MOZ_CAN_RUN_SCRIPT static bool |
2184 | | get_readOnly(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
2185 | 0 | { |
2186 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.readOnly", DOM, cx); |
2187 | 0 |
|
2188 | 0 | bool result(self->ReadOnly()); |
2189 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2190 | 0 | args.rval().setBoolean(result); |
2191 | 0 | return true; |
2192 | 0 | } |
2193 | | |
2194 | | MOZ_CAN_RUN_SCRIPT static bool |
2195 | | set_readOnly(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
2196 | 0 | { |
2197 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.readOnly", DOM, cx); |
2198 | 0 |
|
2199 | 0 | bool arg0; |
2200 | 0 | if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) { |
2201 | 0 | return false; |
2202 | 0 | } |
2203 | 0 | Maybe<AutoCEReaction> ceReaction; |
2204 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
2205 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
2206 | 0 | if (docGroup) { |
2207 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
2208 | 0 | } |
2209 | 0 | } |
2210 | 0 | FastErrorResult rv; |
2211 | 0 | self->SetReadOnly(arg0, rv); |
2212 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
2213 | 0 | return false; |
2214 | 0 | } |
2215 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2216 | 0 |
|
2217 | 0 | return true; |
2218 | 0 | } |
2219 | | |
2220 | | static const JSJitInfo readOnly_getterinfo = { |
2221 | | { (JSJitGetterOp)get_readOnly }, |
2222 | | { prototypes::id::HTMLInputElement }, |
2223 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
2224 | | JSJitInfo::Getter, |
2225 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
2226 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
2227 | | true, /* isInfallible. False in setters. */ |
2228 | | true, /* isMovable. Not relevant for setters. */ |
2229 | | true, /* isEliminatable. Not relevant for setters. */ |
2230 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2231 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2232 | | false, /* isTypedMethod. Only relevant for methods. */ |
2233 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2234 | | }; |
2235 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2236 | | static_assert(0 < 2, "There is no slot for us"); |
2237 | | static const JSJitInfo readOnly_setterinfo = { |
2238 | | { (JSJitGetterOp)set_readOnly }, |
2239 | | { prototypes::id::HTMLInputElement }, |
2240 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
2241 | | JSJitInfo::Setter, |
2242 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
2243 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
2244 | | false, /* isInfallible. False in setters. */ |
2245 | | false, /* isMovable. Not relevant for setters. */ |
2246 | | false, /* isEliminatable. Not relevant for setters. */ |
2247 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2248 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2249 | | false, /* isTypedMethod. Only relevant for methods. */ |
2250 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2251 | | }; |
2252 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2253 | | static_assert(0 < 2, "There is no slot for us"); |
2254 | | |
2255 | | MOZ_CAN_RUN_SCRIPT static bool |
2256 | | get_required(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
2257 | 0 | { |
2258 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.required", DOM, cx); |
2259 | 0 |
|
2260 | 0 | bool result(self->Required()); |
2261 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2262 | 0 | args.rval().setBoolean(result); |
2263 | 0 | return true; |
2264 | 0 | } |
2265 | | |
2266 | | MOZ_CAN_RUN_SCRIPT static bool |
2267 | | set_required(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
2268 | 0 | { |
2269 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.required", DOM, cx); |
2270 | 0 |
|
2271 | 0 | bool arg0; |
2272 | 0 | if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) { |
2273 | 0 | return false; |
2274 | 0 | } |
2275 | 0 | Maybe<AutoCEReaction> ceReaction; |
2276 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
2277 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
2278 | 0 | if (docGroup) { |
2279 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
2280 | 0 | } |
2281 | 0 | } |
2282 | 0 | FastErrorResult rv; |
2283 | 0 | self->SetRequired(arg0, rv); |
2284 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
2285 | 0 | return false; |
2286 | 0 | } |
2287 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2288 | 0 |
|
2289 | 0 | return true; |
2290 | 0 | } |
2291 | | |
2292 | | static const JSJitInfo required_getterinfo = { |
2293 | | { (JSJitGetterOp)get_required }, |
2294 | | { prototypes::id::HTMLInputElement }, |
2295 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
2296 | | JSJitInfo::Getter, |
2297 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
2298 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
2299 | | true, /* isInfallible. False in setters. */ |
2300 | | true, /* isMovable. Not relevant for setters. */ |
2301 | | true, /* isEliminatable. Not relevant for setters. */ |
2302 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2303 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2304 | | false, /* isTypedMethod. Only relevant for methods. */ |
2305 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2306 | | }; |
2307 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2308 | | static_assert(0 < 2, "There is no slot for us"); |
2309 | | static const JSJitInfo required_setterinfo = { |
2310 | | { (JSJitGetterOp)set_required }, |
2311 | | { prototypes::id::HTMLInputElement }, |
2312 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
2313 | | JSJitInfo::Setter, |
2314 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
2315 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
2316 | | false, /* isInfallible. False in setters. */ |
2317 | | false, /* isMovable. Not relevant for setters. */ |
2318 | | false, /* isEliminatable. Not relevant for setters. */ |
2319 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2320 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2321 | | false, /* isTypedMethod. Only relevant for methods. */ |
2322 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2323 | | }; |
2324 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2325 | | static_assert(0 < 2, "There is no slot for us"); |
2326 | | |
2327 | | MOZ_CAN_RUN_SCRIPT static bool |
2328 | | get_size(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
2329 | 0 | { |
2330 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.size", DOM, cx); |
2331 | 0 |
|
2332 | 0 | uint32_t result(self->Size()); |
2333 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2334 | 0 | args.rval().setNumber(result); |
2335 | 0 | return true; |
2336 | 0 | } |
2337 | | |
2338 | | MOZ_CAN_RUN_SCRIPT static bool |
2339 | | set_size(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
2340 | 0 | { |
2341 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.size", DOM, cx); |
2342 | 0 |
|
2343 | 0 | uint32_t arg0; |
2344 | 0 | if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) { |
2345 | 0 | return false; |
2346 | 0 | } |
2347 | 0 | Maybe<AutoCEReaction> ceReaction; |
2348 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
2349 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
2350 | 0 | if (docGroup) { |
2351 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
2352 | 0 | } |
2353 | 0 | } |
2354 | 0 | FastErrorResult rv; |
2355 | 0 | self->SetSize(arg0, rv); |
2356 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
2357 | 0 | return false; |
2358 | 0 | } |
2359 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2360 | 0 |
|
2361 | 0 | return true; |
2362 | 0 | } |
2363 | | |
2364 | | static const JSJitInfo size_getterinfo = { |
2365 | | { (JSJitGetterOp)get_size }, |
2366 | | { prototypes::id::HTMLInputElement }, |
2367 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
2368 | | JSJitInfo::Getter, |
2369 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
2370 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
2371 | | true, /* isInfallible. False in setters. */ |
2372 | | true, /* isMovable. Not relevant for setters. */ |
2373 | | true, /* isEliminatable. Not relevant for setters. */ |
2374 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2375 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2376 | | false, /* isTypedMethod. Only relevant for methods. */ |
2377 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2378 | | }; |
2379 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2380 | | static_assert(0 < 2, "There is no slot for us"); |
2381 | | static const JSJitInfo size_setterinfo = { |
2382 | | { (JSJitGetterOp)set_size }, |
2383 | | { prototypes::id::HTMLInputElement }, |
2384 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
2385 | | JSJitInfo::Setter, |
2386 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
2387 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
2388 | | false, /* isInfallible. False in setters. */ |
2389 | | false, /* isMovable. Not relevant for setters. */ |
2390 | | false, /* isEliminatable. Not relevant for setters. */ |
2391 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2392 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2393 | | false, /* isTypedMethod. Only relevant for methods. */ |
2394 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2395 | | }; |
2396 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2397 | | static_assert(0 < 2, "There is no slot for us"); |
2398 | | |
2399 | | MOZ_CAN_RUN_SCRIPT static bool |
2400 | | get_src(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
2401 | 0 | { |
2402 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.src", DOM, cx); |
2403 | 0 |
|
2404 | 0 | DOMString result; |
2405 | 0 | self->GetSrc(result); |
2406 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2407 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
2408 | 0 | return false; |
2409 | 0 | } |
2410 | 0 | return true; |
2411 | 0 | } |
2412 | | |
2413 | | MOZ_CAN_RUN_SCRIPT static bool |
2414 | | set_src(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
2415 | 0 | { |
2416 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.src", DOM, cx); |
2417 | 0 |
|
2418 | 0 | binding_detail::FakeString arg0; |
2419 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
2420 | 0 | return false; |
2421 | 0 | } |
2422 | 0 | Maybe<AutoCEReaction> ceReaction; |
2423 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
2424 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
2425 | 0 | if (docGroup) { |
2426 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
2427 | 0 | } |
2428 | 0 | } |
2429 | 0 | FastErrorResult rv; |
2430 | 0 | nsIPrincipal* subjectPrincipal; |
2431 | 0 | { |
2432 | 0 | JS::Realm* realm = js::GetContextRealm(cx); |
2433 | 0 | MOZ_ASSERT(realm); |
2434 | 0 | JSPrincipals* principals = JS::GetRealmPrincipals(realm); |
2435 | 0 | nsIPrincipal* principal = nsJSPrincipals::get(principals); |
2436 | 0 | if (nsContentUtils::IsSystemPrincipal(principal)) { |
2437 | 0 | principal = nullptr; |
2438 | 0 | } |
2439 | 0 |
|
2440 | 0 | subjectPrincipal = principal; |
2441 | 0 | } |
2442 | 0 | self->SetSrc(NonNullHelper(Constify(arg0)), subjectPrincipal, rv); |
2443 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
2444 | 0 | return false; |
2445 | 0 | } |
2446 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2447 | 0 |
|
2448 | 0 | return true; |
2449 | 0 | } |
2450 | | |
2451 | | static const JSJitInfo src_getterinfo = { |
2452 | | { (JSJitGetterOp)get_src }, |
2453 | | { prototypes::id::HTMLInputElement }, |
2454 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
2455 | | JSJitInfo::Getter, |
2456 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
2457 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
2458 | | false, /* isInfallible. False in setters. */ |
2459 | | true, /* isMovable. Not relevant for setters. */ |
2460 | | true, /* isEliminatable. Not relevant for setters. */ |
2461 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2462 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2463 | | false, /* isTypedMethod. Only relevant for methods. */ |
2464 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2465 | | }; |
2466 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2467 | | static_assert(0 < 2, "There is no slot for us"); |
2468 | | static const JSJitInfo src_setterinfo = { |
2469 | | { (JSJitGetterOp)set_src }, |
2470 | | { prototypes::id::HTMLInputElement }, |
2471 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
2472 | | JSJitInfo::Setter, |
2473 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
2474 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
2475 | | false, /* isInfallible. False in setters. */ |
2476 | | false, /* isMovable. Not relevant for setters. */ |
2477 | | false, /* isEliminatable. Not relevant for setters. */ |
2478 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2479 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2480 | | false, /* isTypedMethod. Only relevant for methods. */ |
2481 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2482 | | }; |
2483 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2484 | | static_assert(0 < 2, "There is no slot for us"); |
2485 | | |
2486 | | MOZ_CAN_RUN_SCRIPT static bool |
2487 | | get_step(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
2488 | 0 | { |
2489 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.step", DOM, cx); |
2490 | 0 |
|
2491 | 0 | DOMString result; |
2492 | 0 | self->GetStep(result); |
2493 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2494 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
2495 | 0 | return false; |
2496 | 0 | } |
2497 | 0 | return true; |
2498 | 0 | } |
2499 | | |
2500 | | MOZ_CAN_RUN_SCRIPT static bool |
2501 | | set_step(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
2502 | 0 | { |
2503 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.step", DOM, cx); |
2504 | 0 |
|
2505 | 0 | binding_detail::FakeString arg0; |
2506 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
2507 | 0 | return false; |
2508 | 0 | } |
2509 | 0 | Maybe<AutoCEReaction> ceReaction; |
2510 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
2511 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
2512 | 0 | if (docGroup) { |
2513 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
2514 | 0 | } |
2515 | 0 | } |
2516 | 0 | FastErrorResult rv; |
2517 | 0 | self->SetStep(NonNullHelper(Constify(arg0)), rv); |
2518 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
2519 | 0 | return false; |
2520 | 0 | } |
2521 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2522 | 0 |
|
2523 | 0 | return true; |
2524 | 0 | } |
2525 | | |
2526 | | static const JSJitInfo step_getterinfo = { |
2527 | | { (JSJitGetterOp)get_step }, |
2528 | | { prototypes::id::HTMLInputElement }, |
2529 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
2530 | | JSJitInfo::Getter, |
2531 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
2532 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
2533 | | false, /* isInfallible. False in setters. */ |
2534 | | true, /* isMovable. Not relevant for setters. */ |
2535 | | true, /* isEliminatable. Not relevant for setters. */ |
2536 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2537 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2538 | | false, /* isTypedMethod. Only relevant for methods. */ |
2539 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2540 | | }; |
2541 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2542 | | static_assert(0 < 2, "There is no slot for us"); |
2543 | | static const JSJitInfo step_setterinfo = { |
2544 | | { (JSJitGetterOp)set_step }, |
2545 | | { prototypes::id::HTMLInputElement }, |
2546 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
2547 | | JSJitInfo::Setter, |
2548 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
2549 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
2550 | | false, /* isInfallible. False in setters. */ |
2551 | | false, /* isMovable. Not relevant for setters. */ |
2552 | | false, /* isEliminatable. Not relevant for setters. */ |
2553 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2554 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2555 | | false, /* isTypedMethod. Only relevant for methods. */ |
2556 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2557 | | }; |
2558 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2559 | | static_assert(0 < 2, "There is no slot for us"); |
2560 | | |
2561 | | MOZ_CAN_RUN_SCRIPT static bool |
2562 | | get_type(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
2563 | 0 | { |
2564 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.type", DOM, cx); |
2565 | 0 |
|
2566 | 0 | DOMString result; |
2567 | 0 | self->GetType(result); |
2568 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2569 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
2570 | 0 | return false; |
2571 | 0 | } |
2572 | 0 | return true; |
2573 | 0 | } |
2574 | | |
2575 | | MOZ_CAN_RUN_SCRIPT static bool |
2576 | | set_type(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
2577 | 0 | { |
2578 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.type", DOM, cx); |
2579 | 0 |
|
2580 | 0 | binding_detail::FakeString arg0; |
2581 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
2582 | 0 | return false; |
2583 | 0 | } |
2584 | 0 | Maybe<AutoCEReaction> ceReaction; |
2585 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
2586 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
2587 | 0 | if (docGroup) { |
2588 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
2589 | 0 | } |
2590 | 0 | } |
2591 | 0 | FastErrorResult rv; |
2592 | 0 | self->SetType(NonNullHelper(Constify(arg0)), rv); |
2593 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
2594 | 0 | return false; |
2595 | 0 | } |
2596 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2597 | 0 |
|
2598 | 0 | return true; |
2599 | 0 | } |
2600 | | |
2601 | | static const JSJitInfo type_getterinfo = { |
2602 | | { (JSJitGetterOp)get_type }, |
2603 | | { prototypes::id::HTMLInputElement }, |
2604 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
2605 | | JSJitInfo::Getter, |
2606 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
2607 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
2608 | | false, /* isInfallible. False in setters. */ |
2609 | | true, /* isMovable. Not relevant for setters. */ |
2610 | | true, /* isEliminatable. Not relevant for setters. */ |
2611 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2612 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2613 | | false, /* isTypedMethod. Only relevant for methods. */ |
2614 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2615 | | }; |
2616 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2617 | | static_assert(0 < 2, "There is no slot for us"); |
2618 | | static const JSJitInfo type_setterinfo = { |
2619 | | { (JSJitGetterOp)set_type }, |
2620 | | { prototypes::id::HTMLInputElement }, |
2621 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
2622 | | JSJitInfo::Setter, |
2623 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
2624 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
2625 | | false, /* isInfallible. False in setters. */ |
2626 | | false, /* isMovable. Not relevant for setters. */ |
2627 | | false, /* isEliminatable. Not relevant for setters. */ |
2628 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2629 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2630 | | false, /* isTypedMethod. Only relevant for methods. */ |
2631 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2632 | | }; |
2633 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2634 | | static_assert(0 < 2, "There is no slot for us"); |
2635 | | |
2636 | | MOZ_CAN_RUN_SCRIPT static bool |
2637 | | get_defaultValue(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
2638 | 0 | { |
2639 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.defaultValue", DOM, cx); |
2640 | 0 |
|
2641 | 0 | DOMString result; |
2642 | 0 | self->GetDefaultValue(result); |
2643 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2644 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
2645 | 0 | return false; |
2646 | 0 | } |
2647 | 0 | return true; |
2648 | 0 | } |
2649 | | |
2650 | | MOZ_CAN_RUN_SCRIPT static bool |
2651 | | set_defaultValue(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
2652 | 0 | { |
2653 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.defaultValue", DOM, cx); |
2654 | 0 |
|
2655 | 0 | binding_detail::FakeString arg0; |
2656 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
2657 | 0 | return false; |
2658 | 0 | } |
2659 | 0 | Maybe<AutoCEReaction> ceReaction; |
2660 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
2661 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
2662 | 0 | if (docGroup) { |
2663 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
2664 | 0 | } |
2665 | 0 | } |
2666 | 0 | FastErrorResult rv; |
2667 | 0 | self->SetDefaultValue(NonNullHelper(Constify(arg0)), rv); |
2668 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
2669 | 0 | return false; |
2670 | 0 | } |
2671 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2672 | 0 |
|
2673 | 0 | return true; |
2674 | 0 | } |
2675 | | |
2676 | | static const JSJitInfo defaultValue_getterinfo = { |
2677 | | { (JSJitGetterOp)get_defaultValue }, |
2678 | | { prototypes::id::HTMLInputElement }, |
2679 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
2680 | | JSJitInfo::Getter, |
2681 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
2682 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
2683 | | false, /* isInfallible. False in setters. */ |
2684 | | true, /* isMovable. Not relevant for setters. */ |
2685 | | true, /* isEliminatable. Not relevant for setters. */ |
2686 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2687 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2688 | | false, /* isTypedMethod. Only relevant for methods. */ |
2689 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2690 | | }; |
2691 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2692 | | static_assert(0 < 2, "There is no slot for us"); |
2693 | | static const JSJitInfo defaultValue_setterinfo = { |
2694 | | { (JSJitGetterOp)set_defaultValue }, |
2695 | | { prototypes::id::HTMLInputElement }, |
2696 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
2697 | | JSJitInfo::Setter, |
2698 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
2699 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
2700 | | false, /* isInfallible. False in setters. */ |
2701 | | false, /* isMovable. Not relevant for setters. */ |
2702 | | false, /* isEliminatable. Not relevant for setters. */ |
2703 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2704 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2705 | | false, /* isTypedMethod. Only relevant for methods. */ |
2706 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2707 | | }; |
2708 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2709 | | static_assert(0 < 2, "There is no slot for us"); |
2710 | | |
2711 | | MOZ_CAN_RUN_SCRIPT static bool |
2712 | | get_value(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
2713 | 0 | { |
2714 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.value", DOM, cx); |
2715 | 0 |
|
2716 | 0 | DOMString result; |
2717 | 0 | self->GetValue(result, nsContentUtils::IsSystemCaller(cx) ? CallerType::System : CallerType::NonSystem); |
2718 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2719 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
2720 | 0 | return false; |
2721 | 0 | } |
2722 | 0 | return true; |
2723 | 0 | } |
2724 | | |
2725 | | MOZ_CAN_RUN_SCRIPT static bool |
2726 | | set_value(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
2727 | 0 | { |
2728 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.value", DOM, cx); |
2729 | 0 |
|
2730 | 0 | binding_detail::FakeString arg0; |
2731 | 0 | if (!ConvertJSValueToString(cx, args[0], eEmpty, eStringify, arg0)) { |
2732 | 0 | return false; |
2733 | 0 | } |
2734 | 0 | Maybe<AutoCEReaction> ceReaction; |
2735 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
2736 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
2737 | 0 | if (docGroup) { |
2738 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
2739 | 0 | } |
2740 | 0 | } |
2741 | 0 | FastErrorResult rv; |
2742 | 0 | self->SetValue(NonNullHelper(Constify(arg0)), nsContentUtils::IsSystemCaller(cx) ? CallerType::System : CallerType::NonSystem, rv); |
2743 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
2744 | 0 | return false; |
2745 | 0 | } |
2746 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2747 | 0 |
|
2748 | 0 | return true; |
2749 | 0 | } |
2750 | | |
2751 | | static const JSJitInfo value_getterinfo = { |
2752 | | { (JSJitGetterOp)get_value }, |
2753 | | { prototypes::id::HTMLInputElement }, |
2754 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
2755 | | JSJitInfo::Getter, |
2756 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
2757 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
2758 | | false, /* isInfallible. False in setters. */ |
2759 | | true, /* isMovable. Not relevant for setters. */ |
2760 | | true, /* isEliminatable. Not relevant for setters. */ |
2761 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2762 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2763 | | false, /* isTypedMethod. Only relevant for methods. */ |
2764 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2765 | | }; |
2766 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2767 | | static_assert(0 < 2, "There is no slot for us"); |
2768 | | static const JSJitInfo value_setterinfo = { |
2769 | | { (JSJitGetterOp)set_value }, |
2770 | | { prototypes::id::HTMLInputElement }, |
2771 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
2772 | | JSJitInfo::Setter, |
2773 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
2774 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
2775 | | false, /* isInfallible. False in setters. */ |
2776 | | false, /* isMovable. Not relevant for setters. */ |
2777 | | false, /* isEliminatable. Not relevant for setters. */ |
2778 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2779 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2780 | | false, /* isTypedMethod. Only relevant for methods. */ |
2781 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2782 | | }; |
2783 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2784 | | static_assert(0 < 2, "There is no slot for us"); |
2785 | | |
2786 | | MOZ_CAN_RUN_SCRIPT static bool |
2787 | | get_valueAsDate(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
2788 | 0 | { |
2789 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.valueAsDate", DOM, cx); |
2790 | 0 |
|
2791 | 0 | FastErrorResult rv; |
2792 | 0 | Nullable<Date> result(self->GetValueAsDate(rv)); |
2793 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
2794 | 0 | return false; |
2795 | 0 | } |
2796 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2797 | 0 | if (result.IsNull()) { |
2798 | 0 | args.rval().setNull(); |
2799 | 0 | return true; |
2800 | 0 | } |
2801 | 0 | if (!result.Value().ToDateObject(cx, args.rval())) { |
2802 | 0 | return false; |
2803 | 0 | } |
2804 | 0 | return true; |
2805 | 0 | } |
2806 | | |
2807 | | MOZ_CAN_RUN_SCRIPT static bool |
2808 | | set_valueAsDate(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
2809 | 0 | { |
2810 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.valueAsDate", DOM, cx); |
2811 | 0 |
|
2812 | 0 | Nullable<Date> arg0; |
2813 | 0 | if (args[0].isObject()) { |
2814 | 0 | JS::Rooted<JSObject*> possibleDateObject(cx, &args[0].toObject()); |
2815 | 0 | { // scope for isDate |
2816 | 0 | bool isDate; |
2817 | 0 | if (!JS_ObjectIsDate(cx, possibleDateObject, &isDate)) { |
2818 | 0 | return false; |
2819 | 0 | } |
2820 | 0 | if (!isDate) { |
2821 | 0 | ThrowErrorMessage(cx, MSG_NOT_DATE, "Value being assigned to HTMLInputElement.valueAsDate"); |
2822 | 0 | return false; |
2823 | 0 | } |
2824 | 0 | if (!arg0.SetValue().SetTimeStamp(cx, possibleDateObject)) { |
2825 | 0 | return false; |
2826 | 0 | } |
2827 | 0 | } |
2828 | 0 | } else if (args[0].isNullOrUndefined()) { |
2829 | 0 | arg0.SetNull(); |
2830 | 0 | } else { |
2831 | 0 | ThrowErrorMessage(cx, MSG_NOT_DATE, "Value being assigned to HTMLInputElement.valueAsDate"); |
2832 | 0 | return false; |
2833 | 0 | } |
2834 | 0 | FastErrorResult rv; |
2835 | 0 | self->SetValueAsDate(Constify(arg0), rv); |
2836 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
2837 | 0 | return false; |
2838 | 0 | } |
2839 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2840 | 0 |
|
2841 | 0 | return true; |
2842 | 0 | } |
2843 | | |
2844 | | static const JSJitInfo valueAsDate_getterinfo = { |
2845 | | { (JSJitGetterOp)get_valueAsDate }, |
2846 | | { prototypes::id::HTMLInputElement }, |
2847 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
2848 | | JSJitInfo::Getter, |
2849 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
2850 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
2851 | | false, /* isInfallible. False in setters. */ |
2852 | | false, /* isMovable. Not relevant for setters. */ |
2853 | | false, /* isEliminatable. Not relevant for setters. */ |
2854 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2855 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2856 | | false, /* isTypedMethod. Only relevant for methods. */ |
2857 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2858 | | }; |
2859 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2860 | | static_assert(0 < 2, "There is no slot for us"); |
2861 | | static const JSJitInfo valueAsDate_setterinfo = { |
2862 | | { (JSJitGetterOp)set_valueAsDate }, |
2863 | | { prototypes::id::HTMLInputElement }, |
2864 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
2865 | | JSJitInfo::Setter, |
2866 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
2867 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
2868 | | false, /* isInfallible. False in setters. */ |
2869 | | false, /* isMovable. Not relevant for setters. */ |
2870 | | false, /* isEliminatable. Not relevant for setters. */ |
2871 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2872 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2873 | | false, /* isTypedMethod. Only relevant for methods. */ |
2874 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2875 | | }; |
2876 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2877 | | static_assert(0 < 2, "There is no slot for us"); |
2878 | | |
2879 | | MOZ_CAN_RUN_SCRIPT static bool |
2880 | | get_valueAsNumber(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
2881 | 0 | { |
2882 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.valueAsNumber", DOM, cx); |
2883 | 0 |
|
2884 | 0 | double result(self->ValueAsNumber()); |
2885 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2886 | 0 | args.rval().set(JS_NumberValue(double(result))); |
2887 | 0 | return true; |
2888 | 0 | } |
2889 | | |
2890 | | MOZ_CAN_RUN_SCRIPT static bool |
2891 | | set_valueAsNumber(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
2892 | 0 | { |
2893 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.valueAsNumber", DOM, cx); |
2894 | 0 |
|
2895 | 0 | double arg0; |
2896 | 0 | if (!ValueToPrimitive<double, eDefault>(cx, args[0], &arg0)) { |
2897 | 0 | return false; |
2898 | 0 | } |
2899 | 0 | FastErrorResult rv; |
2900 | 0 | self->SetValueAsNumber(arg0, rv); |
2901 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
2902 | 0 | return false; |
2903 | 0 | } |
2904 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2905 | 0 |
|
2906 | 0 | return true; |
2907 | 0 | } |
2908 | | |
2909 | | static const JSJitInfo valueAsNumber_getterinfo = { |
2910 | | { (JSJitGetterOp)get_valueAsNumber }, |
2911 | | { prototypes::id::HTMLInputElement }, |
2912 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
2913 | | JSJitInfo::Getter, |
2914 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
2915 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
2916 | | true, /* isInfallible. False in setters. */ |
2917 | | true, /* isMovable. Not relevant for setters. */ |
2918 | | true, /* isEliminatable. Not relevant for setters. */ |
2919 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2920 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2921 | | false, /* isTypedMethod. Only relevant for methods. */ |
2922 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2923 | | }; |
2924 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2925 | | static_assert(0 < 2, "There is no slot for us"); |
2926 | | static const JSJitInfo valueAsNumber_setterinfo = { |
2927 | | { (JSJitGetterOp)set_valueAsNumber }, |
2928 | | { prototypes::id::HTMLInputElement }, |
2929 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
2930 | | JSJitInfo::Setter, |
2931 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
2932 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
2933 | | false, /* isInfallible. False in setters. */ |
2934 | | false, /* isMovable. Not relevant for setters. */ |
2935 | | false, /* isEliminatable. Not relevant for setters. */ |
2936 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2937 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2938 | | false, /* isTypedMethod. Only relevant for methods. */ |
2939 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2940 | | }; |
2941 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2942 | | static_assert(0 < 2, "There is no slot for us"); |
2943 | | |
2944 | | MOZ_CAN_RUN_SCRIPT static bool |
2945 | | get_width(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
2946 | 0 | { |
2947 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.width", DOM, cx); |
2948 | 0 |
|
2949 | 0 | uint32_t result(self->Width()); |
2950 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2951 | 0 | args.rval().setNumber(result); |
2952 | 0 | return true; |
2953 | 0 | } |
2954 | | |
2955 | | MOZ_CAN_RUN_SCRIPT static bool |
2956 | | set_width(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
2957 | 0 | { |
2958 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.width", DOM, cx); |
2959 | 0 |
|
2960 | 0 | uint32_t arg0; |
2961 | 0 | if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) { |
2962 | 0 | return false; |
2963 | 0 | } |
2964 | 0 | Maybe<AutoCEReaction> ceReaction; |
2965 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
2966 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
2967 | 0 | if (docGroup) { |
2968 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
2969 | 0 | } |
2970 | 0 | } |
2971 | 0 | FastErrorResult rv; |
2972 | 0 | self->SetWidth(arg0, rv); |
2973 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
2974 | 0 | return false; |
2975 | 0 | } |
2976 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
2977 | 0 |
|
2978 | 0 | return true; |
2979 | 0 | } |
2980 | | |
2981 | | static const JSJitInfo width_getterinfo = { |
2982 | | { (JSJitGetterOp)get_width }, |
2983 | | { prototypes::id::HTMLInputElement }, |
2984 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
2985 | | JSJitInfo::Getter, |
2986 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
2987 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
2988 | | true, /* isInfallible. False in setters. */ |
2989 | | false, /* isMovable. Not relevant for setters. */ |
2990 | | false, /* isEliminatable. Not relevant for setters. */ |
2991 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
2992 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
2993 | | false, /* isTypedMethod. Only relevant for methods. */ |
2994 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
2995 | | }; |
2996 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
2997 | | static_assert(0 < 2, "There is no slot for us"); |
2998 | | static const JSJitInfo width_setterinfo = { |
2999 | | { (JSJitGetterOp)set_width }, |
3000 | | { prototypes::id::HTMLInputElement }, |
3001 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
3002 | | JSJitInfo::Setter, |
3003 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
3004 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
3005 | | false, /* isInfallible. False in setters. */ |
3006 | | false, /* isMovable. Not relevant for setters. */ |
3007 | | false, /* isEliminatable. Not relevant for setters. */ |
3008 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
3009 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
3010 | | false, /* isTypedMethod. Only relevant for methods. */ |
3011 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
3012 | | }; |
3013 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
3014 | | static_assert(0 < 2, "There is no slot for us"); |
3015 | | |
3016 | | MOZ_CAN_RUN_SCRIPT static bool |
3017 | | stepUp(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, const JSJitMethodCallArgs& args) |
3018 | 0 | { |
3019 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLInputElement.stepUp", DOM, cx); |
3020 | 0 |
|
3021 | 0 | int32_t arg0; |
3022 | 0 | if (args.hasDefined(0)) { |
3023 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
3024 | 0 | return false; |
3025 | 0 | } |
3026 | 0 | } else { |
3027 | 0 | arg0 = 1; |
3028 | 0 | } |
3029 | 0 | FastErrorResult rv; |
3030 | 0 | self->StepUp(arg0, rv); |
3031 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
3032 | 0 | return false; |
3033 | 0 | } |
3034 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
3035 | 0 | args.rval().setUndefined(); |
3036 | 0 | return true; |
3037 | 0 | } |
3038 | | |
3039 | | static const JSJitInfo stepUp_methodinfo = { |
3040 | | { (JSJitGetterOp)stepUp }, |
3041 | | { prototypes::id::HTMLInputElement }, |
3042 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
3043 | | JSJitInfo::Method, |
3044 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
3045 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
3046 | | false, /* isInfallible. False in setters. */ |
3047 | | false, /* isMovable. Not relevant for setters. */ |
3048 | | false, /* isEliminatable. Not relevant for setters. */ |
3049 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
3050 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
3051 | | false, /* isTypedMethod. Only relevant for methods. */ |
3052 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
3053 | | }; |
3054 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
3055 | | static_assert(0 < 2, "There is no slot for us"); |
3056 | | |
3057 | | MOZ_CAN_RUN_SCRIPT static bool |
3058 | | stepDown(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, const JSJitMethodCallArgs& args) |
3059 | 0 | { |
3060 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLInputElement.stepDown", DOM, cx); |
3061 | 0 |
|
3062 | 0 | int32_t arg0; |
3063 | 0 | if (args.hasDefined(0)) { |
3064 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
3065 | 0 | return false; |
3066 | 0 | } |
3067 | 0 | } else { |
3068 | 0 | arg0 = 1; |
3069 | 0 | } |
3070 | 0 | FastErrorResult rv; |
3071 | 0 | self->StepDown(arg0, rv); |
3072 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
3073 | 0 | return false; |
3074 | 0 | } |
3075 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
3076 | 0 | args.rval().setUndefined(); |
3077 | 0 | return true; |
3078 | 0 | } |
3079 | | |
3080 | | static const JSJitInfo stepDown_methodinfo = { |
3081 | | { (JSJitGetterOp)stepDown }, |
3082 | | { prototypes::id::HTMLInputElement }, |
3083 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
3084 | | JSJitInfo::Method, |
3085 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
3086 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
3087 | | false, /* isInfallible. False in setters. */ |
3088 | | false, /* isMovable. Not relevant for setters. */ |
3089 | | false, /* isEliminatable. Not relevant for setters. */ |
3090 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
3091 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
3092 | | false, /* isTypedMethod. Only relevant for methods. */ |
3093 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
3094 | | }; |
3095 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
3096 | | static_assert(0 < 2, "There is no slot for us"); |
3097 | | |
3098 | | MOZ_CAN_RUN_SCRIPT static bool |
3099 | | get_willValidate(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
3100 | 0 | { |
3101 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.willValidate", DOM, cx); |
3102 | 0 |
|
3103 | 0 | bool result(self->WillValidate()); |
3104 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
3105 | 0 | args.rval().setBoolean(result); |
3106 | 0 | return true; |
3107 | 0 | } |
3108 | | |
3109 | | static const JSJitInfo willValidate_getterinfo = { |
3110 | | { (JSJitGetterOp)get_willValidate }, |
3111 | | { prototypes::id::HTMLInputElement }, |
3112 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
3113 | | JSJitInfo::Getter, |
3114 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
3115 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
3116 | | true, /* isInfallible. False in setters. */ |
3117 | | true, /* isMovable. Not relevant for setters. */ |
3118 | | true, /* isEliminatable. Not relevant for setters. */ |
3119 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
3120 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
3121 | | false, /* isTypedMethod. Only relevant for methods. */ |
3122 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
3123 | | }; |
3124 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
3125 | | static_assert(0 < 2, "There is no slot for us"); |
3126 | | |
3127 | | MOZ_CAN_RUN_SCRIPT static bool |
3128 | | get_validity(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
3129 | 0 | { |
3130 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.validity", DOM, cx); |
3131 | 0 |
|
3132 | 0 | auto result(StrongOrRawPtr<mozilla::dom::ValidityState>(self->Validity())); |
3133 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
3134 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
3135 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
3136 | 0 | return false; |
3137 | 0 | } |
3138 | 0 | return true; |
3139 | 0 | } |
3140 | | |
3141 | | static const JSJitInfo validity_getterinfo = { |
3142 | | { (JSJitGetterOp)get_validity }, |
3143 | | { prototypes::id::HTMLInputElement }, |
3144 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
3145 | | JSJitInfo::Getter, |
3146 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
3147 | | JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ |
3148 | | false, /* isInfallible. False in setters. */ |
3149 | | true, /* isMovable. Not relevant for setters. */ |
3150 | | true, /* isEliminatable. Not relevant for setters. */ |
3151 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
3152 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
3153 | | false, /* isTypedMethod. Only relevant for methods. */ |
3154 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
3155 | | }; |
3156 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
3157 | | static_assert(0 < 2, "There is no slot for us"); |
3158 | | |
3159 | | MOZ_CAN_RUN_SCRIPT static bool |
3160 | | get_validationMessage(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
3161 | 0 | { |
3162 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.validationMessage", DOM, cx); |
3163 | 0 |
|
3164 | 0 | FastErrorResult rv; |
3165 | 0 | DOMString result; |
3166 | 0 | self->GetValidationMessage(result, rv); |
3167 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
3168 | 0 | return false; |
3169 | 0 | } |
3170 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
3171 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
3172 | 0 | return false; |
3173 | 0 | } |
3174 | 0 | return true; |
3175 | 0 | } |
3176 | | |
3177 | | static const JSJitInfo validationMessage_getterinfo = { |
3178 | | { (JSJitGetterOp)get_validationMessage }, |
3179 | | { prototypes::id::HTMLInputElement }, |
3180 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
3181 | | JSJitInfo::Getter, |
3182 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
3183 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
3184 | | false, /* isInfallible. False in setters. */ |
3185 | | false, /* isMovable. Not relevant for setters. */ |
3186 | | false, /* isEliminatable. Not relevant for setters. */ |
3187 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
3188 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
3189 | | false, /* isTypedMethod. Only relevant for methods. */ |
3190 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
3191 | | }; |
3192 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
3193 | | static_assert(0 < 2, "There is no slot for us"); |
3194 | | |
3195 | | MOZ_CAN_RUN_SCRIPT static bool |
3196 | | checkValidity(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, const JSJitMethodCallArgs& args) |
3197 | 0 | { |
3198 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLInputElement.checkValidity", DOM, cx); |
3199 | 0 |
|
3200 | 0 | bool result(self->CheckValidity()); |
3201 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
3202 | 0 | args.rval().setBoolean(result); |
3203 | 0 | return true; |
3204 | 0 | } |
3205 | | |
3206 | | static const JSJitInfo checkValidity_methodinfo = { |
3207 | | { (JSJitGetterOp)checkValidity }, |
3208 | | { prototypes::id::HTMLInputElement }, |
3209 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
3210 | | JSJitInfo::Method, |
3211 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
3212 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
3213 | | true, /* isInfallible. False in setters. */ |
3214 | | false, /* isMovable. Not relevant for setters. */ |
3215 | | false, /* isEliminatable. Not relevant for setters. */ |
3216 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
3217 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
3218 | | false, /* isTypedMethod. Only relevant for methods. */ |
3219 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
3220 | | }; |
3221 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
3222 | | static_assert(0 < 2, "There is no slot for us"); |
3223 | | |
3224 | | MOZ_CAN_RUN_SCRIPT static bool |
3225 | | reportValidity(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, const JSJitMethodCallArgs& args) |
3226 | 0 | { |
3227 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLInputElement.reportValidity", DOM, cx); |
3228 | 0 |
|
3229 | 0 | bool result(self->ReportValidity()); |
3230 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
3231 | 0 | args.rval().setBoolean(result); |
3232 | 0 | return true; |
3233 | 0 | } |
3234 | | |
3235 | | static const JSJitInfo reportValidity_methodinfo = { |
3236 | | { (JSJitGetterOp)reportValidity }, |
3237 | | { prototypes::id::HTMLInputElement }, |
3238 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
3239 | | JSJitInfo::Method, |
3240 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
3241 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
3242 | | true, /* isInfallible. False in setters. */ |
3243 | | false, /* isMovable. Not relevant for setters. */ |
3244 | | false, /* isEliminatable. Not relevant for setters. */ |
3245 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
3246 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
3247 | | false, /* isTypedMethod. Only relevant for methods. */ |
3248 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
3249 | | }; |
3250 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
3251 | | static_assert(0 < 2, "There is no slot for us"); |
3252 | | |
3253 | | MOZ_CAN_RUN_SCRIPT static bool |
3254 | | setCustomValidity(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, const JSJitMethodCallArgs& args) |
3255 | 0 | { |
3256 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLInputElement.setCustomValidity", DOM, cx); |
3257 | 0 |
|
3258 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
3259 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLInputElement.setCustomValidity"); |
3260 | 0 | } |
3261 | 0 | binding_detail::FakeString arg0; |
3262 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
3263 | 0 | return false; |
3264 | 0 | } |
3265 | 0 | self->SetCustomValidity(NonNullHelper(Constify(arg0))); |
3266 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
3267 | 0 | args.rval().setUndefined(); |
3268 | 0 | return true; |
3269 | 0 | } |
3270 | | |
3271 | | static const JSJitInfo setCustomValidity_methodinfo = { |
3272 | | { (JSJitGetterOp)setCustomValidity }, |
3273 | | { prototypes::id::HTMLInputElement }, |
3274 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
3275 | | JSJitInfo::Method, |
3276 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
3277 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
3278 | | false, /* isInfallible. False in setters. */ |
3279 | | false, /* isMovable. Not relevant for setters. */ |
3280 | | false, /* isEliminatable. Not relevant for setters. */ |
3281 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
3282 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
3283 | | false, /* isTypedMethod. Only relevant for methods. */ |
3284 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
3285 | | }; |
3286 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
3287 | | static_assert(0 < 2, "There is no slot for us"); |
3288 | | |
3289 | | MOZ_CAN_RUN_SCRIPT static bool |
3290 | | get_labels(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
3291 | 0 | { |
3292 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.labels", DOM, cx); |
3293 | 0 |
|
3294 | 0 | auto result(StrongOrRawPtr<nsINodeList>(self->GetLabels())); |
3295 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
3296 | 0 | if (!result) { |
3297 | 0 | args.rval().setNull(); |
3298 | 0 | return true; |
3299 | 0 | } |
3300 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
3301 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
3302 | 0 | return false; |
3303 | 0 | } |
3304 | 0 | return true; |
3305 | 0 | } |
3306 | | |
3307 | | static const JSJitInfo labels_getterinfo = { |
3308 | | { (JSJitGetterOp)get_labels }, |
3309 | | { prototypes::id::HTMLInputElement }, |
3310 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
3311 | | JSJitInfo::Getter, |
3312 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
3313 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
3314 | | false, /* isInfallible. False in setters. */ |
3315 | | false, /* isMovable. Not relevant for setters. */ |
3316 | | false, /* isEliminatable. Not relevant for setters. */ |
3317 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
3318 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
3319 | | false, /* isTypedMethod. Only relevant for methods. */ |
3320 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
3321 | | }; |
3322 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
3323 | | static_assert(0 < 2, "There is no slot for us"); |
3324 | | |
3325 | | MOZ_CAN_RUN_SCRIPT static bool |
3326 | | select(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, const JSJitMethodCallArgs& args) |
3327 | 0 | { |
3328 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLInputElement.select", DOM, cx); |
3329 | 0 |
|
3330 | 0 | self->Select(); |
3331 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
3332 | 0 | args.rval().setUndefined(); |
3333 | 0 | return true; |
3334 | 0 | } |
3335 | | |
3336 | | static const JSJitInfo select_methodinfo = { |
3337 | | { (JSJitGetterOp)select }, |
3338 | | { prototypes::id::HTMLInputElement }, |
3339 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
3340 | | JSJitInfo::Method, |
3341 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
3342 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
3343 | | true, /* isInfallible. False in setters. */ |
3344 | | false, /* isMovable. Not relevant for setters. */ |
3345 | | false, /* isEliminatable. Not relevant for setters. */ |
3346 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
3347 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
3348 | | false, /* isTypedMethod. Only relevant for methods. */ |
3349 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
3350 | | }; |
3351 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
3352 | | static_assert(0 < 2, "There is no slot for us"); |
3353 | | |
3354 | | MOZ_CAN_RUN_SCRIPT static bool |
3355 | | get_selectionStart(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
3356 | 0 | { |
3357 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.selectionStart", DOM, cx); |
3358 | 0 |
|
3359 | 0 | FastErrorResult rv; |
3360 | 0 | Nullable<uint32_t> result(self->GetSelectionStart(rv)); |
3361 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
3362 | 0 | return false; |
3363 | 0 | } |
3364 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
3365 | 0 | if (result.IsNull()) { |
3366 | 0 | args.rval().setNull(); |
3367 | 0 | return true; |
3368 | 0 | } |
3369 | 0 | args.rval().setNumber(result.Value()); |
3370 | 0 | return true; |
3371 | 0 | } |
3372 | | |
3373 | | MOZ_CAN_RUN_SCRIPT static bool |
3374 | | set_selectionStart(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
3375 | 0 | { |
3376 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.selectionStart", DOM, cx); |
3377 | 0 |
|
3378 | 0 | Nullable<uint32_t> arg0; |
3379 | 0 | if (args[0].isNullOrUndefined()) { |
3380 | 0 | arg0.SetNull(); |
3381 | 0 | } else if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0.SetValue())) { |
3382 | 0 | return false; |
3383 | 0 | } |
3384 | 0 | FastErrorResult rv; |
3385 | 0 | self->SetSelectionStart(Constify(arg0), rv); |
3386 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
3387 | 0 | return false; |
3388 | 0 | } |
3389 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
3390 | 0 |
|
3391 | 0 | return true; |
3392 | 0 | } |
3393 | | |
3394 | | static const JSJitInfo selectionStart_getterinfo = { |
3395 | | { (JSJitGetterOp)get_selectionStart }, |
3396 | | { prototypes::id::HTMLInputElement }, |
3397 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
3398 | | JSJitInfo::Getter, |
3399 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
3400 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
3401 | | false, /* isInfallible. False in setters. */ |
3402 | | false, /* isMovable. Not relevant for setters. */ |
3403 | | false, /* isEliminatable. Not relevant for setters. */ |
3404 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
3405 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
3406 | | false, /* isTypedMethod. Only relevant for methods. */ |
3407 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
3408 | | }; |
3409 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
3410 | | static_assert(0 < 2, "There is no slot for us"); |
3411 | | static const JSJitInfo selectionStart_setterinfo = { |
3412 | | { (JSJitGetterOp)set_selectionStart }, |
3413 | | { prototypes::id::HTMLInputElement }, |
3414 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
3415 | | JSJitInfo::Setter, |
3416 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
3417 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
3418 | | false, /* isInfallible. False in setters. */ |
3419 | | false, /* isMovable. Not relevant for setters. */ |
3420 | | false, /* isEliminatable. Not relevant for setters. */ |
3421 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
3422 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
3423 | | false, /* isTypedMethod. Only relevant for methods. */ |
3424 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
3425 | | }; |
3426 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
3427 | | static_assert(0 < 2, "There is no slot for us"); |
3428 | | |
3429 | | MOZ_CAN_RUN_SCRIPT static bool |
3430 | | get_selectionEnd(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
3431 | 0 | { |
3432 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.selectionEnd", DOM, cx); |
3433 | 0 |
|
3434 | 0 | FastErrorResult rv; |
3435 | 0 | Nullable<uint32_t> result(self->GetSelectionEnd(rv)); |
3436 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
3437 | 0 | return false; |
3438 | 0 | } |
3439 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
3440 | 0 | if (result.IsNull()) { |
3441 | 0 | args.rval().setNull(); |
3442 | 0 | return true; |
3443 | 0 | } |
3444 | 0 | args.rval().setNumber(result.Value()); |
3445 | 0 | return true; |
3446 | 0 | } |
3447 | | |
3448 | | MOZ_CAN_RUN_SCRIPT static bool |
3449 | | set_selectionEnd(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
3450 | 0 | { |
3451 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.selectionEnd", DOM, cx); |
3452 | 0 |
|
3453 | 0 | Nullable<uint32_t> arg0; |
3454 | 0 | if (args[0].isNullOrUndefined()) { |
3455 | 0 | arg0.SetNull(); |
3456 | 0 | } else if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0.SetValue())) { |
3457 | 0 | return false; |
3458 | 0 | } |
3459 | 0 | FastErrorResult rv; |
3460 | 0 | self->SetSelectionEnd(Constify(arg0), rv); |
3461 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
3462 | 0 | return false; |
3463 | 0 | } |
3464 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
3465 | 0 |
|
3466 | 0 | return true; |
3467 | 0 | } |
3468 | | |
3469 | | static const JSJitInfo selectionEnd_getterinfo = { |
3470 | | { (JSJitGetterOp)get_selectionEnd }, |
3471 | | { prototypes::id::HTMLInputElement }, |
3472 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
3473 | | JSJitInfo::Getter, |
3474 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
3475 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
3476 | | false, /* isInfallible. False in setters. */ |
3477 | | false, /* isMovable. Not relevant for setters. */ |
3478 | | false, /* isEliminatable. Not relevant for setters. */ |
3479 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
3480 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
3481 | | false, /* isTypedMethod. Only relevant for methods. */ |
3482 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
3483 | | }; |
3484 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
3485 | | static_assert(0 < 2, "There is no slot for us"); |
3486 | | static const JSJitInfo selectionEnd_setterinfo = { |
3487 | | { (JSJitGetterOp)set_selectionEnd }, |
3488 | | { prototypes::id::HTMLInputElement }, |
3489 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
3490 | | JSJitInfo::Setter, |
3491 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
3492 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
3493 | | false, /* isInfallible. False in setters. */ |
3494 | | false, /* isMovable. Not relevant for setters. */ |
3495 | | false, /* isEliminatable. Not relevant for setters. */ |
3496 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
3497 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
3498 | | false, /* isTypedMethod. Only relevant for methods. */ |
3499 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
3500 | | }; |
3501 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
3502 | | static_assert(0 < 2, "There is no slot for us"); |
3503 | | |
3504 | | MOZ_CAN_RUN_SCRIPT static bool |
3505 | | get_selectionDirection(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
3506 | 0 | { |
3507 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.selectionDirection", DOM, cx); |
3508 | 0 |
|
3509 | 0 | FastErrorResult rv; |
3510 | 0 | DOMString result; |
3511 | 0 | self->GetSelectionDirection(result, rv); |
3512 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
3513 | 0 | return false; |
3514 | 0 | } |
3515 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
3516 | 0 | if (!xpc::StringToJsval(cx, result, args.rval())) { |
3517 | 0 | return false; |
3518 | 0 | } |
3519 | 0 | return true; |
3520 | 0 | } |
3521 | | |
3522 | | MOZ_CAN_RUN_SCRIPT static bool |
3523 | | set_selectionDirection(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
3524 | 0 | { |
3525 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.selectionDirection", DOM, cx); |
3526 | 0 |
|
3527 | 0 | binding_detail::FakeString arg0; |
3528 | 0 | if (!ConvertJSValueToString(cx, args[0], eNull, eNull, arg0)) { |
3529 | 0 | return false; |
3530 | 0 | } |
3531 | 0 | FastErrorResult rv; |
3532 | 0 | self->SetSelectionDirection(NonNullHelper(Constify(arg0)), rv); |
3533 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
3534 | 0 | return false; |
3535 | 0 | } |
3536 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
3537 | 0 |
|
3538 | 0 | return true; |
3539 | 0 | } |
3540 | | |
3541 | | static const JSJitInfo selectionDirection_getterinfo = { |
3542 | | { (JSJitGetterOp)get_selectionDirection }, |
3543 | | { prototypes::id::HTMLInputElement }, |
3544 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
3545 | | JSJitInfo::Getter, |
3546 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
3547 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
3548 | | false, /* isInfallible. False in setters. */ |
3549 | | false, /* isMovable. Not relevant for setters. */ |
3550 | | false, /* isEliminatable. Not relevant for setters. */ |
3551 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
3552 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
3553 | | false, /* isTypedMethod. Only relevant for methods. */ |
3554 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
3555 | | }; |
3556 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
3557 | | static_assert(0 < 2, "There is no slot for us"); |
3558 | | static const JSJitInfo selectionDirection_setterinfo = { |
3559 | | { (JSJitGetterOp)set_selectionDirection }, |
3560 | | { prototypes::id::HTMLInputElement }, |
3561 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
3562 | | JSJitInfo::Setter, |
3563 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
3564 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
3565 | | false, /* isInfallible. False in setters. */ |
3566 | | false, /* isMovable. Not relevant for setters. */ |
3567 | | false, /* isEliminatable. Not relevant for setters. */ |
3568 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
3569 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
3570 | | false, /* isTypedMethod. Only relevant for methods. */ |
3571 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
3572 | | }; |
3573 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
3574 | | static_assert(0 < 2, "There is no slot for us"); |
3575 | | |
3576 | | MOZ_CAN_RUN_SCRIPT static bool |
3577 | | setRangeText(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, const JSJitMethodCallArgs& args) |
3578 | 0 | { |
3579 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLInputElement.setRangeText", DOM, cx); |
3580 | 0 |
|
3581 | 0 | unsigned argcount = std::min(args.length(), 4u); |
3582 | 0 | switch (argcount) { |
3583 | 0 | case 1: { |
3584 | 0 | binding_detail::FakeString arg0; |
3585 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
3586 | 0 | return false; |
3587 | 0 | } |
3588 | 0 | FastErrorResult rv; |
3589 | 0 | self->SetRangeText(NonNullHelper(Constify(arg0)), rv); |
3590 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
3591 | 0 | return false; |
3592 | 0 | } |
3593 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
3594 | 0 | args.rval().setUndefined(); |
3595 | 0 | return true; |
3596 | 0 | break; |
3597 | 0 | } |
3598 | 0 | case 3: { |
3599 | 0 | MOZ_FALLTHROUGH; |
3600 | 0 | } |
3601 | 0 | case 4: { |
3602 | 0 | binding_detail::FakeString arg0; |
3603 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
3604 | 0 | return false; |
3605 | 0 | } |
3606 | 0 | uint32_t arg1; |
3607 | 0 | if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) { |
3608 | 0 | return false; |
3609 | 0 | } |
3610 | 0 | uint32_t arg2; |
3611 | 0 | if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[2], &arg2)) { |
3612 | 0 | return false; |
3613 | 0 | } |
3614 | 0 | SelectionMode arg3; |
3615 | 0 | if (args.hasDefined(3)) { |
3616 | 0 | { |
3617 | 0 | int index; |
3618 | 0 | if (!FindEnumStringIndex<true>(cx, args[3], SelectionModeValues::strings, "SelectionMode", "Argument 4 of HTMLInputElement.setRangeText", &index)) { |
3619 | 0 | return false; |
3620 | 0 | } |
3621 | 0 | MOZ_ASSERT(index >= 0); |
3622 | 0 | arg3 = static_cast<SelectionMode>(index); |
3623 | 0 | } |
3624 | 0 | } else { |
3625 | 0 | arg3 = SelectionMode::Preserve; |
3626 | 0 | } |
3627 | 0 | FastErrorResult rv; |
3628 | 0 | self->SetRangeText(NonNullHelper(Constify(arg0)), arg1, arg2, arg3, rv); |
3629 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
3630 | 0 | return false; |
3631 | 0 | } |
3632 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
3633 | 0 | args.rval().setUndefined(); |
3634 | 0 | return true; |
3635 | 0 | break; |
3636 | 0 | } |
3637 | 0 | default: { |
3638 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLInputElement.setRangeText"); |
3639 | 0 | break; |
3640 | 0 | } |
3641 | 0 | } |
3642 | 0 | MOZ_CRASH("We have an always-returning default case"); |
3643 | 0 | return false; |
3644 | 0 | } |
3645 | | |
3646 | | static const JSJitInfo setRangeText_methodinfo = { |
3647 | | { (JSJitGetterOp)setRangeText }, |
3648 | | { prototypes::id::HTMLInputElement }, |
3649 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
3650 | | JSJitInfo::Method, |
3651 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
3652 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
3653 | | false, /* isInfallible. False in setters. */ |
3654 | | false, /* isMovable. Not relevant for setters. */ |
3655 | | false, /* isEliminatable. Not relevant for setters. */ |
3656 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
3657 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
3658 | | false, /* isTypedMethod. Only relevant for methods. */ |
3659 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
3660 | | }; |
3661 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
3662 | | static_assert(0 < 2, "There is no slot for us"); |
3663 | | |
3664 | | MOZ_CAN_RUN_SCRIPT static bool |
3665 | | setSelectionRange(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, const JSJitMethodCallArgs& args) |
3666 | 0 | { |
3667 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLInputElement.setSelectionRange", DOM, cx); |
3668 | 0 |
|
3669 | 0 | if (MOZ_UNLIKELY(args.length() < 2)) { |
3670 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLInputElement.setSelectionRange"); |
3671 | 0 | } |
3672 | 0 | uint32_t arg0; |
3673 | 0 | if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) { |
3674 | 0 | return false; |
3675 | 0 | } |
3676 | 0 | uint32_t arg1; |
3677 | 0 | if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) { |
3678 | 0 | return false; |
3679 | 0 | } |
3680 | 0 | Optional<nsAString> arg2; |
3681 | 0 | binding_detail::FakeString arg2_holder; |
3682 | 0 | if (args.hasDefined(2)) { |
3683 | 0 | if (!ConvertJSValueToString(cx, args[2], eStringify, eStringify, arg2_holder)) { |
3684 | 0 | return false; |
3685 | 0 | } |
3686 | 0 | arg2 = &arg2_holder; |
3687 | 0 | } |
3688 | 0 | FastErrorResult rv; |
3689 | 0 | self->SetSelectionRange(arg0, arg1, NonNullHelper(Constify(arg2)), rv); |
3690 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
3691 | 0 | return false; |
3692 | 0 | } |
3693 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
3694 | 0 | args.rval().setUndefined(); |
3695 | 0 | return true; |
3696 | 0 | } |
3697 | | |
3698 | | static const JSJitInfo setSelectionRange_methodinfo = { |
3699 | | { (JSJitGetterOp)setSelectionRange }, |
3700 | | { prototypes::id::HTMLInputElement }, |
3701 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
3702 | | JSJitInfo::Method, |
3703 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
3704 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
3705 | | false, /* isInfallible. False in setters. */ |
3706 | | false, /* isMovable. Not relevant for setters. */ |
3707 | | false, /* isEliminatable. Not relevant for setters. */ |
3708 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
3709 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
3710 | | false, /* isTypedMethod. Only relevant for methods. */ |
3711 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
3712 | | }; |
3713 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
3714 | | static_assert(0 < 2, "There is no slot for us"); |
3715 | | |
3716 | | MOZ_CAN_RUN_SCRIPT static bool |
3717 | | get_align(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
3718 | 0 | { |
3719 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.align", DOM, cx); |
3720 | 0 |
|
3721 | 0 | DOMString result; |
3722 | 0 | self->GetAlign(result); |
3723 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
3724 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
3725 | 0 | return false; |
3726 | 0 | } |
3727 | 0 | return true; |
3728 | 0 | } |
3729 | | |
3730 | | MOZ_CAN_RUN_SCRIPT static bool |
3731 | | set_align(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
3732 | 0 | { |
3733 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.align", DOM, cx); |
3734 | 0 |
|
3735 | 0 | binding_detail::FakeString arg0; |
3736 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
3737 | 0 | return false; |
3738 | 0 | } |
3739 | 0 | Maybe<AutoCEReaction> ceReaction; |
3740 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
3741 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
3742 | 0 | if (docGroup) { |
3743 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
3744 | 0 | } |
3745 | 0 | } |
3746 | 0 | FastErrorResult rv; |
3747 | 0 | self->SetAlign(NonNullHelper(Constify(arg0)), rv); |
3748 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
3749 | 0 | return false; |
3750 | 0 | } |
3751 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
3752 | 0 |
|
3753 | 0 | return true; |
3754 | 0 | } |
3755 | | |
3756 | | static const JSJitInfo align_getterinfo = { |
3757 | | { (JSJitGetterOp)get_align }, |
3758 | | { prototypes::id::HTMLInputElement }, |
3759 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
3760 | | JSJitInfo::Getter, |
3761 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
3762 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
3763 | | false, /* isInfallible. False in setters. */ |
3764 | | true, /* isMovable. Not relevant for setters. */ |
3765 | | true, /* isEliminatable. Not relevant for setters. */ |
3766 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
3767 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
3768 | | false, /* isTypedMethod. Only relevant for methods. */ |
3769 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
3770 | | }; |
3771 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
3772 | | static_assert(0 < 2, "There is no slot for us"); |
3773 | | static const JSJitInfo align_setterinfo = { |
3774 | | { (JSJitGetterOp)set_align }, |
3775 | | { prototypes::id::HTMLInputElement }, |
3776 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
3777 | | JSJitInfo::Setter, |
3778 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
3779 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
3780 | | false, /* isInfallible. False in setters. */ |
3781 | | false, /* isMovable. Not relevant for setters. */ |
3782 | | false, /* isEliminatable. Not relevant for setters. */ |
3783 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
3784 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
3785 | | false, /* isTypedMethod. Only relevant for methods. */ |
3786 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
3787 | | }; |
3788 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
3789 | | static_assert(0 < 2, "There is no slot for us"); |
3790 | | |
3791 | | MOZ_CAN_RUN_SCRIPT static bool |
3792 | | get_useMap(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
3793 | 0 | { |
3794 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.useMap", DOM, cx); |
3795 | 0 |
|
3796 | 0 | DOMString result; |
3797 | 0 | self->GetUseMap(result); |
3798 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
3799 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
3800 | 0 | return false; |
3801 | 0 | } |
3802 | 0 | return true; |
3803 | 0 | } |
3804 | | |
3805 | | MOZ_CAN_RUN_SCRIPT static bool |
3806 | | set_useMap(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
3807 | 0 | { |
3808 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.useMap", DOM, cx); |
3809 | 0 |
|
3810 | 0 | binding_detail::FakeString arg0; |
3811 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
3812 | 0 | return false; |
3813 | 0 | } |
3814 | 0 | Maybe<AutoCEReaction> ceReaction; |
3815 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
3816 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
3817 | 0 | if (docGroup) { |
3818 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
3819 | 0 | } |
3820 | 0 | } |
3821 | 0 | FastErrorResult rv; |
3822 | 0 | self->SetUseMap(NonNullHelper(Constify(arg0)), rv); |
3823 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
3824 | 0 | return false; |
3825 | 0 | } |
3826 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
3827 | 0 |
|
3828 | 0 | return true; |
3829 | 0 | } |
3830 | | |
3831 | | static const JSJitInfo useMap_getterinfo = { |
3832 | | { (JSJitGetterOp)get_useMap }, |
3833 | | { prototypes::id::HTMLInputElement }, |
3834 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
3835 | | JSJitInfo::Getter, |
3836 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
3837 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
3838 | | false, /* isInfallible. False in setters. */ |
3839 | | true, /* isMovable. Not relevant for setters. */ |
3840 | | true, /* isEliminatable. Not relevant for setters. */ |
3841 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
3842 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
3843 | | false, /* isTypedMethod. Only relevant for methods. */ |
3844 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
3845 | | }; |
3846 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
3847 | | static_assert(0 < 2, "There is no slot for us"); |
3848 | | static const JSJitInfo useMap_setterinfo = { |
3849 | | { (JSJitGetterOp)set_useMap }, |
3850 | | { prototypes::id::HTMLInputElement }, |
3851 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
3852 | | JSJitInfo::Setter, |
3853 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
3854 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
3855 | | false, /* isInfallible. False in setters. */ |
3856 | | false, /* isMovable. Not relevant for setters. */ |
3857 | | false, /* isEliminatable. Not relevant for setters. */ |
3858 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
3859 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
3860 | | false, /* isTypedMethod. Only relevant for methods. */ |
3861 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
3862 | | }; |
3863 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
3864 | | static_assert(0 < 2, "There is no slot for us"); |
3865 | | |
3866 | | MOZ_CAN_RUN_SCRIPT static bool |
3867 | | get_controllers(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
3868 | 0 | { |
3869 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.controllers", DOM, cx); |
3870 | 0 |
|
3871 | 0 | FastErrorResult rv; |
3872 | 0 | auto result(StrongOrRawPtr<nsIControllers>(self->GetControllers(rv))); |
3873 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
3874 | 0 | return false; |
3875 | 0 | } |
3876 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
3877 | 0 | if (!WrapObject(cx, result, &NS_GET_IID(nsIControllers), args.rval())) { |
3878 | 0 | return false; |
3879 | 0 | } |
3880 | 0 | return true; |
3881 | 0 | } |
3882 | | |
3883 | | static const JSJitInfo controllers_getterinfo = { |
3884 | | { (JSJitGetterOp)get_controllers }, |
3885 | | { prototypes::id::HTMLInputElement }, |
3886 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
3887 | | JSJitInfo::Getter, |
3888 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
3889 | | JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ |
3890 | | false, /* isInfallible. False in setters. */ |
3891 | | false, /* isMovable. Not relevant for setters. */ |
3892 | | false, /* isEliminatable. Not relevant for setters. */ |
3893 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
3894 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
3895 | | false, /* isTypedMethod. Only relevant for methods. */ |
3896 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
3897 | | }; |
3898 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
3899 | | static_assert(0 < 2, "There is no slot for us"); |
3900 | | |
3901 | | MOZ_CAN_RUN_SCRIPT static bool |
3902 | | get_textLength(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
3903 | 0 | { |
3904 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.textLength", DOM, cx); |
3905 | 0 |
|
3906 | 0 | int32_t result(self->InputTextLength(nsContentUtils::IsSystemCaller(cx) ? CallerType::System : CallerType::NonSystem)); |
3907 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
3908 | 0 | args.rval().setInt32(int32_t(result)); |
3909 | 0 | return true; |
3910 | 0 | } |
3911 | | |
3912 | | static const JSJitInfo textLength_getterinfo = { |
3913 | | { (JSJitGetterOp)get_textLength }, |
3914 | | { prototypes::id::HTMLInputElement }, |
3915 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
3916 | | JSJitInfo::Getter, |
3917 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
3918 | | JSVAL_TYPE_INT32, /* returnType. Not relevant for setters. */ |
3919 | | true, /* isInfallible. False in setters. */ |
3920 | | false, /* isMovable. Not relevant for setters. */ |
3921 | | false, /* isEliminatable. Not relevant for setters. */ |
3922 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
3923 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
3924 | | false, /* isTypedMethod. Only relevant for methods. */ |
3925 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
3926 | | }; |
3927 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
3928 | | static_assert(0 < 2, "There is no slot for us"); |
3929 | | |
3930 | | MOZ_CAN_RUN_SCRIPT static bool |
3931 | | mozGetFileNameArray(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, const JSJitMethodCallArgs& args) |
3932 | 0 | { |
3933 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLInputElement.mozGetFileNameArray", DOM, cx); |
3934 | 0 |
|
3935 | 0 | FastErrorResult rv; |
3936 | 0 | nsTArray<nsString> result; |
3937 | 0 | self->MozGetFileNameArray(result, rv); |
3938 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
3939 | 0 | return false; |
3940 | 0 | } |
3941 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
3942 | 0 |
|
3943 | 0 | uint32_t length = result.Length(); |
3944 | 0 | JS::Rooted<JSObject*> returnArray(cx, JS_NewArrayObject(cx, length)); |
3945 | 0 | if (!returnArray) { |
3946 | 0 | return false; |
3947 | 0 | } |
3948 | 0 | // Scope for 'tmp' |
3949 | 0 | { |
3950 | 0 | JS::Rooted<JS::Value> tmp(cx); |
3951 | 0 | for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { |
3952 | 0 | // Control block to let us common up the JS_DefineElement calls when there |
3953 | 0 | // are different ways to succeed at wrapping the object. |
3954 | 0 | do { |
3955 | 0 | if (!xpc::NonVoidStringToJsval(cx, result[sequenceIdx0], &tmp)) { |
3956 | 0 | return false; |
3957 | 0 | } |
3958 | 0 | break; |
3959 | 0 | } while (false); |
3960 | 0 | if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, |
3961 | 0 | JSPROP_ENUMERATE)) { |
3962 | 0 | return false; |
3963 | 0 | } |
3964 | 0 | } |
3965 | 0 | } |
3966 | 0 | args.rval().setObject(*returnArray); |
3967 | 0 | return true; |
3968 | 0 | } |
3969 | | |
3970 | | static const JSJitInfo mozGetFileNameArray_methodinfo = { |
3971 | | { (JSJitGetterOp)mozGetFileNameArray }, |
3972 | | { prototypes::id::HTMLInputElement }, |
3973 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
3974 | | JSJitInfo::Method, |
3975 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
3976 | | JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ |
3977 | | false, /* isInfallible. False in setters. */ |
3978 | | false, /* isMovable. Not relevant for setters. */ |
3979 | | false, /* isEliminatable. Not relevant for setters. */ |
3980 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
3981 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
3982 | | false, /* isTypedMethod. Only relevant for methods. */ |
3983 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
3984 | | }; |
3985 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
3986 | | static_assert(0 < 2, "There is no slot for us"); |
3987 | | |
3988 | | MOZ_CAN_RUN_SCRIPT static bool |
3989 | | mozSetFileNameArray(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, const JSJitMethodCallArgs& args) |
3990 | 0 | { |
3991 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLInputElement.mozSetFileNameArray", DOM, cx); |
3992 | 0 |
|
3993 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
3994 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLInputElement.mozSetFileNameArray"); |
3995 | 0 | } |
3996 | 0 | binding_detail::AutoSequence<nsString> arg0; |
3997 | 0 | if (args[0].isObject()) { |
3998 | 0 | JS::ForOfIterator iter(cx); |
3999 | 0 | if (!iter.init(args[0], JS::ForOfIterator::AllowNonIterable)) { |
4000 | 0 | return false; |
4001 | 0 | } |
4002 | 0 | if (!iter.valueIsIterable()) { |
4003 | 0 | ThrowErrorMessage(cx, MSG_NOT_SEQUENCE, "Argument 1 of HTMLInputElement.mozSetFileNameArray"); |
4004 | 0 | return false; |
4005 | 0 | } |
4006 | 0 | binding_detail::AutoSequence<nsString> &arr = arg0; |
4007 | 0 | JS::Rooted<JS::Value> temp(cx); |
4008 | 0 | while (true) { |
4009 | 0 | bool done; |
4010 | 0 | if (!iter.next(&temp, &done)) { |
4011 | 0 | return false; |
4012 | 0 | } |
4013 | 0 | if (done) { |
4014 | 0 | break; |
4015 | 0 | } |
4016 | 0 | nsString* slotPtr = arr.AppendElement(mozilla::fallible); |
4017 | 0 | if (!slotPtr) { |
4018 | 0 | JS_ReportOutOfMemory(cx); |
4019 | 0 | return false; |
4020 | 0 | } |
4021 | 0 | nsString& slot = *slotPtr; |
4022 | 0 | if (!ConvertJSValueToString(cx, temp, eStringify, eStringify, slot)) { |
4023 | 0 | return false; |
4024 | 0 | } |
4025 | 0 | } |
4026 | 0 | } else { |
4027 | 0 | ThrowErrorMessage(cx, MSG_NOT_SEQUENCE, "Argument 1 of HTMLInputElement.mozSetFileNameArray"); |
4028 | 0 | return false; |
4029 | 0 | } |
4030 | 0 | FastErrorResult rv; |
4031 | 0 | self->MozSetFileNameArray(Constify(arg0), rv); |
4032 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
4033 | 0 | return false; |
4034 | 0 | } |
4035 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
4036 | 0 | args.rval().setUndefined(); |
4037 | 0 | return true; |
4038 | 0 | } |
4039 | | |
4040 | | static const JSJitInfo mozSetFileNameArray_methodinfo = { |
4041 | | { (JSJitGetterOp)mozSetFileNameArray }, |
4042 | | { prototypes::id::HTMLInputElement }, |
4043 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
4044 | | JSJitInfo::Method, |
4045 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
4046 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
4047 | | false, /* isInfallible. False in setters. */ |
4048 | | false, /* isMovable. Not relevant for setters. */ |
4049 | | false, /* isEliminatable. Not relevant for setters. */ |
4050 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
4051 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
4052 | | false, /* isTypedMethod. Only relevant for methods. */ |
4053 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
4054 | | }; |
4055 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
4056 | | static_assert(0 < 2, "There is no slot for us"); |
4057 | | |
4058 | | MOZ_CAN_RUN_SCRIPT static bool |
4059 | | mozSetFileArray(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, const JSJitMethodCallArgs& args) |
4060 | 0 | { |
4061 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLInputElement.mozSetFileArray", DOM, cx); |
4062 | 0 |
|
4063 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
4064 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLInputElement.mozSetFileArray"); |
4065 | 0 | } |
4066 | 0 | binding_detail::AutoSequence<OwningNonNull<mozilla::dom::File>> arg0; |
4067 | 0 | if (args[0].isObject()) { |
4068 | 0 | JS::ForOfIterator iter(cx); |
4069 | 0 | if (!iter.init(args[0], JS::ForOfIterator::AllowNonIterable)) { |
4070 | 0 | return false; |
4071 | 0 | } |
4072 | 0 | if (!iter.valueIsIterable()) { |
4073 | 0 | ThrowErrorMessage(cx, MSG_NOT_SEQUENCE, "Argument 1 of HTMLInputElement.mozSetFileArray"); |
4074 | 0 | return false; |
4075 | 0 | } |
4076 | 0 | binding_detail::AutoSequence<OwningNonNull<mozilla::dom::File>> &arr = arg0; |
4077 | 0 | JS::Rooted<JS::Value> temp(cx); |
4078 | 0 | while (true) { |
4079 | 0 | bool done; |
4080 | 0 | if (!iter.next(&temp, &done)) { |
4081 | 0 | return false; |
4082 | 0 | } |
4083 | 0 | if (done) { |
4084 | 0 | break; |
4085 | 0 | } |
4086 | 0 | OwningNonNull<mozilla::dom::File>* slotPtr = arr.AppendElement(mozilla::fallible); |
4087 | 0 | if (!slotPtr) { |
4088 | 0 | JS_ReportOutOfMemory(cx); |
4089 | 0 | return false; |
4090 | 0 | } |
4091 | 0 | OwningNonNull<mozilla::dom::File>& slot = *slotPtr; |
4092 | 0 | if (temp.isObject()) { |
4093 | 0 | static_assert(IsRefcounted<mozilla::dom::File>::value, "We can only store refcounted classes.");{ |
4094 | 0 | nsresult rv = UnwrapObject<prototypes::id::File, mozilla::dom::File>(&temp, slot); |
4095 | 0 | if (NS_FAILED(rv)) { |
4096 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Element of argument 1 of HTMLInputElement.mozSetFileArray", "File"); |
4097 | 0 | return false; |
4098 | 0 | } |
4099 | 0 | } |
4100 | 0 | } else { |
4101 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Element of argument 1 of HTMLInputElement.mozSetFileArray"); |
4102 | 0 | return false; |
4103 | 0 | } |
4104 | 0 | } |
4105 | 0 | } else { |
4106 | 0 | ThrowErrorMessage(cx, MSG_NOT_SEQUENCE, "Argument 1 of HTMLInputElement.mozSetFileArray"); |
4107 | 0 | return false; |
4108 | 0 | } |
4109 | 0 | self->MozSetFileArray(Constify(arg0)); |
4110 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
4111 | 0 | args.rval().setUndefined(); |
4112 | 0 | return true; |
4113 | 0 | } |
4114 | | |
4115 | | static const JSJitInfo mozSetFileArray_methodinfo = { |
4116 | | { (JSJitGetterOp)mozSetFileArray }, |
4117 | | { prototypes::id::HTMLInputElement }, |
4118 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
4119 | | JSJitInfo::Method, |
4120 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
4121 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
4122 | | false, /* isInfallible. False in setters. */ |
4123 | | false, /* isMovable. Not relevant for setters. */ |
4124 | | false, /* isEliminatable. Not relevant for setters. */ |
4125 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
4126 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
4127 | | false, /* isTypedMethod. Only relevant for methods. */ |
4128 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
4129 | | }; |
4130 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
4131 | | static_assert(0 < 2, "There is no slot for us"); |
4132 | | |
4133 | | MOZ_CAN_RUN_SCRIPT static bool |
4134 | | mozSetDirectory(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, const JSJitMethodCallArgs& args) |
4135 | 0 | { |
4136 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLInputElement.mozSetDirectory", DOM, cx); |
4137 | 0 |
|
4138 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
4139 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLInputElement.mozSetDirectory"); |
4140 | 0 | } |
4141 | 0 | binding_detail::FakeString arg0; |
4142 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
4143 | 0 | return false; |
4144 | 0 | } |
4145 | 0 | FastErrorResult rv; |
4146 | 0 | self->MozSetDirectory(NonNullHelper(Constify(arg0)), rv); |
4147 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
4148 | 0 | return false; |
4149 | 0 | } |
4150 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
4151 | 0 | args.rval().setUndefined(); |
4152 | 0 | return true; |
4153 | 0 | } |
4154 | | |
4155 | | static const JSJitInfo mozSetDirectory_methodinfo = { |
4156 | | { (JSJitGetterOp)mozSetDirectory }, |
4157 | | { prototypes::id::HTMLInputElement }, |
4158 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
4159 | | JSJitInfo::Method, |
4160 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
4161 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
4162 | | false, /* isInfallible. False in setters. */ |
4163 | | false, /* isMovable. Not relevant for setters. */ |
4164 | | false, /* isEliminatable. Not relevant for setters. */ |
4165 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
4166 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
4167 | | false, /* isTypedMethod. Only relevant for methods. */ |
4168 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
4169 | | }; |
4170 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
4171 | | static_assert(0 < 2, "There is no slot for us"); |
4172 | | |
4173 | | MOZ_CAN_RUN_SCRIPT static bool |
4174 | | mozSetDndFilesAndDirectories(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, const JSJitMethodCallArgs& args) |
4175 | 0 | { |
4176 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLInputElement.mozSetDndFilesAndDirectories", DOM, cx); |
4177 | 0 |
|
4178 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
4179 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLInputElement.mozSetDndFilesAndDirectories"); |
4180 | 0 | } |
4181 | 0 | binding_detail::AutoSequence<OwningFileOrDirectory> arg0; |
4182 | 0 | if (args[0].isObject()) { |
4183 | 0 | JS::ForOfIterator iter(cx); |
4184 | 0 | if (!iter.init(args[0], JS::ForOfIterator::AllowNonIterable)) { |
4185 | 0 | return false; |
4186 | 0 | } |
4187 | 0 | if (!iter.valueIsIterable()) { |
4188 | 0 | ThrowErrorMessage(cx, MSG_NOT_SEQUENCE, "Argument 1 of HTMLInputElement.mozSetDndFilesAndDirectories"); |
4189 | 0 | return false; |
4190 | 0 | } |
4191 | 0 | binding_detail::AutoSequence<OwningFileOrDirectory> &arr = arg0; |
4192 | 0 | JS::Rooted<JS::Value> temp(cx); |
4193 | 0 | while (true) { |
4194 | 0 | bool done; |
4195 | 0 | if (!iter.next(&temp, &done)) { |
4196 | 0 | return false; |
4197 | 0 | } |
4198 | 0 | if (done) { |
4199 | 0 | break; |
4200 | 0 | } |
4201 | 0 | OwningFileOrDirectory* slotPtr = arr.AppendElement(mozilla::fallible); |
4202 | 0 | if (!slotPtr) { |
4203 | 0 | JS_ReportOutOfMemory(cx); |
4204 | 0 | return false; |
4205 | 0 | } |
4206 | 0 | OwningFileOrDirectory& slot = *slotPtr; |
4207 | 0 | { |
4208 | 0 | bool done = false, failed = false, tryNext; |
4209 | 0 | if (temp.isObject()) { |
4210 | 0 | done = (failed = !slot.TrySetToFile(cx, temp, tryNext, false)) || !tryNext || |
4211 | 0 | (failed = !slot.TrySetToDirectory(cx, temp, tryNext, false)) || !tryNext; |
4212 | 0 |
|
4213 | 0 | } |
4214 | 0 | if (failed) { |
4215 | 0 | return false; |
4216 | 0 | } |
4217 | 0 | if (!done) { |
4218 | 0 | ThrowErrorMessage(cx, MSG_NOT_IN_UNION, "Element of argument 1 of HTMLInputElement.mozSetDndFilesAndDirectories", "File, Directory"); |
4219 | 0 | return false; |
4220 | 0 | } |
4221 | 0 | } |
4222 | 0 | } |
4223 | 0 | } else { |
4224 | 0 | ThrowErrorMessage(cx, MSG_NOT_SEQUENCE, "Argument 1 of HTMLInputElement.mozSetDndFilesAndDirectories"); |
4225 | 0 | return false; |
4226 | 0 | } |
4227 | 0 | self->MozSetDndFilesAndDirectories(Constify(arg0)); |
4228 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
4229 | 0 | args.rval().setUndefined(); |
4230 | 0 | return true; |
4231 | 0 | } |
4232 | | |
4233 | | static const JSJitInfo mozSetDndFilesAndDirectories_methodinfo = { |
4234 | | { (JSJitGetterOp)mozSetDndFilesAndDirectories }, |
4235 | | { prototypes::id::HTMLInputElement }, |
4236 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
4237 | | JSJitInfo::Method, |
4238 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
4239 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
4240 | | false, /* isInfallible. False in setters. */ |
4241 | | false, /* isMovable. Not relevant for setters. */ |
4242 | | false, /* isEliminatable. Not relevant for setters. */ |
4243 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
4244 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
4245 | | false, /* isTypedMethod. Only relevant for methods. */ |
4246 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
4247 | | }; |
4248 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
4249 | | static_assert(0 < 2, "There is no slot for us"); |
4250 | | |
4251 | | MOZ_CAN_RUN_SCRIPT static bool |
4252 | | get_ownerNumberControl(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
4253 | 0 | { |
4254 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.ownerNumberControl", DOM, cx); |
4255 | 0 |
|
4256 | 0 | auto result(StrongOrRawPtr<mozilla::dom::HTMLInputElement>(self->GetOwnerNumberControl())); |
4257 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
4258 | 0 | if (!result) { |
4259 | 0 | args.rval().setNull(); |
4260 | 0 | return true; |
4261 | 0 | } |
4262 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
4263 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
4264 | 0 | return false; |
4265 | 0 | } |
4266 | 0 | return true; |
4267 | 0 | } |
4268 | | |
4269 | | static const JSJitInfo ownerNumberControl_getterinfo = { |
4270 | | { (JSJitGetterOp)get_ownerNumberControl }, |
4271 | | { prototypes::id::HTMLInputElement }, |
4272 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
4273 | | JSJitInfo::Getter, |
4274 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
4275 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
4276 | | false, /* isInfallible. False in setters. */ |
4277 | | false, /* isMovable. Not relevant for setters. */ |
4278 | | false, /* isEliminatable. Not relevant for setters. */ |
4279 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
4280 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
4281 | | false, /* isTypedMethod. Only relevant for methods. */ |
4282 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
4283 | | }; |
4284 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
4285 | | static_assert(0 < 2, "There is no slot for us"); |
4286 | | |
4287 | | MOZ_CAN_RUN_SCRIPT static bool |
4288 | | mozIsTextField(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, const JSJitMethodCallArgs& args) |
4289 | 0 | { |
4290 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLInputElement.mozIsTextField", DOM, cx); |
4291 | 0 |
|
4292 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
4293 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLInputElement.mozIsTextField"); |
4294 | 0 | } |
4295 | 0 | bool arg0; |
4296 | 0 | if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) { |
4297 | 0 | return false; |
4298 | 0 | } |
4299 | 0 | bool result(self->MozIsTextField(arg0)); |
4300 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
4301 | 0 | args.rval().setBoolean(result); |
4302 | 0 | return true; |
4303 | 0 | } |
4304 | | |
4305 | | static const JSJitInfo mozIsTextField_methodinfo = { |
4306 | | { (JSJitGetterOp)mozIsTextField }, |
4307 | | { prototypes::id::HTMLInputElement }, |
4308 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
4309 | | JSJitInfo::Method, |
4310 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
4311 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
4312 | | false, /* isInfallible. False in setters. */ |
4313 | | false, /* isMovable. Not relevant for setters. */ |
4314 | | false, /* isEliminatable. Not relevant for setters. */ |
4315 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
4316 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
4317 | | false, /* isTypedMethod. Only relevant for methods. */ |
4318 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
4319 | | }; |
4320 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
4321 | | static_assert(0 < 2, "There is no slot for us"); |
4322 | | |
4323 | | MOZ_CAN_RUN_SCRIPT static bool |
4324 | | getAutocompleteInfo(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, const JSJitMethodCallArgs& args) |
4325 | 0 | { |
4326 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLInputElement.getAutocompleteInfo", DOM, cx); |
4327 | 0 |
|
4328 | 0 | Nullable<AutocompleteInfo> result; |
4329 | 0 | self->GetAutocompleteInfo(result); |
4330 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
4331 | 0 | if (result.IsNull()) { |
4332 | 0 | args.rval().setNull(); |
4333 | 0 | return true; |
4334 | 0 | } |
4335 | 0 | if (!result.Value().ToObjectInternal(cx, args.rval())) { |
4336 | 0 | return false; |
4337 | 0 | } |
4338 | 0 | return true; |
4339 | 0 | } |
4340 | | |
4341 | | static const JSJitInfo getAutocompleteInfo_methodinfo = { |
4342 | | { (JSJitGetterOp)getAutocompleteInfo }, |
4343 | | { prototypes::id::HTMLInputElement }, |
4344 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
4345 | | JSJitInfo::Method, |
4346 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
4347 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
4348 | | false, /* isInfallible. False in setters. */ |
4349 | | false, /* isMovable. Not relevant for setters. */ |
4350 | | false, /* isEliminatable. Not relevant for setters. */ |
4351 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
4352 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
4353 | | false, /* isTypedMethod. Only relevant for methods. */ |
4354 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
4355 | | }; |
4356 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
4357 | | static_assert(0 < 2, "There is no slot for us"); |
4358 | | |
4359 | | MOZ_CAN_RUN_SCRIPT static bool |
4360 | | get_allowdirs(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
4361 | 0 | { |
4362 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.allowdirs", DOM, cx); |
4363 | 0 |
|
4364 | 0 | bool result(self->Allowdirs()); |
4365 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
4366 | 0 | args.rval().setBoolean(result); |
4367 | 0 | return true; |
4368 | 0 | } |
4369 | | |
4370 | | MOZ_CAN_RUN_SCRIPT static bool |
4371 | | set_allowdirs(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
4372 | 0 | { |
4373 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.allowdirs", DOM, cx); |
4374 | 0 |
|
4375 | 0 | bool arg0; |
4376 | 0 | if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) { |
4377 | 0 | return false; |
4378 | 0 | } |
4379 | 0 | FastErrorResult rv; |
4380 | 0 | self->SetAllowdirs(arg0, rv); |
4381 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
4382 | 0 | return false; |
4383 | 0 | } |
4384 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
4385 | 0 |
|
4386 | 0 | return true; |
4387 | 0 | } |
4388 | | |
4389 | | static const JSJitInfo allowdirs_getterinfo = { |
4390 | | { (JSJitGetterOp)get_allowdirs }, |
4391 | | { prototypes::id::HTMLInputElement }, |
4392 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
4393 | | JSJitInfo::Getter, |
4394 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
4395 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
4396 | | true, /* isInfallible. False in setters. */ |
4397 | | false, /* isMovable. Not relevant for setters. */ |
4398 | | false, /* isEliminatable. Not relevant for setters. */ |
4399 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
4400 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
4401 | | false, /* isTypedMethod. Only relevant for methods. */ |
4402 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
4403 | | }; |
4404 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
4405 | | static_assert(0 < 2, "There is no slot for us"); |
4406 | | static const JSJitInfo allowdirs_setterinfo = { |
4407 | | { (JSJitGetterOp)set_allowdirs }, |
4408 | | { prototypes::id::HTMLInputElement }, |
4409 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
4410 | | JSJitInfo::Setter, |
4411 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
4412 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
4413 | | false, /* isInfallible. False in setters. */ |
4414 | | false, /* isMovable. Not relevant for setters. */ |
4415 | | false, /* isEliminatable. Not relevant for setters. */ |
4416 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
4417 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
4418 | | false, /* isTypedMethod. Only relevant for methods. */ |
4419 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
4420 | | }; |
4421 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
4422 | | static_assert(0 < 2, "There is no slot for us"); |
4423 | | |
4424 | | MOZ_CAN_RUN_SCRIPT static bool |
4425 | | get_isFilesAndDirectoriesSupported(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
4426 | 0 | { |
4427 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.isFilesAndDirectoriesSupported", DOM, cx); |
4428 | 0 |
|
4429 | 0 | bool result(self->IsFilesAndDirectoriesSupported()); |
4430 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
4431 | 0 | args.rval().setBoolean(result); |
4432 | 0 | return true; |
4433 | 0 | } |
4434 | | |
4435 | | static const JSJitInfo isFilesAndDirectoriesSupported_getterinfo = { |
4436 | | { (JSJitGetterOp)get_isFilesAndDirectoriesSupported }, |
4437 | | { prototypes::id::HTMLInputElement }, |
4438 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
4439 | | JSJitInfo::Getter, |
4440 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
4441 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
4442 | | true, /* isInfallible. False in setters. */ |
4443 | | false, /* isMovable. Not relevant for setters. */ |
4444 | | false, /* isEliminatable. Not relevant for setters. */ |
4445 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
4446 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
4447 | | false, /* isTypedMethod. Only relevant for methods. */ |
4448 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
4449 | | }; |
4450 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
4451 | | static_assert(0 < 2, "There is no slot for us"); |
4452 | | |
4453 | | MOZ_CAN_RUN_SCRIPT static bool |
4454 | | getFilesAndDirectories(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, const JSJitMethodCallArgs& args) |
4455 | 0 | { |
4456 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLInputElement.getFilesAndDirectories", DOM, cx); |
4457 | 0 |
|
4458 | 0 | FastErrorResult rv; |
4459 | 0 | auto result(StrongOrRawPtr<Promise>(self->GetFilesAndDirectories(rv))); |
4460 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
4461 | 0 | return false; |
4462 | 0 | } |
4463 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
4464 | 0 | if (!ToJSValue(cx, result, args.rval())) { |
4465 | 0 | return false; |
4466 | 0 | } |
4467 | 0 | return true; |
4468 | 0 | } |
4469 | | |
4470 | | MOZ_CAN_RUN_SCRIPT static bool |
4471 | | getFilesAndDirectories_promiseWrapper(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, const JSJitMethodCallArgs& args) |
4472 | 0 | { |
4473 | 0 | bool ok = getFilesAndDirectories(cx, obj, self, args); |
4474 | 0 | if (ok) { |
4475 | 0 | return true; |
4476 | 0 | } |
4477 | 0 | return ConvertExceptionToPromise(cx, args.rval()); |
4478 | 0 | } |
4479 | | |
4480 | | static const JSJitInfo getFilesAndDirectories_methodinfo = { |
4481 | | { (JSJitGetterOp)getFilesAndDirectories_promiseWrapper }, |
4482 | | { prototypes::id::HTMLInputElement }, |
4483 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
4484 | | JSJitInfo::Method, |
4485 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
4486 | | JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ |
4487 | | false, /* isInfallible. False in setters. */ |
4488 | | false, /* isMovable. Not relevant for setters. */ |
4489 | | false, /* isEliminatable. Not relevant for setters. */ |
4490 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
4491 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
4492 | | false, /* isTypedMethod. Only relevant for methods. */ |
4493 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
4494 | | }; |
4495 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
4496 | | static_assert(0 < 2, "There is no slot for us"); |
4497 | | |
4498 | | MOZ_CAN_RUN_SCRIPT static bool |
4499 | | getFiles(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, const JSJitMethodCallArgs& args) |
4500 | 0 | { |
4501 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLInputElement.getFiles", DOM, cx); |
4502 | 0 |
|
4503 | 0 | bool arg0; |
4504 | 0 | if (args.hasDefined(0)) { |
4505 | 0 | if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) { |
4506 | 0 | return false; |
4507 | 0 | } |
4508 | 0 | } else { |
4509 | 0 | arg0 = false; |
4510 | 0 | } |
4511 | 0 | FastErrorResult rv; |
4512 | 0 | auto result(StrongOrRawPtr<Promise>(self->GetFiles(arg0, rv))); |
4513 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
4514 | 0 | return false; |
4515 | 0 | } |
4516 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
4517 | 0 | if (!ToJSValue(cx, result, args.rval())) { |
4518 | 0 | return false; |
4519 | 0 | } |
4520 | 0 | return true; |
4521 | 0 | } |
4522 | | |
4523 | | MOZ_CAN_RUN_SCRIPT static bool |
4524 | | getFiles_promiseWrapper(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, const JSJitMethodCallArgs& args) |
4525 | 0 | { |
4526 | 0 | bool ok = getFiles(cx, obj, self, args); |
4527 | 0 | if (ok) { |
4528 | 0 | return true; |
4529 | 0 | } |
4530 | 0 | return ConvertExceptionToPromise(cx, args.rval()); |
4531 | 0 | } |
4532 | | |
4533 | | static const JSJitInfo getFiles_methodinfo = { |
4534 | | { (JSJitGetterOp)getFiles_promiseWrapper }, |
4535 | | { prototypes::id::HTMLInputElement }, |
4536 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
4537 | | JSJitInfo::Method, |
4538 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
4539 | | JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ |
4540 | | false, /* isInfallible. False in setters. */ |
4541 | | false, /* isMovable. Not relevant for setters. */ |
4542 | | false, /* isEliminatable. Not relevant for setters. */ |
4543 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
4544 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
4545 | | false, /* isTypedMethod. Only relevant for methods. */ |
4546 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
4547 | | }; |
4548 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
4549 | | static_assert(0 < 2, "There is no slot for us"); |
4550 | | |
4551 | | MOZ_CAN_RUN_SCRIPT static bool |
4552 | | chooseDirectory(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, const JSJitMethodCallArgs& args) |
4553 | 0 | { |
4554 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLInputElement.chooseDirectory", DOM, cx); |
4555 | 0 |
|
4556 | 0 | FastErrorResult rv; |
4557 | 0 | self->ChooseDirectory(rv); |
4558 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
4559 | 0 | return false; |
4560 | 0 | } |
4561 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
4562 | 0 | args.rval().setUndefined(); |
4563 | 0 | return true; |
4564 | 0 | } |
4565 | | |
4566 | | static const JSJitInfo chooseDirectory_methodinfo = { |
4567 | | { (JSJitGetterOp)chooseDirectory }, |
4568 | | { prototypes::id::HTMLInputElement }, |
4569 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
4570 | | JSJitInfo::Method, |
4571 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
4572 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
4573 | | false, /* isInfallible. False in setters. */ |
4574 | | false, /* isMovable. Not relevant for setters. */ |
4575 | | false, /* isEliminatable. Not relevant for setters. */ |
4576 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
4577 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
4578 | | false, /* isTypedMethod. Only relevant for methods. */ |
4579 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
4580 | | }; |
4581 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
4582 | | static_assert(0 < 2, "There is no slot for us"); |
4583 | | |
4584 | | MOZ_CAN_RUN_SCRIPT static bool |
4585 | | get_webkitEntries(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
4586 | 0 | { |
4587 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.webkitEntries", DOM, cx); |
4588 | 0 |
|
4589 | 0 | // Have to either root across the getter call or reget after. |
4590 | 0 | bool isXray; |
4591 | 0 | JS::Rooted<JSObject*> slotStorage(cx, GetCachedSlotStorageObject(cx, obj, &isXray)); |
4592 | 0 | if (!slotStorage) { |
4593 | 0 | return false; |
4594 | 0 | } |
4595 | 0 | const size_t slotIndex = isXray ? (xpc::JSSLOT_EXPANDO_COUNT + 0) : (DOM_INSTANCE_RESERVED_SLOTS + 0); |
4596 | 0 | MOZ_ASSERT(JSCLASS_RESERVED_SLOTS(js::GetObjectClass(slotStorage)) > slotIndex); |
4597 | 0 | { |
4598 | 0 | // Scope for cachedVal |
4599 | 0 | JS::Value cachedVal = js::GetReservedSlot(slotStorage, slotIndex); |
4600 | 0 | if (!cachedVal.isUndefined()) { |
4601 | 0 | args.rval().set(cachedVal); |
4602 | 0 | // The cached value is in the compartment of slotStorage, |
4603 | 0 | // so wrap into the caller compartment as needed. |
4604 | 0 | if (MaybeWrapNonDOMObjectValue(cx, args.rval())) { |
4605 | 0 | return true; |
4606 | 0 | } |
4607 | 0 | return false; |
4608 | 0 | } |
4609 | 0 | } |
4610 | 0 | |
4611 | 0 | nsTArray<StrongPtrForMember<mozilla::dom::FileSystemEntry>::Type> result; |
4612 | 0 | self->GetWebkitEntries(result); |
4613 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
4614 | 0 | { |
4615 | 0 | JS::Rooted<JSObject*> conversionScope(cx, isXray ? JS::CurrentGlobalOrNull(cx) : slotStorage); |
4616 | 0 | JSAutoRealm ar(cx, conversionScope); |
4617 | 0 | do { // block we break out of when done wrapping |
4618 | 0 |
|
4619 | 0 | uint32_t length = result.Length(); |
4620 | 0 | JS::Rooted<JSObject*> returnArray(cx, JS_NewArrayObject(cx, length)); |
4621 | 0 | if (!returnArray) { |
4622 | 0 | return false; |
4623 | 0 | } |
4624 | 0 | // Scope for 'tmp' |
4625 | 0 | { |
4626 | 0 | JS::Rooted<JS::Value> tmp(cx); |
4627 | 0 | for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { |
4628 | 0 | // Control block to let us common up the JS_DefineElement calls when there |
4629 | 0 | // are different ways to succeed at wrapping the object. |
4630 | 0 | do { |
4631 | 0 | if (!GetOrCreateDOMReflector(cx, result[sequenceIdx0], &tmp)) { |
4632 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
4633 | 0 | return false; |
4634 | 0 | } |
4635 | 0 | break; |
4636 | 0 | } while (false); |
4637 | 0 | if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, |
4638 | 0 | JSPROP_ENUMERATE)) { |
4639 | 0 | return false; |
4640 | 0 | } |
4641 | 0 | } |
4642 | 0 | } |
4643 | 0 | args.rval().setObject(*returnArray); |
4644 | 0 | break; |
4645 | 0 | } while (false); |
4646 | 0 | JS::Rooted<JSObject*> rvalObj(cx, &args.rval().toObject()); |
4647 | 0 | if (!JS_FreezeObject(cx, rvalObj)) { |
4648 | 0 | return false; |
4649 | 0 | } |
4650 | 0 | } |
4651 | 0 | { // And now store things in the realm of our slotStorage. |
4652 | 0 | JSAutoRealm ar(cx, slotStorage); |
4653 | 0 | // Make a copy so that we don't do unnecessary wrapping on args.rval(). |
4654 | 0 | JS::Rooted<JS::Value> storedVal(cx, args.rval()); |
4655 | 0 | if (!MaybeWrapNonDOMObjectValue(cx, &storedVal)) { |
4656 | 0 | return false; |
4657 | 0 | } |
4658 | 0 | js::SetReservedSlot(slotStorage, slotIndex, storedVal); |
4659 | 0 | if (!isXray) { |
4660 | 0 | // In the Xray case we don't need to do this, because getting the |
4661 | 0 | // expando object already preserved our wrapper. |
4662 | 0 | PreserveWrapper(self); |
4663 | 0 | } |
4664 | 0 | } |
4665 | 0 | // And now make sure args.rval() is in the caller realm. |
4666 | 0 | if (MaybeWrapNonDOMObjectValue(cx, args.rval())) { |
4667 | 0 | return true; |
4668 | 0 | } |
4669 | 0 | return false; |
4670 | 0 | } |
4671 | | |
4672 | | static const JSJitInfo webkitEntries_getterinfo = { |
4673 | | { (JSJitGetterOp)get_webkitEntries }, |
4674 | | { prototypes::id::HTMLInputElement }, |
4675 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
4676 | | JSJitInfo::Getter, |
4677 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
4678 | | JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ |
4679 | | false, /* isInfallible. False in setters. */ |
4680 | | true, /* isMovable. Not relevant for setters. */ |
4681 | | true, /* isEliminatable. Not relevant for setters. */ |
4682 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
4683 | | true, /* isLazilyCachedInSlot. Only relevant for getters. */ |
4684 | | false, /* isTypedMethod. Only relevant for methods. */ |
4685 | | (DOM_INSTANCE_RESERVED_SLOTS + 0) /* Reserved slot index, if we're stored in a slot, else 0. */ |
4686 | | }; |
4687 | | static_assert((DOM_INSTANCE_RESERVED_SLOTS + 0) <= JSJitInfo::maxSlotIndex, "We won't fit"); |
4688 | | static_assert((DOM_INSTANCE_RESERVED_SLOTS + 0) < 2, "There is no slot for us"); |
4689 | | |
4690 | | MOZ_CAN_RUN_SCRIPT static bool |
4691 | | get_webkitdirectory(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
4692 | 0 | { |
4693 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.webkitdirectory", DOM, cx); |
4694 | 0 |
|
4695 | 0 | bool result(self->WebkitDirectoryAttr()); |
4696 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
4697 | 0 | args.rval().setBoolean(result); |
4698 | 0 | return true; |
4699 | 0 | } |
4700 | | |
4701 | | MOZ_CAN_RUN_SCRIPT static bool |
4702 | | set_webkitdirectory(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
4703 | 0 | { |
4704 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.webkitdirectory", DOM, cx); |
4705 | 0 |
|
4706 | 0 | bool arg0; |
4707 | 0 | if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) { |
4708 | 0 | return false; |
4709 | 0 | } |
4710 | 0 | FastErrorResult rv; |
4711 | 0 | self->SetWebkitDirectoryAttr(arg0, rv); |
4712 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
4713 | 0 | return false; |
4714 | 0 | } |
4715 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
4716 | 0 |
|
4717 | 0 | return true; |
4718 | 0 | } |
4719 | | |
4720 | | static const JSJitInfo webkitdirectory_getterinfo = { |
4721 | | { (JSJitGetterOp)get_webkitdirectory }, |
4722 | | { prototypes::id::HTMLInputElement }, |
4723 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
4724 | | JSJitInfo::Getter, |
4725 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
4726 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
4727 | | true, /* isInfallible. False in setters. */ |
4728 | | false, /* isMovable. Not relevant for setters. */ |
4729 | | false, /* isEliminatable. Not relevant for setters. */ |
4730 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
4731 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
4732 | | false, /* isTypedMethod. Only relevant for methods. */ |
4733 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
4734 | | }; |
4735 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
4736 | | static_assert(0 < 2, "There is no slot for us"); |
4737 | | static const JSJitInfo webkitdirectory_setterinfo = { |
4738 | | { (JSJitGetterOp)set_webkitdirectory }, |
4739 | | { prototypes::id::HTMLInputElement }, |
4740 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
4741 | | JSJitInfo::Setter, |
4742 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
4743 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
4744 | | false, /* isInfallible. False in setters. */ |
4745 | | false, /* isMovable. Not relevant for setters. */ |
4746 | | false, /* isEliminatable. Not relevant for setters. */ |
4747 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
4748 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
4749 | | false, /* isTypedMethod. Only relevant for methods. */ |
4750 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
4751 | | }; |
4752 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
4753 | | static_assert(0 < 2, "There is no slot for us"); |
4754 | | |
4755 | | MOZ_CAN_RUN_SCRIPT static bool |
4756 | | getDateTimeInputBoxValue(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, const JSJitMethodCallArgs& args) |
4757 | 0 | { |
4758 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLInputElement.getDateTimeInputBoxValue", DOM, cx); |
4759 | 0 |
|
4760 | 0 | DateTimeValue result; |
4761 | 0 | self->GetDateTimeInputBoxValue(result); |
4762 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
4763 | 0 | if (!result.ToObjectInternal(cx, args.rval())) { |
4764 | 0 | return false; |
4765 | 0 | } |
4766 | 0 | return true; |
4767 | 0 | } |
4768 | | |
4769 | | static const JSJitInfo getDateTimeInputBoxValue_methodinfo = { |
4770 | | { (JSJitGetterOp)getDateTimeInputBoxValue }, |
4771 | | { prototypes::id::HTMLInputElement }, |
4772 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
4773 | | JSJitInfo::Method, |
4774 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
4775 | | JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ |
4776 | | false, /* isInfallible. False in setters. */ |
4777 | | false, /* isMovable. Not relevant for setters. */ |
4778 | | false, /* isEliminatable. Not relevant for setters. */ |
4779 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
4780 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
4781 | | false, /* isTypedMethod. Only relevant for methods. */ |
4782 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
4783 | | }; |
4784 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
4785 | | static_assert(0 < 2, "There is no slot for us"); |
4786 | | |
4787 | | MOZ_CAN_RUN_SCRIPT static bool |
4788 | | updateDateTimeInputBox(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, const JSJitMethodCallArgs& args) |
4789 | 0 | { |
4790 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLInputElement.updateDateTimeInputBox", DOM, cx); |
4791 | 0 |
|
4792 | 0 | binding_detail::FastDateTimeValue arg0; |
4793 | 0 | if (!arg0.Init(cx, (args.hasDefined(0)) ? args[0] : JS::NullHandleValue, "Argument 1 of HTMLInputElement.updateDateTimeInputBox", false)) { |
4794 | 0 | return false; |
4795 | 0 | } |
4796 | 0 | self->UpdateDateTimeInputBox(Constify(arg0)); |
4797 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
4798 | 0 | args.rval().setUndefined(); |
4799 | 0 | return true; |
4800 | 0 | } |
4801 | | |
4802 | | static const JSJitInfo updateDateTimeInputBox_methodinfo = { |
4803 | | { (JSJitGetterOp)updateDateTimeInputBox }, |
4804 | | { prototypes::id::HTMLInputElement }, |
4805 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
4806 | | JSJitInfo::Method, |
4807 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
4808 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
4809 | | false, /* isInfallible. False in setters. */ |
4810 | | false, /* isMovable. Not relevant for setters. */ |
4811 | | false, /* isEliminatable. Not relevant for setters. */ |
4812 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
4813 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
4814 | | false, /* isTypedMethod. Only relevant for methods. */ |
4815 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
4816 | | }; |
4817 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
4818 | | static_assert(0 < 2, "There is no slot for us"); |
4819 | | |
4820 | | MOZ_CAN_RUN_SCRIPT static bool |
4821 | | setDateTimePickerState(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, const JSJitMethodCallArgs& args) |
4822 | 0 | { |
4823 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLInputElement.setDateTimePickerState", DOM, cx); |
4824 | 0 |
|
4825 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
4826 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLInputElement.setDateTimePickerState"); |
4827 | 0 | } |
4828 | 0 | bool arg0; |
4829 | 0 | if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) { |
4830 | 0 | return false; |
4831 | 0 | } |
4832 | 0 | self->SetDateTimePickerState(arg0); |
4833 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
4834 | 0 | args.rval().setUndefined(); |
4835 | 0 | return true; |
4836 | 0 | } |
4837 | | |
4838 | | static const JSJitInfo setDateTimePickerState_methodinfo = { |
4839 | | { (JSJitGetterOp)setDateTimePickerState }, |
4840 | | { prototypes::id::HTMLInputElement }, |
4841 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
4842 | | JSJitInfo::Method, |
4843 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
4844 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
4845 | | false, /* isInfallible. False in setters. */ |
4846 | | false, /* isMovable. Not relevant for setters. */ |
4847 | | false, /* isEliminatable. Not relevant for setters. */ |
4848 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
4849 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
4850 | | false, /* isTypedMethod. Only relevant for methods. */ |
4851 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
4852 | | }; |
4853 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
4854 | | static_assert(0 < 2, "There is no slot for us"); |
4855 | | |
4856 | | MOZ_CAN_RUN_SCRIPT static bool |
4857 | | getMinimum(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, const JSJitMethodCallArgs& args) |
4858 | 0 | { |
4859 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLInputElement.getMinimum", DOM, cx); |
4860 | 0 |
|
4861 | 0 | double result(self->GetMinimumAsDouble()); |
4862 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
4863 | 0 | args.rval().set(JS_NumberValue(double(result))); |
4864 | 0 | return true; |
4865 | 0 | } |
4866 | | |
4867 | | static const JSJitInfo getMinimum_methodinfo = { |
4868 | | { (JSJitGetterOp)getMinimum }, |
4869 | | { prototypes::id::HTMLInputElement }, |
4870 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
4871 | | JSJitInfo::Method, |
4872 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
4873 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
4874 | | true, /* isInfallible. False in setters. */ |
4875 | | false, /* isMovable. Not relevant for setters. */ |
4876 | | false, /* isEliminatable. Not relevant for setters. */ |
4877 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
4878 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
4879 | | false, /* isTypedMethod. Only relevant for methods. */ |
4880 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
4881 | | }; |
4882 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
4883 | | static_assert(0 < 2, "There is no slot for us"); |
4884 | | |
4885 | | MOZ_CAN_RUN_SCRIPT static bool |
4886 | | getMaximum(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, const JSJitMethodCallArgs& args) |
4887 | 0 | { |
4888 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLInputElement.getMaximum", DOM, cx); |
4889 | 0 |
|
4890 | 0 | double result(self->GetMaximumAsDouble()); |
4891 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
4892 | 0 | args.rval().set(JS_NumberValue(double(result))); |
4893 | 0 | return true; |
4894 | 0 | } |
4895 | | |
4896 | | static const JSJitInfo getMaximum_methodinfo = { |
4897 | | { (JSJitGetterOp)getMaximum }, |
4898 | | { prototypes::id::HTMLInputElement }, |
4899 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
4900 | | JSJitInfo::Method, |
4901 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
4902 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
4903 | | true, /* isInfallible. False in setters. */ |
4904 | | false, /* isMovable. Not relevant for setters. */ |
4905 | | false, /* isEliminatable. Not relevant for setters. */ |
4906 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
4907 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
4908 | | false, /* isTypedMethod. Only relevant for methods. */ |
4909 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
4910 | | }; |
4911 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
4912 | | static_assert(0 < 2, "There is no slot for us"); |
4913 | | |
4914 | | MOZ_CAN_RUN_SCRIPT static bool |
4915 | | openDateTimePicker(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, const JSJitMethodCallArgs& args) |
4916 | 0 | { |
4917 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLInputElement.openDateTimePicker", DOM, cx); |
4918 | 0 |
|
4919 | 0 | binding_detail::FastDateTimeValue arg0; |
4920 | 0 | if (!arg0.Init(cx, (args.hasDefined(0)) ? args[0] : JS::NullHandleValue, "Argument 1 of HTMLInputElement.openDateTimePicker", false)) { |
4921 | 0 | return false; |
4922 | 0 | } |
4923 | 0 | self->OpenDateTimePicker(Constify(arg0)); |
4924 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
4925 | 0 | args.rval().setUndefined(); |
4926 | 0 | return true; |
4927 | 0 | } |
4928 | | |
4929 | | static const JSJitInfo openDateTimePicker_methodinfo = { |
4930 | | { (JSJitGetterOp)openDateTimePicker }, |
4931 | | { prototypes::id::HTMLInputElement }, |
4932 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
4933 | | JSJitInfo::Method, |
4934 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
4935 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
4936 | | false, /* isInfallible. False in setters. */ |
4937 | | false, /* isMovable. Not relevant for setters. */ |
4938 | | false, /* isEliminatable. Not relevant for setters. */ |
4939 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
4940 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
4941 | | false, /* isTypedMethod. Only relevant for methods. */ |
4942 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
4943 | | }; |
4944 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
4945 | | static_assert(0 < 2, "There is no slot for us"); |
4946 | | |
4947 | | MOZ_CAN_RUN_SCRIPT static bool |
4948 | | updateDateTimePicker(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, const JSJitMethodCallArgs& args) |
4949 | 0 | { |
4950 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLInputElement.updateDateTimePicker", DOM, cx); |
4951 | 0 |
|
4952 | 0 | binding_detail::FastDateTimeValue arg0; |
4953 | 0 | if (!arg0.Init(cx, (args.hasDefined(0)) ? args[0] : JS::NullHandleValue, "Argument 1 of HTMLInputElement.updateDateTimePicker", false)) { |
4954 | 0 | return false; |
4955 | 0 | } |
4956 | 0 | self->UpdateDateTimePicker(Constify(arg0)); |
4957 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
4958 | 0 | args.rval().setUndefined(); |
4959 | 0 | return true; |
4960 | 0 | } |
4961 | | |
4962 | | static const JSJitInfo updateDateTimePicker_methodinfo = { |
4963 | | { (JSJitGetterOp)updateDateTimePicker }, |
4964 | | { prototypes::id::HTMLInputElement }, |
4965 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
4966 | | JSJitInfo::Method, |
4967 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
4968 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
4969 | | false, /* isInfallible. False in setters. */ |
4970 | | false, /* isMovable. Not relevant for setters. */ |
4971 | | false, /* isEliminatable. Not relevant for setters. */ |
4972 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
4973 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
4974 | | false, /* isTypedMethod. Only relevant for methods. */ |
4975 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
4976 | | }; |
4977 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
4978 | | static_assert(0 < 2, "There is no slot for us"); |
4979 | | |
4980 | | MOZ_CAN_RUN_SCRIPT static bool |
4981 | | closeDateTimePicker(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, const JSJitMethodCallArgs& args) |
4982 | 0 | { |
4983 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLInputElement.closeDateTimePicker", DOM, cx); |
4984 | 0 |
|
4985 | 0 | self->CloseDateTimePicker(); |
4986 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
4987 | 0 | args.rval().setUndefined(); |
4988 | 0 | return true; |
4989 | 0 | } |
4990 | | |
4991 | | static const JSJitInfo closeDateTimePicker_methodinfo = { |
4992 | | { (JSJitGetterOp)closeDateTimePicker }, |
4993 | | { prototypes::id::HTMLInputElement }, |
4994 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
4995 | | JSJitInfo::Method, |
4996 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
4997 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
4998 | | true, /* isInfallible. False in setters. */ |
4999 | | false, /* isMovable. Not relevant for setters. */ |
5000 | | false, /* isEliminatable. Not relevant for setters. */ |
5001 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
5002 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
5003 | | false, /* isTypedMethod. Only relevant for methods. */ |
5004 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
5005 | | }; |
5006 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
5007 | | static_assert(0 < 2, "There is no slot for us"); |
5008 | | |
5009 | | MOZ_CAN_RUN_SCRIPT static bool |
5010 | | setFocusState(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, const JSJitMethodCallArgs& args) |
5011 | 0 | { |
5012 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLInputElement.setFocusState", DOM, cx); |
5013 | 0 |
|
5014 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
5015 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLInputElement.setFocusState"); |
5016 | 0 | } |
5017 | 0 | bool arg0; |
5018 | 0 | if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) { |
5019 | 0 | return false; |
5020 | 0 | } |
5021 | 0 | self->SetFocusState(arg0); |
5022 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
5023 | 0 | args.rval().setUndefined(); |
5024 | 0 | return true; |
5025 | 0 | } |
5026 | | |
5027 | | static const JSJitInfo setFocusState_methodinfo = { |
5028 | | { (JSJitGetterOp)setFocusState }, |
5029 | | { prototypes::id::HTMLInputElement }, |
5030 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
5031 | | JSJitInfo::Method, |
5032 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
5033 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
5034 | | false, /* isInfallible. False in setters. */ |
5035 | | false, /* isMovable. Not relevant for setters. */ |
5036 | | false, /* isEliminatable. Not relevant for setters. */ |
5037 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
5038 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
5039 | | false, /* isTypedMethod. Only relevant for methods. */ |
5040 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
5041 | | }; |
5042 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
5043 | | static_assert(0 < 2, "There is no slot for us"); |
5044 | | |
5045 | | MOZ_CAN_RUN_SCRIPT static bool |
5046 | | updateValidityState(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, const JSJitMethodCallArgs& args) |
5047 | 0 | { |
5048 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLInputElement.updateValidityState", DOM, cx); |
5049 | 0 |
|
5050 | 0 | self->UpdateValidityState(); |
5051 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
5052 | 0 | args.rval().setUndefined(); |
5053 | 0 | return true; |
5054 | 0 | } |
5055 | | |
5056 | | static const JSJitInfo updateValidityState_methodinfo = { |
5057 | | { (JSJitGetterOp)updateValidityState }, |
5058 | | { prototypes::id::HTMLInputElement }, |
5059 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
5060 | | JSJitInfo::Method, |
5061 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
5062 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
5063 | | true, /* isInfallible. False in setters. */ |
5064 | | false, /* isMovable. Not relevant for setters. */ |
5065 | | false, /* isEliminatable. Not relevant for setters. */ |
5066 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
5067 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
5068 | | false, /* isTypedMethod. Only relevant for methods. */ |
5069 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
5070 | | }; |
5071 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
5072 | | static_assert(0 < 2, "There is no slot for us"); |
5073 | | |
5074 | | MOZ_CAN_RUN_SCRIPT static bool |
5075 | | getStep(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, const JSJitMethodCallArgs& args) |
5076 | 0 | { |
5077 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLInputElement.getStep", DOM, cx); |
5078 | 0 |
|
5079 | 0 | double result(self->GetStepAsDouble()); |
5080 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
5081 | 0 | args.rval().set(JS_NumberValue(double(result))); |
5082 | 0 | return true; |
5083 | 0 | } |
5084 | | |
5085 | | static const JSJitInfo getStep_methodinfo = { |
5086 | | { (JSJitGetterOp)getStep }, |
5087 | | { prototypes::id::HTMLInputElement }, |
5088 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
5089 | | JSJitInfo::Method, |
5090 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
5091 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
5092 | | true, /* isInfallible. False in setters. */ |
5093 | | false, /* isMovable. Not relevant for setters. */ |
5094 | | false, /* isEliminatable. Not relevant for setters. */ |
5095 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
5096 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
5097 | | false, /* isTypedMethod. Only relevant for methods. */ |
5098 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
5099 | | }; |
5100 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
5101 | | static_assert(0 < 2, "There is no slot for us"); |
5102 | | |
5103 | | MOZ_CAN_RUN_SCRIPT static bool |
5104 | | getStepBase(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, const JSJitMethodCallArgs& args) |
5105 | 0 | { |
5106 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLInputElement.getStepBase", DOM, cx); |
5107 | 0 |
|
5108 | 0 | double result(self->GetStepBaseAsDouble()); |
5109 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
5110 | 0 | args.rval().set(JS_NumberValue(double(result))); |
5111 | 0 | return true; |
5112 | 0 | } |
5113 | | |
5114 | | static const JSJitInfo getStepBase_methodinfo = { |
5115 | | { (JSJitGetterOp)getStepBase }, |
5116 | | { prototypes::id::HTMLInputElement }, |
5117 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
5118 | | JSJitInfo::Method, |
5119 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
5120 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
5121 | | true, /* isInfallible. False in setters. */ |
5122 | | false, /* isMovable. Not relevant for setters. */ |
5123 | | false, /* isEliminatable. Not relevant for setters. */ |
5124 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
5125 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
5126 | | false, /* isTypedMethod. Only relevant for methods. */ |
5127 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
5128 | | }; |
5129 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
5130 | | static_assert(0 < 2, "There is no slot for us"); |
5131 | | |
5132 | | MOZ_CAN_RUN_SCRIPT static bool |
5133 | | get_previewValue(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
5134 | 0 | { |
5135 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.previewValue", DOM, cx); |
5136 | 0 |
|
5137 | 0 | DOMString result; |
5138 | 0 | self->GetPreviewValue(result); |
5139 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
5140 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
5141 | 0 | return false; |
5142 | 0 | } |
5143 | 0 | return true; |
5144 | 0 | } |
5145 | | |
5146 | | MOZ_CAN_RUN_SCRIPT static bool |
5147 | | set_previewValue(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
5148 | 0 | { |
5149 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.previewValue", DOM, cx); |
5150 | 0 |
|
5151 | 0 | binding_detail::FakeString arg0; |
5152 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
5153 | 0 | return false; |
5154 | 0 | } |
5155 | 0 | self->SetPreviewValue(NonNullHelper(Constify(arg0))); |
5156 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
5157 | 0 |
|
5158 | 0 | return true; |
5159 | 0 | } |
5160 | | |
5161 | | static const JSJitInfo previewValue_getterinfo = { |
5162 | | { (JSJitGetterOp)get_previewValue }, |
5163 | | { prototypes::id::HTMLInputElement }, |
5164 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
5165 | | JSJitInfo::Getter, |
5166 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
5167 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
5168 | | false, /* isInfallible. False in setters. */ |
5169 | | false, /* isMovable. Not relevant for setters. */ |
5170 | | false, /* isEliminatable. Not relevant for setters. */ |
5171 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
5172 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
5173 | | false, /* isTypedMethod. Only relevant for methods. */ |
5174 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
5175 | | }; |
5176 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
5177 | | static_assert(0 < 2, "There is no slot for us"); |
5178 | | static const JSJitInfo previewValue_setterinfo = { |
5179 | | { (JSJitGetterOp)set_previewValue }, |
5180 | | { prototypes::id::HTMLInputElement }, |
5181 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
5182 | | JSJitInfo::Setter, |
5183 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
5184 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
5185 | | false, /* isInfallible. False in setters. */ |
5186 | | false, /* isMovable. Not relevant for setters. */ |
5187 | | false, /* isEliminatable. Not relevant for setters. */ |
5188 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
5189 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
5190 | | false, /* isTypedMethod. Only relevant for methods. */ |
5191 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
5192 | | }; |
5193 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
5194 | | static_assert(0 < 2, "There is no slot for us"); |
5195 | | |
5196 | | MOZ_CAN_RUN_SCRIPT static bool |
5197 | | get_editor(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
5198 | 0 | { |
5199 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.editor", DOM, cx); |
5200 | 0 |
|
5201 | 0 | auto result(StrongOrRawPtr<nsIEditor>(self->GetEditor())); |
5202 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
5203 | 0 | if (!result) { |
5204 | 0 | args.rval().setNull(); |
5205 | 0 | return true; |
5206 | 0 | } |
5207 | 0 | if (!WrapObject(cx, result, &NS_GET_IID(nsIEditor), args.rval())) { |
5208 | 0 | return false; |
5209 | 0 | } |
5210 | 0 | return true; |
5211 | 0 | } |
5212 | | |
5213 | | static const JSJitInfo editor_getterinfo = { |
5214 | | { (JSJitGetterOp)get_editor }, |
5215 | | { prototypes::id::HTMLInputElement }, |
5216 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
5217 | | JSJitInfo::Getter, |
5218 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
5219 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
5220 | | false, /* isInfallible. False in setters. */ |
5221 | | true, /* isMovable. Not relevant for setters. */ |
5222 | | true, /* isEliminatable. Not relevant for setters. */ |
5223 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
5224 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
5225 | | false, /* isTypedMethod. Only relevant for methods. */ |
5226 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
5227 | | }; |
5228 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
5229 | | static_assert(0 < 2, "There is no slot for us"); |
5230 | | |
5231 | | MOZ_CAN_RUN_SCRIPT static bool |
5232 | | setUserInput(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, const JSJitMethodCallArgs& args) |
5233 | 0 | { |
5234 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLInputElement.setUserInput", DOM, cx); |
5235 | 0 |
|
5236 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
5237 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLInputElement.setUserInput"); |
5238 | 0 | } |
5239 | 0 | binding_detail::FakeString arg0; |
5240 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
5241 | 0 | return false; |
5242 | 0 | } |
5243 | 0 | NonNull<nsIPrincipal> subjectPrincipal; |
5244 | 0 | { |
5245 | 0 | JS::Realm* realm = js::GetContextRealm(cx); |
5246 | 0 | MOZ_ASSERT(realm); |
5247 | 0 | JSPrincipals* principals = JS::GetRealmPrincipals(realm); |
5248 | 0 | nsIPrincipal* principal = nsJSPrincipals::get(principals); |
5249 | 0 |
|
5250 | 0 | subjectPrincipal = principal; |
5251 | 0 | } |
5252 | 0 | self->SetUserInput(NonNullHelper(Constify(arg0)), subjectPrincipal); |
5253 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
5254 | 0 | args.rval().setUndefined(); |
5255 | 0 | return true; |
5256 | 0 | } |
5257 | | |
5258 | | static const JSJitInfo setUserInput_methodinfo = { |
5259 | | { (JSJitGetterOp)setUserInput }, |
5260 | | { prototypes::id::HTMLInputElement }, |
5261 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
5262 | | JSJitInfo::Method, |
5263 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
5264 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
5265 | | false, /* isInfallible. False in setters. */ |
5266 | | false, /* isMovable. Not relevant for setters. */ |
5267 | | false, /* isEliminatable. Not relevant for setters. */ |
5268 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
5269 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
5270 | | false, /* isTypedMethod. Only relevant for methods. */ |
5271 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
5272 | | }; |
5273 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
5274 | | static_assert(0 < 2, "There is no slot for us"); |
5275 | | |
5276 | | MOZ_CAN_RUN_SCRIPT static bool |
5277 | | get_loadingEnabled(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
5278 | 0 | { |
5279 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.loadingEnabled", DOM, cx); |
5280 | 0 |
|
5281 | 0 | bool result(self->LoadingEnabled()); |
5282 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
5283 | 0 | args.rval().setBoolean(result); |
5284 | 0 | return true; |
5285 | 0 | } |
5286 | | |
5287 | | MOZ_CAN_RUN_SCRIPT static bool |
5288 | | set_loadingEnabled(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitSetterCallArgs args) |
5289 | 0 | { |
5290 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLInputElement.loadingEnabled", DOM, cx); |
5291 | 0 |
|
5292 | 0 | bool arg0; |
5293 | 0 | if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) { |
5294 | 0 | return false; |
5295 | 0 | } |
5296 | 0 | self->SetLoadingEnabled(arg0); |
5297 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
5298 | 0 |
|
5299 | 0 | return true; |
5300 | 0 | } |
5301 | | |
5302 | | static const JSJitInfo loadingEnabled_getterinfo = { |
5303 | | { (JSJitGetterOp)get_loadingEnabled }, |
5304 | | { prototypes::id::HTMLInputElement }, |
5305 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
5306 | | JSJitInfo::Getter, |
5307 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
5308 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
5309 | | true, /* isInfallible. False in setters. */ |
5310 | | false, /* isMovable. Not relevant for setters. */ |
5311 | | false, /* isEliminatable. Not relevant for setters. */ |
5312 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
5313 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
5314 | | false, /* isTypedMethod. Only relevant for methods. */ |
5315 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
5316 | | }; |
5317 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
5318 | | static_assert(0 < 2, "There is no slot for us"); |
5319 | | static const JSJitInfo loadingEnabled_setterinfo = { |
5320 | | { (JSJitGetterOp)set_loadingEnabled }, |
5321 | | { prototypes::id::HTMLInputElement }, |
5322 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
5323 | | JSJitInfo::Setter, |
5324 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
5325 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
5326 | | false, /* isInfallible. False in setters. */ |
5327 | | false, /* isMovable. Not relevant for setters. */ |
5328 | | false, /* isEliminatable. Not relevant for setters. */ |
5329 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
5330 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
5331 | | false, /* isTypedMethod. Only relevant for methods. */ |
5332 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
5333 | | }; |
5334 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
5335 | | static_assert(0 < 2, "There is no slot for us"); |
5336 | | |
5337 | | MOZ_CAN_RUN_SCRIPT static bool |
5338 | | get_imageBlockingStatus(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
5339 | 0 | { |
5340 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.imageBlockingStatus", DOM, cx); |
5341 | 0 |
|
5342 | 0 | int16_t result(self->ImageBlockingStatus()); |
5343 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
5344 | 0 | args.rval().setInt32(int32_t(result)); |
5345 | 0 | return true; |
5346 | 0 | } |
5347 | | |
5348 | | static const JSJitInfo imageBlockingStatus_getterinfo = { |
5349 | | { (JSJitGetterOp)get_imageBlockingStatus }, |
5350 | | { prototypes::id::HTMLInputElement }, |
5351 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
5352 | | JSJitInfo::Getter, |
5353 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
5354 | | JSVAL_TYPE_INT32, /* returnType. Not relevant for setters. */ |
5355 | | true, /* isInfallible. False in setters. */ |
5356 | | false, /* isMovable. Not relevant for setters. */ |
5357 | | false, /* isEliminatable. Not relevant for setters. */ |
5358 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
5359 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
5360 | | false, /* isTypedMethod. Only relevant for methods. */ |
5361 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
5362 | | }; |
5363 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
5364 | | static_assert(0 < 2, "There is no slot for us"); |
5365 | | |
5366 | | MOZ_CAN_RUN_SCRIPT static bool |
5367 | | addObserver(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, const JSJitMethodCallArgs& args) |
5368 | 0 | { |
5369 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLInputElement.addObserver", DOM, cx); |
5370 | 0 |
|
5371 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
5372 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLInputElement.addObserver"); |
5373 | 0 | } |
5374 | 0 | imgINotificationObserver* arg0; |
5375 | 0 | RefPtr<imgINotificationObserver> arg0_holder; |
5376 | 0 | if (args[0].isObject()) { |
5377 | 0 | JS::Rooted<JSObject*> source(cx, &args[0].toObject()); |
5378 | 0 | if (NS_FAILED(UnwrapArg<imgINotificationObserver>(cx, source, getter_AddRefs(arg0_holder)))) { |
5379 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of HTMLInputElement.addObserver", "imgINotificationObserver"); |
5380 | 0 | return false; |
5381 | 0 | } |
5382 | 0 | MOZ_ASSERT(arg0_holder); |
5383 | 0 | arg0 = arg0_holder; |
5384 | 0 | } else { |
5385 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of HTMLInputElement.addObserver"); |
5386 | 0 | return false; |
5387 | 0 | } |
5388 | 0 | self->AddObserver(MOZ_KnownLive(NonNullHelper(arg0))); |
5389 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
5390 | 0 | args.rval().setUndefined(); |
5391 | 0 | return true; |
5392 | 0 | } |
5393 | | |
5394 | | static const JSJitInfo addObserver_methodinfo = { |
5395 | | { (JSJitGetterOp)addObserver }, |
5396 | | { prototypes::id::HTMLInputElement }, |
5397 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
5398 | | JSJitInfo::Method, |
5399 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
5400 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
5401 | | false, /* isInfallible. False in setters. */ |
5402 | | false, /* isMovable. Not relevant for setters. */ |
5403 | | false, /* isEliminatable. Not relevant for setters. */ |
5404 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
5405 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
5406 | | false, /* isTypedMethod. Only relevant for methods. */ |
5407 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
5408 | | }; |
5409 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
5410 | | static_assert(0 < 2, "There is no slot for us"); |
5411 | | |
5412 | | MOZ_CAN_RUN_SCRIPT static bool |
5413 | | removeObserver(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, const JSJitMethodCallArgs& args) |
5414 | 0 | { |
5415 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLInputElement.removeObserver", DOM, cx); |
5416 | 0 |
|
5417 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
5418 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLInputElement.removeObserver"); |
5419 | 0 | } |
5420 | 0 | imgINotificationObserver* arg0; |
5421 | 0 | RefPtr<imgINotificationObserver> arg0_holder; |
5422 | 0 | if (args[0].isObject()) { |
5423 | 0 | JS::Rooted<JSObject*> source(cx, &args[0].toObject()); |
5424 | 0 | if (NS_FAILED(UnwrapArg<imgINotificationObserver>(cx, source, getter_AddRefs(arg0_holder)))) { |
5425 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of HTMLInputElement.removeObserver", "imgINotificationObserver"); |
5426 | 0 | return false; |
5427 | 0 | } |
5428 | 0 | MOZ_ASSERT(arg0_holder); |
5429 | 0 | arg0 = arg0_holder; |
5430 | 0 | } else { |
5431 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of HTMLInputElement.removeObserver"); |
5432 | 0 | return false; |
5433 | 0 | } |
5434 | 0 | self->RemoveObserver(MOZ_KnownLive(NonNullHelper(arg0))); |
5435 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
5436 | 0 | args.rval().setUndefined(); |
5437 | 0 | return true; |
5438 | 0 | } |
5439 | | |
5440 | | static const JSJitInfo removeObserver_methodinfo = { |
5441 | | { (JSJitGetterOp)removeObserver }, |
5442 | | { prototypes::id::HTMLInputElement }, |
5443 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
5444 | | JSJitInfo::Method, |
5445 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
5446 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
5447 | | false, /* isInfallible. False in setters. */ |
5448 | | false, /* isMovable. Not relevant for setters. */ |
5449 | | false, /* isEliminatable. Not relevant for setters. */ |
5450 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
5451 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
5452 | | false, /* isTypedMethod. Only relevant for methods. */ |
5453 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
5454 | | }; |
5455 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
5456 | | static_assert(0 < 2, "There is no slot for us"); |
5457 | | |
5458 | | MOZ_CAN_RUN_SCRIPT static bool |
5459 | | getRequest(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, const JSJitMethodCallArgs& args) |
5460 | 0 | { |
5461 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLInputElement.getRequest", DOM, cx); |
5462 | 0 |
|
5463 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
5464 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLInputElement.getRequest"); |
5465 | 0 | } |
5466 | 0 | int32_t arg0; |
5467 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
5468 | 0 | return false; |
5469 | 0 | } |
5470 | 0 | FastErrorResult rv; |
5471 | 0 | auto result(StrongOrRawPtr<imgIRequest>(self->GetRequest(arg0, rv))); |
5472 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
5473 | 0 | return false; |
5474 | 0 | } |
5475 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
5476 | 0 | if (!result) { |
5477 | 0 | args.rval().setNull(); |
5478 | 0 | return true; |
5479 | 0 | } |
5480 | 0 | if (!WrapObject(cx, result, &NS_GET_IID(imgIRequest), args.rval())) { |
5481 | 0 | return false; |
5482 | 0 | } |
5483 | 0 | return true; |
5484 | 0 | } |
5485 | | |
5486 | | static const JSJitInfo getRequest_methodinfo = { |
5487 | | { (JSJitGetterOp)getRequest }, |
5488 | | { prototypes::id::HTMLInputElement }, |
5489 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
5490 | | JSJitInfo::Method, |
5491 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
5492 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
5493 | | false, /* isInfallible. False in setters. */ |
5494 | | false, /* isMovable. Not relevant for setters. */ |
5495 | | false, /* isEliminatable. Not relevant for setters. */ |
5496 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
5497 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
5498 | | false, /* isTypedMethod. Only relevant for methods. */ |
5499 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
5500 | | }; |
5501 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
5502 | | static_assert(0 < 2, "There is no slot for us"); |
5503 | | |
5504 | | MOZ_CAN_RUN_SCRIPT static bool |
5505 | | getRequestType(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, const JSJitMethodCallArgs& args) |
5506 | 0 | { |
5507 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLInputElement.getRequestType", DOM, cx); |
5508 | 0 |
|
5509 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
5510 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLInputElement.getRequestType"); |
5511 | 0 | } |
5512 | 0 | imgIRequest* arg0; |
5513 | 0 | RefPtr<imgIRequest> arg0_holder; |
5514 | 0 | if (args[0].isObject()) { |
5515 | 0 | JS::Rooted<JSObject*> source(cx, &args[0].toObject()); |
5516 | 0 | if (NS_FAILED(UnwrapArg<imgIRequest>(cx, source, getter_AddRefs(arg0_holder)))) { |
5517 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of HTMLInputElement.getRequestType", "imgIRequest"); |
5518 | 0 | return false; |
5519 | 0 | } |
5520 | 0 | MOZ_ASSERT(arg0_holder); |
5521 | 0 | arg0 = arg0_holder; |
5522 | 0 | } else { |
5523 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of HTMLInputElement.getRequestType"); |
5524 | 0 | return false; |
5525 | 0 | } |
5526 | 0 | FastErrorResult rv; |
5527 | 0 | int32_t result(self->GetRequestType(MOZ_KnownLive(NonNullHelper(arg0)), rv)); |
5528 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
5529 | 0 | return false; |
5530 | 0 | } |
5531 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
5532 | 0 | args.rval().setInt32(int32_t(result)); |
5533 | 0 | return true; |
5534 | 0 | } |
5535 | | |
5536 | | static const JSJitInfo getRequestType_methodinfo = { |
5537 | | { (JSJitGetterOp)getRequestType }, |
5538 | | { prototypes::id::HTMLInputElement }, |
5539 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
5540 | | JSJitInfo::Method, |
5541 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
5542 | | JSVAL_TYPE_INT32, /* returnType. Not relevant for setters. */ |
5543 | | false, /* isInfallible. False in setters. */ |
5544 | | false, /* isMovable. Not relevant for setters. */ |
5545 | | false, /* isEliminatable. Not relevant for setters. */ |
5546 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
5547 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
5548 | | false, /* isTypedMethod. Only relevant for methods. */ |
5549 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
5550 | | }; |
5551 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
5552 | | static_assert(0 < 2, "There is no slot for us"); |
5553 | | |
5554 | | MOZ_CAN_RUN_SCRIPT static bool |
5555 | | get_currentURI(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
5556 | 0 | { |
5557 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.currentURI", DOM, cx); |
5558 | 0 |
|
5559 | 0 | FastErrorResult rv; |
5560 | 0 | auto result(StrongOrRawPtr<nsIURI>(self->GetCurrentURI(rv))); |
5561 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
5562 | 0 | return false; |
5563 | 0 | } |
5564 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
5565 | 0 | if (!result) { |
5566 | 0 | args.rval().setNull(); |
5567 | 0 | return true; |
5568 | 0 | } |
5569 | 0 | if (!WrapObject(cx, result, &NS_GET_IID(nsIURI), args.rval())) { |
5570 | 0 | return false; |
5571 | 0 | } |
5572 | 0 | return true; |
5573 | 0 | } |
5574 | | |
5575 | | static const JSJitInfo currentURI_getterinfo = { |
5576 | | { (JSJitGetterOp)get_currentURI }, |
5577 | | { prototypes::id::HTMLInputElement }, |
5578 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
5579 | | JSJitInfo::Getter, |
5580 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
5581 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
5582 | | false, /* isInfallible. False in setters. */ |
5583 | | false, /* isMovable. Not relevant for setters. */ |
5584 | | false, /* isEliminatable. Not relevant for setters. */ |
5585 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
5586 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
5587 | | false, /* isTypedMethod. Only relevant for methods. */ |
5588 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
5589 | | }; |
5590 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
5591 | | static_assert(0 < 2, "There is no slot for us"); |
5592 | | |
5593 | | MOZ_CAN_RUN_SCRIPT static bool |
5594 | | get_currentRequestFinalURI(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, JSJitGetterCallArgs args) |
5595 | 0 | { |
5596 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLInputElement.currentRequestFinalURI", DOM, cx); |
5597 | 0 |
|
5598 | 0 | auto result(StrongOrRawPtr<nsIURI>(self->GetCurrentRequestFinalURI())); |
5599 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
5600 | 0 | if (!result) { |
5601 | 0 | args.rval().setNull(); |
5602 | 0 | return true; |
5603 | 0 | } |
5604 | 0 | if (!WrapObject(cx, result, &NS_GET_IID(nsIURI), args.rval())) { |
5605 | 0 | return false; |
5606 | 0 | } |
5607 | 0 | return true; |
5608 | 0 | } |
5609 | | |
5610 | | static const JSJitInfo currentRequestFinalURI_getterinfo = { |
5611 | | { (JSJitGetterOp)get_currentRequestFinalURI }, |
5612 | | { prototypes::id::HTMLInputElement }, |
5613 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
5614 | | JSJitInfo::Getter, |
5615 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
5616 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
5617 | | false, /* isInfallible. False in setters. */ |
5618 | | false, /* isMovable. Not relevant for setters. */ |
5619 | | false, /* isEliminatable. Not relevant for setters. */ |
5620 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
5621 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
5622 | | false, /* isTypedMethod. Only relevant for methods. */ |
5623 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
5624 | | }; |
5625 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
5626 | | static_assert(0 < 2, "There is no slot for us"); |
5627 | | |
5628 | | MOZ_CAN_RUN_SCRIPT static bool |
5629 | | forceReload(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, const JSJitMethodCallArgs& args) |
5630 | 0 | { |
5631 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLInputElement.forceReload", DOM, cx); |
5632 | 0 |
|
5633 | 0 | bool arg0; |
5634 | 0 | if (args.hasDefined(0)) { |
5635 | 0 | if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) { |
5636 | 0 | return false; |
5637 | 0 | } |
5638 | 0 | } else { |
5639 | 0 | arg0 = true; |
5640 | 0 | } |
5641 | 0 | FastErrorResult rv; |
5642 | 0 | self->ForceReload(arg0, rv); |
5643 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
5644 | 0 | return false; |
5645 | 0 | } |
5646 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
5647 | 0 | args.rval().setUndefined(); |
5648 | 0 | return true; |
5649 | 0 | } |
5650 | | |
5651 | | static const JSJitInfo forceReload_methodinfo = { |
5652 | | { (JSJitGetterOp)forceReload }, |
5653 | | { prototypes::id::HTMLInputElement }, |
5654 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
5655 | | JSJitInfo::Method, |
5656 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
5657 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
5658 | | false, /* isInfallible. False in setters. */ |
5659 | | false, /* isMovable. Not relevant for setters. */ |
5660 | | false, /* isEliminatable. Not relevant for setters. */ |
5661 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
5662 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
5663 | | false, /* isTypedMethod. Only relevant for methods. */ |
5664 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
5665 | | }; |
5666 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
5667 | | static_assert(0 < 2, "There is no slot for us"); |
5668 | | |
5669 | | MOZ_CAN_RUN_SCRIPT static bool |
5670 | | forceImageState(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLInputElement* self, const JSJitMethodCallArgs& args) |
5671 | 0 | { |
5672 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLInputElement.forceImageState", DOM, cx); |
5673 | 0 |
|
5674 | 0 | if (MOZ_UNLIKELY(args.length() < 2)) { |
5675 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLInputElement.forceImageState"); |
5676 | 0 | } |
5677 | 0 | bool arg0; |
5678 | 0 | if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) { |
5679 | 0 | return false; |
5680 | 0 | } |
5681 | 0 | uint64_t arg1; |
5682 | 0 | if (!ValueToPrimitive<uint64_t, eDefault>(cx, args[1], &arg1)) { |
5683 | 0 | return false; |
5684 | 0 | } |
5685 | 0 | self->ForceImageState(arg0, arg1); |
5686 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
5687 | 0 | args.rval().setUndefined(); |
5688 | 0 | return true; |
5689 | 0 | } |
5690 | | |
5691 | | static const JSJitInfo forceImageState_methodinfo = { |
5692 | | { (JSJitGetterOp)forceImageState }, |
5693 | | { prototypes::id::HTMLInputElement }, |
5694 | | { PrototypeTraits<prototypes::id::HTMLInputElement>::Depth }, |
5695 | | JSJitInfo::Method, |
5696 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
5697 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
5698 | | false, /* isInfallible. False in setters. */ |
5699 | | false, /* isMovable. Not relevant for setters. */ |
5700 | | false, /* isEliminatable. Not relevant for setters. */ |
5701 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
5702 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
5703 | | false, /* isTypedMethod. Only relevant for methods. */ |
5704 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
5705 | | }; |
5706 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
5707 | | static_assert(0 < 2, "There is no slot for us"); |
5708 | | |
5709 | | static bool |
5710 | | _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val) |
5711 | 0 | { |
5712 | 0 | mozilla::dom::HTMLInputElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLInputElement>(obj); |
5713 | 0 | // We don't want to preserve if we don't have a wrapper, and we |
5714 | 0 | // obviously can't preserve if we're not initialized. |
5715 | 0 | if (self && self->GetWrapperPreserveColor()) { |
5716 | 0 | PreserveWrapper(self); |
5717 | 0 | } |
5718 | 0 | return true; |
5719 | 0 | } |
5720 | | |
5721 | | static void |
5722 | | _finalize(js::FreeOp* fop, JSObject* obj) |
5723 | 0 | { |
5724 | 0 | mozilla::dom::HTMLInputElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLInputElement>(obj); |
5725 | 0 | if (self) { |
5726 | 0 | ClearWrapper(self, self, obj); |
5727 | 0 | AddForDeferredFinalization<mozilla::dom::HTMLInputElement>(self); |
5728 | 0 | } |
5729 | 0 | } |
5730 | | |
5731 | | static size_t |
5732 | | _objectMoved(JSObject* obj, JSObject* old) |
5733 | 0 | { |
5734 | 0 | mozilla::dom::HTMLInputElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLInputElement>(obj); |
5735 | 0 | if (self) { |
5736 | 0 | UpdateWrapper(self, self, obj, old); |
5737 | 0 | } |
5738 | 0 |
|
5739 | 0 | return 0; |
5740 | 0 | } |
5741 | | |
5742 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
5743 | | #if defined(__clang__) |
5744 | | #pragma clang diagnostic push |
5745 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
5746 | | #endif |
5747 | | static const JSFunctionSpec sMethods_specs[] = { |
5748 | | JS_FNSPEC("stepUp", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&stepUp_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
5749 | | JS_FNSPEC("stepDown", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&stepDown_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
5750 | | JS_FNSPEC("checkValidity", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&checkValidity_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
5751 | | JS_FNSPEC("reportValidity", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&reportValidity_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
5752 | | JS_FNSPEC("setCustomValidity", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&setCustomValidity_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
5753 | | JS_FNSPEC("select", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&select_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
5754 | | JS_FNSPEC("setRangeText", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&setRangeText_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
5755 | | JS_FNSPEC("setSelectionRange", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&setSelectionRange_methodinfo), 2, JSPROP_ENUMERATE, nullptr), |
5756 | | JS_FNSPEC("mozIsTextField", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&mozIsTextField_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
5757 | | JS_FS_END, |
5758 | | JS_FNSPEC("getFilesAndDirectories", (GenericMethod<NormalThisPolicy, ConvertExceptionsToPromises>), reinterpret_cast<const JSJitInfo*>(&getFilesAndDirectories_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
5759 | | JS_FNSPEC("getFiles", (GenericMethod<NormalThisPolicy, ConvertExceptionsToPromises>), reinterpret_cast<const JSJitInfo*>(&getFiles_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
5760 | | JS_FNSPEC("chooseDirectory", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&chooseDirectory_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
5761 | | JS_FS_END, |
5762 | | JS_FNSPEC("openDateTimePicker", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&openDateTimePicker_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
5763 | | JS_FNSPEC("updateDateTimePicker", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&updateDateTimePicker_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
5764 | | JS_FNSPEC("closeDateTimePicker", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&closeDateTimePicker_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
5765 | | JS_FNSPEC("setFocusState", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&setFocusState_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
5766 | | JS_FNSPEC("updateValidityState", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&updateValidityState_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
5767 | | JS_FNSPEC("getStep", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getStep_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
5768 | | JS_FNSPEC("getStepBase", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getStepBase_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
5769 | | JS_FS_END, |
5770 | | JS_FNSPEC("setUserInput", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&setUserInput_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
5771 | | JS_FS_END |
5772 | | }; |
5773 | | #if defined(__clang__) |
5774 | | #pragma clang diagnostic pop |
5775 | | #endif |
5776 | | |
5777 | | // Can't be const because the pref-enabled boolean needs to be writable |
5778 | | static PrefableDisablers sMethods_disablers10 = { |
5779 | | true, false, 0, nullptr |
5780 | | }; |
5781 | | |
5782 | | // Can't be const because the pref-enabled boolean needs to be writable |
5783 | | static PrefableDisablers sMethods_disablers14 = { |
5784 | | true, false, 0, &IsChromeOrXBL |
5785 | | }; |
5786 | | |
5787 | | // Can't be const because the pref-enabled boolean needs to be writable |
5788 | | static PrefableDisablers sMethods_disablers22 = { |
5789 | | true, false, 0, &IsChromeOrXBL |
5790 | | }; |
5791 | | |
5792 | | static const Prefable<const JSFunctionSpec> sMethods[] = { |
5793 | | { nullptr, &sMethods_specs[0] }, |
5794 | | { &sMethods_disablers10, &sMethods_specs[10] }, |
5795 | | { &sMethods_disablers14, &sMethods_specs[14] }, |
5796 | | { &sMethods_disablers22, &sMethods_specs[22] }, |
5797 | | { nullptr, nullptr } |
5798 | | }; |
5799 | | |
5800 | | static_assert(4 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
5801 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
5802 | | static_assert(9 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
5803 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
5804 | | |
5805 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
5806 | | #if defined(__clang__) |
5807 | | #pragma clang diagnostic push |
5808 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
5809 | | #endif |
5810 | | static const JSFunctionSpec sChromeMethods_specs[] = { |
5811 | | JS_FNSPEC("mozGetFileNameArray", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&mozGetFileNameArray_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
5812 | | JS_FNSPEC("mozSetFileNameArray", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&mozSetFileNameArray_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
5813 | | JS_FNSPEC("mozSetFileArray", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&mozSetFileArray_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
5814 | | JS_FNSPEC("mozSetDirectory", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&mozSetDirectory_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
5815 | | JS_FNSPEC("mozSetDndFilesAndDirectories", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&mozSetDndFilesAndDirectories_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
5816 | | JS_FNSPEC("getAutocompleteInfo", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getAutocompleteInfo_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
5817 | | JS_FS_END, |
5818 | | JS_FNSPEC("getDateTimeInputBoxValue", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getDateTimeInputBoxValue_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
5819 | | JS_FNSPEC("updateDateTimeInputBox", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&updateDateTimeInputBox_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
5820 | | JS_FNSPEC("setDateTimePickerState", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&setDateTimePickerState_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
5821 | | JS_FNSPEC("getMinimum", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getMinimum_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
5822 | | JS_FNSPEC("getMaximum", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getMaximum_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
5823 | | JS_FS_END, |
5824 | | JS_FNSPEC("addObserver", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&addObserver_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
5825 | | JS_FNSPEC("removeObserver", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&removeObserver_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
5826 | | JS_FNSPEC("getRequest", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getRequest_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
5827 | | JS_FNSPEC("getRequestType", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getRequestType_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
5828 | | JS_FNSPEC("forceReload", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&forceReload_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
5829 | | JS_FNSPEC("forceImageState", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&forceImageState_methodinfo), 2, JSPROP_ENUMERATE, nullptr), |
5830 | | JS_FS_END |
5831 | | }; |
5832 | | #if defined(__clang__) |
5833 | | #pragma clang diagnostic pop |
5834 | | #endif |
5835 | | |
5836 | | // Can't be const because the pref-enabled boolean needs to be writable |
5837 | | static PrefableDisablers sChromeMethods_disablers7 = { |
5838 | | true, false, 0, nullptr |
5839 | | }; |
5840 | | |
5841 | | static const Prefable<const JSFunctionSpec> sChromeMethods[] = { |
5842 | | { nullptr, &sChromeMethods_specs[0] }, |
5843 | | { &sChromeMethods_disablers7, &sChromeMethods_specs[7] }, |
5844 | | { nullptr, &sChromeMethods_specs[13] }, |
5845 | | { nullptr, nullptr } |
5846 | | }; |
5847 | | |
5848 | | static_assert(3 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
5849 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
5850 | | static_assert(6 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
5851 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
5852 | | |
5853 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
5854 | | #if defined(__clang__) |
5855 | | #pragma clang diagnostic push |
5856 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
5857 | | #endif |
5858 | | static const JSPropertySpec sAttributes_specs[] = { |
5859 | | { "accept", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &accept_getterinfo, GenericSetter<NormalThisPolicy>, &accept_setterinfo }, |
5860 | | { "alt", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &alt_getterinfo, GenericSetter<NormalThisPolicy>, &alt_setterinfo }, |
5861 | | { "autocomplete", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &autocomplete_getterinfo, GenericSetter<NormalThisPolicy>, &autocomplete_setterinfo }, |
5862 | | { "autofocus", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &autofocus_getterinfo, GenericSetter<NormalThisPolicy>, &autofocus_setterinfo }, |
5863 | | { "defaultChecked", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &defaultChecked_getterinfo, GenericSetter<NormalThisPolicy>, &defaultChecked_setterinfo }, |
5864 | | { "checked", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &checked_getterinfo, GenericSetter<NormalThisPolicy>, &checked_setterinfo }, |
5865 | | { "disabled", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &disabled_getterinfo, GenericSetter<NormalThisPolicy>, &disabled_setterinfo }, |
5866 | | { "form", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &form_getterinfo, nullptr, nullptr }, |
5867 | | { "files", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &files_getterinfo, GenericSetter<NormalThisPolicy>, &files_setterinfo }, |
5868 | | { "formAction", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &formAction_getterinfo, GenericSetter<NormalThisPolicy>, &formAction_setterinfo }, |
5869 | | { "formEnctype", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &formEnctype_getterinfo, GenericSetter<NormalThisPolicy>, &formEnctype_setterinfo }, |
5870 | | { "formMethod", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &formMethod_getterinfo, GenericSetter<NormalThisPolicy>, &formMethod_setterinfo }, |
5871 | | { "formNoValidate", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &formNoValidate_getterinfo, GenericSetter<NormalThisPolicy>, &formNoValidate_setterinfo }, |
5872 | | { "formTarget", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &formTarget_getterinfo, GenericSetter<NormalThisPolicy>, &formTarget_setterinfo }, |
5873 | | { "height", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &height_getterinfo, GenericSetter<NormalThisPolicy>, &height_setterinfo }, |
5874 | | { "indeterminate", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &indeterminate_getterinfo, GenericSetter<NormalThisPolicy>, &indeterminate_setterinfo }, |
5875 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr }, |
5876 | | { "inputMode", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &inputMode_getterinfo, GenericSetter<NormalThisPolicy>, &inputMode_setterinfo }, |
5877 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr }, |
5878 | | { "list", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &list_getterinfo, nullptr, nullptr }, |
5879 | | { "max", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &max_getterinfo, GenericSetter<NormalThisPolicy>, &max_setterinfo }, |
5880 | | { "maxLength", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &maxLength_getterinfo, GenericSetter<NormalThisPolicy>, &maxLength_setterinfo }, |
5881 | | { "min", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &min_getterinfo, GenericSetter<NormalThisPolicy>, &min_setterinfo }, |
5882 | | { "minLength", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &minLength_getterinfo, GenericSetter<NormalThisPolicy>, &minLength_setterinfo }, |
5883 | | { "multiple", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &multiple_getterinfo, GenericSetter<NormalThisPolicy>, &multiple_setterinfo }, |
5884 | | { "name", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &name_getterinfo, GenericSetter<NormalThisPolicy>, &name_setterinfo }, |
5885 | | { "pattern", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &pattern_getterinfo, GenericSetter<NormalThisPolicy>, &pattern_setterinfo }, |
5886 | | { "placeholder", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &placeholder_getterinfo, GenericSetter<NormalThisPolicy>, &placeholder_setterinfo }, |
5887 | | { "readOnly", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &readOnly_getterinfo, GenericSetter<NormalThisPolicy>, &readOnly_setterinfo }, |
5888 | | { "required", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &required_getterinfo, GenericSetter<NormalThisPolicy>, &required_setterinfo }, |
5889 | | { "size", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &size_getterinfo, GenericSetter<NormalThisPolicy>, &size_setterinfo }, |
5890 | | { "src", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &src_getterinfo, GenericSetter<NormalThisPolicy>, &src_setterinfo }, |
5891 | | { "step", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &step_getterinfo, GenericSetter<NormalThisPolicy>, &step_setterinfo }, |
5892 | | { "type", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &type_getterinfo, GenericSetter<NormalThisPolicy>, &type_setterinfo }, |
5893 | | { "defaultValue", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &defaultValue_getterinfo, GenericSetter<NormalThisPolicy>, &defaultValue_setterinfo }, |
5894 | | { "value", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &value_getterinfo, GenericSetter<NormalThisPolicy>, &value_setterinfo }, |
5895 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr }, |
5896 | | { "valueAsDate", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &valueAsDate_getterinfo, GenericSetter<NormalThisPolicy>, &valueAsDate_setterinfo }, |
5897 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr }, |
5898 | | { "valueAsNumber", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &valueAsNumber_getterinfo, GenericSetter<NormalThisPolicy>, &valueAsNumber_setterinfo }, |
5899 | | { "width", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &width_getterinfo, GenericSetter<NormalThisPolicy>, &width_setterinfo }, |
5900 | | { "willValidate", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &willValidate_getterinfo, nullptr, nullptr }, |
5901 | | { "validity", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &validity_getterinfo, nullptr, nullptr }, |
5902 | | { "validationMessage", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &validationMessage_getterinfo, nullptr, nullptr }, |
5903 | | { "labels", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &labels_getterinfo, nullptr, nullptr }, |
5904 | | { "selectionStart", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &selectionStart_getterinfo, GenericSetter<NormalThisPolicy>, &selectionStart_setterinfo }, |
5905 | | { "selectionEnd", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &selectionEnd_getterinfo, GenericSetter<NormalThisPolicy>, &selectionEnd_setterinfo }, |
5906 | | { "selectionDirection", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &selectionDirection_getterinfo, GenericSetter<NormalThisPolicy>, &selectionDirection_setterinfo }, |
5907 | | { "align", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &align_getterinfo, GenericSetter<NormalThisPolicy>, &align_setterinfo }, |
5908 | | { "useMap", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &useMap_getterinfo, GenericSetter<NormalThisPolicy>, &useMap_setterinfo }, |
5909 | | { "textLength", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &textLength_getterinfo, nullptr, nullptr }, |
5910 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr }, |
5911 | | { "allowdirs", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &allowdirs_getterinfo, GenericSetter<NormalThisPolicy>, &allowdirs_setterinfo }, |
5912 | | { "isFilesAndDirectoriesSupported", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &isFilesAndDirectoriesSupported_getterinfo, nullptr, nullptr }, |
5913 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr }, |
5914 | | { "webkitEntries", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &webkitEntries_getterinfo, nullptr, nullptr }, |
5915 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr }, |
5916 | | { "webkitdirectory", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &webkitdirectory_getterinfo, GenericSetter<NormalThisPolicy>, &webkitdirectory_setterinfo }, |
5917 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr } |
5918 | | }; |
5919 | | #if defined(__clang__) |
5920 | | #pragma clang diagnostic pop |
5921 | | #endif |
5922 | | |
5923 | | // Can't be const because the pref-enabled boolean needs to be writable |
5924 | | static PrefableDisablers sAttributes_disablers17 = { |
5925 | | true, false, 0, nullptr |
5926 | | }; |
5927 | | |
5928 | | // Can't be const because the pref-enabled boolean needs to be writable |
5929 | | static PrefableDisablers sAttributes_disablers37 = { |
5930 | | true, false, 0, &HTMLInputElement::ValueAsDateEnabled |
5931 | | }; |
5932 | | |
5933 | | // Can't be const because the pref-enabled boolean needs to be writable |
5934 | | static PrefableDisablers sAttributes_disablers52 = { |
5935 | | true, false, 0, nullptr |
5936 | | }; |
5937 | | |
5938 | | // Can't be const because the pref-enabled boolean needs to be writable |
5939 | | static PrefableDisablers sAttributes_disablers55 = { |
5940 | | true, false, 0, nullptr |
5941 | | }; |
5942 | | |
5943 | | // Can't be const because the pref-enabled boolean needs to be writable |
5944 | | static PrefableDisablers sAttributes_disablers57 = { |
5945 | | true, false, 0, nullptr |
5946 | | }; |
5947 | | |
5948 | | static const Prefable<const JSPropertySpec> sAttributes[] = { |
5949 | | { nullptr, &sAttributes_specs[0] }, |
5950 | | { &sAttributes_disablers17, &sAttributes_specs[17] }, |
5951 | | { nullptr, &sAttributes_specs[19] }, |
5952 | | { &sAttributes_disablers37, &sAttributes_specs[37] }, |
5953 | | { nullptr, &sAttributes_specs[39] }, |
5954 | | { &sAttributes_disablers52, &sAttributes_specs[52] }, |
5955 | | { &sAttributes_disablers55, &sAttributes_specs[55] }, |
5956 | | { &sAttributes_disablers57, &sAttributes_specs[57] }, |
5957 | | { nullptr, nullptr } |
5958 | | }; |
5959 | | |
5960 | | static_assert(8 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
5961 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
5962 | | static_assert(17 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
5963 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
5964 | | |
5965 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
5966 | | #if defined(__clang__) |
5967 | | #pragma clang diagnostic push |
5968 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
5969 | | #endif |
5970 | | static const JSPropertySpec sChromeAttributes_specs[] = { |
5971 | | { "controllers", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &controllers_getterinfo, nullptr, nullptr }, |
5972 | | { "ownerNumberControl", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &ownerNumberControl_getterinfo, nullptr, nullptr }, |
5973 | | { "previewValue", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &previewValue_getterinfo, GenericSetter<NormalThisPolicy>, &previewValue_setterinfo }, |
5974 | | { "editor", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &editor_getterinfo, nullptr, nullptr }, |
5975 | | { "loadingEnabled", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &loadingEnabled_getterinfo, GenericSetter<NormalThisPolicy>, &loadingEnabled_setterinfo }, |
5976 | | { "imageBlockingStatus", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &imageBlockingStatus_getterinfo, nullptr, nullptr }, |
5977 | | { "currentURI", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, ¤tURI_getterinfo, nullptr, nullptr }, |
5978 | | { "currentRequestFinalURI", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, ¤tRequestFinalURI_getterinfo, nullptr, nullptr }, |
5979 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr } |
5980 | | }; |
5981 | | #if defined(__clang__) |
5982 | | #pragma clang diagnostic pop |
5983 | | #endif |
5984 | | |
5985 | | |
5986 | | static const Prefable<const JSPropertySpec> sChromeAttributes[] = { |
5987 | | { nullptr, &sChromeAttributes_specs[0] }, |
5988 | | { nullptr, nullptr } |
5989 | | }; |
5990 | | |
5991 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
5992 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
5993 | | static_assert(8 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
5994 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
5995 | | |
5996 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
5997 | | #if defined(__clang__) |
5998 | | #pragma clang diagnostic push |
5999 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
6000 | | #endif |
6001 | | static const ConstantSpec sChromeConstants_specs[] = { |
6002 | | { "UNKNOWN_REQUEST", JS::Int32Value(-1) }, |
6003 | | { "CURRENT_REQUEST", JS::Int32Value(0) }, |
6004 | | { "PENDING_REQUEST", JS::Int32Value(1) }, |
6005 | | { 0, JS::UndefinedValue() } |
6006 | | }; |
6007 | | #if defined(__clang__) |
6008 | | #pragma clang diagnostic pop |
6009 | | #endif |
6010 | | |
6011 | | |
6012 | | static const Prefable<const ConstantSpec> sChromeConstants[] = { |
6013 | | { nullptr, &sChromeConstants_specs[0] }, |
6014 | | { nullptr, nullptr } |
6015 | | }; |
6016 | | |
6017 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
6018 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
6019 | | static_assert(3 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
6020 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
6021 | | |
6022 | | |
6023 | | static uint16_t sNativeProperties_sortedPropertyIndices[71]; |
6024 | | static PropertyInfo sNativeProperties_propertyInfos[71]; |
6025 | | |
6026 | | static const NativePropertiesN<2> sNativeProperties = { |
6027 | | false, 0, |
6028 | | false, 0, |
6029 | | true, 0 /* sMethods */, |
6030 | | true, 1 /* sAttributes */, |
6031 | | false, 0, |
6032 | | false, 0, |
6033 | | false, 0, |
6034 | | -1, |
6035 | | 71, |
6036 | | sNativeProperties_sortedPropertyIndices, |
6037 | | { |
6038 | | { sMethods, &sNativeProperties_propertyInfos[0] }, |
6039 | | { sAttributes, &sNativeProperties_propertyInfos[20] } |
6040 | | } |
6041 | | }; |
6042 | | static_assert(71 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount), |
6043 | | "We have a property info count that is oversized"); |
6044 | | |
6045 | | static uint16_t sChromeOnlyNativeProperties_sortedPropertyIndices[28]; |
6046 | | static PropertyInfo sChromeOnlyNativeProperties_propertyInfos[28]; |
6047 | | |
6048 | | static const NativePropertiesN<3> sChromeOnlyNativeProperties = { |
6049 | | false, 0, |
6050 | | false, 0, |
6051 | | true, 0 /* sChromeMethods */, |
6052 | | true, 1 /* sChromeAttributes */, |
6053 | | false, 0, |
6054 | | false, 0, |
6055 | | true, 2 /* sChromeConstants */, |
6056 | | -1, |
6057 | | 28, |
6058 | | sChromeOnlyNativeProperties_sortedPropertyIndices, |
6059 | | { |
6060 | | { sChromeMethods, &sChromeOnlyNativeProperties_propertyInfos[0] }, |
6061 | | { sChromeAttributes, &sChromeOnlyNativeProperties_propertyInfos[17] }, |
6062 | | { sChromeConstants, &sChromeOnlyNativeProperties_propertyInfos[25] } |
6063 | | } |
6064 | | }; |
6065 | | static_assert(28 < 1ull << CHAR_BIT * sizeof(sChromeOnlyNativeProperties.propertyInfoCount), |
6066 | | "We have a property info count that is oversized"); |
6067 | | |
6068 | | static bool |
6069 | | _constructor(JSContext* cx, unsigned argc, JS::Value* vp) |
6070 | 0 | { |
6071 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLInputElement constructor", DOM, cx); |
6072 | 0 |
|
6073 | 0 | return HTMLConstructor(cx, argc, vp, |
6074 | 0 | constructors::id::HTMLInputElement, |
6075 | 0 | prototypes::id::HTMLInputElement, |
6076 | 0 | CreateInterfaceObjects); |
6077 | 0 | } |
6078 | | |
6079 | | static const js::ClassOps sInterfaceObjectClassOps = { |
6080 | | nullptr, /* addProperty */ |
6081 | | nullptr, /* delProperty */ |
6082 | | nullptr, /* enumerate */ |
6083 | | nullptr, /* newEnumerate */ |
6084 | | nullptr, /* resolve */ |
6085 | | nullptr, /* mayResolve */ |
6086 | | nullptr, /* finalize */ |
6087 | | _constructor, /* call */ |
6088 | | nullptr, /* hasInstance */ |
6089 | | _constructor, /* construct */ |
6090 | | nullptr, /* trace */ |
6091 | | }; |
6092 | | |
6093 | | static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = { |
6094 | | { |
6095 | | "Function", |
6096 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE), |
6097 | | &sInterfaceObjectClassOps, |
6098 | | JS_NULL_CLASS_SPEC, |
6099 | | JS_NULL_CLASS_EXT, |
6100 | | &sInterfaceObjectClassObjectOps |
6101 | | }, |
6102 | | eInterface, |
6103 | | true, |
6104 | | prototypes::id::HTMLInputElement, |
6105 | | PrototypeTraits<prototypes::id::HTMLInputElement>::Depth, |
6106 | | sNativePropertyHooks, |
6107 | | "function HTMLInputElement() {\n [native code]\n}", |
6108 | | HTMLElement_Binding::GetConstructorObject |
6109 | | }; |
6110 | | |
6111 | | static const DOMIfaceAndProtoJSClass sPrototypeClass = { |
6112 | | { |
6113 | | "HTMLInputElementPrototype", |
6114 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE), |
6115 | | JS_NULL_CLASS_OPS, |
6116 | | JS_NULL_CLASS_SPEC, |
6117 | | JS_NULL_CLASS_EXT, |
6118 | | JS_NULL_OBJECT_OPS |
6119 | | }, |
6120 | | eInterfacePrototype, |
6121 | | false, |
6122 | | prototypes::id::HTMLInputElement, |
6123 | | PrototypeTraits<prototypes::id::HTMLInputElement>::Depth, |
6124 | | sNativePropertyHooks, |
6125 | | "[object HTMLInputElementPrototype]", |
6126 | | HTMLElement_Binding::GetProtoObject |
6127 | | }; |
6128 | | |
6129 | | static const js::ClassOps sClassOps = { |
6130 | | _addProperty, /* addProperty */ |
6131 | | nullptr, /* delProperty */ |
6132 | | nullptr, /* enumerate */ |
6133 | | nullptr, /* newEnumerate */ |
6134 | | nullptr, /* resolve */ |
6135 | | nullptr, /* mayResolve */ |
6136 | | _finalize, /* finalize */ |
6137 | | nullptr, /* call */ |
6138 | | nullptr, /* hasInstance */ |
6139 | | nullptr, /* construct */ |
6140 | | nullptr, /* trace */ |
6141 | | }; |
6142 | | |
6143 | | static const js::ClassExtension sClassExtension = { |
6144 | | nullptr, /* weakmapKeyDelegateOp */ |
6145 | | _objectMoved /* objectMovedOp */ |
6146 | | }; |
6147 | | |
6148 | | static const DOMJSClass sClass = { |
6149 | | { "HTMLInputElement", |
6150 | | JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(2), |
6151 | | &sClassOps, |
6152 | | JS_NULL_CLASS_SPEC, |
6153 | | &sClassExtension, |
6154 | | JS_NULL_OBJECT_OPS |
6155 | | }, |
6156 | | { prototypes::id::EventTarget, prototypes::id::Node, prototypes::id::Element, prototypes::id::HTMLElement, prototypes::id::HTMLInputElement, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count }, |
6157 | | IsBaseOf<nsISupports, mozilla::dom::HTMLInputElement >::value, |
6158 | | sNativePropertyHooks, |
6159 | | FindAssociatedGlobalForNative<mozilla::dom::HTMLInputElement>::Get, |
6160 | | GetProtoObjectHandle, |
6161 | | GetCCParticipant<mozilla::dom::HTMLInputElement>::Get() |
6162 | | }; |
6163 | | static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS, |
6164 | | "Must have the right minimal number of reserved slots."); |
6165 | | static_assert(2 >= 2, |
6166 | | "Must have enough reserved slots."); |
6167 | | |
6168 | | const JSClass* |
6169 | | GetJSClass() |
6170 | 0 | { |
6171 | 0 | return sClass.ToJSClass(); |
6172 | 0 | } |
6173 | | |
6174 | | bool |
6175 | | Wrap(JSContext* aCx, mozilla::dom::HTMLInputElement* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector) |
6176 | 0 | { |
6177 | 0 | static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::dom::HTMLInputElement>::value, |
6178 | 0 | "Shouldn't have wrappercached things that are not refcounted."); |
6179 | 0 | MOZ_ASSERT(static_cast<mozilla::dom::HTMLInputElement*>(aObject) == |
6180 | 0 | reinterpret_cast<mozilla::dom::HTMLInputElement*>(aObject), |
6181 | 0 | "Multiple inheritance for mozilla::dom::HTMLInputElement is broken."); |
6182 | 0 | MOZ_ASSERT(static_cast<nsGenericHTMLElement*>(aObject) == |
6183 | 0 | reinterpret_cast<nsGenericHTMLElement*>(aObject), |
6184 | 0 | "Multiple inheritance for nsGenericHTMLElement is broken."); |
6185 | 0 | MOZ_ASSERT(static_cast<mozilla::dom::Element*>(aObject) == |
6186 | 0 | reinterpret_cast<mozilla::dom::Element*>(aObject), |
6187 | 0 | "Multiple inheritance for mozilla::dom::Element is broken."); |
6188 | 0 | MOZ_ASSERT(static_cast<nsINode*>(aObject) == |
6189 | 0 | reinterpret_cast<nsINode*>(aObject), |
6190 | 0 | "Multiple inheritance for nsINode is broken."); |
6191 | 0 | MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) == |
6192 | 0 | reinterpret_cast<mozilla::dom::EventTarget*>(aObject), |
6193 | 0 | "Multiple inheritance for mozilla::dom::EventTarget is broken."); |
6194 | 0 | MOZ_ASSERT(ToSupportsIsCorrect(aObject)); |
6195 | 0 | MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx)); |
6196 | 0 | MOZ_ASSERT(!aCache->GetWrapper(), |
6197 | 0 | "You should probably not be using Wrap() directly; use " |
6198 | 0 | "GetOrCreateDOMReflector instead"); |
6199 | 0 |
|
6200 | 0 | MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache), |
6201 | 0 | "nsISupports must be on our primary inheritance chain"); |
6202 | 0 |
|
6203 | 0 | JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject())); |
6204 | 0 | if (!global) { |
6205 | 0 | return false; |
6206 | 0 | } |
6207 | 0 | MOZ_ASSERT(JS_IsGlobalObject(global)); |
6208 | 0 | MOZ_ASSERT(JS::ObjectIsNotGray(global)); |
6209 | 0 |
|
6210 | 0 | // That might have ended up wrapping us already, due to the wonders |
6211 | 0 | // of XBL. Check for that, and bail out as needed. |
6212 | 0 | aReflector.set(aCache->GetWrapper()); |
6213 | 0 | if (aReflector) { |
6214 | | #ifdef DEBUG |
6215 | | AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto); |
6216 | | #endif // DEBUG |
6217 | | return true; |
6218 | 0 | } |
6219 | 0 |
|
6220 | 0 | JSAutoRealm ar(aCx, global); |
6221 | 0 | JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx); |
6222 | 0 | if (!canonicalProto) { |
6223 | 0 | return false; |
6224 | 0 | } |
6225 | 0 | JS::Rooted<JSObject*> proto(aCx); |
6226 | 0 | if (aGivenProto) { |
6227 | 0 | proto = aGivenProto; |
6228 | 0 | // Unfortunately, while aGivenProto was in the compartment of aCx |
6229 | 0 | // coming in, we changed compartments to that of "parent" so may need |
6230 | 0 | // to wrap the proto here. |
6231 | 0 | if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) { |
6232 | 0 | if (!JS_WrapObject(aCx, &proto)) { |
6233 | 0 | return false; |
6234 | 0 | } |
6235 | 0 | } |
6236 | 0 | } else { |
6237 | 0 | proto = canonicalProto; |
6238 | 0 | } |
6239 | 0 |
|
6240 | 0 | BindingJSObjectCreator<mozilla::dom::HTMLInputElement> creator(aCx); |
6241 | 0 | creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector); |
6242 | 0 | if (!aReflector) { |
6243 | 0 | return false; |
6244 | 0 | } |
6245 | 0 | |
6246 | 0 | aCache->SetWrapper(aReflector); |
6247 | 0 | creator.InitializationSucceeded(); |
6248 | 0 |
|
6249 | 0 | MOZ_ASSERT(aCache->GetWrapperPreserveColor() && |
6250 | 0 | aCache->GetWrapperPreserveColor() == aReflector); |
6251 | 0 | // If proto != canonicalProto, we have to preserve our wrapper; |
6252 | 0 | // otherwise we won't be able to properly recreate it later, since |
6253 | 0 | // we won't know what proto to use. Note that we don't check |
6254 | 0 | // aGivenProto here, since it's entirely possible (and even |
6255 | 0 | // somewhat common) to have a non-null aGivenProto which is the |
6256 | 0 | // same as canonicalProto. |
6257 | 0 | if (proto != canonicalProto) { |
6258 | 0 | PreserveWrapper(aObject); |
6259 | 0 | } |
6260 | 0 |
|
6261 | 0 | return true; |
6262 | 0 | } |
6263 | | |
6264 | | // This may allocate too many slots, because we only really need |
6265 | | // slots for our non-interface-typed members that we cache. But |
6266 | | // allocating slots only for those would make the slot index |
6267 | | // computations much more complicated, so let's do this the simple |
6268 | | // way for now. |
6269 | | DEFINE_XRAY_EXPANDO_CLASS(static, sXrayExpandoObjectClass, 1); |
6270 | | |
6271 | | const NativePropertyHooks sNativePropertyHooks[] = { { |
6272 | | nullptr, |
6273 | | nullptr, |
6274 | | nullptr, |
6275 | | { sNativeProperties.Upcast(), sChromeOnlyNativeProperties.Upcast() }, |
6276 | | prototypes::id::HTMLInputElement, |
6277 | | constructors::id::HTMLInputElement, |
6278 | | HTMLElement_Binding::sNativePropertyHooks, |
6279 | | &sXrayExpandoObjectClass |
6280 | | } }; |
6281 | | |
6282 | | void |
6283 | | ClearCachedWebkitEntriesValue(mozilla::dom::HTMLInputElement* aObject) |
6284 | 0 | { |
6285 | 0 | JSObject* obj; |
6286 | 0 | obj = aObject->GetWrapper(); |
6287 | 0 | if (!obj) { |
6288 | 0 | return; |
6289 | 0 | } |
6290 | 0 | js::SetReservedSlot(obj, (DOM_INSTANCE_RESERVED_SLOTS + 0), JS::UndefinedValue()); |
6291 | 0 | xpc::ClearXrayExpandoSlots(obj, (xpc::JSSLOT_EXPANDO_COUNT + 0)); |
6292 | 0 | } |
6293 | | |
6294 | | void |
6295 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal) |
6296 | 0 | { |
6297 | 0 | JS::Handle<JSObject*> parentProto(HTMLElement_Binding::GetProtoObjectHandle(aCx)); |
6298 | 0 | if (!parentProto) { |
6299 | 0 | return; |
6300 | 0 | } |
6301 | 0 | |
6302 | 0 | JS::Handle<JSObject*> constructorProto(HTMLElement_Binding::GetConstructorObjectHandle(aCx)); |
6303 | 0 | if (!constructorProto) { |
6304 | 0 | return; |
6305 | 0 | } |
6306 | 0 | |
6307 | 0 | static bool sIdsInited = false; |
6308 | 0 | if (!sIdsInited && NS_IsMainThread()) { |
6309 | 0 | if (!InitIds(aCx, sNativeProperties.Upcast())) { |
6310 | 0 | return; |
6311 | 0 | } |
6312 | 0 | if (!InitIds(aCx, sChromeOnlyNativeProperties.Upcast())) { |
6313 | 0 | return; |
6314 | 0 | } |
6315 | 0 | sIdsInited = true; |
6316 | 0 | } |
6317 | 0 |
|
6318 | 0 | static bool sPrefCachesInited = false; |
6319 | 0 | if (!sPrefCachesInited && NS_IsMainThread()) { |
6320 | 0 | sPrefCachesInited = true; |
6321 | 0 | Preferences::AddBoolVarCache(&sMethods[1].disablers->enabled, "dom.input.dirpicker"); |
6322 | 0 | Preferences::AddBoolVarCache(&sMethods[2].disablers->enabled, "dom.forms.datetime"); |
6323 | 0 | Preferences::AddBoolVarCache(&sChromeMethods[1].disablers->enabled, "dom.forms.datetime"); |
6324 | 0 | Preferences::AddBoolVarCache(&sAttributes[1].disablers->enabled, "dom.forms.inputmode"); |
6325 | 0 | Preferences::AddBoolVarCache(&sAttributes[5].disablers->enabled, "dom.input.dirpicker"); |
6326 | 0 | Preferences::AddBoolVarCache(&sAttributes[6].disablers->enabled, "dom.webkitBlink.filesystem.enabled"); |
6327 | 0 | Preferences::AddBoolVarCache(&sAttributes[7].disablers->enabled, "dom.webkitBlink.dirPicker.enabled"); |
6328 | 0 | } |
6329 | 0 |
|
6330 | 0 | JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::HTMLInputElement); |
6331 | 0 | JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::HTMLInputElement); |
6332 | 0 | dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, |
6333 | 0 | &sPrototypeClass.mBase, protoCache, |
6334 | 0 | nullptr, |
6335 | 0 | constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr, |
6336 | 0 | interfaceCache, |
6337 | 0 | sNativeProperties.Upcast(), |
6338 | 0 | sChromeOnlyNativeProperties.Upcast(), |
6339 | 0 | "HTMLInputElement", aDefineOnGlobal, |
6340 | 0 | nullptr, |
6341 | 0 | false); |
6342 | 0 | } |
6343 | | |
6344 | | JSObject* |
6345 | | GetConstructorObject(JSContext* aCx) |
6346 | 0 | { |
6347 | 0 | return GetConstructorObjectHandle(aCx); |
6348 | 0 | } |
6349 | | |
6350 | | } // namespace HTMLInputElement_Binding |
6351 | | |
6352 | | |
6353 | | |
6354 | | } // namespace dom |
6355 | | } // namespace mozilla |