/work/obj-fuzz/dom/bindings/CharacterDataBinding.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* THIS FILE IS AUTOGENERATED FROM CharacterData.webidl BY Codegen.py - DO NOT EDIT */ |
2 | | |
3 | | #include "CharacterDataBinding.h" |
4 | | #include "NodeBinding.h" |
5 | | #include "WrapperFactory.h" |
6 | | #include "mozilla/OwningNonNull.h" |
7 | | #include "mozilla/dom/BindingUtils.h" |
8 | | #include "mozilla/dom/CharacterData.h" |
9 | | #include "mozilla/dom/CustomElementRegistry.h" |
10 | | #include "mozilla/dom/DOMJSClass.h" |
11 | | #include "mozilla/dom/DocGroup.h" |
12 | | #include "mozilla/dom/Element.h" |
13 | | #include "mozilla/dom/NonRefcountedDOMObject.h" |
14 | | #include "mozilla/dom/Nullable.h" |
15 | | #include "mozilla/dom/PrimitiveConversions.h" |
16 | | #include "mozilla/dom/UnionConversions.h" |
17 | | #include "mozilla/dom/UnionTypes.h" |
18 | | #include "mozilla/dom/XrayExpandoClass.h" |
19 | | |
20 | | namespace mozilla { |
21 | | namespace dom { |
22 | | |
23 | | namespace binding_detail {}; // Just to make sure it's known as a namespace |
24 | | using namespace mozilla::dom::binding_detail; |
25 | | |
26 | | |
27 | | namespace CharacterData_Binding { |
28 | | |
29 | | static_assert(IsRefcounted<NativeType>::value == IsRefcounted<Node_Binding::NativeType>::value, |
30 | | "Can't inherit from an interface with a different ownership model."); |
31 | | |
32 | | MOZ_CAN_RUN_SCRIPT static bool |
33 | | get_data(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::CharacterData* self, JSJitGetterCallArgs args) |
34 | 0 | { |
35 | 0 | AUTO_PROFILER_LABEL_FAST("get CharacterData.data", DOM, cx); |
36 | 0 |
|
37 | 0 | DOMString result; |
38 | 0 | self->GetData(result); |
39 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
40 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
41 | 0 | return false; |
42 | 0 | } |
43 | 0 | return true; |
44 | 0 | } |
45 | | |
46 | | MOZ_CAN_RUN_SCRIPT static bool |
47 | | set_data(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::CharacterData* self, JSJitSetterCallArgs args) |
48 | 0 | { |
49 | 0 | AUTO_PROFILER_LABEL_FAST("set CharacterData.data", DOM, cx); |
50 | 0 |
|
51 | 0 | binding_detail::FakeString arg0; |
52 | 0 | if (!ConvertJSValueToString(cx, args[0], eEmpty, eStringify, arg0)) { |
53 | 0 | return false; |
54 | 0 | } |
55 | 0 | FastErrorResult rv; |
56 | 0 | self->SetData(NonNullHelper(Constify(arg0)), rv); |
57 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
58 | 0 | return false; |
59 | 0 | } |
60 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
61 | 0 |
|
62 | 0 | return true; |
63 | 0 | } |
64 | | |
65 | | static const JSJitInfo data_getterinfo = { |
66 | | { (JSJitGetterOp)get_data }, |
67 | | { prototypes::id::CharacterData }, |
68 | | { PrototypeTraits<prototypes::id::CharacterData>::Depth }, |
69 | | JSJitInfo::Getter, |
70 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
71 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
72 | | false, /* isInfallible. False in setters. */ |
73 | | true, /* isMovable. Not relevant for setters. */ |
74 | | true, /* isEliminatable. Not relevant for setters. */ |
75 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
76 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
77 | | false, /* isTypedMethod. Only relevant for methods. */ |
78 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
79 | | }; |
80 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
81 | | static_assert(0 < 1, "There is no slot for us"); |
82 | | static const JSJitInfo data_setterinfo = { |
83 | | { (JSJitGetterOp)set_data }, |
84 | | { prototypes::id::CharacterData }, |
85 | | { PrototypeTraits<prototypes::id::CharacterData>::Depth }, |
86 | | JSJitInfo::Setter, |
87 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
88 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
89 | | false, /* isInfallible. False in setters. */ |
90 | | false, /* isMovable. Not relevant for setters. */ |
91 | | false, /* isEliminatable. Not relevant for setters. */ |
92 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
93 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
94 | | false, /* isTypedMethod. Only relevant for methods. */ |
95 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
96 | | }; |
97 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
98 | | static_assert(0 < 1, "There is no slot for us"); |
99 | | |
100 | | MOZ_CAN_RUN_SCRIPT static bool |
101 | | get_length(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::CharacterData* self, JSJitGetterCallArgs args) |
102 | 0 | { |
103 | 0 | AUTO_PROFILER_LABEL_FAST("get CharacterData.length", DOM, cx); |
104 | 0 |
|
105 | 0 | uint32_t result(self->Length()); |
106 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
107 | 0 | args.rval().setNumber(result); |
108 | 0 | return true; |
109 | 0 | } |
110 | | |
111 | | static const JSJitInfo length_getterinfo = { |
112 | | { (JSJitGetterOp)get_length }, |
113 | | { prototypes::id::CharacterData }, |
114 | | { PrototypeTraits<prototypes::id::CharacterData>::Depth }, |
115 | | JSJitInfo::Getter, |
116 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
117 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
118 | | true, /* isInfallible. False in setters. */ |
119 | | true, /* isMovable. Not relevant for setters. */ |
120 | | true, /* isEliminatable. Not relevant for setters. */ |
121 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
122 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
123 | | false, /* isTypedMethod. Only relevant for methods. */ |
124 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
125 | | }; |
126 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
127 | | static_assert(0 < 1, "There is no slot for us"); |
128 | | |
129 | | MOZ_CAN_RUN_SCRIPT static bool |
130 | | substringData(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::CharacterData* self, const JSJitMethodCallArgs& args) |
131 | 0 | { |
132 | 0 | AUTO_PROFILER_LABEL_FAST("CharacterData.substringData", DOM, cx); |
133 | 0 |
|
134 | 0 | if (MOZ_UNLIKELY(args.length() < 2)) { |
135 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "CharacterData.substringData"); |
136 | 0 | } |
137 | 0 | uint32_t arg0; |
138 | 0 | if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) { |
139 | 0 | return false; |
140 | 0 | } |
141 | 0 | uint32_t arg1; |
142 | 0 | if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) { |
143 | 0 | return false; |
144 | 0 | } |
145 | 0 | FastErrorResult rv; |
146 | 0 | DOMString result; |
147 | 0 | self->SubstringData(arg0, arg1, result, rv); |
148 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
149 | 0 | return false; |
150 | 0 | } |
151 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
152 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
153 | 0 | return false; |
154 | 0 | } |
155 | 0 | return true; |
156 | 0 | } |
157 | | |
158 | | static const JSJitInfo substringData_methodinfo = { |
159 | | { (JSJitGetterOp)substringData }, |
160 | | { prototypes::id::CharacterData }, |
161 | | { PrototypeTraits<prototypes::id::CharacterData>::Depth }, |
162 | | JSJitInfo::Method, |
163 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
164 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
165 | | false, /* isInfallible. False in setters. */ |
166 | | false, /* isMovable. Not relevant for setters. */ |
167 | | false, /* isEliminatable. Not relevant for setters. */ |
168 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
169 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
170 | | false, /* isTypedMethod. Only relevant for methods. */ |
171 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
172 | | }; |
173 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
174 | | static_assert(0 < 1, "There is no slot for us"); |
175 | | |
176 | | MOZ_CAN_RUN_SCRIPT static bool |
177 | | appendData(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::CharacterData* self, const JSJitMethodCallArgs& args) |
178 | 0 | { |
179 | 0 | AUTO_PROFILER_LABEL_FAST("CharacterData.appendData", DOM, cx); |
180 | 0 |
|
181 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
182 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "CharacterData.appendData"); |
183 | 0 | } |
184 | 0 | binding_detail::FakeString arg0; |
185 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
186 | 0 | return false; |
187 | 0 | } |
188 | 0 | FastErrorResult rv; |
189 | 0 | self->AppendData(NonNullHelper(Constify(arg0)), rv); |
190 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
191 | 0 | return false; |
192 | 0 | } |
193 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
194 | 0 | args.rval().setUndefined(); |
195 | 0 | return true; |
196 | 0 | } |
197 | | |
198 | | static const JSJitInfo appendData_methodinfo = { |
199 | | { (JSJitGetterOp)appendData }, |
200 | | { prototypes::id::CharacterData }, |
201 | | { PrototypeTraits<prototypes::id::CharacterData>::Depth }, |
202 | | JSJitInfo::Method, |
203 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
204 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
205 | | false, /* isInfallible. False in setters. */ |
206 | | false, /* isMovable. Not relevant for setters. */ |
207 | | false, /* isEliminatable. Not relevant for setters. */ |
208 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
209 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
210 | | false, /* isTypedMethod. Only relevant for methods. */ |
211 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
212 | | }; |
213 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
214 | | static_assert(0 < 1, "There is no slot for us"); |
215 | | |
216 | | MOZ_CAN_RUN_SCRIPT static bool |
217 | | insertData(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::CharacterData* self, const JSJitMethodCallArgs& args) |
218 | 0 | { |
219 | 0 | AUTO_PROFILER_LABEL_FAST("CharacterData.insertData", DOM, cx); |
220 | 0 |
|
221 | 0 | if (MOZ_UNLIKELY(args.length() < 2)) { |
222 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "CharacterData.insertData"); |
223 | 0 | } |
224 | 0 | uint32_t arg0; |
225 | 0 | if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) { |
226 | 0 | return false; |
227 | 0 | } |
228 | 0 | binding_detail::FakeString arg1; |
229 | 0 | if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) { |
230 | 0 | return false; |
231 | 0 | } |
232 | 0 | FastErrorResult rv; |
233 | 0 | self->InsertData(arg0, NonNullHelper(Constify(arg1)), rv); |
234 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
235 | 0 | return false; |
236 | 0 | } |
237 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
238 | 0 | args.rval().setUndefined(); |
239 | 0 | return true; |
240 | 0 | } |
241 | | |
242 | | static const JSJitInfo insertData_methodinfo = { |
243 | | { (JSJitGetterOp)insertData }, |
244 | | { prototypes::id::CharacterData }, |
245 | | { PrototypeTraits<prototypes::id::CharacterData>::Depth }, |
246 | | JSJitInfo::Method, |
247 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
248 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
249 | | false, /* isInfallible. False in setters. */ |
250 | | false, /* isMovable. Not relevant for setters. */ |
251 | | false, /* isEliminatable. Not relevant for setters. */ |
252 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
253 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
254 | | false, /* isTypedMethod. Only relevant for methods. */ |
255 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
256 | | }; |
257 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
258 | | static_assert(0 < 1, "There is no slot for us"); |
259 | | |
260 | | MOZ_CAN_RUN_SCRIPT static bool |
261 | | deleteData(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::CharacterData* self, const JSJitMethodCallArgs& args) |
262 | 0 | { |
263 | 0 | AUTO_PROFILER_LABEL_FAST("CharacterData.deleteData", DOM, cx); |
264 | 0 |
|
265 | 0 | if (MOZ_UNLIKELY(args.length() < 2)) { |
266 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "CharacterData.deleteData"); |
267 | 0 | } |
268 | 0 | uint32_t arg0; |
269 | 0 | if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) { |
270 | 0 | return false; |
271 | 0 | } |
272 | 0 | uint32_t arg1; |
273 | 0 | if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) { |
274 | 0 | return false; |
275 | 0 | } |
276 | 0 | FastErrorResult rv; |
277 | 0 | self->DeleteData(arg0, arg1, rv); |
278 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
279 | 0 | return false; |
280 | 0 | } |
281 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
282 | 0 | args.rval().setUndefined(); |
283 | 0 | return true; |
284 | 0 | } |
285 | | |
286 | | static const JSJitInfo deleteData_methodinfo = { |
287 | | { (JSJitGetterOp)deleteData }, |
288 | | { prototypes::id::CharacterData }, |
289 | | { PrototypeTraits<prototypes::id::CharacterData>::Depth }, |
290 | | JSJitInfo::Method, |
291 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
292 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
293 | | false, /* isInfallible. False in setters. */ |
294 | | false, /* isMovable. Not relevant for setters. */ |
295 | | false, /* isEliminatable. Not relevant for setters. */ |
296 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
297 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
298 | | false, /* isTypedMethod. Only relevant for methods. */ |
299 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
300 | | }; |
301 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
302 | | static_assert(0 < 1, "There is no slot for us"); |
303 | | |
304 | | MOZ_CAN_RUN_SCRIPT static bool |
305 | | replaceData(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::CharacterData* self, const JSJitMethodCallArgs& args) |
306 | 0 | { |
307 | 0 | AUTO_PROFILER_LABEL_FAST("CharacterData.replaceData", DOM, cx); |
308 | 0 |
|
309 | 0 | if (MOZ_UNLIKELY(args.length() < 3)) { |
310 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "CharacterData.replaceData"); |
311 | 0 | } |
312 | 0 | uint32_t arg0; |
313 | 0 | if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) { |
314 | 0 | return false; |
315 | 0 | } |
316 | 0 | uint32_t arg1; |
317 | 0 | if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) { |
318 | 0 | return false; |
319 | 0 | } |
320 | 0 | binding_detail::FakeString arg2; |
321 | 0 | if (!ConvertJSValueToString(cx, args[2], eStringify, eStringify, arg2)) { |
322 | 0 | return false; |
323 | 0 | } |
324 | 0 | FastErrorResult rv; |
325 | 0 | self->ReplaceData(arg0, arg1, NonNullHelper(Constify(arg2)), rv); |
326 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
327 | 0 | return false; |
328 | 0 | } |
329 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
330 | 0 | args.rval().setUndefined(); |
331 | 0 | return true; |
332 | 0 | } |
333 | | |
334 | | static const JSJitInfo replaceData_methodinfo = { |
335 | | { (JSJitGetterOp)replaceData }, |
336 | | { prototypes::id::CharacterData }, |
337 | | { PrototypeTraits<prototypes::id::CharacterData>::Depth }, |
338 | | JSJitInfo::Method, |
339 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
340 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
341 | | false, /* isInfallible. False in setters. */ |
342 | | false, /* isMovable. Not relevant for setters. */ |
343 | | false, /* isEliminatable. Not relevant for setters. */ |
344 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
345 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
346 | | false, /* isTypedMethod. Only relevant for methods. */ |
347 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
348 | | }; |
349 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
350 | | static_assert(0 < 1, "There is no slot for us"); |
351 | | |
352 | | MOZ_CAN_RUN_SCRIPT static bool |
353 | | before(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::CharacterData* self, const JSJitMethodCallArgs& args) |
354 | 0 | { |
355 | 0 | AUTO_PROFILER_LABEL_FAST("CharacterData.before", DOM, cx); |
356 | 0 |
|
357 | 0 | AutoSequence<OwningNodeOrString> arg0; |
358 | 0 | if (args.length() > 0) { |
359 | 0 | if (!arg0.SetCapacity(args.length() - 0, mozilla::fallible)) { |
360 | 0 | JS_ReportOutOfMemory(cx); |
361 | 0 | return false; |
362 | 0 | } |
363 | 0 | for (uint32_t variadicArg = 0; variadicArg < args.length(); ++variadicArg) { |
364 | 0 | OwningNodeOrString& slot = *arg0.AppendElement(mozilla::fallible); |
365 | 0 | { |
366 | 0 | bool done = false, failed = false, tryNext; |
367 | 0 | if (args[variadicArg].isObject()) { |
368 | 0 | done = (failed = !slot.TrySetToNode(cx, args[variadicArg], tryNext, false)) || !tryNext; |
369 | 0 |
|
370 | 0 | } |
371 | 0 | if (!done) { |
372 | 0 | do { |
373 | 0 | done = (failed = !slot.TrySetToString(cx, args[variadicArg], tryNext)) || !tryNext; |
374 | 0 | break; |
375 | 0 | } while (false); |
376 | 0 | } |
377 | 0 | if (failed) { |
378 | 0 | return false; |
379 | 0 | } |
380 | 0 | if (!done) { |
381 | 0 | ThrowErrorMessage(cx, MSG_NOT_IN_UNION, "Argument 1 of CharacterData.before", "Node"); |
382 | 0 | return false; |
383 | 0 | } |
384 | 0 | } |
385 | 0 | } |
386 | 0 | } |
387 | 0 | Maybe<AutoCEReaction> ceReaction; |
388 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
389 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
390 | 0 | if (docGroup) { |
391 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
392 | 0 | } |
393 | 0 | } |
394 | 0 | FastErrorResult rv; |
395 | 0 | self->Before(Constify(arg0), rv); |
396 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
397 | 0 | return false; |
398 | 0 | } |
399 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
400 | 0 | args.rval().setUndefined(); |
401 | 0 | return true; |
402 | 0 | } |
403 | | |
404 | | static const JSJitInfo before_methodinfo = { |
405 | | { (JSJitGetterOp)before }, |
406 | | { prototypes::id::CharacterData }, |
407 | | { PrototypeTraits<prototypes::id::CharacterData>::Depth }, |
408 | | JSJitInfo::Method, |
409 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
410 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
411 | | false, /* isInfallible. False in setters. */ |
412 | | false, /* isMovable. Not relevant for setters. */ |
413 | | false, /* isEliminatable. Not relevant for setters. */ |
414 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
415 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
416 | | false, /* isTypedMethod. Only relevant for methods. */ |
417 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
418 | | }; |
419 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
420 | | static_assert(0 < 1, "There is no slot for us"); |
421 | | |
422 | | MOZ_CAN_RUN_SCRIPT static bool |
423 | | after(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::CharacterData* self, const JSJitMethodCallArgs& args) |
424 | 0 | { |
425 | 0 | AUTO_PROFILER_LABEL_FAST("CharacterData.after", DOM, cx); |
426 | 0 |
|
427 | 0 | AutoSequence<OwningNodeOrString> arg0; |
428 | 0 | if (args.length() > 0) { |
429 | 0 | if (!arg0.SetCapacity(args.length() - 0, mozilla::fallible)) { |
430 | 0 | JS_ReportOutOfMemory(cx); |
431 | 0 | return false; |
432 | 0 | } |
433 | 0 | for (uint32_t variadicArg = 0; variadicArg < args.length(); ++variadicArg) { |
434 | 0 | OwningNodeOrString& slot = *arg0.AppendElement(mozilla::fallible); |
435 | 0 | { |
436 | 0 | bool done = false, failed = false, tryNext; |
437 | 0 | if (args[variadicArg].isObject()) { |
438 | 0 | done = (failed = !slot.TrySetToNode(cx, args[variadicArg], tryNext, false)) || !tryNext; |
439 | 0 |
|
440 | 0 | } |
441 | 0 | if (!done) { |
442 | 0 | do { |
443 | 0 | done = (failed = !slot.TrySetToString(cx, args[variadicArg], tryNext)) || !tryNext; |
444 | 0 | break; |
445 | 0 | } while (false); |
446 | 0 | } |
447 | 0 | if (failed) { |
448 | 0 | return false; |
449 | 0 | } |
450 | 0 | if (!done) { |
451 | 0 | ThrowErrorMessage(cx, MSG_NOT_IN_UNION, "Argument 1 of CharacterData.after", "Node"); |
452 | 0 | return false; |
453 | 0 | } |
454 | 0 | } |
455 | 0 | } |
456 | 0 | } |
457 | 0 | Maybe<AutoCEReaction> ceReaction; |
458 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
459 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
460 | 0 | if (docGroup) { |
461 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
462 | 0 | } |
463 | 0 | } |
464 | 0 | FastErrorResult rv; |
465 | 0 | self->After(Constify(arg0), rv); |
466 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
467 | 0 | return false; |
468 | 0 | } |
469 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
470 | 0 | args.rval().setUndefined(); |
471 | 0 | return true; |
472 | 0 | } |
473 | | |
474 | | static const JSJitInfo after_methodinfo = { |
475 | | { (JSJitGetterOp)after }, |
476 | | { prototypes::id::CharacterData }, |
477 | | { PrototypeTraits<prototypes::id::CharacterData>::Depth }, |
478 | | JSJitInfo::Method, |
479 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
480 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
481 | | false, /* isInfallible. False in setters. */ |
482 | | false, /* isMovable. Not relevant for setters. */ |
483 | | false, /* isEliminatable. Not relevant for setters. */ |
484 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
485 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
486 | | false, /* isTypedMethod. Only relevant for methods. */ |
487 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
488 | | }; |
489 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
490 | | static_assert(0 < 1, "There is no slot for us"); |
491 | | |
492 | | MOZ_CAN_RUN_SCRIPT static bool |
493 | | replaceWith(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::CharacterData* self, const JSJitMethodCallArgs& args) |
494 | 0 | { |
495 | 0 | AUTO_PROFILER_LABEL_FAST("CharacterData.replaceWith", DOM, cx); |
496 | 0 |
|
497 | 0 | AutoSequence<OwningNodeOrString> arg0; |
498 | 0 | if (args.length() > 0) { |
499 | 0 | if (!arg0.SetCapacity(args.length() - 0, mozilla::fallible)) { |
500 | 0 | JS_ReportOutOfMemory(cx); |
501 | 0 | return false; |
502 | 0 | } |
503 | 0 | for (uint32_t variadicArg = 0; variadicArg < args.length(); ++variadicArg) { |
504 | 0 | OwningNodeOrString& slot = *arg0.AppendElement(mozilla::fallible); |
505 | 0 | { |
506 | 0 | bool done = false, failed = false, tryNext; |
507 | 0 | if (args[variadicArg].isObject()) { |
508 | 0 | done = (failed = !slot.TrySetToNode(cx, args[variadicArg], tryNext, false)) || !tryNext; |
509 | 0 |
|
510 | 0 | } |
511 | 0 | if (!done) { |
512 | 0 | do { |
513 | 0 | done = (failed = !slot.TrySetToString(cx, args[variadicArg], tryNext)) || !tryNext; |
514 | 0 | break; |
515 | 0 | } while (false); |
516 | 0 | } |
517 | 0 | if (failed) { |
518 | 0 | return false; |
519 | 0 | } |
520 | 0 | if (!done) { |
521 | 0 | ThrowErrorMessage(cx, MSG_NOT_IN_UNION, "Argument 1 of CharacterData.replaceWith", "Node"); |
522 | 0 | return false; |
523 | 0 | } |
524 | 0 | } |
525 | 0 | } |
526 | 0 | } |
527 | 0 | Maybe<AutoCEReaction> ceReaction; |
528 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
529 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
530 | 0 | if (docGroup) { |
531 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
532 | 0 | } |
533 | 0 | } |
534 | 0 | FastErrorResult rv; |
535 | 0 | self->ReplaceWith(Constify(arg0), rv); |
536 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
537 | 0 | return false; |
538 | 0 | } |
539 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
540 | 0 | args.rval().setUndefined(); |
541 | 0 | return true; |
542 | 0 | } |
543 | | |
544 | | static const JSJitInfo replaceWith_methodinfo = { |
545 | | { (JSJitGetterOp)replaceWith }, |
546 | | { prototypes::id::CharacterData }, |
547 | | { PrototypeTraits<prototypes::id::CharacterData>::Depth }, |
548 | | JSJitInfo::Method, |
549 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
550 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
551 | | false, /* isInfallible. False in setters. */ |
552 | | false, /* isMovable. Not relevant for setters. */ |
553 | | false, /* isEliminatable. Not relevant for setters. */ |
554 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
555 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
556 | | false, /* isTypedMethod. Only relevant for methods. */ |
557 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
558 | | }; |
559 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
560 | | static_assert(0 < 1, "There is no slot for us"); |
561 | | |
562 | | MOZ_CAN_RUN_SCRIPT static bool |
563 | | remove(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::CharacterData* self, const JSJitMethodCallArgs& args) |
564 | 0 | { |
565 | 0 | AUTO_PROFILER_LABEL_FAST("CharacterData.remove", DOM, cx); |
566 | 0 |
|
567 | 0 | Maybe<AutoCEReaction> ceReaction; |
568 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
569 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
570 | 0 | if (docGroup) { |
571 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
572 | 0 | } |
573 | 0 | } |
574 | 0 | self->Remove(); |
575 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
576 | 0 | args.rval().setUndefined(); |
577 | 0 | return true; |
578 | 0 | } |
579 | | |
580 | | static const JSJitInfo remove_methodinfo = { |
581 | | { (JSJitGetterOp)remove }, |
582 | | { prototypes::id::CharacterData }, |
583 | | { PrototypeTraits<prototypes::id::CharacterData>::Depth }, |
584 | | JSJitInfo::Method, |
585 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
586 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
587 | | true, /* isInfallible. False in setters. */ |
588 | | false, /* isMovable. Not relevant for setters. */ |
589 | | false, /* isEliminatable. Not relevant for setters. */ |
590 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
591 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
592 | | false, /* isTypedMethod. Only relevant for methods. */ |
593 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
594 | | }; |
595 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
596 | | static_assert(0 < 1, "There is no slot for us"); |
597 | | |
598 | | MOZ_CAN_RUN_SCRIPT static bool |
599 | | get_previousElementSibling(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::CharacterData* self, JSJitGetterCallArgs args) |
600 | 0 | { |
601 | 0 | AUTO_PROFILER_LABEL_FAST("get CharacterData.previousElementSibling", DOM, cx); |
602 | 0 |
|
603 | 0 | auto result(StrongOrRawPtr<mozilla::dom::Element>(self->GetPreviousElementSibling())); |
604 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
605 | 0 | if (!result) { |
606 | 0 | args.rval().setNull(); |
607 | 0 | return true; |
608 | 0 | } |
609 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
610 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
611 | 0 | return false; |
612 | 0 | } |
613 | 0 | return true; |
614 | 0 | } |
615 | | |
616 | | static const JSJitInfo previousElementSibling_getterinfo = { |
617 | | { (JSJitGetterOp)get_previousElementSibling }, |
618 | | { prototypes::id::CharacterData }, |
619 | | { PrototypeTraits<prototypes::id::CharacterData>::Depth }, |
620 | | JSJitInfo::Getter, |
621 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
622 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
623 | | false, /* isInfallible. False in setters. */ |
624 | | true, /* isMovable. Not relevant for setters. */ |
625 | | true, /* isEliminatable. Not relevant for setters. */ |
626 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
627 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
628 | | false, /* isTypedMethod. Only relevant for methods. */ |
629 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
630 | | }; |
631 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
632 | | static_assert(0 < 1, "There is no slot for us"); |
633 | | |
634 | | MOZ_CAN_RUN_SCRIPT static bool |
635 | | get_nextElementSibling(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::CharacterData* self, JSJitGetterCallArgs args) |
636 | 0 | { |
637 | 0 | AUTO_PROFILER_LABEL_FAST("get CharacterData.nextElementSibling", DOM, cx); |
638 | 0 |
|
639 | 0 | auto result(StrongOrRawPtr<mozilla::dom::Element>(self->GetNextElementSibling())); |
640 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
641 | 0 | if (!result) { |
642 | 0 | args.rval().setNull(); |
643 | 0 | return true; |
644 | 0 | } |
645 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
646 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
647 | 0 | return false; |
648 | 0 | } |
649 | 0 | return true; |
650 | 0 | } |
651 | | |
652 | | static const JSJitInfo nextElementSibling_getterinfo = { |
653 | | { (JSJitGetterOp)get_nextElementSibling }, |
654 | | { prototypes::id::CharacterData }, |
655 | | { PrototypeTraits<prototypes::id::CharacterData>::Depth }, |
656 | | JSJitInfo::Getter, |
657 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
658 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
659 | | false, /* isInfallible. False in setters. */ |
660 | | true, /* isMovable. Not relevant for setters. */ |
661 | | true, /* isEliminatable. Not relevant for setters. */ |
662 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
663 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
664 | | false, /* isTypedMethod. Only relevant for methods. */ |
665 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
666 | | }; |
667 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
668 | | static_assert(0 < 1, "There is no slot for us"); |
669 | | |
670 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
671 | | #if defined(__clang__) |
672 | | #pragma clang diagnostic push |
673 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
674 | | #endif |
675 | | static const JSFunctionSpec sMethods_specs[] = { |
676 | | JS_FNSPEC("substringData", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&substringData_methodinfo), 2, JSPROP_ENUMERATE, nullptr), |
677 | | JS_FNSPEC("appendData", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&appendData_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
678 | | JS_FNSPEC("insertData", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&insertData_methodinfo), 2, JSPROP_ENUMERATE, nullptr), |
679 | | JS_FNSPEC("deleteData", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&deleteData_methodinfo), 2, JSPROP_ENUMERATE, nullptr), |
680 | | JS_FNSPEC("replaceData", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&replaceData_methodinfo), 3, JSPROP_ENUMERATE, nullptr), |
681 | | JS_FNSPEC("before", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&before_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
682 | | JS_FNSPEC("after", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&after_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
683 | | JS_FNSPEC("replaceWith", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&replaceWith_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
684 | | JS_FNSPEC("remove", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&remove_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
685 | | JS_FS_END |
686 | | }; |
687 | | #if defined(__clang__) |
688 | | #pragma clang diagnostic pop |
689 | | #endif |
690 | | |
691 | | |
692 | | static const Prefable<const JSFunctionSpec> sMethods[] = { |
693 | | { nullptr, &sMethods_specs[0] }, |
694 | | { nullptr, nullptr } |
695 | | }; |
696 | | |
697 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
698 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
699 | | static_assert(9 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
700 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
701 | | |
702 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
703 | | #if defined(__clang__) |
704 | | #pragma clang diagnostic push |
705 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
706 | | #endif |
707 | | static const JSPropertySpec sAttributes_specs[] = { |
708 | | { "data", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &data_getterinfo, GenericSetter<NormalThisPolicy>, &data_setterinfo }, |
709 | | { "length", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &length_getterinfo, nullptr, nullptr }, |
710 | | { "previousElementSibling", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &previousElementSibling_getterinfo, nullptr, nullptr }, |
711 | | { "nextElementSibling", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &nextElementSibling_getterinfo, nullptr, nullptr }, |
712 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr } |
713 | | }; |
714 | | #if defined(__clang__) |
715 | | #pragma clang diagnostic pop |
716 | | #endif |
717 | | |
718 | | |
719 | | static const Prefable<const JSPropertySpec> sAttributes[] = { |
720 | | { nullptr, &sAttributes_specs[0] }, |
721 | | { nullptr, nullptr } |
722 | | }; |
723 | | |
724 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
725 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
726 | | static_assert(4 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
727 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
728 | | |
729 | | |
730 | | static uint16_t sNativeProperties_sortedPropertyIndices[13]; |
731 | | static PropertyInfo sNativeProperties_propertyInfos[13]; |
732 | | |
733 | | static const NativePropertiesN<2> sNativeProperties = { |
734 | | false, 0, |
735 | | false, 0, |
736 | | true, 0 /* sMethods */, |
737 | | true, 1 /* sAttributes */, |
738 | | false, 0, |
739 | | false, 0, |
740 | | false, 0, |
741 | | -1, |
742 | | 13, |
743 | | sNativeProperties_sortedPropertyIndices, |
744 | | { |
745 | | { sMethods, &sNativeProperties_propertyInfos[0] }, |
746 | | { sAttributes, &sNativeProperties_propertyInfos[9] } |
747 | | } |
748 | | }; |
749 | | static_assert(13 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount), |
750 | | "We have a property info count that is oversized"); |
751 | | |
752 | | static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = { |
753 | | { |
754 | | "Function", |
755 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE), |
756 | | &sBoringInterfaceObjectClassClassOps, |
757 | | JS_NULL_CLASS_SPEC, |
758 | | JS_NULL_CLASS_EXT, |
759 | | &sInterfaceObjectClassObjectOps |
760 | | }, |
761 | | eInterface, |
762 | | true, |
763 | | prototypes::id::CharacterData, |
764 | | PrototypeTraits<prototypes::id::CharacterData>::Depth, |
765 | | sNativePropertyHooks, |
766 | | "function CharacterData() {\n [native code]\n}", |
767 | | Node_Binding::GetConstructorObject |
768 | | }; |
769 | | |
770 | | static const DOMIfaceAndProtoJSClass sPrototypeClass = { |
771 | | { |
772 | | "CharacterDataPrototype", |
773 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE), |
774 | | JS_NULL_CLASS_OPS, |
775 | | JS_NULL_CLASS_SPEC, |
776 | | JS_NULL_CLASS_EXT, |
777 | | JS_NULL_OBJECT_OPS |
778 | | }, |
779 | | eInterfacePrototype, |
780 | | false, |
781 | | prototypes::id::CharacterData, |
782 | | PrototypeTraits<prototypes::id::CharacterData>::Depth, |
783 | | sNativePropertyHooks, |
784 | | "[object CharacterDataPrototype]", |
785 | | Node_Binding::GetProtoObject |
786 | | }; |
787 | | |
788 | | const NativePropertyHooks sNativePropertyHooks[] = { { |
789 | | nullptr, |
790 | | nullptr, |
791 | | nullptr, |
792 | | { sNativeProperties.Upcast(), nullptr }, |
793 | | prototypes::id::CharacterData, |
794 | | constructors::id::CharacterData, |
795 | | Node_Binding::sNativePropertyHooks, |
796 | | &DefaultXrayExpandoObjectClass |
797 | | } }; |
798 | | |
799 | | static const char* const unscopableNames[] = { |
800 | | "before", |
801 | | "after", |
802 | | "replaceWith", |
803 | | "remove", |
804 | | nullptr |
805 | | }; |
806 | | |
807 | | void |
808 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal) |
809 | 0 | { |
810 | 0 | JS::Handle<JSObject*> parentProto(Node_Binding::GetProtoObjectHandle(aCx)); |
811 | 0 | if (!parentProto) { |
812 | 0 | return; |
813 | 0 | } |
814 | 0 | |
815 | 0 | JS::Handle<JSObject*> constructorProto(Node_Binding::GetConstructorObjectHandle(aCx)); |
816 | 0 | if (!constructorProto) { |
817 | 0 | return; |
818 | 0 | } |
819 | 0 | |
820 | 0 | static bool sIdsInited = false; |
821 | 0 | if (!sIdsInited && NS_IsMainThread()) { |
822 | 0 | if (!InitIds(aCx, sNativeProperties.Upcast())) { |
823 | 0 | return; |
824 | 0 | } |
825 | 0 | sIdsInited = true; |
826 | 0 | } |
827 | 0 |
|
828 | 0 | JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::CharacterData); |
829 | 0 | JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::CharacterData); |
830 | 0 | dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, |
831 | 0 | &sPrototypeClass.mBase, protoCache, |
832 | 0 | nullptr, |
833 | 0 | constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr, |
834 | 0 | interfaceCache, |
835 | 0 | sNativeProperties.Upcast(), |
836 | 0 | nullptr, |
837 | 0 | "CharacterData", aDefineOnGlobal, |
838 | 0 | unscopableNames, |
839 | 0 | false); |
840 | 0 | } |
841 | | |
842 | | JSObject* |
843 | | GetProtoObject(JSContext* aCx) |
844 | 0 | { |
845 | 0 | return GetProtoObjectHandle(aCx); |
846 | 0 | } |
847 | | |
848 | | JSObject* |
849 | | GetConstructorObject(JSContext* aCx) |
850 | 0 | { |
851 | 0 | return GetConstructorObjectHandle(aCx); |
852 | 0 | } |
853 | | |
854 | | } // namespace CharacterData_Binding |
855 | | |
856 | | |
857 | | |
858 | | } // namespace dom |
859 | | } // namespace mozilla |