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