/work/obj-fuzz/dom/bindings/FileSystemDirectoryReaderBinding.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* THIS FILE IS AUTOGENERATED FROM FileSystemDirectoryReader.webidl BY Codegen.py - DO NOT EDIT */ |
2 | | |
3 | | #include "AtomList.h" |
4 | | #include "FileSystemBinding.h" |
5 | | #include "FileSystemDirectoryReaderBinding.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/FileSystemDirectoryReader.h" |
11 | | #include "mozilla/dom/FileSystemEntry.h" |
12 | | #include "mozilla/dom/NonRefcountedDOMObject.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 FileSystemDirectoryReader_Binding { |
23 | | |
24 | | MOZ_CAN_RUN_SCRIPT static bool |
25 | | readEntries(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::FileSystemDirectoryReader* self, const JSJitMethodCallArgs& args) |
26 | 0 | { |
27 | 0 | AUTO_PROFILER_LABEL_FAST("FileSystemDirectoryReader.readEntries", DOM, cx); |
28 | 0 |
|
29 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
30 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "FileSystemDirectoryReader.readEntries"); |
31 | 0 | } |
32 | 0 | RootedCallback<OwningNonNull<binding_detail::FastFileSystemEntriesCallback>> arg0(cx); |
33 | 0 | if (args[0].isObject()) { |
34 | 0 | { // scope for tempRoot and tempGlobalRoot if needed |
35 | 0 | arg0 = new binding_detail::FastFileSystemEntriesCallback(&args[0].toObject(), JS::CurrentGlobalOrNull(cx)); |
36 | 0 | } |
37 | 0 | } else { |
38 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of FileSystemDirectoryReader.readEntries"); |
39 | 0 | return false; |
40 | 0 | } |
41 | 0 | Optional<OwningNonNull<ErrorCallback>> arg1; |
42 | 0 | if (args.hasDefined(1)) { |
43 | 0 | arg1.Construct(); |
44 | 0 | if (args[1].isObject()) { |
45 | 0 | { // scope for tempRoot and tempGlobalRoot if needed |
46 | 0 | JS::Rooted<JSObject*> tempRoot(cx, &args[1].toObject()); |
47 | 0 | JS::Rooted<JSObject*> tempGlobalRoot(cx, JS::CurrentGlobalOrNull(cx)); |
48 | 0 | arg1.Value() = new ErrorCallback(cx, tempRoot, tempGlobalRoot, GetIncumbentGlobal()); |
49 | 0 | } |
50 | 0 | } else { |
51 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 2 of FileSystemDirectoryReader.readEntries"); |
52 | 0 | return false; |
53 | 0 | } |
54 | 0 | } |
55 | 0 | FastErrorResult rv; |
56 | 0 | self->ReadEntries(MOZ_KnownLive(NonNullHelper(arg0)), MOZ_KnownLive(NonNullHelper(Constify(arg1))), rv); |
57 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
58 | 0 | return false; |
59 | 0 | } |
60 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
61 | 0 | args.rval().setUndefined(); |
62 | 0 | return true; |
63 | 0 | } |
64 | | |
65 | | static const JSJitInfo readEntries_methodinfo = { |
66 | | { (JSJitGetterOp)readEntries }, |
67 | | { prototypes::id::FileSystemDirectoryReader }, |
68 | | { PrototypeTraits<prototypes::id::FileSystemDirectoryReader>::Depth }, |
69 | | JSJitInfo::Method, |
70 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
71 | | JSVAL_TYPE_UNDEFINED, /* 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 | | |
83 | | static bool |
84 | | _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val) |
85 | 0 | { |
86 | 0 | mozilla::dom::FileSystemDirectoryReader* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::FileSystemDirectoryReader>(obj); |
87 | 0 | // We don't want to preserve if we don't have a wrapper, and we |
88 | 0 | // obviously can't preserve if we're not initialized. |
89 | 0 | if (self && self->GetWrapperPreserveColor()) { |
90 | 0 | PreserveWrapper(self); |
91 | 0 | } |
92 | 0 | return true; |
93 | 0 | } |
94 | | |
95 | | static void |
96 | | _finalize(js::FreeOp* fop, JSObject* obj) |
97 | 0 | { |
98 | 0 | mozilla::dom::FileSystemDirectoryReader* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::FileSystemDirectoryReader>(obj); |
99 | 0 | if (self) { |
100 | 0 | ClearWrapper(self, self, obj); |
101 | 0 | AddForDeferredFinalization<mozilla::dom::FileSystemDirectoryReader>(self); |
102 | 0 | } |
103 | 0 | } |
104 | | |
105 | | static size_t |
106 | | _objectMoved(JSObject* obj, JSObject* old) |
107 | 0 | { |
108 | 0 | mozilla::dom::FileSystemDirectoryReader* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::FileSystemDirectoryReader>(obj); |
109 | 0 | if (self) { |
110 | 0 | UpdateWrapper(self, self, obj, old); |
111 | 0 | } |
112 | 0 |
|
113 | 0 | return 0; |
114 | 0 | } |
115 | | |
116 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
117 | | #if defined(__clang__) |
118 | | #pragma clang diagnostic push |
119 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
120 | | #endif |
121 | | static const JSFunctionSpec sMethods_specs[] = { |
122 | | JS_FNSPEC("readEntries", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&readEntries_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
123 | | JS_FS_END |
124 | | }; |
125 | | #if defined(__clang__) |
126 | | #pragma clang diagnostic pop |
127 | | #endif |
128 | | |
129 | | |
130 | | static const Prefable<const JSFunctionSpec> sMethods[] = { |
131 | | { nullptr, &sMethods_specs[0] }, |
132 | | { nullptr, nullptr } |
133 | | }; |
134 | | |
135 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
136 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
137 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
138 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
139 | | |
140 | | |
141 | | static uint16_t sNativeProperties_sortedPropertyIndices[1]; |
142 | | static PropertyInfo sNativeProperties_propertyInfos[1]; |
143 | | |
144 | | static const NativePropertiesN<1> sNativeProperties = { |
145 | | false, 0, |
146 | | false, 0, |
147 | | true, 0 /* sMethods */, |
148 | | false, 0, |
149 | | false, 0, |
150 | | false, 0, |
151 | | false, 0, |
152 | | -1, |
153 | | 1, |
154 | | sNativeProperties_sortedPropertyIndices, |
155 | | { |
156 | | { sMethods, &sNativeProperties_propertyInfos[0] } |
157 | | } |
158 | | }; |
159 | | static_assert(1 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount), |
160 | | "We have a property info count that is oversized"); |
161 | | |
162 | | static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = { |
163 | | { |
164 | | "Function", |
165 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE), |
166 | | &sBoringInterfaceObjectClassClassOps, |
167 | | JS_NULL_CLASS_SPEC, |
168 | | JS_NULL_CLASS_EXT, |
169 | | &sInterfaceObjectClassObjectOps |
170 | | }, |
171 | | eInterface, |
172 | | true, |
173 | | prototypes::id::FileSystemDirectoryReader, |
174 | | PrototypeTraits<prototypes::id::FileSystemDirectoryReader>::Depth, |
175 | | sNativePropertyHooks, |
176 | | "function FileSystemDirectoryReader() {\n [native code]\n}", |
177 | | JS::GetRealmFunctionPrototype |
178 | | }; |
179 | | |
180 | | static const DOMIfaceAndProtoJSClass sPrototypeClass = { |
181 | | { |
182 | | "FileSystemDirectoryReaderPrototype", |
183 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE), |
184 | | JS_NULL_CLASS_OPS, |
185 | | JS_NULL_CLASS_SPEC, |
186 | | JS_NULL_CLASS_EXT, |
187 | | JS_NULL_OBJECT_OPS |
188 | | }, |
189 | | eInterfacePrototype, |
190 | | false, |
191 | | prototypes::id::FileSystemDirectoryReader, |
192 | | PrototypeTraits<prototypes::id::FileSystemDirectoryReader>::Depth, |
193 | | sNativePropertyHooks, |
194 | | "[object FileSystemDirectoryReaderPrototype]", |
195 | | JS::GetRealmObjectPrototype |
196 | | }; |
197 | | |
198 | | static const js::ClassOps sClassOps = { |
199 | | _addProperty, /* addProperty */ |
200 | | nullptr, /* delProperty */ |
201 | | nullptr, /* enumerate */ |
202 | | nullptr, /* newEnumerate */ |
203 | | nullptr, /* resolve */ |
204 | | nullptr, /* mayResolve */ |
205 | | _finalize, /* finalize */ |
206 | | nullptr, /* call */ |
207 | | nullptr, /* hasInstance */ |
208 | | nullptr, /* construct */ |
209 | | nullptr, /* trace */ |
210 | | }; |
211 | | |
212 | | static const js::ClassExtension sClassExtension = { |
213 | | nullptr, /* weakmapKeyDelegateOp */ |
214 | | _objectMoved /* objectMovedOp */ |
215 | | }; |
216 | | |
217 | | static const DOMJSClass sClass = { |
218 | | { "FileSystemDirectoryReader", |
219 | | JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1), |
220 | | &sClassOps, |
221 | | JS_NULL_CLASS_SPEC, |
222 | | &sClassExtension, |
223 | | JS_NULL_OBJECT_OPS |
224 | | }, |
225 | | { prototypes::id::FileSystemDirectoryReader, 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 }, |
226 | | IsBaseOf<nsISupports, mozilla::dom::FileSystemDirectoryReader >::value, |
227 | | sNativePropertyHooks, |
228 | | FindAssociatedGlobalForNative<mozilla::dom::FileSystemDirectoryReader>::Get, |
229 | | GetProtoObjectHandle, |
230 | | GetCCParticipant<mozilla::dom::FileSystemDirectoryReader>::Get() |
231 | | }; |
232 | | static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS, |
233 | | "Must have the right minimal number of reserved slots."); |
234 | | static_assert(1 >= 1, |
235 | | "Must have enough reserved slots."); |
236 | | |
237 | | const JSClass* |
238 | | GetJSClass() |
239 | 0 | { |
240 | 0 | return sClass.ToJSClass(); |
241 | 0 | } |
242 | | |
243 | | bool |
244 | | Wrap(JSContext* aCx, mozilla::dom::FileSystemDirectoryReader* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector) |
245 | 0 | { |
246 | 0 | static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::dom::FileSystemDirectoryReader>::value, |
247 | 0 | "Shouldn't have wrappercached things that are not refcounted."); |
248 | 0 | MOZ_ASSERT(static_cast<mozilla::dom::FileSystemDirectoryReader*>(aObject) == |
249 | 0 | reinterpret_cast<mozilla::dom::FileSystemDirectoryReader*>(aObject), |
250 | 0 | "Multiple inheritance for mozilla::dom::FileSystemDirectoryReader is broken."); |
251 | 0 | MOZ_ASSERT(ToSupportsIsCorrect(aObject)); |
252 | 0 | MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx)); |
253 | 0 | MOZ_ASSERT(!aCache->GetWrapper(), |
254 | 0 | "You should probably not be using Wrap() directly; use " |
255 | 0 | "GetOrCreateDOMReflector instead"); |
256 | 0 |
|
257 | 0 | MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache), |
258 | 0 | "nsISupports must be on our primary inheritance chain"); |
259 | 0 |
|
260 | 0 | JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject())); |
261 | 0 | if (!global) { |
262 | 0 | return false; |
263 | 0 | } |
264 | 0 | MOZ_ASSERT(JS_IsGlobalObject(global)); |
265 | 0 | MOZ_ASSERT(JS::ObjectIsNotGray(global)); |
266 | 0 |
|
267 | 0 | // That might have ended up wrapping us already, due to the wonders |
268 | 0 | // of XBL. Check for that, and bail out as needed. |
269 | 0 | aReflector.set(aCache->GetWrapper()); |
270 | 0 | if (aReflector) { |
271 | | #ifdef DEBUG |
272 | | AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto); |
273 | | #endif // DEBUG |
274 | | return true; |
275 | 0 | } |
276 | 0 |
|
277 | 0 | JSAutoRealm ar(aCx, global); |
278 | 0 | JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx); |
279 | 0 | if (!canonicalProto) { |
280 | 0 | return false; |
281 | 0 | } |
282 | 0 | JS::Rooted<JSObject*> proto(aCx); |
283 | 0 | if (aGivenProto) { |
284 | 0 | proto = aGivenProto; |
285 | 0 | // Unfortunately, while aGivenProto was in the compartment of aCx |
286 | 0 | // coming in, we changed compartments to that of "parent" so may need |
287 | 0 | // to wrap the proto here. |
288 | 0 | if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) { |
289 | 0 | if (!JS_WrapObject(aCx, &proto)) { |
290 | 0 | return false; |
291 | 0 | } |
292 | 0 | } |
293 | 0 | } else { |
294 | 0 | proto = canonicalProto; |
295 | 0 | } |
296 | 0 |
|
297 | 0 | BindingJSObjectCreator<mozilla::dom::FileSystemDirectoryReader> creator(aCx); |
298 | 0 | creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector); |
299 | 0 | if (!aReflector) { |
300 | 0 | return false; |
301 | 0 | } |
302 | 0 | |
303 | 0 | aCache->SetWrapper(aReflector); |
304 | 0 | creator.InitializationSucceeded(); |
305 | 0 |
|
306 | 0 | MOZ_ASSERT(aCache->GetWrapperPreserveColor() && |
307 | 0 | aCache->GetWrapperPreserveColor() == aReflector); |
308 | 0 | // If proto != canonicalProto, we have to preserve our wrapper; |
309 | 0 | // otherwise we won't be able to properly recreate it later, since |
310 | 0 | // we won't know what proto to use. Note that we don't check |
311 | 0 | // aGivenProto here, since it's entirely possible (and even |
312 | 0 | // somewhat common) to have a non-null aGivenProto which is the |
313 | 0 | // same as canonicalProto. |
314 | 0 | if (proto != canonicalProto) { |
315 | 0 | PreserveWrapper(aObject); |
316 | 0 | } |
317 | 0 |
|
318 | 0 | return true; |
319 | 0 | } |
320 | | |
321 | | const NativePropertyHooks sNativePropertyHooks[] = { { |
322 | | nullptr, |
323 | | nullptr, |
324 | | nullptr, |
325 | | { sNativeProperties.Upcast(), nullptr }, |
326 | | prototypes::id::FileSystemDirectoryReader, |
327 | | constructors::id::FileSystemDirectoryReader, |
328 | | nullptr, |
329 | | &DefaultXrayExpandoObjectClass |
330 | | } }; |
331 | | |
332 | | void |
333 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal) |
334 | 0 | { |
335 | 0 | JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx)); |
336 | 0 | if (!parentProto) { |
337 | 0 | return; |
338 | 0 | } |
339 | 0 | |
340 | 0 | JS::Rooted<JSObject*> constructorProto(aCx, JS::GetRealmFunctionPrototype(aCx)); |
341 | 0 | if (!constructorProto) { |
342 | 0 | return; |
343 | 0 | } |
344 | 0 | |
345 | 0 | static bool sIdsInited = false; |
346 | 0 | if (!sIdsInited && NS_IsMainThread()) { |
347 | 0 | if (!InitIds(aCx, sNativeProperties.Upcast())) { |
348 | 0 | return; |
349 | 0 | } |
350 | 0 | sIdsInited = true; |
351 | 0 | } |
352 | 0 |
|
353 | 0 | JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::FileSystemDirectoryReader); |
354 | 0 | JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::FileSystemDirectoryReader); |
355 | 0 | dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, |
356 | 0 | &sPrototypeClass.mBase, protoCache, |
357 | 0 | nullptr, |
358 | 0 | constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr, |
359 | 0 | interfaceCache, |
360 | 0 | sNativeProperties.Upcast(), |
361 | 0 | nullptr, |
362 | 0 | "FileSystemDirectoryReader", aDefineOnGlobal, |
363 | 0 | nullptr, |
364 | 0 | false); |
365 | 0 | } |
366 | | |
367 | | JSObject* |
368 | | GetConstructorObject(JSContext* aCx) |
369 | 0 | { |
370 | 0 | return GetConstructorObjectHandle(aCx); |
371 | 0 | } |
372 | | |
373 | | } // namespace FileSystemDirectoryReader_Binding |
374 | | |
375 | | |
376 | | |
377 | | void |
378 | | FileSystemEntriesCallback::HandleEvent(JSContext* cx, JS::Handle<JS::Value> aThisVal, const Sequence<OwningNonNull<FileSystemEntry>>& entries, ErrorResult& aRv) |
379 | 0 | { |
380 | 0 | JS::Rooted<JS::Value> rval(cx, JS::UndefinedValue()); |
381 | 0 | JS::AutoValueVector argv(cx); |
382 | 0 | if (!argv.resize(1)) { |
383 | 0 | aRv.Throw(NS_ERROR_OUT_OF_MEMORY); |
384 | 0 | return; |
385 | 0 | } |
386 | 0 | unsigned argc = 1; |
387 | 0 |
|
388 | 0 | do { |
389 | 0 |
|
390 | 0 | uint32_t length = entries.Length(); |
391 | 0 | JS::Rooted<JSObject*> returnArray(cx, JS_NewArrayObject(cx, length)); |
392 | 0 | if (!returnArray) { |
393 | 0 | aRv.Throw(NS_ERROR_UNEXPECTED); |
394 | 0 | return; |
395 | 0 | } |
396 | 0 | // Scope for 'tmp' |
397 | 0 | { |
398 | 0 | JS::Rooted<JS::Value> tmp(cx); |
399 | 0 | for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { |
400 | 0 | // Control block to let us common up the JS_DefineElement calls when there |
401 | 0 | // are different ways to succeed at wrapping the object. |
402 | 0 | do { |
403 | 0 | if (!GetOrCreateDOMReflector(cx, entries[sequenceIdx0], &tmp)) { |
404 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
405 | 0 | aRv.Throw(NS_ERROR_UNEXPECTED); |
406 | 0 | return; |
407 | 0 | } |
408 | 0 | break; |
409 | 0 | } while (false); |
410 | 0 | if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, |
411 | 0 | JSPROP_ENUMERATE)) { |
412 | 0 | aRv.Throw(NS_ERROR_UNEXPECTED); |
413 | 0 | return; |
414 | 0 | } |
415 | 0 | } |
416 | 0 | } |
417 | 0 | argv[0].setObject(*returnArray); |
418 | 0 | break; |
419 | 0 | } while (false); |
420 | 0 |
|
421 | 0 | bool isCallable = JS::IsCallable(mCallback); |
422 | 0 | JS::Rooted<JS::Value> callable(cx); |
423 | 0 | if (isCallable) { |
424 | 0 | callable = JS::ObjectValue(*mCallback); |
425 | 0 | } else { |
426 | 0 | FileSystemEntriesCallbackAtoms* atomsCache = GetAtomCache<FileSystemEntriesCallbackAtoms>(cx); |
427 | 0 | if ((!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) || |
428 | 0 | !GetCallableProperty(cx, atomsCache->handleEvent_id, &callable)) { |
429 | 0 | aRv.Throw(NS_ERROR_UNEXPECTED); |
430 | 0 | return; |
431 | 0 | } |
432 | 0 | } |
433 | 0 | JS::Rooted<JS::Value> thisValue(cx, isCallable ? aThisVal.get() |
434 | 0 | : JS::ObjectValue(*mCallback)); |
435 | 0 | if (!JS::Call(cx, thisValue, callable, |
436 | 0 | JS::HandleValueArray::subarray(argv, 0, argc), &rval)) { |
437 | 0 | aRv.NoteJSContextException(cx); |
438 | 0 | return; |
439 | 0 | } |
440 | 0 | } |
441 | | |
442 | | bool |
443 | | FileSystemEntriesCallback::InitIds(JSContext* cx, FileSystemEntriesCallbackAtoms* atomsCache) |
444 | 0 | { |
445 | 0 | MOZ_ASSERT(!*reinterpret_cast<jsid**>(atomsCache)); |
446 | 0 |
|
447 | 0 | // Initialize these in reverse order so that any failure leaves the first one |
448 | 0 | // uninitialized. |
449 | 0 | if (!atomsCache->handleEvent_id.init(cx, "handleEvent")) { |
450 | 0 | return false; |
451 | 0 | } |
452 | 0 | return true; |
453 | 0 | } |
454 | | |
455 | | |
456 | | |
457 | | namespace binding_detail { |
458 | | } // namespace binding_detail |
459 | | |
460 | | |
461 | | } // namespace dom |
462 | | } // namespace mozilla |