/work/obj-fuzz/dom/bindings/CSSGroupingRuleBinding.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* THIS FILE IS AUTOGENERATED FROM CSSGroupingRule.webidl BY Codegen.py - DO NOT EDIT */ |
2 | | |
3 | | #include "CSSGroupingRuleBinding.h" |
4 | | #include "CSSRuleBinding.h" |
5 | | #include "WrapperFactory.h" |
6 | | #include "mozilla/OwningNonNull.h" |
7 | | #include "mozilla/css/GroupRule.h" |
8 | | #include "mozilla/dom/BindingUtils.h" |
9 | | #include "mozilla/dom/CSSRuleList.h" |
10 | | #include "mozilla/dom/DOMJSClass.h" |
11 | | #include "mozilla/dom/NonRefcountedDOMObject.h" |
12 | | #include "mozilla/dom/PrimitiveConversions.h" |
13 | | #include "mozilla/dom/XrayExpandoClass.h" |
14 | | |
15 | | namespace mozilla { |
16 | | namespace dom { |
17 | | |
18 | | namespace binding_detail {}; // Just to make sure it's known as a namespace |
19 | | using namespace mozilla::dom::binding_detail; |
20 | | |
21 | | |
22 | | namespace CSSGroupingRule_Binding { |
23 | | |
24 | | static_assert(IsRefcounted<NativeType>::value == IsRefcounted<CSSRule_Binding::NativeType>::value, |
25 | | "Can't inherit from an interface with a different ownership model."); |
26 | | |
27 | | MOZ_CAN_RUN_SCRIPT static bool |
28 | | get_cssRules(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::css::GroupRule* self, JSJitGetterCallArgs args) |
29 | 0 | { |
30 | 0 | AUTO_PROFILER_LABEL_FAST("get CSSGroupingRule.cssRules", DOM, cx); |
31 | 0 |
|
32 | 0 | auto result(StrongOrRawPtr<mozilla::dom::CSSRuleList>(self->CssRules())); |
33 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
34 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
35 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
36 | 0 | return false; |
37 | 0 | } |
38 | 0 | return true; |
39 | 0 | } |
40 | | |
41 | | static const JSJitInfo cssRules_getterinfo = { |
42 | | { (JSJitGetterOp)get_cssRules }, |
43 | | { prototypes::id::CSSGroupingRule }, |
44 | | { PrototypeTraits<prototypes::id::CSSGroupingRule>::Depth }, |
45 | | JSJitInfo::Getter, |
46 | | JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */ |
47 | | JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ |
48 | | false, /* isInfallible. False in setters. */ |
49 | | true, /* isMovable. Not relevant for setters. */ |
50 | | true, /* isEliminatable. Not relevant for setters. */ |
51 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
52 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
53 | | false, /* isTypedMethod. Only relevant for methods. */ |
54 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
55 | | }; |
56 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
57 | | static_assert(0 < 1, "There is no slot for us"); |
58 | | |
59 | | MOZ_CAN_RUN_SCRIPT static bool |
60 | | insertRule(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::css::GroupRule* self, const JSJitMethodCallArgs& args) |
61 | 0 | { |
62 | 0 | AUTO_PROFILER_LABEL_FAST("CSSGroupingRule.insertRule", DOM, cx); |
63 | 0 |
|
64 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
65 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "CSSGroupingRule.insertRule"); |
66 | 0 | } |
67 | 0 | binding_detail::FakeString arg0; |
68 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
69 | 0 | return false; |
70 | 0 | } |
71 | 0 | uint32_t arg1; |
72 | 0 | if (args.hasDefined(1)) { |
73 | 0 | if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) { |
74 | 0 | return false; |
75 | 0 | } |
76 | 0 | } else { |
77 | 0 | arg1 = 0U; |
78 | 0 | } |
79 | 0 | FastErrorResult rv; |
80 | 0 | uint32_t result(self->InsertRule(NonNullHelper(Constify(arg0)), arg1, rv)); |
81 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
82 | 0 | return false; |
83 | 0 | } |
84 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
85 | 0 | args.rval().setNumber(result); |
86 | 0 | return true; |
87 | 0 | } |
88 | | |
89 | | static const JSJitInfo insertRule_methodinfo = { |
90 | | { (JSJitGetterOp)insertRule }, |
91 | | { prototypes::id::CSSGroupingRule }, |
92 | | { PrototypeTraits<prototypes::id::CSSGroupingRule>::Depth }, |
93 | | JSJitInfo::Method, |
94 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
95 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
96 | | false, /* isInfallible. False in setters. */ |
97 | | false, /* isMovable. Not relevant for setters. */ |
98 | | false, /* isEliminatable. Not relevant for setters. */ |
99 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
100 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
101 | | false, /* isTypedMethod. Only relevant for methods. */ |
102 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
103 | | }; |
104 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
105 | | static_assert(0 < 1, "There is no slot for us"); |
106 | | |
107 | | MOZ_CAN_RUN_SCRIPT static bool |
108 | | deleteRule(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::css::GroupRule* self, const JSJitMethodCallArgs& args) |
109 | 0 | { |
110 | 0 | AUTO_PROFILER_LABEL_FAST("CSSGroupingRule.deleteRule", DOM, cx); |
111 | 0 |
|
112 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
113 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "CSSGroupingRule.deleteRule"); |
114 | 0 | } |
115 | 0 | uint32_t arg0; |
116 | 0 | if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) { |
117 | 0 | return false; |
118 | 0 | } |
119 | 0 | FastErrorResult rv; |
120 | 0 | self->DeleteRule(arg0, rv); |
121 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
122 | 0 | return false; |
123 | 0 | } |
124 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
125 | 0 | args.rval().setUndefined(); |
126 | 0 | return true; |
127 | 0 | } |
128 | | |
129 | | static const JSJitInfo deleteRule_methodinfo = { |
130 | | { (JSJitGetterOp)deleteRule }, |
131 | | { prototypes::id::CSSGroupingRule }, |
132 | | { PrototypeTraits<prototypes::id::CSSGroupingRule>::Depth }, |
133 | | JSJitInfo::Method, |
134 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
135 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
136 | | false, /* isInfallible. False in setters. */ |
137 | | false, /* isMovable. Not relevant for setters. */ |
138 | | false, /* isEliminatable. Not relevant for setters. */ |
139 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
140 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
141 | | false, /* isTypedMethod. Only relevant for methods. */ |
142 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
143 | | }; |
144 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
145 | | static_assert(0 < 1, "There is no slot for us"); |
146 | | |
147 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
148 | | #if defined(__clang__) |
149 | | #pragma clang diagnostic push |
150 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
151 | | #endif |
152 | | static const JSFunctionSpec sMethods_specs[] = { |
153 | | JS_FNSPEC("insertRule", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&insertRule_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
154 | | JS_FNSPEC("deleteRule", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&deleteRule_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
155 | | JS_FS_END |
156 | | }; |
157 | | #if defined(__clang__) |
158 | | #pragma clang diagnostic pop |
159 | | #endif |
160 | | |
161 | | |
162 | | static const Prefable<const JSFunctionSpec> sMethods[] = { |
163 | | { nullptr, &sMethods_specs[0] }, |
164 | | { nullptr, nullptr } |
165 | | }; |
166 | | |
167 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
168 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
169 | | static_assert(2 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
170 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
171 | | |
172 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
173 | | #if defined(__clang__) |
174 | | #pragma clang diagnostic push |
175 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
176 | | #endif |
177 | | static const JSPropertySpec sAttributes_specs[] = { |
178 | | { "cssRules", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &cssRules_getterinfo, nullptr, nullptr }, |
179 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr } |
180 | | }; |
181 | | #if defined(__clang__) |
182 | | #pragma clang diagnostic pop |
183 | | #endif |
184 | | |
185 | | |
186 | | static const Prefable<const JSPropertySpec> sAttributes[] = { |
187 | | { nullptr, &sAttributes_specs[0] }, |
188 | | { nullptr, nullptr } |
189 | | }; |
190 | | |
191 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
192 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
193 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
194 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
195 | | |
196 | | |
197 | | static uint16_t sNativeProperties_sortedPropertyIndices[3]; |
198 | | static PropertyInfo sNativeProperties_propertyInfos[3]; |
199 | | |
200 | | static const NativePropertiesN<2> sNativeProperties = { |
201 | | false, 0, |
202 | | false, 0, |
203 | | true, 0 /* sMethods */, |
204 | | true, 1 /* sAttributes */, |
205 | | false, 0, |
206 | | false, 0, |
207 | | false, 0, |
208 | | -1, |
209 | | 3, |
210 | | sNativeProperties_sortedPropertyIndices, |
211 | | { |
212 | | { sMethods, &sNativeProperties_propertyInfos[0] }, |
213 | | { sAttributes, &sNativeProperties_propertyInfos[2] } |
214 | | } |
215 | | }; |
216 | | static_assert(3 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount), |
217 | | "We have a property info count that is oversized"); |
218 | | |
219 | | static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = { |
220 | | { |
221 | | "Function", |
222 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE), |
223 | | &sBoringInterfaceObjectClassClassOps, |
224 | | JS_NULL_CLASS_SPEC, |
225 | | JS_NULL_CLASS_EXT, |
226 | | &sInterfaceObjectClassObjectOps |
227 | | }, |
228 | | eInterface, |
229 | | true, |
230 | | prototypes::id::CSSGroupingRule, |
231 | | PrototypeTraits<prototypes::id::CSSGroupingRule>::Depth, |
232 | | sNativePropertyHooks, |
233 | | "function CSSGroupingRule() {\n [native code]\n}", |
234 | | CSSRule_Binding::GetConstructorObject |
235 | | }; |
236 | | |
237 | | static const DOMIfaceAndProtoJSClass sPrototypeClass = { |
238 | | { |
239 | | "CSSGroupingRulePrototype", |
240 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE), |
241 | | JS_NULL_CLASS_OPS, |
242 | | JS_NULL_CLASS_SPEC, |
243 | | JS_NULL_CLASS_EXT, |
244 | | JS_NULL_OBJECT_OPS |
245 | | }, |
246 | | eInterfacePrototype, |
247 | | false, |
248 | | prototypes::id::CSSGroupingRule, |
249 | | PrototypeTraits<prototypes::id::CSSGroupingRule>::Depth, |
250 | | sNativePropertyHooks, |
251 | | "[object CSSGroupingRulePrototype]", |
252 | | CSSRule_Binding::GetProtoObject |
253 | | }; |
254 | | |
255 | | const NativePropertyHooks sNativePropertyHooks[] = { { |
256 | | nullptr, |
257 | | nullptr, |
258 | | nullptr, |
259 | | { sNativeProperties.Upcast(), nullptr }, |
260 | | prototypes::id::CSSGroupingRule, |
261 | | constructors::id::CSSGroupingRule, |
262 | | CSSRule_Binding::sNativePropertyHooks, |
263 | | &DefaultXrayExpandoObjectClass |
264 | | } }; |
265 | | |
266 | | void |
267 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal) |
268 | 0 | { |
269 | 0 | JS::Handle<JSObject*> parentProto(CSSRule_Binding::GetProtoObjectHandle(aCx)); |
270 | 0 | if (!parentProto) { |
271 | 0 | return; |
272 | 0 | } |
273 | 0 | |
274 | 0 | JS::Handle<JSObject*> constructorProto(CSSRule_Binding::GetConstructorObjectHandle(aCx)); |
275 | 0 | if (!constructorProto) { |
276 | 0 | return; |
277 | 0 | } |
278 | 0 | |
279 | 0 | static bool sIdsInited = false; |
280 | 0 | if (!sIdsInited && NS_IsMainThread()) { |
281 | 0 | if (!InitIds(aCx, sNativeProperties.Upcast())) { |
282 | 0 | return; |
283 | 0 | } |
284 | 0 | sIdsInited = true; |
285 | 0 | } |
286 | 0 |
|
287 | 0 | JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::CSSGroupingRule); |
288 | 0 | JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::CSSGroupingRule); |
289 | 0 | dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, |
290 | 0 | &sPrototypeClass.mBase, protoCache, |
291 | 0 | nullptr, |
292 | 0 | constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr, |
293 | 0 | interfaceCache, |
294 | 0 | sNativeProperties.Upcast(), |
295 | 0 | nullptr, |
296 | 0 | "CSSGroupingRule", aDefineOnGlobal, |
297 | 0 | nullptr, |
298 | 0 | false); |
299 | 0 | } |
300 | | |
301 | | JSObject* |
302 | | GetProtoObject(JSContext* aCx) |
303 | 0 | { |
304 | 0 | return GetProtoObjectHandle(aCx); |
305 | 0 | } |
306 | | |
307 | | JSObject* |
308 | | GetConstructorObject(JSContext* aCx) |
309 | 0 | { |
310 | 0 | return GetConstructorObjectHandle(aCx); |
311 | 0 | } |
312 | | |
313 | | } // namespace CSSGroupingRule_Binding |
314 | | |
315 | | |
316 | | |
317 | | } // namespace dom |
318 | | } // namespace mozilla |