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