/work/obj-fuzz/dom/bindings/IDBFileRequestBinding.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* THIS FILE IS AUTOGENERATED FROM IDBFileRequest.webidl BY Codegen.py - DO NOT EDIT */ |
2 | | |
3 | | #include "DOMRequestBinding.h" |
4 | | #include "EventHandlerBinding.h" |
5 | | #include "IDBFileRequestBinding.h" |
6 | | #include "WrapperFactory.h" |
7 | | #include "mozilla/OwningNonNull.h" |
8 | | #include "mozilla/dom/BindingUtils.h" |
9 | | #include "mozilla/dom/DOMJSClass.h" |
10 | | #include "mozilla/dom/IDBFileHandle.h" |
11 | | #include "mozilla/dom/IDBFileRequest.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 IDBFileRequest_Binding { |
24 | | |
25 | | static_assert(IsRefcounted<NativeType>::value == IsRefcounted<DOMRequest_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_fileHandle(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::IDBFileRequest* self, JSJitGetterCallArgs args) |
30 | 0 | { |
31 | 0 | AUTO_PROFILER_LABEL_FAST("get IDBFileRequest.fileHandle", DOM, cx); |
32 | 0 |
|
33 | 0 | auto result(StrongOrRawPtr<mozilla::dom::IDBFileHandle>(self->GetFileHandle())); |
34 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
35 | 0 | if (!result) { |
36 | 0 | args.rval().setNull(); |
37 | 0 | return true; |
38 | 0 | } |
39 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
40 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
41 | 0 | return false; |
42 | 0 | } |
43 | 0 | return true; |
44 | 0 | } |
45 | | |
46 | | static const JSJitInfo fileHandle_getterinfo = { |
47 | | { (JSJitGetterOp)get_fileHandle }, |
48 | | { prototypes::id::IDBFileRequest }, |
49 | | { PrototypeTraits<prototypes::id::IDBFileRequest>::Depth }, |
50 | | JSJitInfo::Getter, |
51 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
52 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
53 | | false, /* isInfallible. False in setters. */ |
54 | | false, /* isMovable. Not relevant for setters. */ |
55 | | false, /* isEliminatable. Not relevant for setters. */ |
56 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
57 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
58 | | false, /* isTypedMethod. Only relevant for methods. */ |
59 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
60 | | }; |
61 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
62 | | static_assert(0 < 1, "There is no slot for us"); |
63 | | |
64 | | MOZ_CAN_RUN_SCRIPT static bool |
65 | | get_lockedFile(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::IDBFileRequest* self, JSJitGetterCallArgs args) |
66 | 0 | { |
67 | 0 | AUTO_PROFILER_LABEL_FAST("get IDBFileRequest.lockedFile", DOM, cx); |
68 | 0 |
|
69 | 0 | auto result(StrongOrRawPtr<mozilla::dom::IDBFileHandle>(self->GetLockedFile())); |
70 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
71 | 0 | if (!result) { |
72 | 0 | args.rval().setNull(); |
73 | 0 | return true; |
74 | 0 | } |
75 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
76 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
77 | 0 | return false; |
78 | 0 | } |
79 | 0 | return true; |
80 | 0 | } |
81 | | |
82 | | static const JSJitInfo lockedFile_getterinfo = { |
83 | | { (JSJitGetterOp)get_lockedFile }, |
84 | | { prototypes::id::IDBFileRequest }, |
85 | | { PrototypeTraits<prototypes::id::IDBFileRequest>::Depth }, |
86 | | JSJitInfo::Getter, |
87 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
88 | | JSVAL_TYPE_UNKNOWN, /* 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_onprogress(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::IDBFileRequest* self, JSJitGetterCallArgs args) |
102 | 0 | { |
103 | 0 | AUTO_PROFILER_LABEL_FAST("get IDBFileRequest.onprogress", DOM, cx); |
104 | 0 |
|
105 | 0 | RefPtr<EventHandlerNonNull> result(self->GetOnprogress()); |
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_onprogress(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::IDBFileRequest* self, JSJitSetterCallArgs args) |
121 | 0 | { |
122 | 0 | AUTO_PROFILER_LABEL_FAST("set IDBFileRequest.onprogress", 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->SetOnprogress(Constify(arg0)); |
133 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
134 | 0 |
|
135 | 0 | return true; |
136 | 0 | } |
137 | | |
138 | | static const JSJitInfo onprogress_getterinfo = { |
139 | | { (JSJitGetterOp)get_onprogress }, |
140 | | { prototypes::id::IDBFileRequest }, |
141 | | { PrototypeTraits<prototypes::id::IDBFileRequest>::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 onprogress_setterinfo = { |
156 | | { (JSJitGetterOp)set_onprogress }, |
157 | | { prototypes::id::IDBFileRequest }, |
158 | | { PrototypeTraits<prototypes::id::IDBFileRequest>::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::IDBFileRequest* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::IDBFileRequest>(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::IDBFileRequest* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::IDBFileRequest>(obj); |
189 | 0 | if (self) { |
190 | 0 | ClearWrapper(self, self, obj); |
191 | 0 | AddForDeferredFinalization<mozilla::dom::IDBFileRequest>(self); |
192 | 0 | } |
193 | 0 | } |
194 | | |
195 | | static size_t |
196 | | _objectMoved(JSObject* obj, JSObject* old) |
197 | 0 | { |
198 | 0 | mozilla::dom::IDBFileRequest* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::IDBFileRequest>(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 | | { "fileHandle", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &fileHandle_getterinfo, nullptr, nullptr }, |
213 | | { "lockedFile", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &lockedFile_getterinfo, nullptr, nullptr }, |
214 | | { "onprogress", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &onprogress_getterinfo, GenericSetter<NormalThisPolicy>, &onprogress_setterinfo }, |
215 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr } |
216 | | }; |
217 | | #if defined(__clang__) |
218 | | #pragma clang diagnostic pop |
219 | | #endif |
220 | | |
221 | | |
222 | | static const Prefable<const JSPropertySpec> sAttributes[] = { |
223 | | { nullptr, &sAttributes_specs[0] }, |
224 | | { nullptr, nullptr } |
225 | | }; |
226 | | |
227 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
228 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
229 | | static_assert(3 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
230 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
231 | | |
232 | | |
233 | | static uint16_t sNativeProperties_sortedPropertyIndices[3]; |
234 | | static PropertyInfo sNativeProperties_propertyInfos[3]; |
235 | | |
236 | | static const NativePropertiesN<1> sNativeProperties = { |
237 | | false, 0, |
238 | | false, 0, |
239 | | false, 0, |
240 | | true, 0 /* sAttributes */, |
241 | | false, 0, |
242 | | false, 0, |
243 | | false, 0, |
244 | | -1, |
245 | | 3, |
246 | | sNativeProperties_sortedPropertyIndices, |
247 | | { |
248 | | { sAttributes, &sNativeProperties_propertyInfos[0] } |
249 | | } |
250 | | }; |
251 | | static_assert(3 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount), |
252 | | "We have a property info count that is oversized"); |
253 | | |
254 | | static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = { |
255 | | { |
256 | | "Function", |
257 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE), |
258 | | &sBoringInterfaceObjectClassClassOps, |
259 | | JS_NULL_CLASS_SPEC, |
260 | | JS_NULL_CLASS_EXT, |
261 | | &sInterfaceObjectClassObjectOps |
262 | | }, |
263 | | eInterface, |
264 | | true, |
265 | | prototypes::id::IDBFileRequest, |
266 | | PrototypeTraits<prototypes::id::IDBFileRequest>::Depth, |
267 | | sNativePropertyHooks, |
268 | | "function IDBFileRequest() {\n [native code]\n}", |
269 | | DOMRequest_Binding::GetConstructorObject |
270 | | }; |
271 | | |
272 | | static const DOMIfaceAndProtoJSClass sPrototypeClass = { |
273 | | { |
274 | | "IDBFileRequestPrototype", |
275 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE), |
276 | | JS_NULL_CLASS_OPS, |
277 | | JS_NULL_CLASS_SPEC, |
278 | | JS_NULL_CLASS_EXT, |
279 | | JS_NULL_OBJECT_OPS |
280 | | }, |
281 | | eInterfacePrototype, |
282 | | false, |
283 | | prototypes::id::IDBFileRequest, |
284 | | PrototypeTraits<prototypes::id::IDBFileRequest>::Depth, |
285 | | sNativePropertyHooks, |
286 | | "[object IDBFileRequestPrototype]", |
287 | | DOMRequest_Binding::GetProtoObject |
288 | | }; |
289 | | |
290 | | static const js::ClassOps sClassOps = { |
291 | | _addProperty, /* addProperty */ |
292 | | nullptr, /* delProperty */ |
293 | | nullptr, /* enumerate */ |
294 | | nullptr, /* newEnumerate */ |
295 | | nullptr, /* resolve */ |
296 | | nullptr, /* mayResolve */ |
297 | | _finalize, /* finalize */ |
298 | | nullptr, /* call */ |
299 | | nullptr, /* hasInstance */ |
300 | | nullptr, /* construct */ |
301 | | nullptr, /* trace */ |
302 | | }; |
303 | | |
304 | | static const js::ClassExtension sClassExtension = { |
305 | | nullptr, /* weakmapKeyDelegateOp */ |
306 | | _objectMoved /* objectMovedOp */ |
307 | | }; |
308 | | |
309 | | static const DOMJSClass sClass = { |
310 | | { "IDBFileRequest", |
311 | | JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1), |
312 | | &sClassOps, |
313 | | JS_NULL_CLASS_SPEC, |
314 | | &sClassExtension, |
315 | | JS_NULL_OBJECT_OPS |
316 | | }, |
317 | | { prototypes::id::EventTarget, prototypes::id::DOMRequest, prototypes::id::IDBFileRequest, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count }, |
318 | | IsBaseOf<nsISupports, mozilla::dom::IDBFileRequest >::value, |
319 | | sNativePropertyHooks, |
320 | | FindAssociatedGlobalForNative<mozilla::dom::IDBFileRequest>::Get, |
321 | | GetProtoObjectHandle, |
322 | | GetCCParticipant<mozilla::dom::IDBFileRequest>::Get() |
323 | | }; |
324 | | static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS, |
325 | | "Must have the right minimal number of reserved slots."); |
326 | | static_assert(1 >= 1, |
327 | | "Must have enough reserved slots."); |
328 | | |
329 | | const JSClass* |
330 | | GetJSClass() |
331 | 0 | { |
332 | 0 | return sClass.ToJSClass(); |
333 | 0 | } |
334 | | |
335 | | bool |
336 | | Wrap(JSContext* aCx, mozilla::dom::IDBFileRequest* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector) |
337 | 0 | { |
338 | 0 | static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::dom::IDBFileRequest>::value, |
339 | 0 | "Shouldn't have wrappercached things that are not refcounted."); |
340 | 0 | MOZ_ASSERT(static_cast<mozilla::dom::IDBFileRequest*>(aObject) == |
341 | 0 | reinterpret_cast<mozilla::dom::IDBFileRequest*>(aObject), |
342 | 0 | "Multiple inheritance for mozilla::dom::IDBFileRequest is broken."); |
343 | 0 | MOZ_ASSERT(static_cast<mozilla::dom::DOMRequest*>(aObject) == |
344 | 0 | reinterpret_cast<mozilla::dom::DOMRequest*>(aObject), |
345 | 0 | "Multiple inheritance for mozilla::dom::DOMRequest is broken."); |
346 | 0 | MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) == |
347 | 0 | reinterpret_cast<mozilla::dom::EventTarget*>(aObject), |
348 | 0 | "Multiple inheritance for mozilla::dom::EventTarget is broken."); |
349 | 0 | MOZ_ASSERT(ToSupportsIsCorrect(aObject)); |
350 | 0 | MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx)); |
351 | 0 | MOZ_ASSERT(!aCache->GetWrapper(), |
352 | 0 | "You should probably not be using Wrap() directly; use " |
353 | 0 | "GetOrCreateDOMReflector instead"); |
354 | 0 |
|
355 | 0 | MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache), |
356 | 0 | "nsISupports must be on our primary inheritance chain"); |
357 | 0 |
|
358 | 0 | JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject())); |
359 | 0 | if (!global) { |
360 | 0 | return false; |
361 | 0 | } |
362 | 0 | MOZ_ASSERT(JS_IsGlobalObject(global)); |
363 | 0 | MOZ_ASSERT(JS::ObjectIsNotGray(global)); |
364 | 0 |
|
365 | 0 | // That might have ended up wrapping us already, due to the wonders |
366 | 0 | // of XBL. Check for that, and bail out as needed. |
367 | 0 | aReflector.set(aCache->GetWrapper()); |
368 | 0 | if (aReflector) { |
369 | | #ifdef DEBUG |
370 | | AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto); |
371 | | #endif // DEBUG |
372 | | return true; |
373 | 0 | } |
374 | 0 |
|
375 | 0 | JSAutoRealm ar(aCx, global); |
376 | 0 | JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx); |
377 | 0 | if (!canonicalProto) { |
378 | 0 | return false; |
379 | 0 | } |
380 | 0 | JS::Rooted<JSObject*> proto(aCx); |
381 | 0 | if (aGivenProto) { |
382 | 0 | proto = aGivenProto; |
383 | 0 | // Unfortunately, while aGivenProto was in the compartment of aCx |
384 | 0 | // coming in, we changed compartments to that of "parent" so may need |
385 | 0 | // to wrap the proto here. |
386 | 0 | if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) { |
387 | 0 | if (!JS_WrapObject(aCx, &proto)) { |
388 | 0 | return false; |
389 | 0 | } |
390 | 0 | } |
391 | 0 | } else { |
392 | 0 | proto = canonicalProto; |
393 | 0 | } |
394 | 0 |
|
395 | 0 | BindingJSObjectCreator<mozilla::dom::IDBFileRequest> creator(aCx); |
396 | 0 | creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector); |
397 | 0 | if (!aReflector) { |
398 | 0 | return false; |
399 | 0 | } |
400 | 0 | |
401 | 0 | aCache->SetWrapper(aReflector); |
402 | 0 | creator.InitializationSucceeded(); |
403 | 0 |
|
404 | 0 | MOZ_ASSERT(aCache->GetWrapperPreserveColor() && |
405 | 0 | aCache->GetWrapperPreserveColor() == aReflector); |
406 | 0 | // If proto != canonicalProto, we have to preserve our wrapper; |
407 | 0 | // otherwise we won't be able to properly recreate it later, since |
408 | 0 | // we won't know what proto to use. Note that we don't check |
409 | 0 | // aGivenProto here, since it's entirely possible (and even |
410 | 0 | // somewhat common) to have a non-null aGivenProto which is the |
411 | 0 | // same as canonicalProto. |
412 | 0 | if (proto != canonicalProto) { |
413 | 0 | PreserveWrapper(aObject); |
414 | 0 | } |
415 | 0 |
|
416 | 0 | return true; |
417 | 0 | } |
418 | | |
419 | | const NativePropertyHooks sNativePropertyHooks[] = { { |
420 | | nullptr, |
421 | | nullptr, |
422 | | nullptr, |
423 | | { sNativeProperties.Upcast(), nullptr }, |
424 | | prototypes::id::IDBFileRequest, |
425 | | constructors::id::IDBFileRequest, |
426 | | DOMRequest_Binding::sNativePropertyHooks, |
427 | | &DefaultXrayExpandoObjectClass |
428 | | } }; |
429 | | |
430 | | void |
431 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal) |
432 | 0 | { |
433 | 0 | JS::Handle<JSObject*> parentProto(DOMRequest_Binding::GetProtoObjectHandle(aCx)); |
434 | 0 | if (!parentProto) { |
435 | 0 | return; |
436 | 0 | } |
437 | 0 | |
438 | 0 | JS::Handle<JSObject*> constructorProto(DOMRequest_Binding::GetConstructorObjectHandle(aCx)); |
439 | 0 | if (!constructorProto) { |
440 | 0 | return; |
441 | 0 | } |
442 | 0 | |
443 | 0 | static bool sIdsInited = false; |
444 | 0 | if (!sIdsInited && NS_IsMainThread()) { |
445 | 0 | if (!InitIds(aCx, sNativeProperties.Upcast())) { |
446 | 0 | return; |
447 | 0 | } |
448 | 0 | sIdsInited = true; |
449 | 0 | } |
450 | 0 |
|
451 | 0 | JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::IDBFileRequest); |
452 | 0 | JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::IDBFileRequest); |
453 | 0 | dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, |
454 | 0 | &sPrototypeClass.mBase, protoCache, |
455 | 0 | nullptr, |
456 | 0 | constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr, |
457 | 0 | interfaceCache, |
458 | 0 | sNativeProperties.Upcast(), |
459 | 0 | nullptr, |
460 | 0 | "IDBFileRequest", aDefineOnGlobal, |
461 | 0 | nullptr, |
462 | 0 | false); |
463 | 0 | } |
464 | | |
465 | | JSObject* |
466 | | GetConstructorObject(JSContext* aCx) |
467 | 0 | { |
468 | 0 | return GetConstructorObjectHandle(aCx); |
469 | 0 | } |
470 | | |
471 | | } // namespace IDBFileRequest_Binding |
472 | | |
473 | | |
474 | | |
475 | | } // namespace dom |
476 | | } // namespace mozilla |