/work/obj-fuzz/dom/bindings/TreeBoxObjectBinding.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* THIS FILE IS AUTOGENERATED FROM TreeBoxObject.webidl BY Codegen.py - DO NOT EDIT */ |
2 | | |
3 | | #include "AtomList.h" |
4 | | #include "BoxObjectBinding.h" |
5 | | #include "TreeBoxObjectBinding.h" |
6 | | #include "WrapperFactory.h" |
7 | | #include "mozilla/OwningNonNull.h" |
8 | | #include "mozilla/dom/BindingUtils.h" |
9 | | #include "mozilla/dom/DOMJSClass.h" |
10 | | #include "mozilla/dom/DOMRect.h" |
11 | | #include "mozilla/dom/Element.h" |
12 | | #include "mozilla/dom/NonRefcountedDOMObject.h" |
13 | | #include "mozilla/dom/Nullable.h" |
14 | | #include "mozilla/dom/PrimitiveConversions.h" |
15 | | #include "mozilla/dom/ScriptSettings.h" |
16 | | #include "mozilla/dom/TreeBoxObject.h" |
17 | | #include "mozilla/dom/XrayExpandoClass.h" |
18 | | #include "nsContentUtils.h" |
19 | | #include "nsITreeView.h" |
20 | | #include "nsTreeColumns.h" |
21 | | |
22 | | namespace mozilla { |
23 | | namespace dom { |
24 | | |
25 | | namespace binding_detail {}; // Just to make sure it's known as a namespace |
26 | | using namespace mozilla::dom::binding_detail; |
27 | | |
28 | | |
29 | | |
30 | | TreeCellInfo::TreeCellInfo() |
31 | 0 | { |
32 | 0 | // Safe to pass a null context if we pass a null value |
33 | 0 | Init(nullptr, JS::NullHandleValue); |
34 | 0 | } |
35 | | |
36 | | |
37 | | |
38 | | bool |
39 | | TreeCellInfo::InitIds(JSContext* cx, TreeCellInfoAtoms* atomsCache) |
40 | 0 | { |
41 | 0 | MOZ_ASSERT(!*reinterpret_cast<jsid**>(atomsCache)); |
42 | 0 |
|
43 | 0 | // Initialize these in reverse order so that any failure leaves the first one |
44 | 0 | // uninitialized. |
45 | 0 | if (!atomsCache->row_id.init(cx, "row") || |
46 | 0 | !atomsCache->col_id.init(cx, "col") || |
47 | 0 | !atomsCache->childElt_id.init(cx, "childElt")) { |
48 | 0 | return false; |
49 | 0 | } |
50 | 0 | return true; |
51 | 0 | } |
52 | | |
53 | | bool |
54 | | TreeCellInfo::Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription, bool passedToJSImpl) |
55 | 0 | { |
56 | 0 | // Passing a null JSContext is OK only if we're initing from null, |
57 | 0 | // Since in that case we will not have to do any property gets |
58 | 0 | // Also evaluate isNullOrUndefined in order to avoid false-positive |
59 | 0 | // checkers by static analysis tools |
60 | 0 | MOZ_ASSERT_IF(!cx, val.isNull() && val.isNullOrUndefined()); |
61 | 0 | TreeCellInfoAtoms* atomsCache = nullptr; |
62 | 0 | if (cx) { |
63 | 0 | atomsCache = GetAtomCache<TreeCellInfoAtoms>(cx); |
64 | 0 | if (!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) { |
65 | 0 | return false; |
66 | 0 | } |
67 | 0 | } |
68 | 0 | |
69 | 0 | if (!IsConvertibleToDictionary(val)) { |
70 | 0 | return ThrowErrorMessage(cx, MSG_NOT_DICTIONARY, sourceDescription); |
71 | 0 | } |
72 | 0 | |
73 | 0 | bool isNull = val.isNullOrUndefined(); |
74 | 0 | // We only need these if !isNull, in which case we have |cx|. |
75 | 0 | Maybe<JS::Rooted<JSObject *> > object; |
76 | 0 | Maybe<JS::Rooted<JS::Value> > temp; |
77 | 0 | if (!isNull) { |
78 | 0 | MOZ_ASSERT(cx); |
79 | 0 | object.emplace(cx, &val.toObject()); |
80 | 0 | temp.emplace(cx); |
81 | 0 | } |
82 | 0 | if (!isNull) { |
83 | 0 | if (!JS_GetPropertyById(cx, *object, atomsCache->childElt_id, temp.ptr())) { |
84 | 0 | return false; |
85 | 0 | } |
86 | 0 | } |
87 | 0 | if (!isNull && !temp->isUndefined()) { |
88 | 0 | if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, mChildElt)) { |
89 | 0 | return false; |
90 | 0 | } |
91 | 0 | } else { |
92 | 0 | static const char16_t data[] = { 0 }; |
93 | 0 | mChildElt.Rebind(data, ArrayLength(data) - 1); |
94 | 0 | } |
95 | 0 | mIsAnyMemberPresent = true; |
96 | 0 |
|
97 | 0 | if (!isNull) { |
98 | 0 | if (!JS_GetPropertyById(cx, *object, atomsCache->col_id, temp.ptr())) { |
99 | 0 | return false; |
100 | 0 | } |
101 | 0 | } |
102 | 0 | if (!isNull && !temp->isUndefined()) { |
103 | 0 | if (temp.ref().isObject()) { |
104 | 0 | static_assert(IsRefcounted<nsTreeColumn>::value, "We can only store refcounted classes.");{ |
105 | 0 | nsresult rv = UnwrapObject<prototypes::id::TreeColumn, nsTreeColumn>(temp.ptr(), mCol); |
106 | 0 | if (NS_FAILED(rv)) { |
107 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "'col' member of TreeCellInfo", "TreeColumn"); |
108 | 0 | return false; |
109 | 0 | } |
110 | 0 | } |
111 | 0 | } else if (temp.ref().isNullOrUndefined()) { |
112 | 0 | mCol = nullptr; |
113 | 0 | } else { |
114 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "'col' member of TreeCellInfo"); |
115 | 0 | return false; |
116 | 0 | } |
117 | 0 | } else { |
118 | 0 | mCol = nullptr; |
119 | 0 | } |
120 | 0 | mIsAnyMemberPresent = true; |
121 | 0 |
|
122 | 0 | if (!isNull) { |
123 | 0 | if (!JS_GetPropertyById(cx, *object, atomsCache->row_id, temp.ptr())) { |
124 | 0 | return false; |
125 | 0 | } |
126 | 0 | } |
127 | 0 | if (!isNull && !temp->isUndefined()) { |
128 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, temp.ref(), &mRow)) { |
129 | 0 | return false; |
130 | 0 | } |
131 | 0 | } else { |
132 | 0 | mRow = 0; |
133 | 0 | } |
134 | 0 | mIsAnyMemberPresent = true; |
135 | 0 | return true; |
136 | 0 | } |
137 | | |
138 | | bool |
139 | | TreeCellInfo::ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const |
140 | 0 | { |
141 | 0 | TreeCellInfoAtoms* atomsCache = GetAtomCache<TreeCellInfoAtoms>(cx); |
142 | 0 | if (!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) { |
143 | 0 | return false; |
144 | 0 | } |
145 | 0 | |
146 | 0 | JS::Rooted<JSObject*> obj(cx, JS_NewPlainObject(cx)); |
147 | 0 | if (!obj) { |
148 | 0 | return false; |
149 | 0 | } |
150 | 0 | rval.set(JS::ObjectValue(*obj)); |
151 | 0 |
|
152 | 0 | do { |
153 | 0 | // block for our 'break' successCode and scope for 'temp' and 'currentValue' |
154 | 0 | JS::Rooted<JS::Value> temp(cx); |
155 | 0 | nsString const & currentValue = mChildElt; |
156 | 0 | if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) { |
157 | 0 | return false; |
158 | 0 | } |
159 | 0 | if (!JS_DefinePropertyById(cx, obj, atomsCache->childElt_id, temp, JSPROP_ENUMERATE)) { |
160 | 0 | return false; |
161 | 0 | } |
162 | 0 | break; |
163 | 0 | } while(false); |
164 | 0 |
|
165 | 0 | do { |
166 | 0 | // block for our 'break' successCode and scope for 'temp' and 'currentValue' |
167 | 0 | JS::Rooted<JS::Value> temp(cx); |
168 | 0 | RefPtr<nsTreeColumn> const & currentValue = mCol; |
169 | 0 | if (!currentValue) { |
170 | 0 | temp.setNull(); |
171 | 0 | if (!JS_DefinePropertyById(cx, obj, atomsCache->col_id, temp, JSPROP_ENUMERATE)) { |
172 | 0 | return false; |
173 | 0 | } |
174 | 0 | break; |
175 | 0 | } |
176 | 0 | if (!GetOrCreateDOMReflector(cx, currentValue, &temp)) { |
177 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
178 | 0 | return false; |
179 | 0 | } |
180 | 0 | if (!JS_DefinePropertyById(cx, obj, atomsCache->col_id, temp, JSPROP_ENUMERATE)) { |
181 | 0 | return false; |
182 | 0 | } |
183 | 0 | break; |
184 | 0 | } while(false); |
185 | 0 |
|
186 | 0 | do { |
187 | 0 | // block for our 'break' successCode and scope for 'temp' and 'currentValue' |
188 | 0 | JS::Rooted<JS::Value> temp(cx); |
189 | 0 | int32_t const & currentValue = mRow; |
190 | 0 | temp.setInt32(int32_t(currentValue)); |
191 | 0 | if (!JS_DefinePropertyById(cx, obj, atomsCache->row_id, temp, JSPROP_ENUMERATE)) { |
192 | 0 | return false; |
193 | 0 | } |
194 | 0 | break; |
195 | 0 | } while(false); |
196 | 0 |
|
197 | 0 | return true; |
198 | 0 | } |
199 | | |
200 | | void |
201 | | TreeCellInfo::TraceDictionary(JSTracer* trc) |
202 | 0 | { |
203 | 0 | } |
204 | | |
205 | | |
206 | | |
207 | | TreeCellInfo& |
208 | | TreeCellInfo::operator=(const TreeCellInfo& aOther) |
209 | 0 | { |
210 | 0 | DictionaryBase::operator=(aOther); |
211 | 0 | mChildElt = aOther.mChildElt; |
212 | 0 | mCol = aOther.mCol; |
213 | 0 | mRow = aOther.mRow; |
214 | 0 | return *this; |
215 | 0 | } |
216 | | |
217 | | namespace binding_detail { |
218 | | } // namespace binding_detail |
219 | | |
220 | | |
221 | | namespace TreeBoxObject_Binding { |
222 | | |
223 | | static_assert(IsRefcounted<NativeType>::value == IsRefcounted<BoxObject_Binding::NativeType>::value, |
224 | | "Can't inherit from an interface with a different ownership model."); |
225 | | |
226 | | MOZ_CAN_RUN_SCRIPT static bool |
227 | | get_columns(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TreeBoxObject* self, JSJitGetterCallArgs args) |
228 | 0 | { |
229 | 0 | AUTO_PROFILER_LABEL_FAST("get TreeBoxObject.columns", DOM, cx); |
230 | 0 |
|
231 | 0 | auto result(StrongOrRawPtr<nsTreeColumns>(self->GetColumns())); |
232 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
233 | 0 | if (!result) { |
234 | 0 | args.rval().setNull(); |
235 | 0 | return true; |
236 | 0 | } |
237 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
238 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
239 | 0 | return false; |
240 | 0 | } |
241 | 0 | return true; |
242 | 0 | } |
243 | | |
244 | | static const JSJitInfo columns_getterinfo = { |
245 | | { (JSJitGetterOp)get_columns }, |
246 | | { prototypes::id::TreeBoxObject }, |
247 | | { PrototypeTraits<prototypes::id::TreeBoxObject>::Depth }, |
248 | | JSJitInfo::Getter, |
249 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
250 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
251 | | false, /* isInfallible. False in setters. */ |
252 | | false, /* isMovable. Not relevant for setters. */ |
253 | | false, /* isEliminatable. Not relevant for setters. */ |
254 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
255 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
256 | | false, /* isTypedMethod. Only relevant for methods. */ |
257 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
258 | | }; |
259 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
260 | | static_assert(0 < 1, "There is no slot for us"); |
261 | | |
262 | | MOZ_CAN_RUN_SCRIPT static bool |
263 | | get_view(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TreeBoxObject* self, JSJitGetterCallArgs args) |
264 | 0 | { |
265 | 0 | AUTO_PROFILER_LABEL_FAST("get TreeBoxObject.view", DOM, cx); |
266 | 0 |
|
267 | 0 | auto result(StrongOrRawPtr<nsITreeView>(self->GetView(nsContentUtils::IsSystemCaller(cx) ? CallerType::System : CallerType::NonSystem))); |
268 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
269 | 0 | if (!result) { |
270 | 0 | args.rval().setNull(); |
271 | 0 | return true; |
272 | 0 | } |
273 | 0 | if (!WrapObject(cx, result, &NS_GET_IID(nsITreeView), args.rval())) { |
274 | 0 | return false; |
275 | 0 | } |
276 | 0 | return true; |
277 | 0 | } |
278 | | |
279 | | MOZ_CAN_RUN_SCRIPT static bool |
280 | | set_view(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TreeBoxObject* self, JSJitSetterCallArgs args) |
281 | 0 | { |
282 | 0 | AUTO_PROFILER_LABEL_FAST("set TreeBoxObject.view", DOM, cx); |
283 | 0 |
|
284 | 0 | nsITreeView* arg0; |
285 | 0 | RefPtr<nsITreeView> arg0_holder; |
286 | 0 | if (args[0].isObject()) { |
287 | 0 | JS::Rooted<JSObject*> source(cx, &args[0].toObject()); |
288 | 0 | if (NS_FAILED(UnwrapArg<nsITreeView>(cx, source, getter_AddRefs(arg0_holder)))) { |
289 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Value being assigned to TreeBoxObject.view", "MozTreeView"); |
290 | 0 | return false; |
291 | 0 | } |
292 | 0 | MOZ_ASSERT(arg0_holder); |
293 | 0 | arg0 = arg0_holder; |
294 | 0 | } else if (args[0].isNullOrUndefined()) { |
295 | 0 | arg0 = nullptr; |
296 | 0 | } else { |
297 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Value being assigned to TreeBoxObject.view"); |
298 | 0 | return false; |
299 | 0 | } |
300 | 0 | FastErrorResult rv; |
301 | 0 | self->SetView(MOZ_KnownLive(Constify(arg0)), nsContentUtils::IsSystemCaller(cx) ? CallerType::System : CallerType::NonSystem, rv); |
302 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
303 | 0 | return false; |
304 | 0 | } |
305 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
306 | 0 |
|
307 | 0 | return true; |
308 | 0 | } |
309 | | |
310 | | static const JSJitInfo view_getterinfo = { |
311 | | { (JSJitGetterOp)get_view }, |
312 | | { prototypes::id::TreeBoxObject }, |
313 | | { PrototypeTraits<prototypes::id::TreeBoxObject>::Depth }, |
314 | | JSJitInfo::Getter, |
315 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
316 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
317 | | false, /* isInfallible. False in setters. */ |
318 | | false, /* isMovable. Not relevant for setters. */ |
319 | | false, /* isEliminatable. Not relevant for setters. */ |
320 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
321 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
322 | | false, /* isTypedMethod. Only relevant for methods. */ |
323 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
324 | | }; |
325 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
326 | | static_assert(0 < 1, "There is no slot for us"); |
327 | | static const JSJitInfo view_setterinfo = { |
328 | | { (JSJitGetterOp)set_view }, |
329 | | { prototypes::id::TreeBoxObject }, |
330 | | { PrototypeTraits<prototypes::id::TreeBoxObject>::Depth }, |
331 | | JSJitInfo::Setter, |
332 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
333 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
334 | | false, /* isInfallible. False in setters. */ |
335 | | false, /* isMovable. Not relevant for setters. */ |
336 | | false, /* isEliminatable. Not relevant for setters. */ |
337 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
338 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
339 | | false, /* isTypedMethod. Only relevant for methods. */ |
340 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
341 | | }; |
342 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
343 | | static_assert(0 < 1, "There is no slot for us"); |
344 | | |
345 | | MOZ_CAN_RUN_SCRIPT static bool |
346 | | get_focused(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TreeBoxObject* self, JSJitGetterCallArgs args) |
347 | 0 | { |
348 | 0 | AUTO_PROFILER_LABEL_FAST("get TreeBoxObject.focused", DOM, cx); |
349 | 0 |
|
350 | 0 | bool result(self->Focused()); |
351 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
352 | 0 | args.rval().setBoolean(result); |
353 | 0 | return true; |
354 | 0 | } |
355 | | |
356 | | MOZ_CAN_RUN_SCRIPT static bool |
357 | | set_focused(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TreeBoxObject* self, JSJitSetterCallArgs args) |
358 | 0 | { |
359 | 0 | AUTO_PROFILER_LABEL_FAST("set TreeBoxObject.focused", DOM, cx); |
360 | 0 |
|
361 | 0 | bool arg0; |
362 | 0 | if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) { |
363 | 0 | return false; |
364 | 0 | } |
365 | 0 | self->SetFocused(arg0); |
366 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
367 | 0 |
|
368 | 0 | return true; |
369 | 0 | } |
370 | | |
371 | | static const JSJitInfo focused_getterinfo = { |
372 | | { (JSJitGetterOp)get_focused }, |
373 | | { prototypes::id::TreeBoxObject }, |
374 | | { PrototypeTraits<prototypes::id::TreeBoxObject>::Depth }, |
375 | | JSJitInfo::Getter, |
376 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
377 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
378 | | true, /* isInfallible. False in setters. */ |
379 | | false, /* isMovable. Not relevant for setters. */ |
380 | | false, /* isEliminatable. Not relevant for setters. */ |
381 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
382 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
383 | | false, /* isTypedMethod. Only relevant for methods. */ |
384 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
385 | | }; |
386 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
387 | | static_assert(0 < 1, "There is no slot for us"); |
388 | | static const JSJitInfo focused_setterinfo = { |
389 | | { (JSJitGetterOp)set_focused }, |
390 | | { prototypes::id::TreeBoxObject }, |
391 | | { PrototypeTraits<prototypes::id::TreeBoxObject>::Depth }, |
392 | | JSJitInfo::Setter, |
393 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
394 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
395 | | false, /* isInfallible. False in setters. */ |
396 | | false, /* isMovable. Not relevant for setters. */ |
397 | | false, /* isEliminatable. Not relevant for setters. */ |
398 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
399 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
400 | | false, /* isTypedMethod. Only relevant for methods. */ |
401 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
402 | | }; |
403 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
404 | | static_assert(0 < 1, "There is no slot for us"); |
405 | | |
406 | | MOZ_CAN_RUN_SCRIPT static bool |
407 | | get_treeBody(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TreeBoxObject* self, JSJitGetterCallArgs args) |
408 | 0 | { |
409 | 0 | AUTO_PROFILER_LABEL_FAST("get TreeBoxObject.treeBody", DOM, cx); |
410 | 0 |
|
411 | 0 | auto result(StrongOrRawPtr<mozilla::dom::Element>(self->GetTreeBody())); |
412 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
413 | 0 | if (!result) { |
414 | 0 | args.rval().setNull(); |
415 | 0 | return true; |
416 | 0 | } |
417 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
418 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
419 | 0 | return false; |
420 | 0 | } |
421 | 0 | return true; |
422 | 0 | } |
423 | | |
424 | | static const JSJitInfo treeBody_getterinfo = { |
425 | | { (JSJitGetterOp)get_treeBody }, |
426 | | { prototypes::id::TreeBoxObject }, |
427 | | { PrototypeTraits<prototypes::id::TreeBoxObject>::Depth }, |
428 | | JSJitInfo::Getter, |
429 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
430 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
431 | | false, /* isInfallible. False in setters. */ |
432 | | false, /* isMovable. Not relevant for setters. */ |
433 | | false, /* isEliminatable. Not relevant for setters. */ |
434 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
435 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
436 | | false, /* isTypedMethod. Only relevant for methods. */ |
437 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
438 | | }; |
439 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
440 | | static_assert(0 < 1, "There is no slot for us"); |
441 | | |
442 | | MOZ_CAN_RUN_SCRIPT static bool |
443 | | get_rowHeight(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TreeBoxObject* self, JSJitGetterCallArgs args) |
444 | 0 | { |
445 | 0 | AUTO_PROFILER_LABEL_FAST("get TreeBoxObject.rowHeight", DOM, cx); |
446 | 0 |
|
447 | 0 | int32_t result(self->RowHeight()); |
448 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
449 | 0 | args.rval().setInt32(int32_t(result)); |
450 | 0 | return true; |
451 | 0 | } |
452 | | |
453 | | static const JSJitInfo rowHeight_getterinfo = { |
454 | | { (JSJitGetterOp)get_rowHeight }, |
455 | | { prototypes::id::TreeBoxObject }, |
456 | | { PrototypeTraits<prototypes::id::TreeBoxObject>::Depth }, |
457 | | JSJitInfo::Getter, |
458 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
459 | | JSVAL_TYPE_INT32, /* returnType. Not relevant for setters. */ |
460 | | true, /* isInfallible. False in setters. */ |
461 | | false, /* isMovable. Not relevant for setters. */ |
462 | | false, /* isEliminatable. Not relevant for setters. */ |
463 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
464 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
465 | | false, /* isTypedMethod. Only relevant for methods. */ |
466 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
467 | | }; |
468 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
469 | | static_assert(0 < 1, "There is no slot for us"); |
470 | | |
471 | | MOZ_CAN_RUN_SCRIPT static bool |
472 | | get_rowWidth(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TreeBoxObject* self, JSJitGetterCallArgs args) |
473 | 0 | { |
474 | 0 | AUTO_PROFILER_LABEL_FAST("get TreeBoxObject.rowWidth", DOM, cx); |
475 | 0 |
|
476 | 0 | int32_t result(self->RowWidth()); |
477 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
478 | 0 | args.rval().setInt32(int32_t(result)); |
479 | 0 | return true; |
480 | 0 | } |
481 | | |
482 | | static const JSJitInfo rowWidth_getterinfo = { |
483 | | { (JSJitGetterOp)get_rowWidth }, |
484 | | { prototypes::id::TreeBoxObject }, |
485 | | { PrototypeTraits<prototypes::id::TreeBoxObject>::Depth }, |
486 | | JSJitInfo::Getter, |
487 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
488 | | JSVAL_TYPE_INT32, /* returnType. Not relevant for setters. */ |
489 | | true, /* isInfallible. False in setters. */ |
490 | | false, /* isMovable. Not relevant for setters. */ |
491 | | false, /* isEliminatable. Not relevant for setters. */ |
492 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
493 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
494 | | false, /* isTypedMethod. Only relevant for methods. */ |
495 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
496 | | }; |
497 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
498 | | static_assert(0 < 1, "There is no slot for us"); |
499 | | |
500 | | MOZ_CAN_RUN_SCRIPT static bool |
501 | | get_horizontalPosition(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TreeBoxObject* self, JSJitGetterCallArgs args) |
502 | 0 | { |
503 | 0 | AUTO_PROFILER_LABEL_FAST("get TreeBoxObject.horizontalPosition", DOM, cx); |
504 | 0 |
|
505 | 0 | int32_t result(self->HorizontalPosition()); |
506 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
507 | 0 | args.rval().setInt32(int32_t(result)); |
508 | 0 | return true; |
509 | 0 | } |
510 | | |
511 | | static const JSJitInfo horizontalPosition_getterinfo = { |
512 | | { (JSJitGetterOp)get_horizontalPosition }, |
513 | | { prototypes::id::TreeBoxObject }, |
514 | | { PrototypeTraits<prototypes::id::TreeBoxObject>::Depth }, |
515 | | JSJitInfo::Getter, |
516 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
517 | | JSVAL_TYPE_INT32, /* returnType. Not relevant for setters. */ |
518 | | true, /* isInfallible. False in setters. */ |
519 | | false, /* isMovable. Not relevant for setters. */ |
520 | | false, /* isEliminatable. Not relevant for setters. */ |
521 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
522 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
523 | | false, /* isTypedMethod. Only relevant for methods. */ |
524 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
525 | | }; |
526 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
527 | | static_assert(0 < 1, "There is no slot for us"); |
528 | | |
529 | | MOZ_CAN_RUN_SCRIPT static bool |
530 | | getFirstVisibleRow(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TreeBoxObject* self, const JSJitMethodCallArgs& args) |
531 | 0 | { |
532 | 0 | AUTO_PROFILER_LABEL_FAST("TreeBoxObject.getFirstVisibleRow", DOM, cx); |
533 | 0 |
|
534 | 0 | int32_t result(self->GetFirstVisibleRow()); |
535 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
536 | 0 | args.rval().setInt32(int32_t(result)); |
537 | 0 | return true; |
538 | 0 | } |
539 | | |
540 | | static const JSJitInfo getFirstVisibleRow_methodinfo = { |
541 | | { (JSJitGetterOp)getFirstVisibleRow }, |
542 | | { prototypes::id::TreeBoxObject }, |
543 | | { PrototypeTraits<prototypes::id::TreeBoxObject>::Depth }, |
544 | | JSJitInfo::Method, |
545 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
546 | | JSVAL_TYPE_INT32, /* returnType. Not relevant for setters. */ |
547 | | true, /* isInfallible. False in setters. */ |
548 | | false, /* isMovable. Not relevant for setters. */ |
549 | | false, /* isEliminatable. Not relevant for setters. */ |
550 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
551 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
552 | | false, /* isTypedMethod. Only relevant for methods. */ |
553 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
554 | | }; |
555 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
556 | | static_assert(0 < 1, "There is no slot for us"); |
557 | | |
558 | | MOZ_CAN_RUN_SCRIPT static bool |
559 | | getLastVisibleRow(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TreeBoxObject* self, const JSJitMethodCallArgs& args) |
560 | 0 | { |
561 | 0 | AUTO_PROFILER_LABEL_FAST("TreeBoxObject.getLastVisibleRow", DOM, cx); |
562 | 0 |
|
563 | 0 | int32_t result(self->GetLastVisibleRow()); |
564 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
565 | 0 | args.rval().setInt32(int32_t(result)); |
566 | 0 | return true; |
567 | 0 | } |
568 | | |
569 | | static const JSJitInfo getLastVisibleRow_methodinfo = { |
570 | | { (JSJitGetterOp)getLastVisibleRow }, |
571 | | { prototypes::id::TreeBoxObject }, |
572 | | { PrototypeTraits<prototypes::id::TreeBoxObject>::Depth }, |
573 | | JSJitInfo::Method, |
574 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
575 | | JSVAL_TYPE_INT32, /* returnType. Not relevant for setters. */ |
576 | | true, /* isInfallible. False in setters. */ |
577 | | false, /* isMovable. Not relevant for setters. */ |
578 | | false, /* isEliminatable. Not relevant for setters. */ |
579 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
580 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
581 | | false, /* isTypedMethod. Only relevant for methods. */ |
582 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
583 | | }; |
584 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
585 | | static_assert(0 < 1, "There is no slot for us"); |
586 | | |
587 | | MOZ_CAN_RUN_SCRIPT static bool |
588 | | getPageLength(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TreeBoxObject* self, const JSJitMethodCallArgs& args) |
589 | 0 | { |
590 | 0 | AUTO_PROFILER_LABEL_FAST("TreeBoxObject.getPageLength", DOM, cx); |
591 | 0 |
|
592 | 0 | int32_t result(self->GetPageLength()); |
593 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
594 | 0 | args.rval().setInt32(int32_t(result)); |
595 | 0 | return true; |
596 | 0 | } |
597 | | |
598 | | static const JSJitInfo getPageLength_methodinfo = { |
599 | | { (JSJitGetterOp)getPageLength }, |
600 | | { prototypes::id::TreeBoxObject }, |
601 | | { PrototypeTraits<prototypes::id::TreeBoxObject>::Depth }, |
602 | | JSJitInfo::Method, |
603 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
604 | | JSVAL_TYPE_INT32, /* returnType. Not relevant for setters. */ |
605 | | true, /* isInfallible. False in setters. */ |
606 | | false, /* isMovable. Not relevant for setters. */ |
607 | | false, /* isEliminatable. Not relevant for setters. */ |
608 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
609 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
610 | | false, /* isTypedMethod. Only relevant for methods. */ |
611 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
612 | | }; |
613 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
614 | | static_assert(0 < 1, "There is no slot for us"); |
615 | | |
616 | | MOZ_CAN_RUN_SCRIPT static bool |
617 | | ensureRowIsVisible(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TreeBoxObject* self, const JSJitMethodCallArgs& args) |
618 | 0 | { |
619 | 0 | AUTO_PROFILER_LABEL_FAST("TreeBoxObject.ensureRowIsVisible", DOM, cx); |
620 | 0 |
|
621 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
622 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeBoxObject.ensureRowIsVisible"); |
623 | 0 | } |
624 | 0 | int32_t arg0; |
625 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
626 | 0 | return false; |
627 | 0 | } |
628 | 0 | self->EnsureRowIsVisible(arg0); |
629 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
630 | 0 | args.rval().setUndefined(); |
631 | 0 | return true; |
632 | 0 | } |
633 | | |
634 | | static const JSJitInfo ensureRowIsVisible_methodinfo = { |
635 | | { (JSJitGetterOp)ensureRowIsVisible }, |
636 | | { prototypes::id::TreeBoxObject }, |
637 | | { PrototypeTraits<prototypes::id::TreeBoxObject>::Depth }, |
638 | | JSJitInfo::Method, |
639 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
640 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
641 | | false, /* isInfallible. False in setters. */ |
642 | | false, /* isMovable. Not relevant for setters. */ |
643 | | false, /* isEliminatable. Not relevant for setters. */ |
644 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
645 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
646 | | false, /* isTypedMethod. Only relevant for methods. */ |
647 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
648 | | }; |
649 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
650 | | static_assert(0 < 1, "There is no slot for us"); |
651 | | |
652 | | MOZ_CAN_RUN_SCRIPT static bool |
653 | | ensureCellIsVisible(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TreeBoxObject* self, const JSJitMethodCallArgs& args) |
654 | 0 | { |
655 | 0 | AUTO_PROFILER_LABEL_FAST("TreeBoxObject.ensureCellIsVisible", DOM, cx); |
656 | 0 |
|
657 | 0 | if (MOZ_UNLIKELY(args.length() < 2)) { |
658 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeBoxObject.ensureCellIsVisible"); |
659 | 0 | } |
660 | 0 | int32_t arg0; |
661 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
662 | 0 | return false; |
663 | 0 | } |
664 | 0 | nsTreeColumn* arg1; |
665 | 0 | if (args[1].isObject()) { |
666 | 0 | { |
667 | 0 | nsresult rv = UnwrapObject<prototypes::id::TreeColumn, nsTreeColumn>(args[1], arg1); |
668 | 0 | if (NS_FAILED(rv)) { |
669 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 2 of TreeBoxObject.ensureCellIsVisible", "TreeColumn"); |
670 | 0 | return false; |
671 | 0 | } |
672 | 0 | } |
673 | 0 | } else if (args[1].isNullOrUndefined()) { |
674 | 0 | arg1 = nullptr; |
675 | 0 | } else { |
676 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 2 of TreeBoxObject.ensureCellIsVisible"); |
677 | 0 | return false; |
678 | 0 | } |
679 | 0 | FastErrorResult rv; |
680 | 0 | self->EnsureCellIsVisible(arg0, MOZ_KnownLive(Constify(arg1)), rv); |
681 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
682 | 0 | return false; |
683 | 0 | } |
684 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
685 | 0 | args.rval().setUndefined(); |
686 | 0 | return true; |
687 | 0 | } |
688 | | |
689 | | static const JSJitInfo ensureCellIsVisible_methodinfo = { |
690 | | { (JSJitGetterOp)ensureCellIsVisible }, |
691 | | { prototypes::id::TreeBoxObject }, |
692 | | { PrototypeTraits<prototypes::id::TreeBoxObject>::Depth }, |
693 | | JSJitInfo::Method, |
694 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
695 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
696 | | false, /* isInfallible. False in setters. */ |
697 | | false, /* isMovable. Not relevant for setters. */ |
698 | | false, /* isEliminatable. Not relevant for setters. */ |
699 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
700 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
701 | | false, /* isTypedMethod. Only relevant for methods. */ |
702 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
703 | | }; |
704 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
705 | | static_assert(0 < 1, "There is no slot for us"); |
706 | | |
707 | | MOZ_CAN_RUN_SCRIPT static bool |
708 | | scrollToRow(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TreeBoxObject* self, const JSJitMethodCallArgs& args) |
709 | 0 | { |
710 | 0 | AUTO_PROFILER_LABEL_FAST("TreeBoxObject.scrollToRow", DOM, cx); |
711 | 0 |
|
712 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
713 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeBoxObject.scrollToRow"); |
714 | 0 | } |
715 | 0 | int32_t arg0; |
716 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
717 | 0 | return false; |
718 | 0 | } |
719 | 0 | self->ScrollToRow(arg0); |
720 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
721 | 0 | args.rval().setUndefined(); |
722 | 0 | return true; |
723 | 0 | } |
724 | | |
725 | | static const JSJitInfo scrollToRow_methodinfo = { |
726 | | { (JSJitGetterOp)scrollToRow }, |
727 | | { prototypes::id::TreeBoxObject }, |
728 | | { PrototypeTraits<prototypes::id::TreeBoxObject>::Depth }, |
729 | | JSJitInfo::Method, |
730 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
731 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
732 | | false, /* isInfallible. False in setters. */ |
733 | | false, /* isMovable. Not relevant for setters. */ |
734 | | false, /* isEliminatable. Not relevant for setters. */ |
735 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
736 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
737 | | false, /* isTypedMethod. Only relevant for methods. */ |
738 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
739 | | }; |
740 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
741 | | static_assert(0 < 1, "There is no slot for us"); |
742 | | |
743 | | MOZ_CAN_RUN_SCRIPT static bool |
744 | | scrollByLines(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TreeBoxObject* self, const JSJitMethodCallArgs& args) |
745 | 0 | { |
746 | 0 | AUTO_PROFILER_LABEL_FAST("TreeBoxObject.scrollByLines", DOM, cx); |
747 | 0 |
|
748 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
749 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeBoxObject.scrollByLines"); |
750 | 0 | } |
751 | 0 | int32_t arg0; |
752 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
753 | 0 | return false; |
754 | 0 | } |
755 | 0 | self->ScrollByLines(arg0); |
756 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
757 | 0 | args.rval().setUndefined(); |
758 | 0 | return true; |
759 | 0 | } |
760 | | |
761 | | static const JSJitInfo scrollByLines_methodinfo = { |
762 | | { (JSJitGetterOp)scrollByLines }, |
763 | | { prototypes::id::TreeBoxObject }, |
764 | | { PrototypeTraits<prototypes::id::TreeBoxObject>::Depth }, |
765 | | JSJitInfo::Method, |
766 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
767 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
768 | | false, /* isInfallible. False in setters. */ |
769 | | false, /* isMovable. Not relevant for setters. */ |
770 | | false, /* isEliminatable. Not relevant for setters. */ |
771 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
772 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
773 | | false, /* isTypedMethod. Only relevant for methods. */ |
774 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
775 | | }; |
776 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
777 | | static_assert(0 < 1, "There is no slot for us"); |
778 | | |
779 | | MOZ_CAN_RUN_SCRIPT static bool |
780 | | scrollByPages(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TreeBoxObject* self, const JSJitMethodCallArgs& args) |
781 | 0 | { |
782 | 0 | AUTO_PROFILER_LABEL_FAST("TreeBoxObject.scrollByPages", DOM, cx); |
783 | 0 |
|
784 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
785 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeBoxObject.scrollByPages"); |
786 | 0 | } |
787 | 0 | int32_t arg0; |
788 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
789 | 0 | return false; |
790 | 0 | } |
791 | 0 | self->ScrollByPages(arg0); |
792 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
793 | 0 | args.rval().setUndefined(); |
794 | 0 | return true; |
795 | 0 | } |
796 | | |
797 | | static const JSJitInfo scrollByPages_methodinfo = { |
798 | | { (JSJitGetterOp)scrollByPages }, |
799 | | { prototypes::id::TreeBoxObject }, |
800 | | { PrototypeTraits<prototypes::id::TreeBoxObject>::Depth }, |
801 | | JSJitInfo::Method, |
802 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
803 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
804 | | false, /* isInfallible. False in setters. */ |
805 | | false, /* isMovable. Not relevant for setters. */ |
806 | | false, /* isEliminatable. Not relevant for setters. */ |
807 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
808 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
809 | | false, /* isTypedMethod. Only relevant for methods. */ |
810 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
811 | | }; |
812 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
813 | | static_assert(0 < 1, "There is no slot for us"); |
814 | | |
815 | | MOZ_CAN_RUN_SCRIPT static bool |
816 | | invalidate(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TreeBoxObject* self, const JSJitMethodCallArgs& args) |
817 | 0 | { |
818 | 0 | AUTO_PROFILER_LABEL_FAST("TreeBoxObject.invalidate", DOM, cx); |
819 | 0 |
|
820 | 0 | self->Invalidate(); |
821 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
822 | 0 | args.rval().setUndefined(); |
823 | 0 | return true; |
824 | 0 | } |
825 | | |
826 | | static const JSJitInfo invalidate_methodinfo = { |
827 | | { (JSJitGetterOp)invalidate }, |
828 | | { prototypes::id::TreeBoxObject }, |
829 | | { PrototypeTraits<prototypes::id::TreeBoxObject>::Depth }, |
830 | | JSJitInfo::Method, |
831 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
832 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
833 | | true, /* isInfallible. False in setters. */ |
834 | | false, /* isMovable. Not relevant for setters. */ |
835 | | false, /* 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 < 1, "There is no slot for us"); |
843 | | |
844 | | MOZ_CAN_RUN_SCRIPT static bool |
845 | | invalidateColumn(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TreeBoxObject* self, const JSJitMethodCallArgs& args) |
846 | 0 | { |
847 | 0 | AUTO_PROFILER_LABEL_FAST("TreeBoxObject.invalidateColumn", DOM, cx); |
848 | 0 |
|
849 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
850 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeBoxObject.invalidateColumn"); |
851 | 0 | } |
852 | 0 | nsTreeColumn* arg0; |
853 | 0 | if (args[0].isObject()) { |
854 | 0 | { |
855 | 0 | nsresult rv = UnwrapObject<prototypes::id::TreeColumn, nsTreeColumn>(args[0], arg0); |
856 | 0 | if (NS_FAILED(rv)) { |
857 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of TreeBoxObject.invalidateColumn", "TreeColumn"); |
858 | 0 | return false; |
859 | 0 | } |
860 | 0 | } |
861 | 0 | } else if (args[0].isNullOrUndefined()) { |
862 | 0 | arg0 = nullptr; |
863 | 0 | } else { |
864 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of TreeBoxObject.invalidateColumn"); |
865 | 0 | return false; |
866 | 0 | } |
867 | 0 | self->InvalidateColumn(MOZ_KnownLive(Constify(arg0))); |
868 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
869 | 0 | args.rval().setUndefined(); |
870 | 0 | return true; |
871 | 0 | } |
872 | | |
873 | | static const JSJitInfo invalidateColumn_methodinfo = { |
874 | | { (JSJitGetterOp)invalidateColumn }, |
875 | | { prototypes::id::TreeBoxObject }, |
876 | | { PrototypeTraits<prototypes::id::TreeBoxObject>::Depth }, |
877 | | JSJitInfo::Method, |
878 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
879 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
880 | | false, /* isInfallible. False in setters. */ |
881 | | false, /* isMovable. Not relevant for setters. */ |
882 | | false, /* isEliminatable. Not relevant for setters. */ |
883 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
884 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
885 | | false, /* isTypedMethod. Only relevant for methods. */ |
886 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
887 | | }; |
888 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
889 | | static_assert(0 < 1, "There is no slot for us"); |
890 | | |
891 | | MOZ_CAN_RUN_SCRIPT static bool |
892 | | invalidateRow(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TreeBoxObject* self, const JSJitMethodCallArgs& args) |
893 | 0 | { |
894 | 0 | AUTO_PROFILER_LABEL_FAST("TreeBoxObject.invalidateRow", DOM, cx); |
895 | 0 |
|
896 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
897 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeBoxObject.invalidateRow"); |
898 | 0 | } |
899 | 0 | int32_t arg0; |
900 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
901 | 0 | return false; |
902 | 0 | } |
903 | 0 | self->InvalidateRow(arg0); |
904 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
905 | 0 | args.rval().setUndefined(); |
906 | 0 | return true; |
907 | 0 | } |
908 | | |
909 | | static const JSJitInfo invalidateRow_methodinfo = { |
910 | | { (JSJitGetterOp)invalidateRow }, |
911 | | { prototypes::id::TreeBoxObject }, |
912 | | { PrototypeTraits<prototypes::id::TreeBoxObject>::Depth }, |
913 | | JSJitInfo::Method, |
914 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
915 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
916 | | false, /* isInfallible. False in setters. */ |
917 | | false, /* isMovable. Not relevant for setters. */ |
918 | | false, /* isEliminatable. Not relevant for setters. */ |
919 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
920 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
921 | | false, /* isTypedMethod. Only relevant for methods. */ |
922 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
923 | | }; |
924 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
925 | | static_assert(0 < 1, "There is no slot for us"); |
926 | | |
927 | | MOZ_CAN_RUN_SCRIPT static bool |
928 | | invalidateCell(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TreeBoxObject* self, const JSJitMethodCallArgs& args) |
929 | 0 | { |
930 | 0 | AUTO_PROFILER_LABEL_FAST("TreeBoxObject.invalidateCell", DOM, cx); |
931 | 0 |
|
932 | 0 | if (MOZ_UNLIKELY(args.length() < 2)) { |
933 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeBoxObject.invalidateCell"); |
934 | 0 | } |
935 | 0 | int32_t arg0; |
936 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
937 | 0 | return false; |
938 | 0 | } |
939 | 0 | nsTreeColumn* arg1; |
940 | 0 | if (args[1].isObject()) { |
941 | 0 | { |
942 | 0 | nsresult rv = UnwrapObject<prototypes::id::TreeColumn, nsTreeColumn>(args[1], arg1); |
943 | 0 | if (NS_FAILED(rv)) { |
944 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 2 of TreeBoxObject.invalidateCell", "TreeColumn"); |
945 | 0 | return false; |
946 | 0 | } |
947 | 0 | } |
948 | 0 | } else if (args[1].isNullOrUndefined()) { |
949 | 0 | arg1 = nullptr; |
950 | 0 | } else { |
951 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 2 of TreeBoxObject.invalidateCell"); |
952 | 0 | return false; |
953 | 0 | } |
954 | 0 | self->InvalidateCell(arg0, MOZ_KnownLive(Constify(arg1))); |
955 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
956 | 0 | args.rval().setUndefined(); |
957 | 0 | return true; |
958 | 0 | } |
959 | | |
960 | | static const JSJitInfo invalidateCell_methodinfo = { |
961 | | { (JSJitGetterOp)invalidateCell }, |
962 | | { prototypes::id::TreeBoxObject }, |
963 | | { PrototypeTraits<prototypes::id::TreeBoxObject>::Depth }, |
964 | | JSJitInfo::Method, |
965 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
966 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
967 | | false, /* isInfallible. False in setters. */ |
968 | | false, /* isMovable. Not relevant for setters. */ |
969 | | false, /* isEliminatable. Not relevant for setters. */ |
970 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
971 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
972 | | false, /* isTypedMethod. Only relevant for methods. */ |
973 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
974 | | }; |
975 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
976 | | static_assert(0 < 1, "There is no slot for us"); |
977 | | |
978 | | MOZ_CAN_RUN_SCRIPT static bool |
979 | | invalidateRange(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TreeBoxObject* self, const JSJitMethodCallArgs& args) |
980 | 0 | { |
981 | 0 | AUTO_PROFILER_LABEL_FAST("TreeBoxObject.invalidateRange", DOM, cx); |
982 | 0 |
|
983 | 0 | if (MOZ_UNLIKELY(args.length() < 2)) { |
984 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeBoxObject.invalidateRange"); |
985 | 0 | } |
986 | 0 | int32_t arg0; |
987 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
988 | 0 | return false; |
989 | 0 | } |
990 | 0 | int32_t arg1; |
991 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[1], &arg1)) { |
992 | 0 | return false; |
993 | 0 | } |
994 | 0 | self->InvalidateRange(arg0, arg1); |
995 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
996 | 0 | args.rval().setUndefined(); |
997 | 0 | return true; |
998 | 0 | } |
999 | | |
1000 | | static const JSJitInfo invalidateRange_methodinfo = { |
1001 | | { (JSJitGetterOp)invalidateRange }, |
1002 | | { prototypes::id::TreeBoxObject }, |
1003 | | { PrototypeTraits<prototypes::id::TreeBoxObject>::Depth }, |
1004 | | JSJitInfo::Method, |
1005 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1006 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1007 | | false, /* isInfallible. False in setters. */ |
1008 | | false, /* isMovable. Not relevant for setters. */ |
1009 | | false, /* isEliminatable. Not relevant for setters. */ |
1010 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1011 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1012 | | false, /* isTypedMethod. Only relevant for methods. */ |
1013 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1014 | | }; |
1015 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1016 | | static_assert(0 < 1, "There is no slot for us"); |
1017 | | |
1018 | | MOZ_CAN_RUN_SCRIPT static bool |
1019 | | getRowAt(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TreeBoxObject* self, const JSJitMethodCallArgs& args) |
1020 | 0 | { |
1021 | 0 | AUTO_PROFILER_LABEL_FAST("TreeBoxObject.getRowAt", DOM, cx); |
1022 | 0 |
|
1023 | 0 | if (MOZ_UNLIKELY(args.length() < 2)) { |
1024 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeBoxObject.getRowAt"); |
1025 | 0 | } |
1026 | 0 | int32_t arg0; |
1027 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
1028 | 0 | return false; |
1029 | 0 | } |
1030 | 0 | int32_t arg1; |
1031 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[1], &arg1)) { |
1032 | 0 | return false; |
1033 | 0 | } |
1034 | 0 | int32_t result(self->GetRowAt(arg0, arg1)); |
1035 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1036 | 0 | args.rval().setInt32(int32_t(result)); |
1037 | 0 | return true; |
1038 | 0 | } |
1039 | | |
1040 | | static const JSJitInfo getRowAt_methodinfo = { |
1041 | | { (JSJitGetterOp)getRowAt }, |
1042 | | { prototypes::id::TreeBoxObject }, |
1043 | | { PrototypeTraits<prototypes::id::TreeBoxObject>::Depth }, |
1044 | | JSJitInfo::Method, |
1045 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1046 | | JSVAL_TYPE_INT32, /* returnType. Not relevant for setters. */ |
1047 | | false, /* isInfallible. False in setters. */ |
1048 | | false, /* isMovable. Not relevant for setters. */ |
1049 | | false, /* isEliminatable. Not relevant for setters. */ |
1050 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1051 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1052 | | false, /* isTypedMethod. Only relevant for methods. */ |
1053 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1054 | | }; |
1055 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1056 | | static_assert(0 < 1, "There is no slot for us"); |
1057 | | |
1058 | | MOZ_CAN_RUN_SCRIPT static bool |
1059 | | getCellAt(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TreeBoxObject* self, const JSJitMethodCallArgs& args) |
1060 | 0 | { |
1061 | 0 | AUTO_PROFILER_LABEL_FAST("TreeBoxObject.getCellAt", DOM, cx); |
1062 | 0 |
|
1063 | 0 | unsigned argcount = std::min(args.length(), 5u); |
1064 | 0 | switch (argcount) { |
1065 | 0 | case 2: { |
1066 | 0 | int32_t arg0; |
1067 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
1068 | 0 | return false; |
1069 | 0 | } |
1070 | 0 | int32_t arg1; |
1071 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[1], &arg1)) { |
1072 | 0 | return false; |
1073 | 0 | } |
1074 | 0 | FastErrorResult rv; |
1075 | 0 | TreeCellInfo result; |
1076 | 0 | self->GetCellAt(arg0, arg1, result, rv); |
1077 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1078 | 0 | return false; |
1079 | 0 | } |
1080 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1081 | 0 | if (!result.ToObjectInternal(cx, args.rval())) { |
1082 | 0 | return false; |
1083 | 0 | } |
1084 | 0 | return true; |
1085 | 0 | break; |
1086 | 0 | } |
1087 | 0 | case 5: { |
1088 | 0 | int32_t arg0; |
1089 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
1090 | 0 | return false; |
1091 | 0 | } |
1092 | 0 | int32_t arg1; |
1093 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[1], &arg1)) { |
1094 | 0 | return false; |
1095 | 0 | } |
1096 | 0 | JS::Rooted<JSObject*> arg2(cx); |
1097 | 0 | if (args[2].isObject()) { |
1098 | 0 | arg2 = &args[2].toObject(); |
1099 | 0 | } else { |
1100 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 3 of TreeBoxObject.getCellAt"); |
1101 | 0 | return false; |
1102 | 0 | } |
1103 | 0 | JS::Rooted<JSObject*> arg3(cx); |
1104 | 0 | if (args[3].isObject()) { |
1105 | 0 | arg3 = &args[3].toObject(); |
1106 | 0 | } else { |
1107 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 4 of TreeBoxObject.getCellAt"); |
1108 | 0 | return false; |
1109 | 0 | } |
1110 | 0 | JS::Rooted<JSObject*> arg4(cx); |
1111 | 0 | if (args[4].isObject()) { |
1112 | 0 | arg4 = &args[4].toObject(); |
1113 | 0 | } else { |
1114 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 5 of TreeBoxObject.getCellAt"); |
1115 | 0 | return false; |
1116 | 0 | } |
1117 | 0 | FastErrorResult rv; |
1118 | 0 | self->GetCellAt(cx, arg0, arg1, arg2, arg3, arg4, rv); |
1119 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1120 | 0 | return false; |
1121 | 0 | } |
1122 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1123 | 0 | args.rval().setUndefined(); |
1124 | 0 | return true; |
1125 | 0 | break; |
1126 | 0 | } |
1127 | 0 | default: { |
1128 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeBoxObject.getCellAt"); |
1129 | 0 | break; |
1130 | 0 | } |
1131 | 0 | } |
1132 | 0 | MOZ_CRASH("We have an always-returning default case"); |
1133 | 0 | return false; |
1134 | 0 | } |
1135 | | |
1136 | | static const JSJitInfo getCellAt_methodinfo = { |
1137 | | { (JSJitGetterOp)getCellAt }, |
1138 | | { prototypes::id::TreeBoxObject }, |
1139 | | { PrototypeTraits<prototypes::id::TreeBoxObject>::Depth }, |
1140 | | JSJitInfo::Method, |
1141 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1142 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
1143 | | false, /* isInfallible. False in setters. */ |
1144 | | false, /* isMovable. Not relevant for setters. */ |
1145 | | false, /* isEliminatable. Not relevant for setters. */ |
1146 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1147 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1148 | | false, /* isTypedMethod. Only relevant for methods. */ |
1149 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1150 | | }; |
1151 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1152 | | static_assert(0 < 1, "There is no slot for us"); |
1153 | | |
1154 | | MOZ_CAN_RUN_SCRIPT static bool |
1155 | | getCoordsForCellItem(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TreeBoxObject* self, const JSJitMethodCallArgs& args) |
1156 | 0 | { |
1157 | 0 | AUTO_PROFILER_LABEL_FAST("TreeBoxObject.getCoordsForCellItem", DOM, cx); |
1158 | 0 |
|
1159 | 0 | unsigned argcount = std::min(args.length(), 7u); |
1160 | 0 | switch (argcount) { |
1161 | 0 | case 3: { |
1162 | 0 | int32_t arg0; |
1163 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
1164 | 0 | return false; |
1165 | 0 | } |
1166 | 0 | NonNull<nsTreeColumn> arg1; |
1167 | 0 | if (args[1].isObject()) { |
1168 | 0 | { |
1169 | 0 | nsresult rv = UnwrapObject<prototypes::id::TreeColumn, nsTreeColumn>(args[1], arg1); |
1170 | 0 | if (NS_FAILED(rv)) { |
1171 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 2 of TreeBoxObject.getCoordsForCellItem", "TreeColumn"); |
1172 | 0 | return false; |
1173 | 0 | } |
1174 | 0 | } |
1175 | 0 | } else { |
1176 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 2 of TreeBoxObject.getCoordsForCellItem"); |
1177 | 0 | return false; |
1178 | 0 | } |
1179 | 0 | binding_detail::FakeString arg2; |
1180 | 0 | if (!ConvertJSValueToString(cx, args[2], eStringify, eStringify, arg2)) { |
1181 | 0 | return false; |
1182 | 0 | } |
1183 | 0 | FastErrorResult rv; |
1184 | 0 | auto result(StrongOrRawPtr<mozilla::dom::DOMRect>(self->GetCoordsForCellItem(arg0, MOZ_KnownLive(NonNullHelper(arg1)), NonNullHelper(Constify(arg2)), rv))); |
1185 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1186 | 0 | return false; |
1187 | 0 | } |
1188 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1189 | 0 | if (!result) { |
1190 | 0 | args.rval().setNull(); |
1191 | 0 | return true; |
1192 | 0 | } |
1193 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
1194 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
1195 | 0 | return false; |
1196 | 0 | } |
1197 | 0 | return true; |
1198 | 0 | break; |
1199 | 0 | } |
1200 | 0 | case 7: { |
1201 | 0 | int32_t arg0; |
1202 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
1203 | 0 | return false; |
1204 | 0 | } |
1205 | 0 | NonNull<nsTreeColumn> arg1; |
1206 | 0 | if (args[1].isObject()) { |
1207 | 0 | { |
1208 | 0 | nsresult rv = UnwrapObject<prototypes::id::TreeColumn, nsTreeColumn>(args[1], arg1); |
1209 | 0 | if (NS_FAILED(rv)) { |
1210 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 2 of TreeBoxObject.getCoordsForCellItem", "TreeColumn"); |
1211 | 0 | return false; |
1212 | 0 | } |
1213 | 0 | } |
1214 | 0 | } else { |
1215 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 2 of TreeBoxObject.getCoordsForCellItem"); |
1216 | 0 | return false; |
1217 | 0 | } |
1218 | 0 | binding_detail::FakeString arg2; |
1219 | 0 | if (!ConvertJSValueToString(cx, args[2], eStringify, eStringify, arg2)) { |
1220 | 0 | return false; |
1221 | 0 | } |
1222 | 0 | JS::Rooted<JSObject*> arg3(cx); |
1223 | 0 | if (args[3].isObject()) { |
1224 | 0 | arg3 = &args[3].toObject(); |
1225 | 0 | } else { |
1226 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 4 of TreeBoxObject.getCoordsForCellItem"); |
1227 | 0 | return false; |
1228 | 0 | } |
1229 | 0 | JS::Rooted<JSObject*> arg4(cx); |
1230 | 0 | if (args[4].isObject()) { |
1231 | 0 | arg4 = &args[4].toObject(); |
1232 | 0 | } else { |
1233 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 5 of TreeBoxObject.getCoordsForCellItem"); |
1234 | 0 | return false; |
1235 | 0 | } |
1236 | 0 | JS::Rooted<JSObject*> arg5(cx); |
1237 | 0 | if (args[5].isObject()) { |
1238 | 0 | arg5 = &args[5].toObject(); |
1239 | 0 | } else { |
1240 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 6 of TreeBoxObject.getCoordsForCellItem"); |
1241 | 0 | return false; |
1242 | 0 | } |
1243 | 0 | JS::Rooted<JSObject*> arg6(cx); |
1244 | 0 | if (args[6].isObject()) { |
1245 | 0 | arg6 = &args[6].toObject(); |
1246 | 0 | } else { |
1247 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 7 of TreeBoxObject.getCoordsForCellItem"); |
1248 | 0 | return false; |
1249 | 0 | } |
1250 | 0 | FastErrorResult rv; |
1251 | 0 | self->GetCoordsForCellItem(cx, arg0, MOZ_KnownLive(NonNullHelper(arg1)), NonNullHelper(Constify(arg2)), arg3, arg4, arg5, arg6, rv); |
1252 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1253 | 0 | return false; |
1254 | 0 | } |
1255 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1256 | 0 | args.rval().setUndefined(); |
1257 | 0 | return true; |
1258 | 0 | break; |
1259 | 0 | } |
1260 | 0 | default: { |
1261 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeBoxObject.getCoordsForCellItem"); |
1262 | 0 | break; |
1263 | 0 | } |
1264 | 0 | } |
1265 | 0 | MOZ_CRASH("We have an always-returning default case"); |
1266 | 0 | return false; |
1267 | 0 | } |
1268 | | |
1269 | | static const JSJitInfo getCoordsForCellItem_methodinfo = { |
1270 | | { (JSJitGetterOp)getCoordsForCellItem }, |
1271 | | { prototypes::id::TreeBoxObject }, |
1272 | | { PrototypeTraits<prototypes::id::TreeBoxObject>::Depth }, |
1273 | | JSJitInfo::Method, |
1274 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1275 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
1276 | | false, /* isInfallible. False in setters. */ |
1277 | | false, /* isMovable. Not relevant for setters. */ |
1278 | | false, /* isEliminatable. Not relevant for setters. */ |
1279 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1280 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1281 | | false, /* isTypedMethod. Only relevant for methods. */ |
1282 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1283 | | }; |
1284 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1285 | | static_assert(0 < 1, "There is no slot for us"); |
1286 | | |
1287 | | MOZ_CAN_RUN_SCRIPT static bool |
1288 | | isCellCropped(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TreeBoxObject* self, const JSJitMethodCallArgs& args) |
1289 | 0 | { |
1290 | 0 | AUTO_PROFILER_LABEL_FAST("TreeBoxObject.isCellCropped", DOM, cx); |
1291 | 0 |
|
1292 | 0 | if (MOZ_UNLIKELY(args.length() < 2)) { |
1293 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeBoxObject.isCellCropped"); |
1294 | 0 | } |
1295 | 0 | int32_t arg0; |
1296 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
1297 | 0 | return false; |
1298 | 0 | } |
1299 | 0 | nsTreeColumn* arg1; |
1300 | 0 | if (args[1].isObject()) { |
1301 | 0 | { |
1302 | 0 | nsresult rv = UnwrapObject<prototypes::id::TreeColumn, nsTreeColumn>(args[1], arg1); |
1303 | 0 | if (NS_FAILED(rv)) { |
1304 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 2 of TreeBoxObject.isCellCropped", "TreeColumn"); |
1305 | 0 | return false; |
1306 | 0 | } |
1307 | 0 | } |
1308 | 0 | } else if (args[1].isNullOrUndefined()) { |
1309 | 0 | arg1 = nullptr; |
1310 | 0 | } else { |
1311 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 2 of TreeBoxObject.isCellCropped"); |
1312 | 0 | return false; |
1313 | 0 | } |
1314 | 0 | FastErrorResult rv; |
1315 | 0 | bool result(self->IsCellCropped(arg0, MOZ_KnownLive(Constify(arg1)), rv)); |
1316 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1317 | 0 | return false; |
1318 | 0 | } |
1319 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1320 | 0 | args.rval().setBoolean(result); |
1321 | 0 | return true; |
1322 | 0 | } |
1323 | | |
1324 | | static const JSJitInfo isCellCropped_methodinfo = { |
1325 | | { (JSJitGetterOp)isCellCropped }, |
1326 | | { prototypes::id::TreeBoxObject }, |
1327 | | { PrototypeTraits<prototypes::id::TreeBoxObject>::Depth }, |
1328 | | JSJitInfo::Method, |
1329 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1330 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
1331 | | false, /* isInfallible. False in setters. */ |
1332 | | false, /* isMovable. Not relevant for setters. */ |
1333 | | false, /* isEliminatable. Not relevant for setters. */ |
1334 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1335 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1336 | | false, /* isTypedMethod. Only relevant for methods. */ |
1337 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1338 | | }; |
1339 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1340 | | static_assert(0 < 1, "There is no slot for us"); |
1341 | | |
1342 | | MOZ_CAN_RUN_SCRIPT static bool |
1343 | | rowCountChanged(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TreeBoxObject* self, const JSJitMethodCallArgs& args) |
1344 | 0 | { |
1345 | 0 | AUTO_PROFILER_LABEL_FAST("TreeBoxObject.rowCountChanged", DOM, cx); |
1346 | 0 |
|
1347 | 0 | if (MOZ_UNLIKELY(args.length() < 2)) { |
1348 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeBoxObject.rowCountChanged"); |
1349 | 0 | } |
1350 | 0 | int32_t arg0; |
1351 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
1352 | 0 | return false; |
1353 | 0 | } |
1354 | 0 | int32_t arg1; |
1355 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[1], &arg1)) { |
1356 | 0 | return false; |
1357 | 0 | } |
1358 | 0 | self->RowCountChanged(arg0, arg1); |
1359 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1360 | 0 | args.rval().setUndefined(); |
1361 | 0 | return true; |
1362 | 0 | } |
1363 | | |
1364 | | static const JSJitInfo rowCountChanged_methodinfo = { |
1365 | | { (JSJitGetterOp)rowCountChanged }, |
1366 | | { prototypes::id::TreeBoxObject }, |
1367 | | { PrototypeTraits<prototypes::id::TreeBoxObject>::Depth }, |
1368 | | JSJitInfo::Method, |
1369 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1370 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1371 | | false, /* isInfallible. False in setters. */ |
1372 | | false, /* isMovable. Not relevant for setters. */ |
1373 | | false, /* isEliminatable. Not relevant for setters. */ |
1374 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1375 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1376 | | false, /* isTypedMethod. Only relevant for methods. */ |
1377 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1378 | | }; |
1379 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1380 | | static_assert(0 < 1, "There is no slot for us"); |
1381 | | |
1382 | | MOZ_CAN_RUN_SCRIPT static bool |
1383 | | beginUpdateBatch(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TreeBoxObject* self, const JSJitMethodCallArgs& args) |
1384 | 0 | { |
1385 | 0 | AUTO_PROFILER_LABEL_FAST("TreeBoxObject.beginUpdateBatch", DOM, cx); |
1386 | 0 |
|
1387 | 0 | self->BeginUpdateBatch(); |
1388 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1389 | 0 | args.rval().setUndefined(); |
1390 | 0 | return true; |
1391 | 0 | } |
1392 | | |
1393 | | static const JSJitInfo beginUpdateBatch_methodinfo = { |
1394 | | { (JSJitGetterOp)beginUpdateBatch }, |
1395 | | { prototypes::id::TreeBoxObject }, |
1396 | | { PrototypeTraits<prototypes::id::TreeBoxObject>::Depth }, |
1397 | | JSJitInfo::Method, |
1398 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1399 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1400 | | true, /* isInfallible. False in setters. */ |
1401 | | false, /* isMovable. Not relevant for setters. */ |
1402 | | false, /* isEliminatable. Not relevant for setters. */ |
1403 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1404 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1405 | | false, /* isTypedMethod. Only relevant for methods. */ |
1406 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1407 | | }; |
1408 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1409 | | static_assert(0 < 1, "There is no slot for us"); |
1410 | | |
1411 | | MOZ_CAN_RUN_SCRIPT static bool |
1412 | | endUpdateBatch(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TreeBoxObject* self, const JSJitMethodCallArgs& args) |
1413 | 0 | { |
1414 | 0 | AUTO_PROFILER_LABEL_FAST("TreeBoxObject.endUpdateBatch", DOM, cx); |
1415 | 0 |
|
1416 | 0 | self->EndUpdateBatch(); |
1417 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1418 | 0 | args.rval().setUndefined(); |
1419 | 0 | return true; |
1420 | 0 | } |
1421 | | |
1422 | | static const JSJitInfo endUpdateBatch_methodinfo = { |
1423 | | { (JSJitGetterOp)endUpdateBatch }, |
1424 | | { prototypes::id::TreeBoxObject }, |
1425 | | { PrototypeTraits<prototypes::id::TreeBoxObject>::Depth }, |
1426 | | JSJitInfo::Method, |
1427 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1428 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1429 | | true, /* isInfallible. False in setters. */ |
1430 | | false, /* isMovable. Not relevant for setters. */ |
1431 | | false, /* isEliminatable. Not relevant for setters. */ |
1432 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1433 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1434 | | false, /* isTypedMethod. Only relevant for methods. */ |
1435 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1436 | | }; |
1437 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1438 | | static_assert(0 < 1, "There is no slot for us"); |
1439 | | |
1440 | | MOZ_CAN_RUN_SCRIPT static bool |
1441 | | clearStyleAndImageCaches(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TreeBoxObject* self, const JSJitMethodCallArgs& args) |
1442 | 0 | { |
1443 | 0 | AUTO_PROFILER_LABEL_FAST("TreeBoxObject.clearStyleAndImageCaches", DOM, cx); |
1444 | 0 |
|
1445 | 0 | self->ClearStyleAndImageCaches(); |
1446 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1447 | 0 | args.rval().setUndefined(); |
1448 | 0 | return true; |
1449 | 0 | } |
1450 | | |
1451 | | static const JSJitInfo clearStyleAndImageCaches_methodinfo = { |
1452 | | { (JSJitGetterOp)clearStyleAndImageCaches }, |
1453 | | { prototypes::id::TreeBoxObject }, |
1454 | | { PrototypeTraits<prototypes::id::TreeBoxObject>::Depth }, |
1455 | | JSJitInfo::Method, |
1456 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1457 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1458 | | true, /* isInfallible. False in setters. */ |
1459 | | false, /* isMovable. Not relevant for setters. */ |
1460 | | false, /* isEliminatable. Not relevant for setters. */ |
1461 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1462 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1463 | | false, /* isTypedMethod. Only relevant for methods. */ |
1464 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1465 | | }; |
1466 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1467 | | static_assert(0 < 1, "There is no slot for us"); |
1468 | | |
1469 | | MOZ_CAN_RUN_SCRIPT static bool |
1470 | | removeImageCacheEntry(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::TreeBoxObject* self, const JSJitMethodCallArgs& args) |
1471 | 0 | { |
1472 | 0 | AUTO_PROFILER_LABEL_FAST("TreeBoxObject.removeImageCacheEntry", DOM, cx); |
1473 | 0 |
|
1474 | 0 | if (MOZ_UNLIKELY(args.length() < 2)) { |
1475 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeBoxObject.removeImageCacheEntry"); |
1476 | 0 | } |
1477 | 0 | int32_t arg0; |
1478 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
1479 | 0 | return false; |
1480 | 0 | } |
1481 | 0 | NonNull<nsTreeColumn> arg1; |
1482 | 0 | if (args[1].isObject()) { |
1483 | 0 | { |
1484 | 0 | nsresult rv = UnwrapObject<prototypes::id::TreeColumn, nsTreeColumn>(args[1], arg1); |
1485 | 0 | if (NS_FAILED(rv)) { |
1486 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 2 of TreeBoxObject.removeImageCacheEntry", "TreeColumn"); |
1487 | 0 | return false; |
1488 | 0 | } |
1489 | 0 | } |
1490 | 0 | } else { |
1491 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 2 of TreeBoxObject.removeImageCacheEntry"); |
1492 | 0 | return false; |
1493 | 0 | } |
1494 | 0 | FastErrorResult rv; |
1495 | 0 | self->RemoveImageCacheEntry(arg0, MOZ_KnownLive(NonNullHelper(arg1)), rv); |
1496 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1497 | 0 | return false; |
1498 | 0 | } |
1499 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1500 | 0 | args.rval().setUndefined(); |
1501 | 0 | return true; |
1502 | 0 | } |
1503 | | |
1504 | | static const JSJitInfo removeImageCacheEntry_methodinfo = { |
1505 | | { (JSJitGetterOp)removeImageCacheEntry }, |
1506 | | { prototypes::id::TreeBoxObject }, |
1507 | | { PrototypeTraits<prototypes::id::TreeBoxObject>::Depth }, |
1508 | | JSJitInfo::Method, |
1509 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1510 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1511 | | false, /* isInfallible. False in setters. */ |
1512 | | false, /* isMovable. Not relevant for setters. */ |
1513 | | false, /* isEliminatable. Not relevant for setters. */ |
1514 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1515 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1516 | | false, /* isTypedMethod. Only relevant for methods. */ |
1517 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1518 | | }; |
1519 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1520 | | static_assert(0 < 1, "There is no slot for us"); |
1521 | | |
1522 | | static bool |
1523 | | _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val) |
1524 | 0 | { |
1525 | 0 | mozilla::dom::TreeBoxObject* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::TreeBoxObject>(obj); |
1526 | 0 | // We don't want to preserve if we don't have a wrapper, and we |
1527 | 0 | // obviously can't preserve if we're not initialized. |
1528 | 0 | if (self && self->GetWrapperPreserveColor()) { |
1529 | 0 | PreserveWrapper(self); |
1530 | 0 | } |
1531 | 0 | return true; |
1532 | 0 | } |
1533 | | |
1534 | | static void |
1535 | | _finalize(js::FreeOp* fop, JSObject* obj) |
1536 | 0 | { |
1537 | 0 | mozilla::dom::TreeBoxObject* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::TreeBoxObject>(obj); |
1538 | 0 | if (self) { |
1539 | 0 | ClearWrapper(self, self, obj); |
1540 | 0 | AddForDeferredFinalization<mozilla::dom::TreeBoxObject>(self); |
1541 | 0 | } |
1542 | 0 | } |
1543 | | |
1544 | | static size_t |
1545 | | _objectMoved(JSObject* obj, JSObject* old) |
1546 | 0 | { |
1547 | 0 | mozilla::dom::TreeBoxObject* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::TreeBoxObject>(obj); |
1548 | 0 | if (self) { |
1549 | 0 | UpdateWrapper(self, self, obj, old); |
1550 | 0 | } |
1551 | 0 |
|
1552 | 0 | return 0; |
1553 | 0 | } |
1554 | | |
1555 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
1556 | | #if defined(__clang__) |
1557 | | #pragma clang diagnostic push |
1558 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
1559 | | #endif |
1560 | | static const JSFunctionSpec sMethods_specs[] = { |
1561 | | JS_FNSPEC("getFirstVisibleRow", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getFirstVisibleRow_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
1562 | | JS_FNSPEC("getLastVisibleRow", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getLastVisibleRow_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
1563 | | JS_FNSPEC("getPageLength", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getPageLength_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
1564 | | JS_FNSPEC("ensureRowIsVisible", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&ensureRowIsVisible_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
1565 | | JS_FNSPEC("ensureCellIsVisible", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&ensureCellIsVisible_methodinfo), 2, JSPROP_ENUMERATE, nullptr), |
1566 | | JS_FNSPEC("scrollToRow", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&scrollToRow_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
1567 | | JS_FNSPEC("scrollByLines", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&scrollByLines_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
1568 | | JS_FNSPEC("scrollByPages", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&scrollByPages_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
1569 | | JS_FNSPEC("invalidate", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&invalidate_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
1570 | | JS_FNSPEC("invalidateColumn", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&invalidateColumn_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
1571 | | JS_FNSPEC("invalidateRow", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&invalidateRow_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
1572 | | JS_FNSPEC("invalidateCell", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&invalidateCell_methodinfo), 2, JSPROP_ENUMERATE, nullptr), |
1573 | | JS_FNSPEC("invalidateRange", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&invalidateRange_methodinfo), 2, JSPROP_ENUMERATE, nullptr), |
1574 | | JS_FNSPEC("getRowAt", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getRowAt_methodinfo), 2, JSPROP_ENUMERATE, nullptr), |
1575 | | JS_FNSPEC("getCellAt", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getCellAt_methodinfo), 2, JSPROP_ENUMERATE, nullptr), |
1576 | | JS_FNSPEC("getCoordsForCellItem", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getCoordsForCellItem_methodinfo), 3, JSPROP_ENUMERATE, nullptr), |
1577 | | JS_FNSPEC("isCellCropped", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&isCellCropped_methodinfo), 2, JSPROP_ENUMERATE, nullptr), |
1578 | | JS_FNSPEC("rowCountChanged", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&rowCountChanged_methodinfo), 2, JSPROP_ENUMERATE, nullptr), |
1579 | | JS_FNSPEC("beginUpdateBatch", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&beginUpdateBatch_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
1580 | | JS_FNSPEC("endUpdateBatch", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&endUpdateBatch_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
1581 | | JS_FNSPEC("clearStyleAndImageCaches", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&clearStyleAndImageCaches_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
1582 | | JS_FNSPEC("removeImageCacheEntry", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&removeImageCacheEntry_methodinfo), 2, JSPROP_ENUMERATE, nullptr), |
1583 | | JS_FS_END |
1584 | | }; |
1585 | | #if defined(__clang__) |
1586 | | #pragma clang diagnostic pop |
1587 | | #endif |
1588 | | |
1589 | | |
1590 | | static const Prefable<const JSFunctionSpec> sMethods[] = { |
1591 | | { nullptr, &sMethods_specs[0] }, |
1592 | | { nullptr, nullptr } |
1593 | | }; |
1594 | | |
1595 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
1596 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
1597 | | static_assert(22 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
1598 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
1599 | | |
1600 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
1601 | | #if defined(__clang__) |
1602 | | #pragma clang diagnostic push |
1603 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
1604 | | #endif |
1605 | | static const JSPropertySpec sAttributes_specs[] = { |
1606 | | { "columns", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &columns_getterinfo, nullptr, nullptr }, |
1607 | | { "view", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &view_getterinfo, GenericSetter<NormalThisPolicy>, &view_setterinfo }, |
1608 | | { "focused", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &focused_getterinfo, GenericSetter<NormalThisPolicy>, &focused_setterinfo }, |
1609 | | { "treeBody", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &treeBody_getterinfo, nullptr, nullptr }, |
1610 | | { "rowHeight", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &rowHeight_getterinfo, nullptr, nullptr }, |
1611 | | { "rowWidth", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &rowWidth_getterinfo, nullptr, nullptr }, |
1612 | | { "horizontalPosition", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &horizontalPosition_getterinfo, nullptr, nullptr }, |
1613 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr } |
1614 | | }; |
1615 | | #if defined(__clang__) |
1616 | | #pragma clang diagnostic pop |
1617 | | #endif |
1618 | | |
1619 | | |
1620 | | static const Prefable<const JSPropertySpec> sAttributes[] = { |
1621 | | { nullptr, &sAttributes_specs[0] }, |
1622 | | { nullptr, nullptr } |
1623 | | }; |
1624 | | |
1625 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
1626 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
1627 | | static_assert(7 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
1628 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
1629 | | |
1630 | | |
1631 | | static uint16_t sNativeProperties_sortedPropertyIndices[29]; |
1632 | | static PropertyInfo sNativeProperties_propertyInfos[29]; |
1633 | | |
1634 | | static const NativePropertiesN<2> sNativeProperties = { |
1635 | | false, 0, |
1636 | | false, 0, |
1637 | | true, 0 /* sMethods */, |
1638 | | true, 1 /* sAttributes */, |
1639 | | false, 0, |
1640 | | false, 0, |
1641 | | false, 0, |
1642 | | -1, |
1643 | | 29, |
1644 | | sNativeProperties_sortedPropertyIndices, |
1645 | | { |
1646 | | { sMethods, &sNativeProperties_propertyInfos[0] }, |
1647 | | { sAttributes, &sNativeProperties_propertyInfos[22] } |
1648 | | } |
1649 | | }; |
1650 | | static_assert(29 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount), |
1651 | | "We have a property info count that is oversized"); |
1652 | | |
1653 | | static const DOMIfaceAndProtoJSClass sPrototypeClass = { |
1654 | | { |
1655 | | "TreeBoxObjectPrototype", |
1656 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE), |
1657 | | JS_NULL_CLASS_OPS, |
1658 | | JS_NULL_CLASS_SPEC, |
1659 | | JS_NULL_CLASS_EXT, |
1660 | | JS_NULL_OBJECT_OPS |
1661 | | }, |
1662 | | eInterfacePrototype, |
1663 | | false, |
1664 | | prototypes::id::TreeBoxObject, |
1665 | | PrototypeTraits<prototypes::id::TreeBoxObject>::Depth, |
1666 | | sNativePropertyHooks, |
1667 | | "[object TreeBoxObjectPrototype]", |
1668 | | BoxObject_Binding::GetProtoObject |
1669 | | }; |
1670 | | |
1671 | | static const js::ClassOps sClassOps = { |
1672 | | _addProperty, /* addProperty */ |
1673 | | nullptr, /* delProperty */ |
1674 | | nullptr, /* enumerate */ |
1675 | | nullptr, /* newEnumerate */ |
1676 | | nullptr, /* resolve */ |
1677 | | nullptr, /* mayResolve */ |
1678 | | _finalize, /* finalize */ |
1679 | | nullptr, /* call */ |
1680 | | nullptr, /* hasInstance */ |
1681 | | nullptr, /* construct */ |
1682 | | nullptr, /* trace */ |
1683 | | }; |
1684 | | |
1685 | | static const js::ClassExtension sClassExtension = { |
1686 | | nullptr, /* weakmapKeyDelegateOp */ |
1687 | | _objectMoved /* objectMovedOp */ |
1688 | | }; |
1689 | | |
1690 | | static const DOMJSClass sClass = { |
1691 | | { "TreeBoxObject", |
1692 | | JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1), |
1693 | | &sClassOps, |
1694 | | JS_NULL_CLASS_SPEC, |
1695 | | &sClassExtension, |
1696 | | JS_NULL_OBJECT_OPS |
1697 | | }, |
1698 | | { prototypes::id::BoxObject, prototypes::id::TreeBoxObject, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count }, |
1699 | | IsBaseOf<nsISupports, mozilla::dom::TreeBoxObject >::value, |
1700 | | sNativePropertyHooks, |
1701 | | FindAssociatedGlobalForNative<mozilla::dom::TreeBoxObject>::Get, |
1702 | | GetProtoObjectHandle, |
1703 | | GetCCParticipant<mozilla::dom::TreeBoxObject>::Get() |
1704 | | }; |
1705 | | static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS, |
1706 | | "Must have the right minimal number of reserved slots."); |
1707 | | static_assert(1 >= 1, |
1708 | | "Must have enough reserved slots."); |
1709 | | |
1710 | | const JSClass* |
1711 | | GetJSClass() |
1712 | 0 | { |
1713 | 0 | return sClass.ToJSClass(); |
1714 | 0 | } |
1715 | | |
1716 | | bool |
1717 | | Wrap(JSContext* aCx, mozilla::dom::TreeBoxObject* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector) |
1718 | 0 | { |
1719 | 0 | static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::dom::TreeBoxObject>::value, |
1720 | 0 | "Shouldn't have wrappercached things that are not refcounted."); |
1721 | 0 | MOZ_ASSERT(static_cast<mozilla::dom::TreeBoxObject*>(aObject) == |
1722 | 0 | reinterpret_cast<mozilla::dom::TreeBoxObject*>(aObject), |
1723 | 0 | "Multiple inheritance for mozilla::dom::TreeBoxObject is broken."); |
1724 | 0 | MOZ_ASSERT(static_cast<mozilla::dom::BoxObject*>(aObject) == |
1725 | 0 | reinterpret_cast<mozilla::dom::BoxObject*>(aObject), |
1726 | 0 | "Multiple inheritance for mozilla::dom::BoxObject is broken."); |
1727 | 0 | MOZ_ASSERT(ToSupportsIsCorrect(aObject)); |
1728 | 0 | MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx)); |
1729 | 0 | MOZ_ASSERT(!aCache->GetWrapper(), |
1730 | 0 | "You should probably not be using Wrap() directly; use " |
1731 | 0 | "GetOrCreateDOMReflector instead"); |
1732 | 0 |
|
1733 | 0 | MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache), |
1734 | 0 | "nsISupports must be on our primary inheritance chain"); |
1735 | 0 |
|
1736 | 0 | JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject())); |
1737 | 0 | if (!global) { |
1738 | 0 | return false; |
1739 | 0 | } |
1740 | 0 | MOZ_ASSERT(JS_IsGlobalObject(global)); |
1741 | 0 | MOZ_ASSERT(JS::ObjectIsNotGray(global)); |
1742 | 0 |
|
1743 | 0 | // That might have ended up wrapping us already, due to the wonders |
1744 | 0 | // of XBL. Check for that, and bail out as needed. |
1745 | 0 | aReflector.set(aCache->GetWrapper()); |
1746 | 0 | if (aReflector) { |
1747 | | #ifdef DEBUG |
1748 | | AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto); |
1749 | | #endif // DEBUG |
1750 | | return true; |
1751 | 0 | } |
1752 | 0 |
|
1753 | 0 | JSAutoRealm ar(aCx, global); |
1754 | 0 | JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx); |
1755 | 0 | if (!canonicalProto) { |
1756 | 0 | return false; |
1757 | 0 | } |
1758 | 0 | JS::Rooted<JSObject*> proto(aCx); |
1759 | 0 | if (aGivenProto) { |
1760 | 0 | proto = aGivenProto; |
1761 | 0 | // Unfortunately, while aGivenProto was in the compartment of aCx |
1762 | 0 | // coming in, we changed compartments to that of "parent" so may need |
1763 | 0 | // to wrap the proto here. |
1764 | 0 | if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) { |
1765 | 0 | if (!JS_WrapObject(aCx, &proto)) { |
1766 | 0 | return false; |
1767 | 0 | } |
1768 | 0 | } |
1769 | 0 | } else { |
1770 | 0 | proto = canonicalProto; |
1771 | 0 | } |
1772 | 0 |
|
1773 | 0 | BindingJSObjectCreator<mozilla::dom::TreeBoxObject> creator(aCx); |
1774 | 0 | creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector); |
1775 | 0 | if (!aReflector) { |
1776 | 0 | return false; |
1777 | 0 | } |
1778 | 0 | |
1779 | 0 | aCache->SetWrapper(aReflector); |
1780 | 0 | creator.InitializationSucceeded(); |
1781 | 0 |
|
1782 | 0 | MOZ_ASSERT(aCache->GetWrapperPreserveColor() && |
1783 | 0 | aCache->GetWrapperPreserveColor() == aReflector); |
1784 | 0 | // If proto != canonicalProto, we have to preserve our wrapper; |
1785 | 0 | // otherwise we won't be able to properly recreate it later, since |
1786 | 0 | // we won't know what proto to use. Note that we don't check |
1787 | 0 | // aGivenProto here, since it's entirely possible (and even |
1788 | 0 | // somewhat common) to have a non-null aGivenProto which is the |
1789 | 0 | // same as canonicalProto. |
1790 | 0 | if (proto != canonicalProto) { |
1791 | 0 | PreserveWrapper(aObject); |
1792 | 0 | } |
1793 | 0 |
|
1794 | 0 | return true; |
1795 | 0 | } |
1796 | | |
1797 | | const NativePropertyHooks sNativePropertyHooks[] = { { |
1798 | | nullptr, |
1799 | | nullptr, |
1800 | | nullptr, |
1801 | | { sNativeProperties.Upcast(), nullptr }, |
1802 | | prototypes::id::TreeBoxObject, |
1803 | | constructors::id::_ID_Count, |
1804 | | BoxObject_Binding::sNativePropertyHooks, |
1805 | | &DefaultXrayExpandoObjectClass |
1806 | | } }; |
1807 | | |
1808 | | void |
1809 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal) |
1810 | 0 | { |
1811 | 0 | JS::Handle<JSObject*> parentProto(BoxObject_Binding::GetProtoObjectHandle(aCx)); |
1812 | 0 | if (!parentProto) { |
1813 | 0 | return; |
1814 | 0 | } |
1815 | 0 | |
1816 | 0 | static bool sIdsInited = false; |
1817 | 0 | if (!sIdsInited && NS_IsMainThread()) { |
1818 | 0 | if (!InitIds(aCx, sNativeProperties.Upcast())) { |
1819 | 0 | return; |
1820 | 0 | } |
1821 | 0 | sIdsInited = true; |
1822 | 0 | } |
1823 | 0 |
|
1824 | 0 | JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::TreeBoxObject); |
1825 | 0 | JS::Heap<JSObject*>* interfaceCache = nullptr; |
1826 | 0 | dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, |
1827 | 0 | &sPrototypeClass.mBase, protoCache, |
1828 | 0 | nullptr, |
1829 | 0 | nullptr, nullptr, 0, nullptr, |
1830 | 0 | interfaceCache, |
1831 | 0 | sNativeProperties.Upcast(), |
1832 | 0 | nullptr, |
1833 | 0 | nullptr, aDefineOnGlobal, |
1834 | 0 | nullptr, |
1835 | 0 | false); |
1836 | 0 | } |
1837 | | |
1838 | | } // namespace TreeBoxObject_Binding |
1839 | | |
1840 | | |
1841 | | |
1842 | | } // namespace dom |
1843 | | } // namespace mozilla |