/work/obj-fuzz/dom/bindings/TreeContentViewBinding.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* THIS FILE IS AUTOGENERATED FROM TreeContentView.webidl BY Codegen.py - DO NOT EDIT */ |
2 | | |
3 | | #include "TreeContentViewBinding.h" |
4 | | #include "WrapperFactory.h" |
5 | | #include "mozilla/OwningNonNull.h" |
6 | | #include "mozilla/dom/BindingUtils.h" |
7 | | #include "mozilla/dom/DOMJSClass.h" |
8 | | #include "mozilla/dom/DataTransfer.h" |
9 | | #include "mozilla/dom/Element.h" |
10 | | #include "mozilla/dom/NonRefcountedDOMObject.h" |
11 | | #include "mozilla/dom/Nullable.h" |
12 | | #include "mozilla/dom/PrimitiveConversions.h" |
13 | | #include "mozilla/dom/TreeBoxObject.h" |
14 | | #include "mozilla/dom/XrayExpandoClass.h" |
15 | | #include "nsContentUtils.h" |
16 | | #include "nsISupports.h" |
17 | | #include "nsITreeSelection.h" |
18 | | #include "nsTreeColumns.h" |
19 | | #include "nsTreeContentView.h" |
20 | | #include "xpcjsid.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 | | namespace TreeContentView_Binding { |
30 | | |
31 | | MOZ_CAN_RUN_SCRIPT static bool |
32 | | getItemAtIndex(JSContext* cx, JS::Handle<JSObject*> obj, nsTreeContentView* self, const JSJitMethodCallArgs& args) |
33 | 0 | { |
34 | 0 | AUTO_PROFILER_LABEL_FAST("TreeContentView.getItemAtIndex", DOM, cx); |
35 | 0 |
|
36 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
37 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeContentView.getItemAtIndex"); |
38 | 0 | } |
39 | 0 | int32_t arg0; |
40 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
41 | 0 | return false; |
42 | 0 | } |
43 | 0 | FastErrorResult rv; |
44 | 0 | auto result(StrongOrRawPtr<mozilla::dom::Element>(self->GetItemAtIndex(arg0, rv))); |
45 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
46 | 0 | return false; |
47 | 0 | } |
48 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
49 | 0 | if (!result) { |
50 | 0 | args.rval().setNull(); |
51 | 0 | return true; |
52 | 0 | } |
53 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
54 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
55 | 0 | return false; |
56 | 0 | } |
57 | 0 | return true; |
58 | 0 | } |
59 | | |
60 | | static const JSJitInfo getItemAtIndex_methodinfo = { |
61 | | { (JSJitGetterOp)getItemAtIndex }, |
62 | | { prototypes::id::TreeContentView }, |
63 | | { PrototypeTraits<prototypes::id::TreeContentView>::Depth }, |
64 | | JSJitInfo::Method, |
65 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
66 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
67 | | false, /* isInfallible. False in setters. */ |
68 | | false, /* isMovable. Not relevant for setters. */ |
69 | | false, /* isEliminatable. Not relevant for setters. */ |
70 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
71 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
72 | | false, /* isTypedMethod. Only relevant for methods. */ |
73 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
74 | | }; |
75 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
76 | | static_assert(0 < 1, "There is no slot for us"); |
77 | | |
78 | | MOZ_CAN_RUN_SCRIPT static bool |
79 | | getIndexOfItem(JSContext* cx, JS::Handle<JSObject*> obj, nsTreeContentView* self, const JSJitMethodCallArgs& args) |
80 | 0 | { |
81 | 0 | AUTO_PROFILER_LABEL_FAST("TreeContentView.getIndexOfItem", DOM, cx); |
82 | 0 |
|
83 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
84 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeContentView.getIndexOfItem"); |
85 | 0 | } |
86 | 0 | mozilla::dom::Element* arg0; |
87 | 0 | if (args[0].isObject()) { |
88 | 0 | { |
89 | 0 | nsresult rv = UnwrapObject<prototypes::id::Element, mozilla::dom::Element>(args[0], arg0); |
90 | 0 | if (NS_FAILED(rv)) { |
91 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of TreeContentView.getIndexOfItem", "Element"); |
92 | 0 | return false; |
93 | 0 | } |
94 | 0 | } |
95 | 0 | } else if (args[0].isNullOrUndefined()) { |
96 | 0 | arg0 = nullptr; |
97 | 0 | } else { |
98 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of TreeContentView.getIndexOfItem"); |
99 | 0 | return false; |
100 | 0 | } |
101 | 0 | int32_t result(self->GetIndexOfItem(MOZ_KnownLive(Constify(arg0)))); |
102 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
103 | 0 | args.rval().setInt32(int32_t(result)); |
104 | 0 | return true; |
105 | 0 | } |
106 | | |
107 | | static const JSJitInfo getIndexOfItem_methodinfo = { |
108 | | { (JSJitGetterOp)getIndexOfItem }, |
109 | | { prototypes::id::TreeContentView }, |
110 | | { PrototypeTraits<prototypes::id::TreeContentView>::Depth }, |
111 | | JSJitInfo::Method, |
112 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
113 | | JSVAL_TYPE_INT32, /* returnType. Not relevant for setters. */ |
114 | | false, /* isInfallible. False in setters. */ |
115 | | false, /* isMovable. Not relevant for setters. */ |
116 | | false, /* isEliminatable. Not relevant for setters. */ |
117 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
118 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
119 | | false, /* isTypedMethod. Only relevant for methods. */ |
120 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
121 | | }; |
122 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
123 | | static_assert(0 < 1, "There is no slot for us"); |
124 | | |
125 | | MOZ_CAN_RUN_SCRIPT static bool |
126 | | get_rowCount(JSContext* cx, JS::Handle<JSObject*> obj, nsTreeContentView* self, JSJitGetterCallArgs args) |
127 | 0 | { |
128 | 0 | AUTO_PROFILER_LABEL_FAST("get TreeContentView.rowCount", DOM, cx); |
129 | 0 |
|
130 | 0 | int32_t result(self->RowCount()); |
131 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
132 | 0 | args.rval().setInt32(int32_t(result)); |
133 | 0 | return true; |
134 | 0 | } |
135 | | |
136 | | static const JSJitInfo rowCount_getterinfo = { |
137 | | { (JSJitGetterOp)get_rowCount }, |
138 | | { prototypes::id::TreeContentView }, |
139 | | { PrototypeTraits<prototypes::id::TreeContentView>::Depth }, |
140 | | JSJitInfo::Getter, |
141 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
142 | | JSVAL_TYPE_INT32, /* returnType. Not relevant for setters. */ |
143 | | true, /* isInfallible. False in setters. */ |
144 | | false, /* isMovable. Not relevant for setters. */ |
145 | | false, /* isEliminatable. Not relevant for setters. */ |
146 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
147 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
148 | | false, /* isTypedMethod. Only relevant for methods. */ |
149 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
150 | | }; |
151 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
152 | | static_assert(0 < 1, "There is no slot for us"); |
153 | | |
154 | | MOZ_CAN_RUN_SCRIPT static bool |
155 | | get_selection(JSContext* cx, JS::Handle<JSObject*> obj, nsTreeContentView* self, JSJitGetterCallArgs args) |
156 | 0 | { |
157 | 0 | AUTO_PROFILER_LABEL_FAST("get TreeContentView.selection", DOM, cx); |
158 | 0 |
|
159 | 0 | auto result(StrongOrRawPtr<nsITreeSelection>(self->GetSelection())); |
160 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
161 | 0 | if (!result) { |
162 | 0 | args.rval().setNull(); |
163 | 0 | return true; |
164 | 0 | } |
165 | 0 | if (!WrapObject(cx, result, &NS_GET_IID(nsITreeSelection), args.rval())) { |
166 | 0 | return false; |
167 | 0 | } |
168 | 0 | return true; |
169 | 0 | } |
170 | | |
171 | | MOZ_CAN_RUN_SCRIPT static bool |
172 | | set_selection(JSContext* cx, JS::Handle<JSObject*> obj, nsTreeContentView* self, JSJitSetterCallArgs args) |
173 | 0 | { |
174 | 0 | AUTO_PROFILER_LABEL_FAST("set TreeContentView.selection", DOM, cx); |
175 | 0 |
|
176 | 0 | nsITreeSelection* arg0; |
177 | 0 | RefPtr<nsITreeSelection> arg0_holder; |
178 | 0 | if (args[0].isObject()) { |
179 | 0 | JS::Rooted<JSObject*> source(cx, &args[0].toObject()); |
180 | 0 | if (NS_FAILED(UnwrapArg<nsITreeSelection>(cx, source, getter_AddRefs(arg0_holder)))) { |
181 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Value being assigned to TreeContentView.selection", "nsITreeSelection"); |
182 | 0 | return false; |
183 | 0 | } |
184 | 0 | MOZ_ASSERT(arg0_holder); |
185 | 0 | arg0 = arg0_holder; |
186 | 0 | } else if (args[0].isNullOrUndefined()) { |
187 | 0 | arg0 = nullptr; |
188 | 0 | } else { |
189 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Value being assigned to TreeContentView.selection"); |
190 | 0 | return false; |
191 | 0 | } |
192 | 0 | FastErrorResult rv; |
193 | 0 | self->SetSelection(MOZ_KnownLive(Constify(arg0)), rv); |
194 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
195 | 0 | return false; |
196 | 0 | } |
197 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
198 | 0 |
|
199 | 0 | return true; |
200 | 0 | } |
201 | | |
202 | | static const JSJitInfo selection_getterinfo = { |
203 | | { (JSJitGetterOp)get_selection }, |
204 | | { prototypes::id::TreeContentView }, |
205 | | { PrototypeTraits<prototypes::id::TreeContentView>::Depth }, |
206 | | JSJitInfo::Getter, |
207 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
208 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
209 | | false, /* isInfallible. False in setters. */ |
210 | | false, /* isMovable. Not relevant for setters. */ |
211 | | false, /* isEliminatable. Not relevant for setters. */ |
212 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
213 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
214 | | false, /* isTypedMethod. Only relevant for methods. */ |
215 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
216 | | }; |
217 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
218 | | static_assert(0 < 1, "There is no slot for us"); |
219 | | static const JSJitInfo selection_setterinfo = { |
220 | | { (JSJitGetterOp)set_selection }, |
221 | | { prototypes::id::TreeContentView }, |
222 | | { PrototypeTraits<prototypes::id::TreeContentView>::Depth }, |
223 | | JSJitInfo::Setter, |
224 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
225 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
226 | | false, /* isInfallible. False in setters. */ |
227 | | false, /* isMovable. Not relevant for setters. */ |
228 | | false, /* isEliminatable. Not relevant for setters. */ |
229 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
230 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
231 | | false, /* isTypedMethod. Only relevant for methods. */ |
232 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
233 | | }; |
234 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
235 | | static_assert(0 < 1, "There is no slot for us"); |
236 | | |
237 | | MOZ_CAN_RUN_SCRIPT static bool |
238 | | getRowProperties(JSContext* cx, JS::Handle<JSObject*> obj, nsTreeContentView* self, const JSJitMethodCallArgs& args) |
239 | 0 | { |
240 | 0 | AUTO_PROFILER_LABEL_FAST("TreeContentView.getRowProperties", DOM, cx); |
241 | 0 |
|
242 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
243 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeContentView.getRowProperties"); |
244 | 0 | } |
245 | 0 | int32_t arg0; |
246 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
247 | 0 | return false; |
248 | 0 | } |
249 | 0 | FastErrorResult rv; |
250 | 0 | DOMString result; |
251 | 0 | self->GetRowProperties(arg0, result, rv); |
252 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
253 | 0 | return false; |
254 | 0 | } |
255 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
256 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
257 | 0 | return false; |
258 | 0 | } |
259 | 0 | return true; |
260 | 0 | } |
261 | | |
262 | | static const JSJitInfo getRowProperties_methodinfo = { |
263 | | { (JSJitGetterOp)getRowProperties }, |
264 | | { prototypes::id::TreeContentView }, |
265 | | { PrototypeTraits<prototypes::id::TreeContentView>::Depth }, |
266 | | JSJitInfo::Method, |
267 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
268 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
269 | | false, /* isInfallible. False in setters. */ |
270 | | false, /* isMovable. Not relevant for setters. */ |
271 | | false, /* isEliminatable. Not relevant for setters. */ |
272 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
273 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
274 | | false, /* isTypedMethod. Only relevant for methods. */ |
275 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
276 | | }; |
277 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
278 | | static_assert(0 < 1, "There is no slot for us"); |
279 | | |
280 | | MOZ_CAN_RUN_SCRIPT static bool |
281 | | getCellProperties(JSContext* cx, JS::Handle<JSObject*> obj, nsTreeContentView* self, const JSJitMethodCallArgs& args) |
282 | 0 | { |
283 | 0 | AUTO_PROFILER_LABEL_FAST("TreeContentView.getCellProperties", DOM, cx); |
284 | 0 |
|
285 | 0 | if (MOZ_UNLIKELY(args.length() < 2)) { |
286 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeContentView.getCellProperties"); |
287 | 0 | } |
288 | 0 | int32_t arg0; |
289 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
290 | 0 | return false; |
291 | 0 | } |
292 | 0 | NonNull<nsTreeColumn> arg1; |
293 | 0 | if (args[1].isObject()) { |
294 | 0 | { |
295 | 0 | nsresult rv = UnwrapObject<prototypes::id::TreeColumn, nsTreeColumn>(args[1], arg1); |
296 | 0 | if (NS_FAILED(rv)) { |
297 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 2 of TreeContentView.getCellProperties", "TreeColumn"); |
298 | 0 | return false; |
299 | 0 | } |
300 | 0 | } |
301 | 0 | } else { |
302 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 2 of TreeContentView.getCellProperties"); |
303 | 0 | return false; |
304 | 0 | } |
305 | 0 | FastErrorResult rv; |
306 | 0 | DOMString result; |
307 | 0 | self->GetCellProperties(arg0, MOZ_KnownLive(NonNullHelper(arg1)), result, rv); |
308 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
309 | 0 | return false; |
310 | 0 | } |
311 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
312 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
313 | 0 | return false; |
314 | 0 | } |
315 | 0 | return true; |
316 | 0 | } |
317 | | |
318 | | static const JSJitInfo getCellProperties_methodinfo = { |
319 | | { (JSJitGetterOp)getCellProperties }, |
320 | | { prototypes::id::TreeContentView }, |
321 | | { PrototypeTraits<prototypes::id::TreeContentView>::Depth }, |
322 | | JSJitInfo::Method, |
323 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
324 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
325 | | false, /* isInfallible. False in setters. */ |
326 | | false, /* isMovable. Not relevant for setters. */ |
327 | | false, /* isEliminatable. Not relevant for setters. */ |
328 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
329 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
330 | | false, /* isTypedMethod. Only relevant for methods. */ |
331 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
332 | | }; |
333 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
334 | | static_assert(0 < 1, "There is no slot for us"); |
335 | | |
336 | | MOZ_CAN_RUN_SCRIPT static bool |
337 | | getColumnProperties(JSContext* cx, JS::Handle<JSObject*> obj, nsTreeContentView* self, const JSJitMethodCallArgs& args) |
338 | 0 | { |
339 | 0 | AUTO_PROFILER_LABEL_FAST("TreeContentView.getColumnProperties", DOM, cx); |
340 | 0 |
|
341 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
342 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeContentView.getColumnProperties"); |
343 | 0 | } |
344 | 0 | NonNull<nsTreeColumn> arg0; |
345 | 0 | if (args[0].isObject()) { |
346 | 0 | { |
347 | 0 | nsresult rv = UnwrapObject<prototypes::id::TreeColumn, nsTreeColumn>(args[0], arg0); |
348 | 0 | if (NS_FAILED(rv)) { |
349 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of TreeContentView.getColumnProperties", "TreeColumn"); |
350 | 0 | return false; |
351 | 0 | } |
352 | 0 | } |
353 | 0 | } else { |
354 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of TreeContentView.getColumnProperties"); |
355 | 0 | return false; |
356 | 0 | } |
357 | 0 | DOMString result; |
358 | 0 | self->GetColumnProperties(MOZ_KnownLive(NonNullHelper(arg0)), result); |
359 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
360 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
361 | 0 | return false; |
362 | 0 | } |
363 | 0 | return true; |
364 | 0 | } |
365 | | |
366 | | static const JSJitInfo getColumnProperties_methodinfo = { |
367 | | { (JSJitGetterOp)getColumnProperties }, |
368 | | { prototypes::id::TreeContentView }, |
369 | | { PrototypeTraits<prototypes::id::TreeContentView>::Depth }, |
370 | | JSJitInfo::Method, |
371 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
372 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
373 | | false, /* isInfallible. False in setters. */ |
374 | | false, /* isMovable. Not relevant for setters. */ |
375 | | false, /* isEliminatable. Not relevant for setters. */ |
376 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
377 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
378 | | false, /* isTypedMethod. Only relevant for methods. */ |
379 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
380 | | }; |
381 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
382 | | static_assert(0 < 1, "There is no slot for us"); |
383 | | |
384 | | MOZ_CAN_RUN_SCRIPT static bool |
385 | | isContainer(JSContext* cx, JS::Handle<JSObject*> obj, nsTreeContentView* self, const JSJitMethodCallArgs& args) |
386 | 0 | { |
387 | 0 | AUTO_PROFILER_LABEL_FAST("TreeContentView.isContainer", DOM, cx); |
388 | 0 |
|
389 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
390 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeContentView.isContainer"); |
391 | 0 | } |
392 | 0 | int32_t arg0; |
393 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
394 | 0 | return false; |
395 | 0 | } |
396 | 0 | FastErrorResult rv; |
397 | 0 | bool result(self->IsContainer(arg0, rv)); |
398 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
399 | 0 | return false; |
400 | 0 | } |
401 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
402 | 0 | args.rval().setBoolean(result); |
403 | 0 | return true; |
404 | 0 | } |
405 | | |
406 | | static const JSJitInfo isContainer_methodinfo = { |
407 | | { (JSJitGetterOp)isContainer }, |
408 | | { prototypes::id::TreeContentView }, |
409 | | { PrototypeTraits<prototypes::id::TreeContentView>::Depth }, |
410 | | JSJitInfo::Method, |
411 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
412 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
413 | | false, /* isInfallible. False in setters. */ |
414 | | false, /* isMovable. Not relevant for setters. */ |
415 | | false, /* isEliminatable. Not relevant for setters. */ |
416 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
417 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
418 | | false, /* isTypedMethod. Only relevant for methods. */ |
419 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
420 | | }; |
421 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
422 | | static_assert(0 < 1, "There is no slot for us"); |
423 | | |
424 | | MOZ_CAN_RUN_SCRIPT static bool |
425 | | isContainerOpen(JSContext* cx, JS::Handle<JSObject*> obj, nsTreeContentView* self, const JSJitMethodCallArgs& args) |
426 | 0 | { |
427 | 0 | AUTO_PROFILER_LABEL_FAST("TreeContentView.isContainerOpen", DOM, cx); |
428 | 0 |
|
429 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
430 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeContentView.isContainerOpen"); |
431 | 0 | } |
432 | 0 | int32_t arg0; |
433 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
434 | 0 | return false; |
435 | 0 | } |
436 | 0 | FastErrorResult rv; |
437 | 0 | bool result(self->IsContainerOpen(arg0, rv)); |
438 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
439 | 0 | return false; |
440 | 0 | } |
441 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
442 | 0 | args.rval().setBoolean(result); |
443 | 0 | return true; |
444 | 0 | } |
445 | | |
446 | | static const JSJitInfo isContainerOpen_methodinfo = { |
447 | | { (JSJitGetterOp)isContainerOpen }, |
448 | | { prototypes::id::TreeContentView }, |
449 | | { PrototypeTraits<prototypes::id::TreeContentView>::Depth }, |
450 | | JSJitInfo::Method, |
451 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
452 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
453 | | false, /* isInfallible. False in setters. */ |
454 | | false, /* isMovable. Not relevant for setters. */ |
455 | | false, /* isEliminatable. Not relevant for setters. */ |
456 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
457 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
458 | | false, /* isTypedMethod. Only relevant for methods. */ |
459 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
460 | | }; |
461 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
462 | | static_assert(0 < 1, "There is no slot for us"); |
463 | | |
464 | | MOZ_CAN_RUN_SCRIPT static bool |
465 | | isContainerEmpty(JSContext* cx, JS::Handle<JSObject*> obj, nsTreeContentView* self, const JSJitMethodCallArgs& args) |
466 | 0 | { |
467 | 0 | AUTO_PROFILER_LABEL_FAST("TreeContentView.isContainerEmpty", DOM, cx); |
468 | 0 |
|
469 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
470 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeContentView.isContainerEmpty"); |
471 | 0 | } |
472 | 0 | int32_t arg0; |
473 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
474 | 0 | return false; |
475 | 0 | } |
476 | 0 | FastErrorResult rv; |
477 | 0 | bool result(self->IsContainerEmpty(arg0, rv)); |
478 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
479 | 0 | return false; |
480 | 0 | } |
481 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
482 | 0 | args.rval().setBoolean(result); |
483 | 0 | return true; |
484 | 0 | } |
485 | | |
486 | | static const JSJitInfo isContainerEmpty_methodinfo = { |
487 | | { (JSJitGetterOp)isContainerEmpty }, |
488 | | { prototypes::id::TreeContentView }, |
489 | | { PrototypeTraits<prototypes::id::TreeContentView>::Depth }, |
490 | | JSJitInfo::Method, |
491 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
492 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
493 | | false, /* isInfallible. False in setters. */ |
494 | | false, /* isMovable. Not relevant for setters. */ |
495 | | false, /* isEliminatable. Not relevant for setters. */ |
496 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
497 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
498 | | false, /* isTypedMethod. Only relevant for methods. */ |
499 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
500 | | }; |
501 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
502 | | static_assert(0 < 1, "There is no slot for us"); |
503 | | |
504 | | MOZ_CAN_RUN_SCRIPT static bool |
505 | | isSeparator(JSContext* cx, JS::Handle<JSObject*> obj, nsTreeContentView* self, const JSJitMethodCallArgs& args) |
506 | 0 | { |
507 | 0 | AUTO_PROFILER_LABEL_FAST("TreeContentView.isSeparator", DOM, cx); |
508 | 0 |
|
509 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
510 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeContentView.isSeparator"); |
511 | 0 | } |
512 | 0 | int32_t arg0; |
513 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
514 | 0 | return false; |
515 | 0 | } |
516 | 0 | FastErrorResult rv; |
517 | 0 | bool result(self->IsSeparator(arg0, rv)); |
518 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
519 | 0 | return false; |
520 | 0 | } |
521 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
522 | 0 | args.rval().setBoolean(result); |
523 | 0 | return true; |
524 | 0 | } |
525 | | |
526 | | static const JSJitInfo isSeparator_methodinfo = { |
527 | | { (JSJitGetterOp)isSeparator }, |
528 | | { prototypes::id::TreeContentView }, |
529 | | { PrototypeTraits<prototypes::id::TreeContentView>::Depth }, |
530 | | JSJitInfo::Method, |
531 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
532 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
533 | | false, /* isInfallible. False in setters. */ |
534 | | false, /* isMovable. Not relevant for setters. */ |
535 | | false, /* isEliminatable. Not relevant for setters. */ |
536 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
537 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
538 | | false, /* isTypedMethod. Only relevant for methods. */ |
539 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
540 | | }; |
541 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
542 | | static_assert(0 < 1, "There is no slot for us"); |
543 | | |
544 | | MOZ_CAN_RUN_SCRIPT static bool |
545 | | isSorted(JSContext* cx, JS::Handle<JSObject*> obj, nsTreeContentView* self, const JSJitMethodCallArgs& args) |
546 | 0 | { |
547 | 0 | AUTO_PROFILER_LABEL_FAST("TreeContentView.isSorted", DOM, cx); |
548 | 0 |
|
549 | 0 | bool result(self->IsSorted()); |
550 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
551 | 0 | args.rval().setBoolean(result); |
552 | 0 | return true; |
553 | 0 | } |
554 | | |
555 | | static const JSJitInfo isSorted_methodinfo = { |
556 | | { (JSJitGetterOp)isSorted }, |
557 | | { prototypes::id::TreeContentView }, |
558 | | { PrototypeTraits<prototypes::id::TreeContentView>::Depth }, |
559 | | JSJitInfo::Method, |
560 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
561 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
562 | | true, /* isInfallible. False in setters. */ |
563 | | false, /* isMovable. Not relevant for setters. */ |
564 | | false, /* isEliminatable. Not relevant for setters. */ |
565 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
566 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
567 | | false, /* isTypedMethod. Only relevant for methods. */ |
568 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
569 | | }; |
570 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
571 | | static_assert(0 < 1, "There is no slot for us"); |
572 | | |
573 | | MOZ_CAN_RUN_SCRIPT static bool |
574 | | canDrop(JSContext* cx, JS::Handle<JSObject*> obj, nsTreeContentView* self, const JSJitMethodCallArgs& args) |
575 | 0 | { |
576 | 0 | AUTO_PROFILER_LABEL_FAST("TreeContentView.canDrop", DOM, cx); |
577 | 0 |
|
578 | 0 | if (MOZ_UNLIKELY(args.length() < 3)) { |
579 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeContentView.canDrop"); |
580 | 0 | } |
581 | 0 | int32_t arg0; |
582 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
583 | 0 | return false; |
584 | 0 | } |
585 | 0 | int32_t arg1; |
586 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[1], &arg1)) { |
587 | 0 | return false; |
588 | 0 | } |
589 | 0 | mozilla::dom::DataTransfer* arg2; |
590 | 0 | if (args[2].isObject()) { |
591 | 0 | { |
592 | 0 | nsresult rv = UnwrapObject<prototypes::id::DataTransfer, mozilla::dom::DataTransfer>(args[2], arg2); |
593 | 0 | if (NS_FAILED(rv)) { |
594 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 3 of TreeContentView.canDrop", "DataTransfer"); |
595 | 0 | return false; |
596 | 0 | } |
597 | 0 | } |
598 | 0 | } else if (args[2].isNullOrUndefined()) { |
599 | 0 | arg2 = nullptr; |
600 | 0 | } else { |
601 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 3 of TreeContentView.canDrop"); |
602 | 0 | return false; |
603 | 0 | } |
604 | 0 | FastErrorResult rv; |
605 | 0 | bool result(self->CanDrop(arg0, arg1, MOZ_KnownLive(Constify(arg2)), rv)); |
606 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
607 | 0 | return false; |
608 | 0 | } |
609 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
610 | 0 | args.rval().setBoolean(result); |
611 | 0 | return true; |
612 | 0 | } |
613 | | |
614 | | static const JSJitInfo canDrop_methodinfo = { |
615 | | { (JSJitGetterOp)canDrop }, |
616 | | { prototypes::id::TreeContentView }, |
617 | | { PrototypeTraits<prototypes::id::TreeContentView>::Depth }, |
618 | | JSJitInfo::Method, |
619 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
620 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
621 | | false, /* isInfallible. False in setters. */ |
622 | | false, /* isMovable. Not relevant for setters. */ |
623 | | false, /* isEliminatable. Not relevant for setters. */ |
624 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
625 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
626 | | false, /* isTypedMethod. Only relevant for methods. */ |
627 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
628 | | }; |
629 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
630 | | static_assert(0 < 1, "There is no slot for us"); |
631 | | |
632 | | MOZ_CAN_RUN_SCRIPT static bool |
633 | | drop(JSContext* cx, JS::Handle<JSObject*> obj, nsTreeContentView* self, const JSJitMethodCallArgs& args) |
634 | 0 | { |
635 | 0 | AUTO_PROFILER_LABEL_FAST("TreeContentView.drop", DOM, cx); |
636 | 0 |
|
637 | 0 | if (MOZ_UNLIKELY(args.length() < 3)) { |
638 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeContentView.drop"); |
639 | 0 | } |
640 | 0 | int32_t arg0; |
641 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
642 | 0 | return false; |
643 | 0 | } |
644 | 0 | int32_t arg1; |
645 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[1], &arg1)) { |
646 | 0 | return false; |
647 | 0 | } |
648 | 0 | mozilla::dom::DataTransfer* arg2; |
649 | 0 | if (args[2].isObject()) { |
650 | 0 | { |
651 | 0 | nsresult rv = UnwrapObject<prototypes::id::DataTransfer, mozilla::dom::DataTransfer>(args[2], arg2); |
652 | 0 | if (NS_FAILED(rv)) { |
653 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 3 of TreeContentView.drop", "DataTransfer"); |
654 | 0 | return false; |
655 | 0 | } |
656 | 0 | } |
657 | 0 | } else if (args[2].isNullOrUndefined()) { |
658 | 0 | arg2 = nullptr; |
659 | 0 | } else { |
660 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 3 of TreeContentView.drop"); |
661 | 0 | return false; |
662 | 0 | } |
663 | 0 | FastErrorResult rv; |
664 | 0 | self->Drop(arg0, arg1, MOZ_KnownLive(Constify(arg2)), rv); |
665 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
666 | 0 | return false; |
667 | 0 | } |
668 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
669 | 0 | args.rval().setUndefined(); |
670 | 0 | return true; |
671 | 0 | } |
672 | | |
673 | | static const JSJitInfo drop_methodinfo = { |
674 | | { (JSJitGetterOp)drop }, |
675 | | { prototypes::id::TreeContentView }, |
676 | | { PrototypeTraits<prototypes::id::TreeContentView>::Depth }, |
677 | | JSJitInfo::Method, |
678 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
679 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
680 | | false, /* isInfallible. False in setters. */ |
681 | | false, /* isMovable. Not relevant for setters. */ |
682 | | false, /* isEliminatable. Not relevant for setters. */ |
683 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
684 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
685 | | false, /* isTypedMethod. Only relevant for methods. */ |
686 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
687 | | }; |
688 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
689 | | static_assert(0 < 1, "There is no slot for us"); |
690 | | |
691 | | MOZ_CAN_RUN_SCRIPT static bool |
692 | | getParentIndex(JSContext* cx, JS::Handle<JSObject*> obj, nsTreeContentView* self, const JSJitMethodCallArgs& args) |
693 | 0 | { |
694 | 0 | AUTO_PROFILER_LABEL_FAST("TreeContentView.getParentIndex", DOM, cx); |
695 | 0 |
|
696 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
697 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeContentView.getParentIndex"); |
698 | 0 | } |
699 | 0 | int32_t arg0; |
700 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
701 | 0 | return false; |
702 | 0 | } |
703 | 0 | FastErrorResult rv; |
704 | 0 | int32_t result(self->GetParentIndex(arg0, rv)); |
705 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
706 | 0 | return false; |
707 | 0 | } |
708 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
709 | 0 | args.rval().setInt32(int32_t(result)); |
710 | 0 | return true; |
711 | 0 | } |
712 | | |
713 | | static const JSJitInfo getParentIndex_methodinfo = { |
714 | | { (JSJitGetterOp)getParentIndex }, |
715 | | { prototypes::id::TreeContentView }, |
716 | | { PrototypeTraits<prototypes::id::TreeContentView>::Depth }, |
717 | | JSJitInfo::Method, |
718 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
719 | | JSVAL_TYPE_INT32, /* returnType. Not relevant for setters. */ |
720 | | false, /* isInfallible. False in setters. */ |
721 | | false, /* isMovable. Not relevant for setters. */ |
722 | | false, /* isEliminatable. Not relevant for setters. */ |
723 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
724 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
725 | | false, /* isTypedMethod. Only relevant for methods. */ |
726 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
727 | | }; |
728 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
729 | | static_assert(0 < 1, "There is no slot for us"); |
730 | | |
731 | | MOZ_CAN_RUN_SCRIPT static bool |
732 | | hasNextSibling(JSContext* cx, JS::Handle<JSObject*> obj, nsTreeContentView* self, const JSJitMethodCallArgs& args) |
733 | 0 | { |
734 | 0 | AUTO_PROFILER_LABEL_FAST("TreeContentView.hasNextSibling", DOM, cx); |
735 | 0 |
|
736 | 0 | if (MOZ_UNLIKELY(args.length() < 2)) { |
737 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeContentView.hasNextSibling"); |
738 | 0 | } |
739 | 0 | int32_t arg0; |
740 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
741 | 0 | return false; |
742 | 0 | } |
743 | 0 | int32_t arg1; |
744 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[1], &arg1)) { |
745 | 0 | return false; |
746 | 0 | } |
747 | 0 | FastErrorResult rv; |
748 | 0 | bool result(self->HasNextSibling(arg0, arg1, rv)); |
749 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
750 | 0 | return false; |
751 | 0 | } |
752 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
753 | 0 | args.rval().setBoolean(result); |
754 | 0 | return true; |
755 | 0 | } |
756 | | |
757 | | static const JSJitInfo hasNextSibling_methodinfo = { |
758 | | { (JSJitGetterOp)hasNextSibling }, |
759 | | { prototypes::id::TreeContentView }, |
760 | | { PrototypeTraits<prototypes::id::TreeContentView>::Depth }, |
761 | | JSJitInfo::Method, |
762 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
763 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
764 | | false, /* isInfallible. False in setters. */ |
765 | | false, /* isMovable. Not relevant for setters. */ |
766 | | false, /* isEliminatable. Not relevant for setters. */ |
767 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
768 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
769 | | false, /* isTypedMethod. Only relevant for methods. */ |
770 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
771 | | }; |
772 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
773 | | static_assert(0 < 1, "There is no slot for us"); |
774 | | |
775 | | MOZ_CAN_RUN_SCRIPT static bool |
776 | | getLevel(JSContext* cx, JS::Handle<JSObject*> obj, nsTreeContentView* self, const JSJitMethodCallArgs& args) |
777 | 0 | { |
778 | 0 | AUTO_PROFILER_LABEL_FAST("TreeContentView.getLevel", DOM, cx); |
779 | 0 |
|
780 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
781 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeContentView.getLevel"); |
782 | 0 | } |
783 | 0 | int32_t arg0; |
784 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
785 | 0 | return false; |
786 | 0 | } |
787 | 0 | FastErrorResult rv; |
788 | 0 | int32_t result(self->GetLevel(arg0, rv)); |
789 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
790 | 0 | return false; |
791 | 0 | } |
792 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
793 | 0 | args.rval().setInt32(int32_t(result)); |
794 | 0 | return true; |
795 | 0 | } |
796 | | |
797 | | static const JSJitInfo getLevel_methodinfo = { |
798 | | { (JSJitGetterOp)getLevel }, |
799 | | { prototypes::id::TreeContentView }, |
800 | | { PrototypeTraits<prototypes::id::TreeContentView>::Depth }, |
801 | | JSJitInfo::Method, |
802 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
803 | | JSVAL_TYPE_INT32, /* 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 | | getImageSrc(JSContext* cx, JS::Handle<JSObject*> obj, nsTreeContentView* self, const JSJitMethodCallArgs& args) |
817 | 0 | { |
818 | 0 | AUTO_PROFILER_LABEL_FAST("TreeContentView.getImageSrc", DOM, cx); |
819 | 0 |
|
820 | 0 | if (MOZ_UNLIKELY(args.length() < 2)) { |
821 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeContentView.getImageSrc"); |
822 | 0 | } |
823 | 0 | int32_t arg0; |
824 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
825 | 0 | return false; |
826 | 0 | } |
827 | 0 | NonNull<nsTreeColumn> arg1; |
828 | 0 | if (args[1].isObject()) { |
829 | 0 | { |
830 | 0 | nsresult rv = UnwrapObject<prototypes::id::TreeColumn, nsTreeColumn>(args[1], arg1); |
831 | 0 | if (NS_FAILED(rv)) { |
832 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 2 of TreeContentView.getImageSrc", "TreeColumn"); |
833 | 0 | return false; |
834 | 0 | } |
835 | 0 | } |
836 | 0 | } else { |
837 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 2 of TreeContentView.getImageSrc"); |
838 | 0 | return false; |
839 | 0 | } |
840 | 0 | FastErrorResult rv; |
841 | 0 | DOMString result; |
842 | 0 | self->GetImageSrc(arg0, MOZ_KnownLive(NonNullHelper(arg1)), result, rv); |
843 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
844 | 0 | return false; |
845 | 0 | } |
846 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
847 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
848 | 0 | return false; |
849 | 0 | } |
850 | 0 | return true; |
851 | 0 | } |
852 | | |
853 | | static const JSJitInfo getImageSrc_methodinfo = { |
854 | | { (JSJitGetterOp)getImageSrc }, |
855 | | { prototypes::id::TreeContentView }, |
856 | | { PrototypeTraits<prototypes::id::TreeContentView>::Depth }, |
857 | | JSJitInfo::Method, |
858 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
859 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
860 | | false, /* isInfallible. False in setters. */ |
861 | | false, /* isMovable. Not relevant for setters. */ |
862 | | false, /* isEliminatable. Not relevant for setters. */ |
863 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
864 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
865 | | false, /* isTypedMethod. Only relevant for methods. */ |
866 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
867 | | }; |
868 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
869 | | static_assert(0 < 1, "There is no slot for us"); |
870 | | |
871 | | MOZ_CAN_RUN_SCRIPT static bool |
872 | | getCellValue(JSContext* cx, JS::Handle<JSObject*> obj, nsTreeContentView* self, const JSJitMethodCallArgs& args) |
873 | 0 | { |
874 | 0 | AUTO_PROFILER_LABEL_FAST("TreeContentView.getCellValue", DOM, cx); |
875 | 0 |
|
876 | 0 | if (MOZ_UNLIKELY(args.length() < 2)) { |
877 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeContentView.getCellValue"); |
878 | 0 | } |
879 | 0 | int32_t arg0; |
880 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
881 | 0 | return false; |
882 | 0 | } |
883 | 0 | NonNull<nsTreeColumn> arg1; |
884 | 0 | if (args[1].isObject()) { |
885 | 0 | { |
886 | 0 | nsresult rv = UnwrapObject<prototypes::id::TreeColumn, nsTreeColumn>(args[1], arg1); |
887 | 0 | if (NS_FAILED(rv)) { |
888 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 2 of TreeContentView.getCellValue", "TreeColumn"); |
889 | 0 | return false; |
890 | 0 | } |
891 | 0 | } |
892 | 0 | } else { |
893 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 2 of TreeContentView.getCellValue"); |
894 | 0 | return false; |
895 | 0 | } |
896 | 0 | FastErrorResult rv; |
897 | 0 | DOMString result; |
898 | 0 | self->GetCellValue(arg0, MOZ_KnownLive(NonNullHelper(arg1)), result, rv); |
899 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
900 | 0 | return false; |
901 | 0 | } |
902 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
903 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
904 | 0 | return false; |
905 | 0 | } |
906 | 0 | return true; |
907 | 0 | } |
908 | | |
909 | | static const JSJitInfo getCellValue_methodinfo = { |
910 | | { (JSJitGetterOp)getCellValue }, |
911 | | { prototypes::id::TreeContentView }, |
912 | | { PrototypeTraits<prototypes::id::TreeContentView>::Depth }, |
913 | | JSJitInfo::Method, |
914 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
915 | | JSVAL_TYPE_STRING, /* 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 | | getCellText(JSContext* cx, JS::Handle<JSObject*> obj, nsTreeContentView* self, const JSJitMethodCallArgs& args) |
929 | 0 | { |
930 | 0 | AUTO_PROFILER_LABEL_FAST("TreeContentView.getCellText", DOM, cx); |
931 | 0 |
|
932 | 0 | if (MOZ_UNLIKELY(args.length() < 2)) { |
933 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeContentView.getCellText"); |
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 | NonNull<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 TreeContentView.getCellText", "TreeColumn"); |
945 | 0 | return false; |
946 | 0 | } |
947 | 0 | } |
948 | 0 | } else { |
949 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 2 of TreeContentView.getCellText"); |
950 | 0 | return false; |
951 | 0 | } |
952 | 0 | FastErrorResult rv; |
953 | 0 | DOMString result; |
954 | 0 | self->GetCellText(arg0, MOZ_KnownLive(NonNullHelper(arg1)), result, rv); |
955 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
956 | 0 | return false; |
957 | 0 | } |
958 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
959 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
960 | 0 | return false; |
961 | 0 | } |
962 | 0 | return true; |
963 | 0 | } |
964 | | |
965 | | static const JSJitInfo getCellText_methodinfo = { |
966 | | { (JSJitGetterOp)getCellText }, |
967 | | { prototypes::id::TreeContentView }, |
968 | | { PrototypeTraits<prototypes::id::TreeContentView>::Depth }, |
969 | | JSJitInfo::Method, |
970 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
971 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
972 | | false, /* isInfallible. False in setters. */ |
973 | | false, /* isMovable. Not relevant for setters. */ |
974 | | false, /* isEliminatable. Not relevant for setters. */ |
975 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
976 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
977 | | false, /* isTypedMethod. Only relevant for methods. */ |
978 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
979 | | }; |
980 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
981 | | static_assert(0 < 1, "There is no slot for us"); |
982 | | |
983 | | MOZ_CAN_RUN_SCRIPT static bool |
984 | | setTree(JSContext* cx, JS::Handle<JSObject*> obj, nsTreeContentView* self, const JSJitMethodCallArgs& args) |
985 | 0 | { |
986 | 0 | AUTO_PROFILER_LABEL_FAST("TreeContentView.setTree", DOM, cx); |
987 | 0 |
|
988 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
989 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeContentView.setTree"); |
990 | 0 | } |
991 | 0 | mozilla::dom::TreeBoxObject* arg0; |
992 | 0 | if (args[0].isObject()) { |
993 | 0 | { |
994 | 0 | nsresult rv = UnwrapObject<prototypes::id::TreeBoxObject, mozilla::dom::TreeBoxObject>(args[0], arg0); |
995 | 0 | if (NS_FAILED(rv)) { |
996 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of TreeContentView.setTree", "TreeBoxObject"); |
997 | 0 | return false; |
998 | 0 | } |
999 | 0 | } |
1000 | 0 | } else if (args[0].isNullOrUndefined()) { |
1001 | 0 | arg0 = nullptr; |
1002 | 0 | } else { |
1003 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of TreeContentView.setTree"); |
1004 | 0 | return false; |
1005 | 0 | } |
1006 | 0 | FastErrorResult rv; |
1007 | 0 | self->SetTree(MOZ_KnownLive(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 | args.rval().setUndefined(); |
1013 | 0 | return true; |
1014 | 0 | } |
1015 | | |
1016 | | static const JSJitInfo setTree_methodinfo = { |
1017 | | { (JSJitGetterOp)setTree }, |
1018 | | { prototypes::id::TreeContentView }, |
1019 | | { PrototypeTraits<prototypes::id::TreeContentView>::Depth }, |
1020 | | JSJitInfo::Method, |
1021 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1022 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1023 | | false, /* isInfallible. False in setters. */ |
1024 | | false, /* isMovable. Not relevant for setters. */ |
1025 | | false, /* 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 < 1, "There is no slot for us"); |
1033 | | |
1034 | | MOZ_CAN_RUN_SCRIPT static bool |
1035 | | toggleOpenState(JSContext* cx, JS::Handle<JSObject*> obj, nsTreeContentView* self, const JSJitMethodCallArgs& args) |
1036 | 0 | { |
1037 | 0 | AUTO_PROFILER_LABEL_FAST("TreeContentView.toggleOpenState", DOM, cx); |
1038 | 0 |
|
1039 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
1040 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeContentView.toggleOpenState"); |
1041 | 0 | } |
1042 | 0 | int32_t arg0; |
1043 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
1044 | 0 | return false; |
1045 | 0 | } |
1046 | 0 | FastErrorResult rv; |
1047 | 0 | self->ToggleOpenState(arg0, rv); |
1048 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1049 | 0 | return false; |
1050 | 0 | } |
1051 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1052 | 0 | args.rval().setUndefined(); |
1053 | 0 | return true; |
1054 | 0 | } |
1055 | | |
1056 | | static const JSJitInfo toggleOpenState_methodinfo = { |
1057 | | { (JSJitGetterOp)toggleOpenState }, |
1058 | | { prototypes::id::TreeContentView }, |
1059 | | { PrototypeTraits<prototypes::id::TreeContentView>::Depth }, |
1060 | | JSJitInfo::Method, |
1061 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1062 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1063 | | false, /* isInfallible. False in setters. */ |
1064 | | false, /* isMovable. Not relevant for setters. */ |
1065 | | false, /* isEliminatable. Not relevant for setters. */ |
1066 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1067 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1068 | | false, /* isTypedMethod. Only relevant for methods. */ |
1069 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1070 | | }; |
1071 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1072 | | static_assert(0 < 1, "There is no slot for us"); |
1073 | | |
1074 | | MOZ_CAN_RUN_SCRIPT static bool |
1075 | | cycleHeader(JSContext* cx, JS::Handle<JSObject*> obj, nsTreeContentView* self, const JSJitMethodCallArgs& args) |
1076 | 0 | { |
1077 | 0 | AUTO_PROFILER_LABEL_FAST("TreeContentView.cycleHeader", DOM, cx); |
1078 | 0 |
|
1079 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
1080 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeContentView.cycleHeader"); |
1081 | 0 | } |
1082 | 0 | NonNull<nsTreeColumn> arg0; |
1083 | 0 | if (args[0].isObject()) { |
1084 | 0 | { |
1085 | 0 | nsresult rv = UnwrapObject<prototypes::id::TreeColumn, nsTreeColumn>(args[0], arg0); |
1086 | 0 | if (NS_FAILED(rv)) { |
1087 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of TreeContentView.cycleHeader", "TreeColumn"); |
1088 | 0 | return false; |
1089 | 0 | } |
1090 | 0 | } |
1091 | 0 | } else { |
1092 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of TreeContentView.cycleHeader"); |
1093 | 0 | return false; |
1094 | 0 | } |
1095 | 0 | FastErrorResult rv; |
1096 | 0 | self->CycleHeader(MOZ_KnownLive(NonNullHelper(arg0)), rv); |
1097 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1098 | 0 | return false; |
1099 | 0 | } |
1100 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1101 | 0 | args.rval().setUndefined(); |
1102 | 0 | return true; |
1103 | 0 | } |
1104 | | |
1105 | | static const JSJitInfo cycleHeader_methodinfo = { |
1106 | | { (JSJitGetterOp)cycleHeader }, |
1107 | | { prototypes::id::TreeContentView }, |
1108 | | { PrototypeTraits<prototypes::id::TreeContentView>::Depth }, |
1109 | | JSJitInfo::Method, |
1110 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1111 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1112 | | false, /* isInfallible. False in setters. */ |
1113 | | false, /* isMovable. Not relevant for setters. */ |
1114 | | false, /* isEliminatable. Not relevant for setters. */ |
1115 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1116 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1117 | | false, /* isTypedMethod. Only relevant for methods. */ |
1118 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1119 | | }; |
1120 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1121 | | static_assert(0 < 1, "There is no slot for us"); |
1122 | | |
1123 | | MOZ_CAN_RUN_SCRIPT static bool |
1124 | | selectionChanged(JSContext* cx, JS::Handle<JSObject*> obj, nsTreeContentView* self, const JSJitMethodCallArgs& args) |
1125 | 0 | { |
1126 | 0 | AUTO_PROFILER_LABEL_FAST("TreeContentView.selectionChanged", DOM, cx); |
1127 | 0 |
|
1128 | 0 | self->SelectionChanged(); |
1129 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1130 | 0 | args.rval().setUndefined(); |
1131 | 0 | return true; |
1132 | 0 | } |
1133 | | |
1134 | | static const JSJitInfo selectionChanged_methodinfo = { |
1135 | | { (JSJitGetterOp)selectionChanged }, |
1136 | | { prototypes::id::TreeContentView }, |
1137 | | { PrototypeTraits<prototypes::id::TreeContentView>::Depth }, |
1138 | | JSJitInfo::Method, |
1139 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1140 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1141 | | true, /* isInfallible. False in setters. */ |
1142 | | false, /* isMovable. Not relevant for setters. */ |
1143 | | false, /* isEliminatable. Not relevant for setters. */ |
1144 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1145 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1146 | | false, /* isTypedMethod. Only relevant for methods. */ |
1147 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1148 | | }; |
1149 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1150 | | static_assert(0 < 1, "There is no slot for us"); |
1151 | | |
1152 | | MOZ_CAN_RUN_SCRIPT static bool |
1153 | | cycleCell(JSContext* cx, JS::Handle<JSObject*> obj, nsTreeContentView* self, const JSJitMethodCallArgs& args) |
1154 | 0 | { |
1155 | 0 | AUTO_PROFILER_LABEL_FAST("TreeContentView.cycleCell", DOM, cx); |
1156 | 0 |
|
1157 | 0 | if (MOZ_UNLIKELY(args.length() < 2)) { |
1158 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeContentView.cycleCell"); |
1159 | 0 | } |
1160 | 0 | int32_t arg0; |
1161 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
1162 | 0 | return false; |
1163 | 0 | } |
1164 | 0 | NonNull<nsTreeColumn> arg1; |
1165 | 0 | if (args[1].isObject()) { |
1166 | 0 | { |
1167 | 0 | nsresult rv = UnwrapObject<prototypes::id::TreeColumn, nsTreeColumn>(args[1], arg1); |
1168 | 0 | if (NS_FAILED(rv)) { |
1169 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 2 of TreeContentView.cycleCell", "TreeColumn"); |
1170 | 0 | return false; |
1171 | 0 | } |
1172 | 0 | } |
1173 | 0 | } else { |
1174 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 2 of TreeContentView.cycleCell"); |
1175 | 0 | return false; |
1176 | 0 | } |
1177 | 0 | self->CycleCell(arg0, MOZ_KnownLive(NonNullHelper(arg1))); |
1178 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1179 | 0 | args.rval().setUndefined(); |
1180 | 0 | return true; |
1181 | 0 | } |
1182 | | |
1183 | | static const JSJitInfo cycleCell_methodinfo = { |
1184 | | { (JSJitGetterOp)cycleCell }, |
1185 | | { prototypes::id::TreeContentView }, |
1186 | | { PrototypeTraits<prototypes::id::TreeContentView>::Depth }, |
1187 | | JSJitInfo::Method, |
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 < 1, "There is no slot for us"); |
1200 | | |
1201 | | MOZ_CAN_RUN_SCRIPT static bool |
1202 | | isEditable(JSContext* cx, JS::Handle<JSObject*> obj, nsTreeContentView* self, const JSJitMethodCallArgs& args) |
1203 | 0 | { |
1204 | 0 | AUTO_PROFILER_LABEL_FAST("TreeContentView.isEditable", DOM, cx); |
1205 | 0 |
|
1206 | 0 | if (MOZ_UNLIKELY(args.length() < 2)) { |
1207 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeContentView.isEditable"); |
1208 | 0 | } |
1209 | 0 | int32_t arg0; |
1210 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
1211 | 0 | return false; |
1212 | 0 | } |
1213 | 0 | NonNull<nsTreeColumn> arg1; |
1214 | 0 | if (args[1].isObject()) { |
1215 | 0 | { |
1216 | 0 | nsresult rv = UnwrapObject<prototypes::id::TreeColumn, nsTreeColumn>(args[1], arg1); |
1217 | 0 | if (NS_FAILED(rv)) { |
1218 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 2 of TreeContentView.isEditable", "TreeColumn"); |
1219 | 0 | return false; |
1220 | 0 | } |
1221 | 0 | } |
1222 | 0 | } else { |
1223 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 2 of TreeContentView.isEditable"); |
1224 | 0 | return false; |
1225 | 0 | } |
1226 | 0 | FastErrorResult rv; |
1227 | 0 | bool result(self->IsEditable(arg0, MOZ_KnownLive(NonNullHelper(arg1)), rv)); |
1228 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1229 | 0 | return false; |
1230 | 0 | } |
1231 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1232 | 0 | args.rval().setBoolean(result); |
1233 | 0 | return true; |
1234 | 0 | } |
1235 | | |
1236 | | static const JSJitInfo isEditable_methodinfo = { |
1237 | | { (JSJitGetterOp)isEditable }, |
1238 | | { prototypes::id::TreeContentView }, |
1239 | | { PrototypeTraits<prototypes::id::TreeContentView>::Depth }, |
1240 | | JSJitInfo::Method, |
1241 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1242 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
1243 | | false, /* isInfallible. False in setters. */ |
1244 | | false, /* isMovable. Not relevant for setters. */ |
1245 | | false, /* isEliminatable. Not relevant for setters. */ |
1246 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1247 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1248 | | false, /* isTypedMethod. Only relevant for methods. */ |
1249 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1250 | | }; |
1251 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1252 | | static_assert(0 < 1, "There is no slot for us"); |
1253 | | |
1254 | | MOZ_CAN_RUN_SCRIPT static bool |
1255 | | isSelectable(JSContext* cx, JS::Handle<JSObject*> obj, nsTreeContentView* self, const JSJitMethodCallArgs& args) |
1256 | 0 | { |
1257 | 0 | AUTO_PROFILER_LABEL_FAST("TreeContentView.isSelectable", DOM, cx); |
1258 | 0 |
|
1259 | 0 | if (MOZ_UNLIKELY(args.length() < 2)) { |
1260 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeContentView.isSelectable"); |
1261 | 0 | } |
1262 | 0 | int32_t arg0; |
1263 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
1264 | 0 | return false; |
1265 | 0 | } |
1266 | 0 | NonNull<nsTreeColumn> arg1; |
1267 | 0 | if (args[1].isObject()) { |
1268 | 0 | { |
1269 | 0 | nsresult rv = UnwrapObject<prototypes::id::TreeColumn, nsTreeColumn>(args[1], arg1); |
1270 | 0 | if (NS_FAILED(rv)) { |
1271 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 2 of TreeContentView.isSelectable", "TreeColumn"); |
1272 | 0 | return false; |
1273 | 0 | } |
1274 | 0 | } |
1275 | 0 | } else { |
1276 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 2 of TreeContentView.isSelectable"); |
1277 | 0 | return false; |
1278 | 0 | } |
1279 | 0 | FastErrorResult rv; |
1280 | 0 | bool result(self->IsSelectable(arg0, MOZ_KnownLive(NonNullHelper(arg1)), rv)); |
1281 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1282 | 0 | return false; |
1283 | 0 | } |
1284 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1285 | 0 | args.rval().setBoolean(result); |
1286 | 0 | return true; |
1287 | 0 | } |
1288 | | |
1289 | | static const JSJitInfo isSelectable_methodinfo = { |
1290 | | { (JSJitGetterOp)isSelectable }, |
1291 | | { prototypes::id::TreeContentView }, |
1292 | | { PrototypeTraits<prototypes::id::TreeContentView>::Depth }, |
1293 | | JSJitInfo::Method, |
1294 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1295 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
1296 | | false, /* isInfallible. False in setters. */ |
1297 | | false, /* isMovable. Not relevant for setters. */ |
1298 | | false, /* isEliminatable. Not relevant for setters. */ |
1299 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1300 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1301 | | false, /* isTypedMethod. Only relevant for methods. */ |
1302 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1303 | | }; |
1304 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1305 | | static_assert(0 < 1, "There is no slot for us"); |
1306 | | |
1307 | | MOZ_CAN_RUN_SCRIPT static bool |
1308 | | setCellValue(JSContext* cx, JS::Handle<JSObject*> obj, nsTreeContentView* self, const JSJitMethodCallArgs& args) |
1309 | 0 | { |
1310 | 0 | AUTO_PROFILER_LABEL_FAST("TreeContentView.setCellValue", DOM, cx); |
1311 | 0 |
|
1312 | 0 | if (MOZ_UNLIKELY(args.length() < 3)) { |
1313 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeContentView.setCellValue"); |
1314 | 0 | } |
1315 | 0 | int32_t arg0; |
1316 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
1317 | 0 | return false; |
1318 | 0 | } |
1319 | 0 | NonNull<nsTreeColumn> arg1; |
1320 | 0 | if (args[1].isObject()) { |
1321 | 0 | { |
1322 | 0 | nsresult rv = UnwrapObject<prototypes::id::TreeColumn, nsTreeColumn>(args[1], arg1); |
1323 | 0 | if (NS_FAILED(rv)) { |
1324 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 2 of TreeContentView.setCellValue", "TreeColumn"); |
1325 | 0 | return false; |
1326 | 0 | } |
1327 | 0 | } |
1328 | 0 | } else { |
1329 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 2 of TreeContentView.setCellValue"); |
1330 | 0 | return false; |
1331 | 0 | } |
1332 | 0 | binding_detail::FakeString arg2; |
1333 | 0 | if (!ConvertJSValueToString(cx, args[2], eStringify, eStringify, arg2)) { |
1334 | 0 | return false; |
1335 | 0 | } |
1336 | 0 | FastErrorResult rv; |
1337 | 0 | self->SetCellValue(arg0, MOZ_KnownLive(NonNullHelper(arg1)), NonNullHelper(Constify(arg2)), rv); |
1338 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1339 | 0 | return false; |
1340 | 0 | } |
1341 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1342 | 0 | args.rval().setUndefined(); |
1343 | 0 | return true; |
1344 | 0 | } |
1345 | | |
1346 | | static const JSJitInfo setCellValue_methodinfo = { |
1347 | | { (JSJitGetterOp)setCellValue }, |
1348 | | { prototypes::id::TreeContentView }, |
1349 | | { PrototypeTraits<prototypes::id::TreeContentView>::Depth }, |
1350 | | JSJitInfo::Method, |
1351 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1352 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1353 | | false, /* isInfallible. False in setters. */ |
1354 | | false, /* isMovable. Not relevant for setters. */ |
1355 | | false, /* isEliminatable. Not relevant for setters. */ |
1356 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1357 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1358 | | false, /* isTypedMethod. Only relevant for methods. */ |
1359 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1360 | | }; |
1361 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1362 | | static_assert(0 < 1, "There is no slot for us"); |
1363 | | |
1364 | | MOZ_CAN_RUN_SCRIPT static bool |
1365 | | setCellText(JSContext* cx, JS::Handle<JSObject*> obj, nsTreeContentView* self, const JSJitMethodCallArgs& args) |
1366 | 0 | { |
1367 | 0 | AUTO_PROFILER_LABEL_FAST("TreeContentView.setCellText", DOM, cx); |
1368 | 0 |
|
1369 | 0 | if (MOZ_UNLIKELY(args.length() < 3)) { |
1370 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeContentView.setCellText"); |
1371 | 0 | } |
1372 | 0 | int32_t arg0; |
1373 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
1374 | 0 | return false; |
1375 | 0 | } |
1376 | 0 | NonNull<nsTreeColumn> arg1; |
1377 | 0 | if (args[1].isObject()) { |
1378 | 0 | { |
1379 | 0 | nsresult rv = UnwrapObject<prototypes::id::TreeColumn, nsTreeColumn>(args[1], arg1); |
1380 | 0 | if (NS_FAILED(rv)) { |
1381 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 2 of TreeContentView.setCellText", "TreeColumn"); |
1382 | 0 | return false; |
1383 | 0 | } |
1384 | 0 | } |
1385 | 0 | } else { |
1386 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 2 of TreeContentView.setCellText"); |
1387 | 0 | return false; |
1388 | 0 | } |
1389 | 0 | binding_detail::FakeString arg2; |
1390 | 0 | if (!ConvertJSValueToString(cx, args[2], eStringify, eStringify, arg2)) { |
1391 | 0 | return false; |
1392 | 0 | } |
1393 | 0 | FastErrorResult rv; |
1394 | 0 | self->SetCellText(arg0, MOZ_KnownLive(NonNullHelper(arg1)), NonNullHelper(Constify(arg2)), rv); |
1395 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1396 | 0 | return false; |
1397 | 0 | } |
1398 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1399 | 0 | args.rval().setUndefined(); |
1400 | 0 | return true; |
1401 | 0 | } |
1402 | | |
1403 | | static const JSJitInfo setCellText_methodinfo = { |
1404 | | { (JSJitGetterOp)setCellText }, |
1405 | | { prototypes::id::TreeContentView }, |
1406 | | { PrototypeTraits<prototypes::id::TreeContentView>::Depth }, |
1407 | | JSJitInfo::Method, |
1408 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1409 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1410 | | false, /* isInfallible. False in setters. */ |
1411 | | false, /* isMovable. Not relevant for setters. */ |
1412 | | false, /* isEliminatable. Not relevant for setters. */ |
1413 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1414 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1415 | | false, /* isTypedMethod. Only relevant for methods. */ |
1416 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1417 | | }; |
1418 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1419 | | static_assert(0 < 1, "There is no slot for us"); |
1420 | | |
1421 | | MOZ_CAN_RUN_SCRIPT static bool |
1422 | | performAction(JSContext* cx, JS::Handle<JSObject*> obj, nsTreeContentView* self, const JSJitMethodCallArgs& args) |
1423 | 0 | { |
1424 | 0 | AUTO_PROFILER_LABEL_FAST("TreeContentView.performAction", DOM, cx); |
1425 | 0 |
|
1426 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
1427 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeContentView.performAction"); |
1428 | 0 | } |
1429 | 0 | binding_detail::FakeString arg0; |
1430 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
1431 | 0 | return false; |
1432 | 0 | } |
1433 | 0 | self->PerformAction(NonNullHelper(Constify(arg0))); |
1434 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1435 | 0 | args.rval().setUndefined(); |
1436 | 0 | return true; |
1437 | 0 | } |
1438 | | |
1439 | | static const JSJitInfo performAction_methodinfo = { |
1440 | | { (JSJitGetterOp)performAction }, |
1441 | | { prototypes::id::TreeContentView }, |
1442 | | { PrototypeTraits<prototypes::id::TreeContentView>::Depth }, |
1443 | | JSJitInfo::Method, |
1444 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1445 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1446 | | false, /* isInfallible. False in setters. */ |
1447 | | false, /* isMovable. Not relevant for setters. */ |
1448 | | false, /* isEliminatable. Not relevant for setters. */ |
1449 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1450 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1451 | | false, /* isTypedMethod. Only relevant for methods. */ |
1452 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1453 | | }; |
1454 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1455 | | static_assert(0 < 1, "There is no slot for us"); |
1456 | | |
1457 | | MOZ_CAN_RUN_SCRIPT static bool |
1458 | | performActionOnRow(JSContext* cx, JS::Handle<JSObject*> obj, nsTreeContentView* self, const JSJitMethodCallArgs& args) |
1459 | 0 | { |
1460 | 0 | AUTO_PROFILER_LABEL_FAST("TreeContentView.performActionOnRow", DOM, cx); |
1461 | 0 |
|
1462 | 0 | if (MOZ_UNLIKELY(args.length() < 2)) { |
1463 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeContentView.performActionOnRow"); |
1464 | 0 | } |
1465 | 0 | binding_detail::FakeString arg0; |
1466 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
1467 | 0 | return false; |
1468 | 0 | } |
1469 | 0 | int32_t arg1; |
1470 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[1], &arg1)) { |
1471 | 0 | return false; |
1472 | 0 | } |
1473 | 0 | self->PerformActionOnRow(NonNullHelper(Constify(arg0)), arg1); |
1474 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1475 | 0 | args.rval().setUndefined(); |
1476 | 0 | return true; |
1477 | 0 | } |
1478 | | |
1479 | | static const JSJitInfo performActionOnRow_methodinfo = { |
1480 | | { (JSJitGetterOp)performActionOnRow }, |
1481 | | { prototypes::id::TreeContentView }, |
1482 | | { PrototypeTraits<prototypes::id::TreeContentView>::Depth }, |
1483 | | JSJitInfo::Method, |
1484 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1485 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1486 | | false, /* isInfallible. False in setters. */ |
1487 | | false, /* isMovable. Not relevant for setters. */ |
1488 | | false, /* isEliminatable. Not relevant for setters. */ |
1489 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1490 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1491 | | false, /* isTypedMethod. Only relevant for methods. */ |
1492 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1493 | | }; |
1494 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1495 | | static_assert(0 < 1, "There is no slot for us"); |
1496 | | |
1497 | | MOZ_CAN_RUN_SCRIPT static bool |
1498 | | performActionOnCell(JSContext* cx, JS::Handle<JSObject*> obj, nsTreeContentView* self, const JSJitMethodCallArgs& args) |
1499 | 0 | { |
1500 | 0 | AUTO_PROFILER_LABEL_FAST("TreeContentView.performActionOnCell", DOM, cx); |
1501 | 0 |
|
1502 | 0 | if (MOZ_UNLIKELY(args.length() < 3)) { |
1503 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "TreeContentView.performActionOnCell"); |
1504 | 0 | } |
1505 | 0 | binding_detail::FakeString arg0; |
1506 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
1507 | 0 | return false; |
1508 | 0 | } |
1509 | 0 | int32_t arg1; |
1510 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[1], &arg1)) { |
1511 | 0 | return false; |
1512 | 0 | } |
1513 | 0 | NonNull<nsTreeColumn> arg2; |
1514 | 0 | if (args[2].isObject()) { |
1515 | 0 | { |
1516 | 0 | nsresult rv = UnwrapObject<prototypes::id::TreeColumn, nsTreeColumn>(args[2], arg2); |
1517 | 0 | if (NS_FAILED(rv)) { |
1518 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 3 of TreeContentView.performActionOnCell", "TreeColumn"); |
1519 | 0 | return false; |
1520 | 0 | } |
1521 | 0 | } |
1522 | 0 | } else { |
1523 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 3 of TreeContentView.performActionOnCell"); |
1524 | 0 | return false; |
1525 | 0 | } |
1526 | 0 | self->PerformActionOnCell(NonNullHelper(Constify(arg0)), arg1, MOZ_KnownLive(NonNullHelper(arg2))); |
1527 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1528 | 0 | args.rval().setUndefined(); |
1529 | 0 | return true; |
1530 | 0 | } |
1531 | | |
1532 | | static const JSJitInfo performActionOnCell_methodinfo = { |
1533 | | { (JSJitGetterOp)performActionOnCell }, |
1534 | | { prototypes::id::TreeContentView }, |
1535 | | { PrototypeTraits<prototypes::id::TreeContentView>::Depth }, |
1536 | | JSJitInfo::Method, |
1537 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1538 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1539 | | false, /* isInfallible. False in setters. */ |
1540 | | false, /* isMovable. Not relevant for setters. */ |
1541 | | false, /* isEliminatable. Not relevant for setters. */ |
1542 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1543 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1544 | | false, /* isTypedMethod. Only relevant for methods. */ |
1545 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1546 | | }; |
1547 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1548 | | static_assert(0 < 1, "There is no slot for us"); |
1549 | | |
1550 | | static bool |
1551 | | _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val) |
1552 | 0 | { |
1553 | 0 | nsTreeContentView* self = UnwrapPossiblyNotInitializedDOMObject<nsTreeContentView>(obj); |
1554 | 0 | // We don't want to preserve if we don't have a wrapper, and we |
1555 | 0 | // obviously can't preserve if we're not initialized. |
1556 | 0 | if (self && self->GetWrapperPreserveColor()) { |
1557 | 0 | PreserveWrapper(self); |
1558 | 0 | } |
1559 | 0 | return true; |
1560 | 0 | } |
1561 | | |
1562 | | static void |
1563 | | _finalize(js::FreeOp* fop, JSObject* obj) |
1564 | 0 | { |
1565 | 0 | nsTreeContentView* self = UnwrapPossiblyNotInitializedDOMObject<nsTreeContentView>(obj); |
1566 | 0 | if (self) { |
1567 | 0 | ClearWrapper(self, self, obj); |
1568 | 0 | AddForDeferredFinalization<nsTreeContentView>(self); |
1569 | 0 | } |
1570 | 0 | } |
1571 | | |
1572 | | static size_t |
1573 | | _objectMoved(JSObject* obj, JSObject* old) |
1574 | 0 | { |
1575 | 0 | nsTreeContentView* self = UnwrapPossiblyNotInitializedDOMObject<nsTreeContentView>(obj); |
1576 | 0 | if (self) { |
1577 | 0 | UpdateWrapper(self, self, obj, old); |
1578 | 0 | } |
1579 | 0 |
|
1580 | 0 | return 0; |
1581 | 0 | } |
1582 | | |
1583 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
1584 | | #if defined(__clang__) |
1585 | | #pragma clang diagnostic push |
1586 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
1587 | | #endif |
1588 | | static const JSFunctionSpec sMethods_specs[] = { |
1589 | | JS_FNSPEC("getItemAtIndex", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getItemAtIndex_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
1590 | | JS_FNSPEC("getIndexOfItem", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getIndexOfItem_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
1591 | | JS_FNSPEC("getRowProperties", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getRowProperties_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
1592 | | JS_FNSPEC("getCellProperties", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getCellProperties_methodinfo), 2, JSPROP_ENUMERATE, nullptr), |
1593 | | JS_FNSPEC("getColumnProperties", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getColumnProperties_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
1594 | | JS_FNSPEC("isContainer", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&isContainer_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
1595 | | JS_FNSPEC("isContainerOpen", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&isContainerOpen_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
1596 | | JS_FNSPEC("isContainerEmpty", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&isContainerEmpty_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
1597 | | JS_FNSPEC("isSeparator", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&isSeparator_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
1598 | | JS_FNSPEC("isSorted", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&isSorted_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
1599 | | JS_FNSPEC("canDrop", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&canDrop_methodinfo), 3, JSPROP_ENUMERATE, nullptr), |
1600 | | JS_FNSPEC("drop", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&drop_methodinfo), 3, JSPROP_ENUMERATE, nullptr), |
1601 | | JS_FNSPEC("getParentIndex", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getParentIndex_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
1602 | | JS_FNSPEC("hasNextSibling", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&hasNextSibling_methodinfo), 2, JSPROP_ENUMERATE, nullptr), |
1603 | | JS_FNSPEC("getLevel", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getLevel_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
1604 | | JS_FNSPEC("getImageSrc", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getImageSrc_methodinfo), 2, JSPROP_ENUMERATE, nullptr), |
1605 | | JS_FNSPEC("getCellValue", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getCellValue_methodinfo), 2, JSPROP_ENUMERATE, nullptr), |
1606 | | JS_FNSPEC("getCellText", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getCellText_methodinfo), 2, JSPROP_ENUMERATE, nullptr), |
1607 | | JS_FNSPEC("setTree", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&setTree_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
1608 | | JS_FNSPEC("toggleOpenState", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&toggleOpenState_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
1609 | | JS_FNSPEC("cycleHeader", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&cycleHeader_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
1610 | | JS_FNSPEC("selectionChanged", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&selectionChanged_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
1611 | | JS_FNSPEC("cycleCell", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&cycleCell_methodinfo), 2, JSPROP_ENUMERATE, nullptr), |
1612 | | JS_FNSPEC("isEditable", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&isEditable_methodinfo), 2, JSPROP_ENUMERATE, nullptr), |
1613 | | JS_FNSPEC("isSelectable", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&isSelectable_methodinfo), 2, JSPROP_ENUMERATE, nullptr), |
1614 | | JS_FNSPEC("setCellValue", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&setCellValue_methodinfo), 3, JSPROP_ENUMERATE, nullptr), |
1615 | | JS_FNSPEC("setCellText", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&setCellText_methodinfo), 3, JSPROP_ENUMERATE, nullptr), |
1616 | | JS_FNSPEC("performAction", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&performAction_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
1617 | | JS_FNSPEC("performActionOnRow", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&performActionOnRow_methodinfo), 2, JSPROP_ENUMERATE, nullptr), |
1618 | | JS_FNSPEC("performActionOnCell", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&performActionOnCell_methodinfo), 3, JSPROP_ENUMERATE, nullptr), |
1619 | | JS_FS_END |
1620 | | }; |
1621 | | #if defined(__clang__) |
1622 | | #pragma clang diagnostic pop |
1623 | | #endif |
1624 | | |
1625 | | |
1626 | | static const Prefable<const JSFunctionSpec> sMethods[] = { |
1627 | | { nullptr, &sMethods_specs[0] }, |
1628 | | { nullptr, nullptr } |
1629 | | }; |
1630 | | |
1631 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
1632 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
1633 | | static_assert(30 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
1634 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
1635 | | |
1636 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
1637 | | #if defined(__clang__) |
1638 | | #pragma clang diagnostic push |
1639 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
1640 | | #endif |
1641 | | static const JSFunctionSpec sChromeMethods_specs[] = { |
1642 | | JS_FNSPEC("QueryInterface", QueryInterface, nullptr, 1, 0, nullptr), |
1643 | | JS_FS_END |
1644 | | }; |
1645 | | #if defined(__clang__) |
1646 | | #pragma clang diagnostic pop |
1647 | | #endif |
1648 | | |
1649 | | |
1650 | | static const Prefable<const JSFunctionSpec> sChromeMethods[] = { |
1651 | | { nullptr, &sChromeMethods_specs[0] }, |
1652 | | { nullptr, nullptr } |
1653 | | }; |
1654 | | |
1655 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
1656 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
1657 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
1658 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
1659 | | |
1660 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
1661 | | #if defined(__clang__) |
1662 | | #pragma clang diagnostic push |
1663 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
1664 | | #endif |
1665 | | static const JSPropertySpec sAttributes_specs[] = { |
1666 | | { "rowCount", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &rowCount_getterinfo, nullptr, nullptr }, |
1667 | | { "selection", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &selection_getterinfo, GenericSetter<NormalThisPolicy>, &selection_setterinfo }, |
1668 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr } |
1669 | | }; |
1670 | | #if defined(__clang__) |
1671 | | #pragma clang diagnostic pop |
1672 | | #endif |
1673 | | |
1674 | | |
1675 | | static const Prefable<const JSPropertySpec> sAttributes[] = { |
1676 | | { nullptr, &sAttributes_specs[0] }, |
1677 | | { nullptr, nullptr } |
1678 | | }; |
1679 | | |
1680 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
1681 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
1682 | | static_assert(2 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
1683 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
1684 | | |
1685 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
1686 | | #if defined(__clang__) |
1687 | | #pragma clang diagnostic push |
1688 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
1689 | | #endif |
1690 | | static const ConstantSpec sConstants_specs[] = { |
1691 | | { "DROP_BEFORE", JS::Int32Value(-1) }, |
1692 | | { "DROP_ON", JS::Int32Value(0) }, |
1693 | | { "DROP_AFTER", JS::Int32Value(1) }, |
1694 | | { 0, JS::UndefinedValue() } |
1695 | | }; |
1696 | | #if defined(__clang__) |
1697 | | #pragma clang diagnostic pop |
1698 | | #endif |
1699 | | |
1700 | | |
1701 | | static const Prefable<const ConstantSpec> sConstants[] = { |
1702 | | { nullptr, &sConstants_specs[0] }, |
1703 | | { nullptr, nullptr } |
1704 | | }; |
1705 | | |
1706 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
1707 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
1708 | | static_assert(3 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
1709 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
1710 | | |
1711 | | |
1712 | | static uint16_t sNativeProperties_sortedPropertyIndices[35]; |
1713 | | static PropertyInfo sNativeProperties_propertyInfos[35]; |
1714 | | |
1715 | | static const NativePropertiesN<3> sNativeProperties = { |
1716 | | false, 0, |
1717 | | false, 0, |
1718 | | true, 0 /* sMethods */, |
1719 | | true, 1 /* sAttributes */, |
1720 | | false, 0, |
1721 | | false, 0, |
1722 | | true, 2 /* sConstants */, |
1723 | | -1, |
1724 | | 35, |
1725 | | sNativeProperties_sortedPropertyIndices, |
1726 | | { |
1727 | | { sMethods, &sNativeProperties_propertyInfos[0] }, |
1728 | | { sAttributes, &sNativeProperties_propertyInfos[30] }, |
1729 | | { sConstants, &sNativeProperties_propertyInfos[32] } |
1730 | | } |
1731 | | }; |
1732 | | static_assert(35 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount), |
1733 | | "We have a property info count that is oversized"); |
1734 | | |
1735 | | static uint16_t sChromeOnlyNativeProperties_sortedPropertyIndices[1]; |
1736 | | static PropertyInfo sChromeOnlyNativeProperties_propertyInfos[1]; |
1737 | | |
1738 | | static const NativePropertiesN<1> sChromeOnlyNativeProperties = { |
1739 | | false, 0, |
1740 | | false, 0, |
1741 | | true, 0 /* sChromeMethods */, |
1742 | | false, 0, |
1743 | | false, 0, |
1744 | | false, 0, |
1745 | | false, 0, |
1746 | | -1, |
1747 | | 1, |
1748 | | sChromeOnlyNativeProperties_sortedPropertyIndices, |
1749 | | { |
1750 | | { sChromeMethods, &sChromeOnlyNativeProperties_propertyInfos[0] } |
1751 | | } |
1752 | | }; |
1753 | | static_assert(1 < 1ull << CHAR_BIT * sizeof(sChromeOnlyNativeProperties.propertyInfoCount), |
1754 | | "We have a property info count that is oversized"); |
1755 | | |
1756 | | static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = { |
1757 | | { |
1758 | | "Function", |
1759 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE), |
1760 | | &sBoringInterfaceObjectClassClassOps, |
1761 | | JS_NULL_CLASS_SPEC, |
1762 | | JS_NULL_CLASS_EXT, |
1763 | | &sInterfaceObjectClassObjectOps |
1764 | | }, |
1765 | | eInterface, |
1766 | | true, |
1767 | | prototypes::id::TreeContentView, |
1768 | | PrototypeTraits<prototypes::id::TreeContentView>::Depth, |
1769 | | sNativePropertyHooks, |
1770 | | "function TreeContentView() {\n [native code]\n}", |
1771 | | JS::GetRealmFunctionPrototype |
1772 | | }; |
1773 | | |
1774 | | static const DOMIfaceAndProtoJSClass sPrototypeClass = { |
1775 | | { |
1776 | | "TreeContentViewPrototype", |
1777 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE), |
1778 | | JS_NULL_CLASS_OPS, |
1779 | | JS_NULL_CLASS_SPEC, |
1780 | | JS_NULL_CLASS_EXT, |
1781 | | JS_NULL_OBJECT_OPS |
1782 | | }, |
1783 | | eInterfacePrototype, |
1784 | | false, |
1785 | | prototypes::id::TreeContentView, |
1786 | | PrototypeTraits<prototypes::id::TreeContentView>::Depth, |
1787 | | sNativePropertyHooks, |
1788 | | "[object TreeContentViewPrototype]", |
1789 | | JS::GetRealmObjectPrototype |
1790 | | }; |
1791 | | |
1792 | | bool |
1793 | | ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj) |
1794 | 0 | { |
1795 | 0 | return IsChromeOrXBL(aCx, aObj); |
1796 | 0 | } |
1797 | | |
1798 | | static const js::ClassOps sClassOps = { |
1799 | | _addProperty, /* addProperty */ |
1800 | | nullptr, /* delProperty */ |
1801 | | nullptr, /* enumerate */ |
1802 | | nullptr, /* newEnumerate */ |
1803 | | nullptr, /* resolve */ |
1804 | | nullptr, /* mayResolve */ |
1805 | | _finalize, /* finalize */ |
1806 | | nullptr, /* call */ |
1807 | | nullptr, /* hasInstance */ |
1808 | | nullptr, /* construct */ |
1809 | | nullptr, /* trace */ |
1810 | | }; |
1811 | | |
1812 | | static const js::ClassExtension sClassExtension = { |
1813 | | nullptr, /* weakmapKeyDelegateOp */ |
1814 | | _objectMoved /* objectMovedOp */ |
1815 | | }; |
1816 | | |
1817 | | static const DOMJSClass sClass = { |
1818 | | { "TreeContentView", |
1819 | | JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1), |
1820 | | &sClassOps, |
1821 | | JS_NULL_CLASS_SPEC, |
1822 | | &sClassExtension, |
1823 | | JS_NULL_OBJECT_OPS |
1824 | | }, |
1825 | | { prototypes::id::TreeContentView, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count }, |
1826 | | IsBaseOf<nsISupports, nsTreeContentView >::value, |
1827 | | sNativePropertyHooks, |
1828 | | FindAssociatedGlobalForNative<nsTreeContentView>::Get, |
1829 | | GetProtoObjectHandle, |
1830 | | GetCCParticipant<nsTreeContentView>::Get() |
1831 | | }; |
1832 | | static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS, |
1833 | | "Must have the right minimal number of reserved slots."); |
1834 | | static_assert(1 >= 1, |
1835 | | "Must have enough reserved slots."); |
1836 | | |
1837 | | const JSClass* |
1838 | | GetJSClass() |
1839 | 0 | { |
1840 | 0 | return sClass.ToJSClass(); |
1841 | 0 | } |
1842 | | |
1843 | | bool |
1844 | | Wrap(JSContext* aCx, nsTreeContentView* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector) |
1845 | 0 | { |
1846 | 0 | static_assert(!IsBaseOf<NonRefcountedDOMObject, nsTreeContentView>::value, |
1847 | 0 | "Shouldn't have wrappercached things that are not refcounted."); |
1848 | 0 | MOZ_ASSERT(static_cast<nsTreeContentView*>(aObject) == |
1849 | 0 | reinterpret_cast<nsTreeContentView*>(aObject), |
1850 | 0 | "Multiple inheritance for nsTreeContentView is broken."); |
1851 | 0 | MOZ_ASSERT(ToSupportsIsCorrect(aObject)); |
1852 | 0 | MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx)); |
1853 | 0 | MOZ_ASSERT(!aCache->GetWrapper(), |
1854 | 0 | "You should probably not be using Wrap() directly; use " |
1855 | 0 | "GetOrCreateDOMReflector instead"); |
1856 | 0 |
|
1857 | 0 | MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache), |
1858 | 0 | "nsISupports must be on our primary inheritance chain"); |
1859 | 0 |
|
1860 | 0 | JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject())); |
1861 | 0 | if (!global) { |
1862 | 0 | return false; |
1863 | 0 | } |
1864 | 0 | MOZ_ASSERT(JS_IsGlobalObject(global)); |
1865 | 0 | MOZ_ASSERT(JS::ObjectIsNotGray(global)); |
1866 | 0 |
|
1867 | 0 | // That might have ended up wrapping us already, due to the wonders |
1868 | 0 | // of XBL. Check for that, and bail out as needed. |
1869 | 0 | aReflector.set(aCache->GetWrapper()); |
1870 | 0 | if (aReflector) { |
1871 | | #ifdef DEBUG |
1872 | | AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto); |
1873 | | #endif // DEBUG |
1874 | | return true; |
1875 | 0 | } |
1876 | 0 |
|
1877 | 0 | JSAutoRealm ar(aCx, global); |
1878 | 0 | JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx); |
1879 | 0 | if (!canonicalProto) { |
1880 | 0 | return false; |
1881 | 0 | } |
1882 | 0 | JS::Rooted<JSObject*> proto(aCx); |
1883 | 0 | if (aGivenProto) { |
1884 | 0 | proto = aGivenProto; |
1885 | 0 | // Unfortunately, while aGivenProto was in the compartment of aCx |
1886 | 0 | // coming in, we changed compartments to that of "parent" so may need |
1887 | 0 | // to wrap the proto here. |
1888 | 0 | if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) { |
1889 | 0 | if (!JS_WrapObject(aCx, &proto)) { |
1890 | 0 | return false; |
1891 | 0 | } |
1892 | 0 | } |
1893 | 0 | } else { |
1894 | 0 | proto = canonicalProto; |
1895 | 0 | } |
1896 | 0 |
|
1897 | 0 | BindingJSObjectCreator<nsTreeContentView> creator(aCx); |
1898 | 0 | creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector); |
1899 | 0 | if (!aReflector) { |
1900 | 0 | return false; |
1901 | 0 | } |
1902 | 0 | |
1903 | 0 | aCache->SetWrapper(aReflector); |
1904 | 0 | creator.InitializationSucceeded(); |
1905 | 0 |
|
1906 | 0 | MOZ_ASSERT(aCache->GetWrapperPreserveColor() && |
1907 | 0 | aCache->GetWrapperPreserveColor() == aReflector); |
1908 | 0 | // If proto != canonicalProto, we have to preserve our wrapper; |
1909 | 0 | // otherwise we won't be able to properly recreate it later, since |
1910 | 0 | // we won't know what proto to use. Note that we don't check |
1911 | 0 | // aGivenProto here, since it's entirely possible (and even |
1912 | 0 | // somewhat common) to have a non-null aGivenProto which is the |
1913 | 0 | // same as canonicalProto. |
1914 | 0 | if (proto != canonicalProto) { |
1915 | 0 | PreserveWrapper(aObject); |
1916 | 0 | } |
1917 | 0 |
|
1918 | 0 | return true; |
1919 | 0 | } |
1920 | | |
1921 | | const NativePropertyHooks sNativePropertyHooks[] = { { |
1922 | | nullptr, |
1923 | | nullptr, |
1924 | | nullptr, |
1925 | | { sNativeProperties.Upcast(), sChromeOnlyNativeProperties.Upcast() }, |
1926 | | prototypes::id::TreeContentView, |
1927 | | constructors::id::TreeContentView, |
1928 | | nullptr, |
1929 | | &DefaultXrayExpandoObjectClass |
1930 | | } }; |
1931 | | |
1932 | | void |
1933 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal) |
1934 | 0 | { |
1935 | 0 | JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx)); |
1936 | 0 | if (!parentProto) { |
1937 | 0 | return; |
1938 | 0 | } |
1939 | 0 | |
1940 | 0 | JS::Rooted<JSObject*> constructorProto(aCx, JS::GetRealmFunctionPrototype(aCx)); |
1941 | 0 | if (!constructorProto) { |
1942 | 0 | return; |
1943 | 0 | } |
1944 | 0 | |
1945 | 0 | static bool sIdsInited = false; |
1946 | 0 | if (!sIdsInited && NS_IsMainThread()) { |
1947 | 0 | if (!InitIds(aCx, sNativeProperties.Upcast())) { |
1948 | 0 | return; |
1949 | 0 | } |
1950 | 0 | if (!InitIds(aCx, sChromeOnlyNativeProperties.Upcast())) { |
1951 | 0 | return; |
1952 | 0 | } |
1953 | 0 | sIdsInited = true; |
1954 | 0 | } |
1955 | 0 |
|
1956 | 0 | JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::TreeContentView); |
1957 | 0 | JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::TreeContentView); |
1958 | 0 | dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, |
1959 | 0 | &sPrototypeClass.mBase, protoCache, |
1960 | 0 | nullptr, |
1961 | 0 | constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr, |
1962 | 0 | interfaceCache, |
1963 | 0 | sNativeProperties.Upcast(), |
1964 | 0 | sChromeOnlyNativeProperties.Upcast(), |
1965 | 0 | "TreeContentView", aDefineOnGlobal, |
1966 | 0 | nullptr, |
1967 | 0 | false); |
1968 | 0 | } |
1969 | | |
1970 | | JSObject* |
1971 | | GetConstructorObject(JSContext* aCx) |
1972 | 0 | { |
1973 | 0 | return GetConstructorObjectHandle(aCx); |
1974 | 0 | } |
1975 | | |
1976 | | } // namespace TreeContentView_Binding |
1977 | | |
1978 | | |
1979 | | |
1980 | | } // namespace dom |
1981 | | } // namespace mozilla |