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