/work/obj-fuzz/dom/bindings/CSSImportRuleBinding.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* THIS FILE IS AUTOGENERATED FROM CSSImportRule.webidl BY Codegen.py - DO NOT EDIT */ |
2 | | |
3 | | #include "CSSImportRuleBinding.h" |
4 | | #include "CSSRuleBinding.h" |
5 | | #include "WrapperFactory.h" |
6 | | #include "mozilla/OwningNonNull.h" |
7 | | #include "mozilla/StyleSheet.h" |
8 | | #include "mozilla/dom/BindingUtils.h" |
9 | | #include "mozilla/dom/CSSImportRule.h" |
10 | | #include "mozilla/dom/DOMJSClass.h" |
11 | | #include "mozilla/dom/MediaList.h" |
12 | | #include "mozilla/dom/NonRefcountedDOMObject.h" |
13 | | #include "mozilla/dom/Nullable.h" |
14 | | #include "mozilla/dom/XrayExpandoClass.h" |
15 | | |
16 | | namespace mozilla { |
17 | | namespace dom { |
18 | | |
19 | | namespace binding_detail {}; // Just to make sure it's known as a namespace |
20 | | using namespace mozilla::dom::binding_detail; |
21 | | |
22 | | |
23 | | namespace CSSImportRule_Binding { |
24 | | |
25 | | static_assert(IsRefcounted<NativeType>::value == IsRefcounted<CSSRule_Binding::NativeType>::value, |
26 | | "Can't inherit from an interface with a different ownership model."); |
27 | | |
28 | | MOZ_CAN_RUN_SCRIPT static bool |
29 | | get_href(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::CSSImportRule* self, JSJitGetterCallArgs args) |
30 | 0 | { |
31 | 0 | AUTO_PROFILER_LABEL_FAST("get CSSImportRule.href", DOM, cx); |
32 | 0 |
|
33 | 0 | DOMString result; |
34 | 0 | self->GetHref(result); |
35 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
36 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
37 | 0 | return false; |
38 | 0 | } |
39 | 0 | return true; |
40 | 0 | } |
41 | | |
42 | | static const JSJitInfo href_getterinfo = { |
43 | | { (JSJitGetterOp)get_href }, |
44 | | { prototypes::id::CSSImportRule }, |
45 | | { PrototypeTraits<prototypes::id::CSSImportRule>::Depth }, |
46 | | JSJitInfo::Getter, |
47 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
48 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
49 | | false, /* isInfallible. False in setters. */ |
50 | | false, /* isMovable. Not relevant for setters. */ |
51 | | false, /* isEliminatable. Not relevant for setters. */ |
52 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
53 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
54 | | false, /* isTypedMethod. Only relevant for methods. */ |
55 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
56 | | }; |
57 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
58 | | static_assert(0 < 1, "There is no slot for us"); |
59 | | |
60 | | MOZ_CAN_RUN_SCRIPT static bool |
61 | | get_media(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::CSSImportRule* self, JSJitGetterCallArgs args) |
62 | 0 | { |
63 | 0 | AUTO_PROFILER_LABEL_FAST("get CSSImportRule.media", DOM, cx); |
64 | 0 |
|
65 | 0 | auto result(StrongOrRawPtr<mozilla::dom::MediaList>(self->GetMedia())); |
66 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
67 | 0 | if (!result) { |
68 | 0 | args.rval().setNull(); |
69 | 0 | return true; |
70 | 0 | } |
71 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
72 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
73 | 0 | return false; |
74 | 0 | } |
75 | 0 | return true; |
76 | 0 | } |
77 | | |
78 | | MOZ_CAN_RUN_SCRIPT static bool |
79 | | set_media(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::CSSImportRule* self, JSJitSetterCallArgs args) |
80 | 0 | { |
81 | 0 | AUTO_PROFILER_LABEL_FAST("set CSSImportRule.media", DOM, cx); |
82 | 0 |
|
83 | 0 | JS::Rooted<JS::Value> v(cx); |
84 | 0 | if (!JS_GetProperty(cx, obj, "media", &v)) { |
85 | 0 | return false; |
86 | 0 | } |
87 | 0 | |
88 | 0 | if (!v.isObject()) { |
89 | 0 | return ThrowErrorMessage(cx, MSG_NOT_OBJECT, "CSSImportRule.media"); |
90 | 0 | } |
91 | 0 | |
92 | 0 | JS::Rooted<JSObject*> targetObj(cx, &v.toObject()); |
93 | 0 | return JS_SetProperty(cx, targetObj, "mediaText", args[0]); |
94 | 0 | } |
95 | | |
96 | | static const JSJitInfo media_getterinfo = { |
97 | | { (JSJitGetterOp)get_media }, |
98 | | { prototypes::id::CSSImportRule }, |
99 | | { PrototypeTraits<prototypes::id::CSSImportRule>::Depth }, |
100 | | JSJitInfo::Getter, |
101 | | JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */ |
102 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
103 | | false, /* isInfallible. False in setters. */ |
104 | | true, /* isMovable. Not relevant for setters. */ |
105 | | true, /* isEliminatable. Not relevant for setters. */ |
106 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
107 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
108 | | false, /* isTypedMethod. Only relevant for methods. */ |
109 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
110 | | }; |
111 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
112 | | static_assert(0 < 1, "There is no slot for us"); |
113 | | static const JSJitInfo media_setterinfo = { |
114 | | { (JSJitGetterOp)set_media }, |
115 | | { prototypes::id::CSSImportRule }, |
116 | | { PrototypeTraits<prototypes::id::CSSImportRule>::Depth }, |
117 | | JSJitInfo::Setter, |
118 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
119 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
120 | | false, /* isInfallible. False in setters. */ |
121 | | false, /* isMovable. Not relevant for setters. */ |
122 | | false, /* isEliminatable. Not relevant for setters. */ |
123 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
124 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
125 | | false, /* isTypedMethod. Only relevant for methods. */ |
126 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
127 | | }; |
128 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
129 | | static_assert(0 < 1, "There is no slot for us"); |
130 | | |
131 | | MOZ_CAN_RUN_SCRIPT static bool |
132 | | get_styleSheet(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::CSSImportRule* self, JSJitGetterCallArgs args) |
133 | 0 | { |
134 | 0 | AUTO_PROFILER_LABEL_FAST("get CSSImportRule.styleSheet", DOM, cx); |
135 | 0 |
|
136 | 0 | auto result(StrongOrRawPtr<mozilla::StyleSheet>(self->GetStyleSheet())); |
137 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
138 | 0 | if (!result) { |
139 | 0 | args.rval().setNull(); |
140 | 0 | return true; |
141 | 0 | } |
142 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
143 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
144 | 0 | return false; |
145 | 0 | } |
146 | 0 | return true; |
147 | 0 | } |
148 | | |
149 | | static const JSJitInfo styleSheet_getterinfo = { |
150 | | { (JSJitGetterOp)get_styleSheet }, |
151 | | { prototypes::id::CSSImportRule }, |
152 | | { PrototypeTraits<prototypes::id::CSSImportRule>::Depth }, |
153 | | JSJitInfo::Getter, |
154 | | JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */ |
155 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
156 | | false, /* isInfallible. False in setters. */ |
157 | | true, /* isMovable. Not relevant for setters. */ |
158 | | true, /* isEliminatable. Not relevant for setters. */ |
159 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
160 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
161 | | false, /* isTypedMethod. Only relevant for methods. */ |
162 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
163 | | }; |
164 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
165 | | static_assert(0 < 1, "There is no slot for us"); |
166 | | |
167 | | static bool |
168 | | _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val) |
169 | 0 | { |
170 | 0 | mozilla::dom::CSSImportRule* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::CSSImportRule>(obj); |
171 | 0 | // We don't want to preserve if we don't have a wrapper, and we |
172 | 0 | // obviously can't preserve if we're not initialized. |
173 | 0 | if (self && self->GetWrapperPreserveColor()) { |
174 | 0 | PreserveWrapper(self); |
175 | 0 | } |
176 | 0 | return true; |
177 | 0 | } |
178 | | |
179 | | static void |
180 | | _finalize(js::FreeOp* fop, JSObject* obj) |
181 | 0 | { |
182 | 0 | mozilla::dom::CSSImportRule* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::CSSImportRule>(obj); |
183 | 0 | if (self) { |
184 | 0 | ClearWrapper(self, self, obj); |
185 | 0 | AddForDeferredFinalization<mozilla::dom::CSSImportRule>(self); |
186 | 0 | } |
187 | 0 | } |
188 | | |
189 | | static size_t |
190 | | _objectMoved(JSObject* obj, JSObject* old) |
191 | 0 | { |
192 | 0 | mozilla::dom::CSSImportRule* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::CSSImportRule>(obj); |
193 | 0 | if (self) { |
194 | 0 | UpdateWrapper(self, self, obj, old); |
195 | 0 | } |
196 | 0 |
|
197 | 0 | return 0; |
198 | 0 | } |
199 | | |
200 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
201 | | #if defined(__clang__) |
202 | | #pragma clang diagnostic push |
203 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
204 | | #endif |
205 | | static const JSPropertySpec sAttributes_specs[] = { |
206 | | { "href", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &href_getterinfo, nullptr, nullptr }, |
207 | | { "media", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &media_getterinfo, GenericSetter<NormalThisPolicy>, &media_setterinfo }, |
208 | | { "styleSheet", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &styleSheet_getterinfo, nullptr, nullptr }, |
209 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr } |
210 | | }; |
211 | | #if defined(__clang__) |
212 | | #pragma clang diagnostic pop |
213 | | #endif |
214 | | |
215 | | |
216 | | static const Prefable<const JSPropertySpec> sAttributes[] = { |
217 | | { nullptr, &sAttributes_specs[0] }, |
218 | | { nullptr, nullptr } |
219 | | }; |
220 | | |
221 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
222 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
223 | | static_assert(3 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
224 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
225 | | |
226 | | |
227 | | static uint16_t sNativeProperties_sortedPropertyIndices[3]; |
228 | | static PropertyInfo sNativeProperties_propertyInfos[3]; |
229 | | |
230 | | static const NativePropertiesN<1> sNativeProperties = { |
231 | | false, 0, |
232 | | false, 0, |
233 | | false, 0, |
234 | | true, 0 /* sAttributes */, |
235 | | false, 0, |
236 | | false, 0, |
237 | | false, 0, |
238 | | -1, |
239 | | 3, |
240 | | sNativeProperties_sortedPropertyIndices, |
241 | | { |
242 | | { sAttributes, &sNativeProperties_propertyInfos[0] } |
243 | | } |
244 | | }; |
245 | | static_assert(3 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount), |
246 | | "We have a property info count that is oversized"); |
247 | | |
248 | | static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = { |
249 | | { |
250 | | "Function", |
251 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE), |
252 | | &sBoringInterfaceObjectClassClassOps, |
253 | | JS_NULL_CLASS_SPEC, |
254 | | JS_NULL_CLASS_EXT, |
255 | | &sInterfaceObjectClassObjectOps |
256 | | }, |
257 | | eInterface, |
258 | | true, |
259 | | prototypes::id::CSSImportRule, |
260 | | PrototypeTraits<prototypes::id::CSSImportRule>::Depth, |
261 | | sNativePropertyHooks, |
262 | | "function CSSImportRule() {\n [native code]\n}", |
263 | | CSSRule_Binding::GetConstructorObject |
264 | | }; |
265 | | |
266 | | static const DOMIfaceAndProtoJSClass sPrototypeClass = { |
267 | | { |
268 | | "CSSImportRulePrototype", |
269 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE), |
270 | | JS_NULL_CLASS_OPS, |
271 | | JS_NULL_CLASS_SPEC, |
272 | | JS_NULL_CLASS_EXT, |
273 | | JS_NULL_OBJECT_OPS |
274 | | }, |
275 | | eInterfacePrototype, |
276 | | false, |
277 | | prototypes::id::CSSImportRule, |
278 | | PrototypeTraits<prototypes::id::CSSImportRule>::Depth, |
279 | | sNativePropertyHooks, |
280 | | "[object CSSImportRulePrototype]", |
281 | | CSSRule_Binding::GetProtoObject |
282 | | }; |
283 | | |
284 | | static const js::ClassOps sClassOps = { |
285 | | _addProperty, /* addProperty */ |
286 | | nullptr, /* delProperty */ |
287 | | nullptr, /* enumerate */ |
288 | | nullptr, /* newEnumerate */ |
289 | | nullptr, /* resolve */ |
290 | | nullptr, /* mayResolve */ |
291 | | _finalize, /* finalize */ |
292 | | nullptr, /* call */ |
293 | | nullptr, /* hasInstance */ |
294 | | nullptr, /* construct */ |
295 | | nullptr, /* trace */ |
296 | | }; |
297 | | |
298 | | static const js::ClassExtension sClassExtension = { |
299 | | nullptr, /* weakmapKeyDelegateOp */ |
300 | | _objectMoved /* objectMovedOp */ |
301 | | }; |
302 | | |
303 | | static const DOMJSClass sClass = { |
304 | | { "CSSImportRule", |
305 | | JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1), |
306 | | &sClassOps, |
307 | | JS_NULL_CLASS_SPEC, |
308 | | &sClassExtension, |
309 | | JS_NULL_OBJECT_OPS |
310 | | }, |
311 | | { prototypes::id::CSSRule, prototypes::id::CSSImportRule, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count }, |
312 | | IsBaseOf<nsISupports, mozilla::dom::CSSImportRule >::value, |
313 | | sNativePropertyHooks, |
314 | | FindAssociatedGlobalForNative<mozilla::dom::CSSImportRule>::Get, |
315 | | GetProtoObjectHandle, |
316 | | GetCCParticipant<mozilla::dom::CSSImportRule>::Get() |
317 | | }; |
318 | | static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS, |
319 | | "Must have the right minimal number of reserved slots."); |
320 | | static_assert(1 >= 1, |
321 | | "Must have enough reserved slots."); |
322 | | |
323 | | const JSClass* |
324 | | GetJSClass() |
325 | 0 | { |
326 | 0 | return sClass.ToJSClass(); |
327 | 0 | } |
328 | | |
329 | | bool |
330 | | Wrap(JSContext* aCx, mozilla::dom::CSSImportRule* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector) |
331 | 0 | { |
332 | 0 | static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::dom::CSSImportRule>::value, |
333 | 0 | "Shouldn't have wrappercached things that are not refcounted."); |
334 | 0 | MOZ_ASSERT(static_cast<mozilla::dom::CSSImportRule*>(aObject) == |
335 | 0 | reinterpret_cast<mozilla::dom::CSSImportRule*>(aObject), |
336 | 0 | "Multiple inheritance for mozilla::dom::CSSImportRule is broken."); |
337 | 0 | MOZ_ASSERT(static_cast<mozilla::css::Rule*>(aObject) == |
338 | 0 | reinterpret_cast<mozilla::css::Rule*>(aObject), |
339 | 0 | "Multiple inheritance for mozilla::css::Rule is broken."); |
340 | 0 | MOZ_ASSERT(ToSupportsIsCorrect(aObject)); |
341 | 0 | MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx)); |
342 | 0 | MOZ_ASSERT(!aCache->GetWrapper(), |
343 | 0 | "You should probably not be using Wrap() directly; use " |
344 | 0 | "GetOrCreateDOMReflector instead"); |
345 | 0 |
|
346 | 0 | MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache), |
347 | 0 | "nsISupports must be on our primary inheritance chain"); |
348 | 0 |
|
349 | 0 | JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject())); |
350 | 0 | if (!global) { |
351 | 0 | return false; |
352 | 0 | } |
353 | 0 | MOZ_ASSERT(JS_IsGlobalObject(global)); |
354 | 0 | MOZ_ASSERT(JS::ObjectIsNotGray(global)); |
355 | 0 |
|
356 | 0 | // That might have ended up wrapping us already, due to the wonders |
357 | 0 | // of XBL. Check for that, and bail out as needed. |
358 | 0 | aReflector.set(aCache->GetWrapper()); |
359 | 0 | if (aReflector) { |
360 | | #ifdef DEBUG |
361 | | AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto); |
362 | | #endif // DEBUG |
363 | | return true; |
364 | 0 | } |
365 | 0 |
|
366 | 0 | JSAutoRealm ar(aCx, global); |
367 | 0 | JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx); |
368 | 0 | if (!canonicalProto) { |
369 | 0 | return false; |
370 | 0 | } |
371 | 0 | JS::Rooted<JSObject*> proto(aCx); |
372 | 0 | if (aGivenProto) { |
373 | 0 | proto = aGivenProto; |
374 | 0 | // Unfortunately, while aGivenProto was in the compartment of aCx |
375 | 0 | // coming in, we changed compartments to that of "parent" so may need |
376 | 0 | // to wrap the proto here. |
377 | 0 | if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) { |
378 | 0 | if (!JS_WrapObject(aCx, &proto)) { |
379 | 0 | return false; |
380 | 0 | } |
381 | 0 | } |
382 | 0 | } else { |
383 | 0 | proto = canonicalProto; |
384 | 0 | } |
385 | 0 |
|
386 | 0 | BindingJSObjectCreator<mozilla::dom::CSSImportRule> creator(aCx); |
387 | 0 | creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector); |
388 | 0 | if (!aReflector) { |
389 | 0 | return false; |
390 | 0 | } |
391 | 0 | |
392 | 0 | aCache->SetWrapper(aReflector); |
393 | 0 | creator.InitializationSucceeded(); |
394 | 0 |
|
395 | 0 | MOZ_ASSERT(aCache->GetWrapperPreserveColor() && |
396 | 0 | aCache->GetWrapperPreserveColor() == aReflector); |
397 | 0 | // If proto != canonicalProto, we have to preserve our wrapper; |
398 | 0 | // otherwise we won't be able to properly recreate it later, since |
399 | 0 | // we won't know what proto to use. Note that we don't check |
400 | 0 | // aGivenProto here, since it's entirely possible (and even |
401 | 0 | // somewhat common) to have a non-null aGivenProto which is the |
402 | 0 | // same as canonicalProto. |
403 | 0 | if (proto != canonicalProto) { |
404 | 0 | PreserveWrapper(aObject); |
405 | 0 | } |
406 | 0 |
|
407 | 0 | return true; |
408 | 0 | } |
409 | | |
410 | | const NativePropertyHooks sNativePropertyHooks[] = { { |
411 | | nullptr, |
412 | | nullptr, |
413 | | nullptr, |
414 | | { sNativeProperties.Upcast(), nullptr }, |
415 | | prototypes::id::CSSImportRule, |
416 | | constructors::id::CSSImportRule, |
417 | | CSSRule_Binding::sNativePropertyHooks, |
418 | | &DefaultXrayExpandoObjectClass |
419 | | } }; |
420 | | |
421 | | void |
422 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal) |
423 | 0 | { |
424 | 0 | JS::Handle<JSObject*> parentProto(CSSRule_Binding::GetProtoObjectHandle(aCx)); |
425 | 0 | if (!parentProto) { |
426 | 0 | return; |
427 | 0 | } |
428 | 0 | |
429 | 0 | JS::Handle<JSObject*> constructorProto(CSSRule_Binding::GetConstructorObjectHandle(aCx)); |
430 | 0 | if (!constructorProto) { |
431 | 0 | return; |
432 | 0 | } |
433 | 0 | |
434 | 0 | static bool sIdsInited = false; |
435 | 0 | if (!sIdsInited && NS_IsMainThread()) { |
436 | 0 | if (!InitIds(aCx, sNativeProperties.Upcast())) { |
437 | 0 | return; |
438 | 0 | } |
439 | 0 | sIdsInited = true; |
440 | 0 | } |
441 | 0 |
|
442 | 0 | JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::CSSImportRule); |
443 | 0 | JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::CSSImportRule); |
444 | 0 | dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, |
445 | 0 | &sPrototypeClass.mBase, protoCache, |
446 | 0 | nullptr, |
447 | 0 | constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr, |
448 | 0 | interfaceCache, |
449 | 0 | sNativeProperties.Upcast(), |
450 | 0 | nullptr, |
451 | 0 | "CSSImportRule", aDefineOnGlobal, |
452 | 0 | nullptr, |
453 | 0 | false); |
454 | 0 | } |
455 | | |
456 | | JSObject* |
457 | | GetConstructorObject(JSContext* aCx) |
458 | 0 | { |
459 | 0 | return GetConstructorObjectHandle(aCx); |
460 | 0 | } |
461 | | |
462 | | } // namespace CSSImportRule_Binding |
463 | | |
464 | | |
465 | | |
466 | | } // namespace dom |
467 | | } // namespace mozilla |