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