/work/obj-fuzz/dom/bindings/CSSConditionRuleBinding.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* THIS FILE IS AUTOGENERATED FROM CSSConditionRule.webidl BY Codegen.py - DO NOT EDIT */ |
2 | | |
3 | | #include "CSSConditionRuleBinding.h" |
4 | | #include "CSSGroupingRuleBinding.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/DOMJSClass.h" |
10 | | #include "mozilla/dom/NonRefcountedDOMObject.h" |
11 | | #include "mozilla/dom/XrayExpandoClass.h" |
12 | | |
13 | | namespace mozilla { |
14 | | namespace dom { |
15 | | |
16 | | namespace binding_detail {}; // Just to make sure it's known as a namespace |
17 | | using namespace mozilla::dom::binding_detail; |
18 | | |
19 | | |
20 | | namespace CSSConditionRule_Binding { |
21 | | |
22 | | static_assert(IsRefcounted<NativeType>::value == IsRefcounted<CSSGroupingRule_Binding::NativeType>::value, |
23 | | "Can't inherit from an interface with a different ownership model."); |
24 | | |
25 | | MOZ_CAN_RUN_SCRIPT static bool |
26 | | get_conditionText(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::css::ConditionRule* self, JSJitGetterCallArgs args) |
27 | 0 | { |
28 | 0 | AUTO_PROFILER_LABEL_FAST("get CSSConditionRule.conditionText", DOM, cx); |
29 | 0 |
|
30 | 0 | DOMString result; |
31 | 0 | self->GetConditionText(result); |
32 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
33 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
34 | 0 | return false; |
35 | 0 | } |
36 | 0 | return true; |
37 | 0 | } |
38 | | |
39 | | MOZ_CAN_RUN_SCRIPT static bool |
40 | | set_conditionText(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::css::ConditionRule* self, JSJitSetterCallArgs args) |
41 | 0 | { |
42 | 0 | AUTO_PROFILER_LABEL_FAST("set CSSConditionRule.conditionText", DOM, cx); |
43 | 0 |
|
44 | 0 | binding_detail::FakeString arg0; |
45 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
46 | 0 | return false; |
47 | 0 | } |
48 | 0 | FastErrorResult rv; |
49 | 0 | self->SetConditionText(NonNullHelper(Constify(arg0)), rv); |
50 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
51 | 0 | return false; |
52 | 0 | } |
53 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
54 | 0 |
|
55 | 0 | return true; |
56 | 0 | } |
57 | | |
58 | | static const JSJitInfo conditionText_getterinfo = { |
59 | | { (JSJitGetterOp)get_conditionText }, |
60 | | { prototypes::id::CSSConditionRule }, |
61 | | { PrototypeTraits<prototypes::id::CSSConditionRule>::Depth }, |
62 | | JSJitInfo::Getter, |
63 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
64 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
65 | | false, /* isInfallible. False in setters. */ |
66 | | false, /* isMovable. Not relevant for setters. */ |
67 | | false, /* isEliminatable. Not relevant for setters. */ |
68 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
69 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
70 | | false, /* isTypedMethod. Only relevant for methods. */ |
71 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
72 | | }; |
73 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
74 | | static_assert(0 < 1, "There is no slot for us"); |
75 | | static const JSJitInfo conditionText_setterinfo = { |
76 | | { (JSJitGetterOp)set_conditionText }, |
77 | | { prototypes::id::CSSConditionRule }, |
78 | | { PrototypeTraits<prototypes::id::CSSConditionRule>::Depth }, |
79 | | JSJitInfo::Setter, |
80 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
81 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
82 | | false, /* isInfallible. False in setters. */ |
83 | | false, /* isMovable. Not relevant for setters. */ |
84 | | false, /* isEliminatable. Not relevant for setters. */ |
85 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
86 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
87 | | false, /* isTypedMethod. Only relevant for methods. */ |
88 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
89 | | }; |
90 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
91 | | static_assert(0 < 1, "There is no slot for us"); |
92 | | |
93 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
94 | | #if defined(__clang__) |
95 | | #pragma clang diagnostic push |
96 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
97 | | #endif |
98 | | static const JSPropertySpec sAttributes_specs[] = { |
99 | | { "conditionText", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &conditionText_getterinfo, GenericSetter<NormalThisPolicy>, &conditionText_setterinfo }, |
100 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr } |
101 | | }; |
102 | | #if defined(__clang__) |
103 | | #pragma clang diagnostic pop |
104 | | #endif |
105 | | |
106 | | |
107 | | static const Prefable<const JSPropertySpec> sAttributes[] = { |
108 | | { nullptr, &sAttributes_specs[0] }, |
109 | | { nullptr, nullptr } |
110 | | }; |
111 | | |
112 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
113 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
114 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
115 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
116 | | |
117 | | |
118 | | static uint16_t sNativeProperties_sortedPropertyIndices[1]; |
119 | | static PropertyInfo sNativeProperties_propertyInfos[1]; |
120 | | |
121 | | static const NativePropertiesN<1> sNativeProperties = { |
122 | | false, 0, |
123 | | false, 0, |
124 | | false, 0, |
125 | | true, 0 /* sAttributes */, |
126 | | false, 0, |
127 | | false, 0, |
128 | | false, 0, |
129 | | -1, |
130 | | 1, |
131 | | sNativeProperties_sortedPropertyIndices, |
132 | | { |
133 | | { sAttributes, &sNativeProperties_propertyInfos[0] } |
134 | | } |
135 | | }; |
136 | | static_assert(1 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount), |
137 | | "We have a property info count that is oversized"); |
138 | | |
139 | | static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = { |
140 | | { |
141 | | "Function", |
142 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE), |
143 | | &sBoringInterfaceObjectClassClassOps, |
144 | | JS_NULL_CLASS_SPEC, |
145 | | JS_NULL_CLASS_EXT, |
146 | | &sInterfaceObjectClassObjectOps |
147 | | }, |
148 | | eInterface, |
149 | | true, |
150 | | prototypes::id::CSSConditionRule, |
151 | | PrototypeTraits<prototypes::id::CSSConditionRule>::Depth, |
152 | | sNativePropertyHooks, |
153 | | "function CSSConditionRule() {\n [native code]\n}", |
154 | | CSSGroupingRule_Binding::GetConstructorObject |
155 | | }; |
156 | | |
157 | | static const DOMIfaceAndProtoJSClass sPrototypeClass = { |
158 | | { |
159 | | "CSSConditionRulePrototype", |
160 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE), |
161 | | JS_NULL_CLASS_OPS, |
162 | | JS_NULL_CLASS_SPEC, |
163 | | JS_NULL_CLASS_EXT, |
164 | | JS_NULL_OBJECT_OPS |
165 | | }, |
166 | | eInterfacePrototype, |
167 | | false, |
168 | | prototypes::id::CSSConditionRule, |
169 | | PrototypeTraits<prototypes::id::CSSConditionRule>::Depth, |
170 | | sNativePropertyHooks, |
171 | | "[object CSSConditionRulePrototype]", |
172 | | CSSGroupingRule_Binding::GetProtoObject |
173 | | }; |
174 | | |
175 | | const NativePropertyHooks sNativePropertyHooks[] = { { |
176 | | nullptr, |
177 | | nullptr, |
178 | | nullptr, |
179 | | { sNativeProperties.Upcast(), nullptr }, |
180 | | prototypes::id::CSSConditionRule, |
181 | | constructors::id::CSSConditionRule, |
182 | | CSSGroupingRule_Binding::sNativePropertyHooks, |
183 | | &DefaultXrayExpandoObjectClass |
184 | | } }; |
185 | | |
186 | | void |
187 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal) |
188 | 0 | { |
189 | 0 | JS::Handle<JSObject*> parentProto(CSSGroupingRule_Binding::GetProtoObjectHandle(aCx)); |
190 | 0 | if (!parentProto) { |
191 | 0 | return; |
192 | 0 | } |
193 | 0 | |
194 | 0 | JS::Handle<JSObject*> constructorProto(CSSGroupingRule_Binding::GetConstructorObjectHandle(aCx)); |
195 | 0 | if (!constructorProto) { |
196 | 0 | return; |
197 | 0 | } |
198 | 0 | |
199 | 0 | static bool sIdsInited = false; |
200 | 0 | if (!sIdsInited && NS_IsMainThread()) { |
201 | 0 | if (!InitIds(aCx, sNativeProperties.Upcast())) { |
202 | 0 | return; |
203 | 0 | } |
204 | 0 | sIdsInited = true; |
205 | 0 | } |
206 | 0 |
|
207 | 0 | JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::CSSConditionRule); |
208 | 0 | JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::CSSConditionRule); |
209 | 0 | dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, |
210 | 0 | &sPrototypeClass.mBase, protoCache, |
211 | 0 | nullptr, |
212 | 0 | constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr, |
213 | 0 | interfaceCache, |
214 | 0 | sNativeProperties.Upcast(), |
215 | 0 | nullptr, |
216 | 0 | "CSSConditionRule", aDefineOnGlobal, |
217 | 0 | nullptr, |
218 | 0 | false); |
219 | 0 | } |
220 | | |
221 | | JSObject* |
222 | | GetProtoObject(JSContext* aCx) |
223 | 0 | { |
224 | 0 | return GetProtoObjectHandle(aCx); |
225 | 0 | } |
226 | | |
227 | | JSObject* |
228 | | GetConstructorObject(JSContext* aCx) |
229 | 0 | { |
230 | 0 | return GetConstructorObjectHandle(aCx); |
231 | 0 | } |
232 | | |
233 | | } // namespace CSSConditionRule_Binding |
234 | | |
235 | | |
236 | | |
237 | | } // namespace dom |
238 | | } // namespace mozilla |