/work/obj-fuzz/dom/bindings/PopupBlockedEventBinding.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* THIS FILE IS AUTOGENERATED FROM PopupBlockedEvent.webidl BY Codegen.py - DO NOT EDIT */ |
2 | | |
3 | | #include "AtomList.h" |
4 | | #include "EventBinding.h" |
5 | | #include "PopupBlockedEventBinding.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/NonRefcountedDOMObject.h" |
11 | | #include "mozilla/dom/Nullable.h" |
12 | | #include "mozilla/dom/PopupBlockedEvent.h" |
13 | | #include "mozilla/dom/PrimitiveConversions.h" |
14 | | #include "mozilla/dom/ScriptSettings.h" |
15 | | #include "mozilla/dom/XrayExpandoClass.h" |
16 | | #include "nsGlobalWindow.h" |
17 | | #include "nsIURI.h" |
18 | | |
19 | | namespace mozilla { |
20 | | namespace dom { |
21 | | |
22 | | namespace binding_detail {}; // Just to make sure it's known as a namespace |
23 | | using namespace mozilla::dom::binding_detail; |
24 | | |
25 | | |
26 | | |
27 | | PopupBlockedEventInit::PopupBlockedEventInit() |
28 | | : EventInit(FastDictionaryInitializer()) |
29 | 0 | { |
30 | 0 | // Safe to pass a null context if we pass a null value |
31 | 0 | Init(nullptr, JS::NullHandleValue); |
32 | 0 | } |
33 | | |
34 | | |
35 | | |
36 | | bool |
37 | | PopupBlockedEventInit::InitIds(JSContext* cx, PopupBlockedEventInitAtoms* atomsCache) |
38 | 0 | { |
39 | 0 | MOZ_ASSERT(!*reinterpret_cast<jsid**>(atomsCache)); |
40 | 0 |
|
41 | 0 | // Initialize these in reverse order so that any failure leaves the first one |
42 | 0 | // uninitialized. |
43 | 0 | if (!atomsCache->requestingWindow_id.init(cx, "requestingWindow") || |
44 | 0 | !atomsCache->popupWindowURI_id.init(cx, "popupWindowURI") || |
45 | 0 | !atomsCache->popupWindowName_id.init(cx, "popupWindowName") || |
46 | 0 | !atomsCache->popupWindowFeatures_id.init(cx, "popupWindowFeatures")) { |
47 | 0 | return false; |
48 | 0 | } |
49 | 0 | return true; |
50 | 0 | } |
51 | | |
52 | | bool |
53 | | PopupBlockedEventInit::Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription, bool passedToJSImpl) |
54 | 0 | { |
55 | 0 | // Passing a null JSContext is OK only if we're initing from null, |
56 | 0 | // Since in that case we will not have to do any property gets |
57 | 0 | // Also evaluate isNullOrUndefined in order to avoid false-positive |
58 | 0 | // checkers by static analysis tools |
59 | 0 | MOZ_ASSERT_IF(!cx, val.isNull() && val.isNullOrUndefined()); |
60 | 0 | PopupBlockedEventInitAtoms* atomsCache = nullptr; |
61 | 0 | if (cx) { |
62 | 0 | atomsCache = GetAtomCache<PopupBlockedEventInitAtoms>(cx); |
63 | 0 | if (!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) { |
64 | 0 | return false; |
65 | 0 | } |
66 | 0 | } |
67 | 0 | |
68 | 0 | // Per spec, we init the parent's members first |
69 | 0 | if (!EventInit::Init(cx, val)) { |
70 | 0 | return false; |
71 | 0 | } |
72 | 0 | |
73 | 0 | bool isNull = val.isNullOrUndefined(); |
74 | 0 | // We only need these if !isNull, in which case we have |cx|. |
75 | 0 | Maybe<JS::Rooted<JSObject *> > object; |
76 | 0 | Maybe<JS::Rooted<JS::Value> > temp; |
77 | 0 | if (!isNull) { |
78 | 0 | MOZ_ASSERT(cx); |
79 | 0 | object.emplace(cx, &val.toObject()); |
80 | 0 | temp.emplace(cx); |
81 | 0 | } |
82 | 0 | if (!isNull) { |
83 | 0 | if (!JS_GetPropertyById(cx, *object, atomsCache->popupWindowFeatures_id, temp.ptr())) { |
84 | 0 | return false; |
85 | 0 | } |
86 | 0 | } |
87 | 0 | if (!isNull && !temp->isUndefined()) { |
88 | 0 | if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, mPopupWindowFeatures)) { |
89 | 0 | return false; |
90 | 0 | } |
91 | 0 | } else { |
92 | 0 | static const char16_t data[] = { 0 }; |
93 | 0 | mPopupWindowFeatures.Rebind(data, ArrayLength(data) - 1); |
94 | 0 | } |
95 | 0 | mIsAnyMemberPresent = true; |
96 | 0 |
|
97 | 0 | if (!isNull) { |
98 | 0 | if (!JS_GetPropertyById(cx, *object, atomsCache->popupWindowName_id, temp.ptr())) { |
99 | 0 | return false; |
100 | 0 | } |
101 | 0 | } |
102 | 0 | if (!isNull && !temp->isUndefined()) { |
103 | 0 | if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, mPopupWindowName)) { |
104 | 0 | return false; |
105 | 0 | } |
106 | 0 | } else { |
107 | 0 | static const char16_t data[] = { 0 }; |
108 | 0 | mPopupWindowName.Rebind(data, ArrayLength(data) - 1); |
109 | 0 | } |
110 | 0 | mIsAnyMemberPresent = true; |
111 | 0 |
|
112 | 0 | if (!isNull) { |
113 | 0 | if (!JS_GetPropertyById(cx, *object, atomsCache->popupWindowURI_id, temp.ptr())) { |
114 | 0 | return false; |
115 | 0 | } |
116 | 0 | } |
117 | 0 | if (!isNull && !temp->isUndefined()) { |
118 | 0 | if (temp.ref().isObject()) { |
119 | 0 | static_assert(IsRefcounted<nsIURI>::value, "We can only store refcounted classes.");RefPtr<nsIURI> holder; |
120 | 0 | JS::Rooted<JSObject*> source(cx, &temp.ref().toObject()); |
121 | 0 | if (NS_FAILED(UnwrapArg<nsIURI>(cx, source, getter_AddRefs(holder)))) { |
122 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "'popupWindowURI' member of PopupBlockedEventInit", "URI"); |
123 | 0 | return false; |
124 | 0 | } |
125 | 0 | MOZ_ASSERT(holder); |
126 | 0 | mPopupWindowURI = holder; |
127 | 0 | } else if (temp.ref().isNullOrUndefined()) { |
128 | 0 | mPopupWindowURI = nullptr; |
129 | 0 | } else { |
130 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "'popupWindowURI' member of PopupBlockedEventInit"); |
131 | 0 | return false; |
132 | 0 | } |
133 | 0 | } else { |
134 | 0 | mPopupWindowURI = nullptr; |
135 | 0 | } |
136 | 0 | mIsAnyMemberPresent = true; |
137 | 0 |
|
138 | 0 | if (!isNull) { |
139 | 0 | if (!JS_GetPropertyById(cx, *object, atomsCache->requestingWindow_id, temp.ptr())) { |
140 | 0 | return false; |
141 | 0 | } |
142 | 0 | } |
143 | 0 | if (!isNull && !temp->isUndefined()) { |
144 | 0 | if (temp.ref().isObject()) { |
145 | 0 | static_assert(IsRefcounted<nsGlobalWindowInner>::value, "We can only store refcounted classes.");{ |
146 | 0 | nsresult rv = UnwrapObject<prototypes::id::Window, nsGlobalWindowInner>(temp.ptr(), mRequestingWindow); |
147 | 0 | if (NS_FAILED(rv)) { |
148 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "'requestingWindow' member of PopupBlockedEventInit", "Window"); |
149 | 0 | return false; |
150 | 0 | } |
151 | 0 | } |
152 | 0 | } else if (temp.ref().isNullOrUndefined()) { |
153 | 0 | mRequestingWindow = nullptr; |
154 | 0 | } else { |
155 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "'requestingWindow' member of PopupBlockedEventInit"); |
156 | 0 | return false; |
157 | 0 | } |
158 | 0 | } else { |
159 | 0 | mRequestingWindow = nullptr; |
160 | 0 | } |
161 | 0 | mIsAnyMemberPresent = true; |
162 | 0 | return true; |
163 | 0 | } |
164 | | |
165 | | bool |
166 | | PopupBlockedEventInit::ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const |
167 | 0 | { |
168 | 0 | PopupBlockedEventInitAtoms* atomsCache = GetAtomCache<PopupBlockedEventInitAtoms>(cx); |
169 | 0 | if (!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) { |
170 | 0 | return false; |
171 | 0 | } |
172 | 0 | |
173 | 0 | // Per spec, we define the parent's members first |
174 | 0 | if (!EventInit::ToObjectInternal(cx, rval)) { |
175 | 0 | return false; |
176 | 0 | } |
177 | 0 | JS::Rooted<JSObject*> obj(cx, &rval.toObject()); |
178 | 0 |
|
179 | 0 | do { |
180 | 0 | // block for our 'break' successCode and scope for 'temp' and 'currentValue' |
181 | 0 | JS::Rooted<JS::Value> temp(cx); |
182 | 0 | nsString const & currentValue = mPopupWindowFeatures; |
183 | 0 | if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) { |
184 | 0 | return false; |
185 | 0 | } |
186 | 0 | if (!JS_DefinePropertyById(cx, obj, atomsCache->popupWindowFeatures_id, temp, JSPROP_ENUMERATE)) { |
187 | 0 | return false; |
188 | 0 | } |
189 | 0 | break; |
190 | 0 | } while(false); |
191 | 0 |
|
192 | 0 | do { |
193 | 0 | // block for our 'break' successCode and scope for 'temp' and 'currentValue' |
194 | 0 | JS::Rooted<JS::Value> temp(cx); |
195 | 0 | nsString const & currentValue = mPopupWindowName; |
196 | 0 | if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) { |
197 | 0 | return false; |
198 | 0 | } |
199 | 0 | if (!JS_DefinePropertyById(cx, obj, atomsCache->popupWindowName_id, temp, JSPROP_ENUMERATE)) { |
200 | 0 | return false; |
201 | 0 | } |
202 | 0 | break; |
203 | 0 | } while(false); |
204 | 0 |
|
205 | 0 | do { |
206 | 0 | // block for our 'break' successCode and scope for 'temp' and 'currentValue' |
207 | 0 | JS::Rooted<JS::Value> temp(cx); |
208 | 0 | RefPtr<nsIURI> const & currentValue = mPopupWindowURI; |
209 | 0 | if (!currentValue) { |
210 | 0 | temp.setNull(); |
211 | 0 | if (!JS_DefinePropertyById(cx, obj, atomsCache->popupWindowURI_id, temp, JSPROP_ENUMERATE)) { |
212 | 0 | return false; |
213 | 0 | } |
214 | 0 | break; |
215 | 0 | } |
216 | 0 | if (!WrapObject(cx, currentValue, &NS_GET_IID(nsIURI), &temp)) { |
217 | 0 | return false; |
218 | 0 | } |
219 | 0 | if (!JS_DefinePropertyById(cx, obj, atomsCache->popupWindowURI_id, temp, JSPROP_ENUMERATE)) { |
220 | 0 | return false; |
221 | 0 | } |
222 | 0 | break; |
223 | 0 | } while(false); |
224 | 0 |
|
225 | 0 | do { |
226 | 0 | // block for our 'break' successCode and scope for 'temp' and 'currentValue' |
227 | 0 | JS::Rooted<JS::Value> temp(cx); |
228 | 0 | RefPtr<nsGlobalWindowInner> const & currentValue = mRequestingWindow; |
229 | 0 | if (!currentValue) { |
230 | 0 | temp.setNull(); |
231 | 0 | if (!JS_DefinePropertyById(cx, obj, atomsCache->requestingWindow_id, temp, JSPROP_ENUMERATE)) { |
232 | 0 | return false; |
233 | 0 | } |
234 | 0 | break; |
235 | 0 | } |
236 | 0 | if (!GetOrCreateDOMReflector(cx, currentValue, &temp)) { |
237 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
238 | 0 | return false; |
239 | 0 | } |
240 | 0 | if (!JS_DefinePropertyById(cx, obj, atomsCache->requestingWindow_id, temp, JSPROP_ENUMERATE)) { |
241 | 0 | return false; |
242 | 0 | } |
243 | 0 | break; |
244 | 0 | } while(false); |
245 | 0 |
|
246 | 0 | return true; |
247 | 0 | } |
248 | | |
249 | | void |
250 | | PopupBlockedEventInit::TraceDictionary(JSTracer* trc) |
251 | 0 | { |
252 | 0 | EventInit::TraceDictionary(trc); |
253 | 0 | } |
254 | | |
255 | | |
256 | | |
257 | | PopupBlockedEventInit& |
258 | | PopupBlockedEventInit::operator=(const PopupBlockedEventInit& aOther) |
259 | 0 | { |
260 | 0 | EventInit::operator=(aOther); |
261 | 0 | mPopupWindowFeatures = aOther.mPopupWindowFeatures; |
262 | 0 | mPopupWindowName = aOther.mPopupWindowName; |
263 | 0 | mPopupWindowURI = aOther.mPopupWindowURI; |
264 | 0 | mRequestingWindow = aOther.mRequestingWindow; |
265 | 0 | return *this; |
266 | 0 | } |
267 | | |
268 | | namespace binding_detail { |
269 | | } // namespace binding_detail |
270 | | |
271 | | |
272 | | namespace PopupBlockedEvent_Binding { |
273 | | |
274 | | static_assert(IsRefcounted<NativeType>::value == IsRefcounted<Event_Binding::NativeType>::value, |
275 | | "Can't inherit from an interface with a different ownership model."); |
276 | | |
277 | | MOZ_CAN_RUN_SCRIPT static bool |
278 | | get_requestingWindow(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PopupBlockedEvent* self, JSJitGetterCallArgs args) |
279 | 0 | { |
280 | 0 | AUTO_PROFILER_LABEL_FAST("get PopupBlockedEvent.requestingWindow", DOM, cx); |
281 | 0 |
|
282 | 0 | auto result(StrongOrRawPtr<nsGlobalWindowInner>(self->GetRequestingWindow())); |
283 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
284 | 0 | if (!result) { |
285 | 0 | args.rval().setNull(); |
286 | 0 | return true; |
287 | 0 | } |
288 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
289 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
290 | 0 | return false; |
291 | 0 | } |
292 | 0 | return true; |
293 | 0 | } |
294 | | |
295 | | static const JSJitInfo requestingWindow_getterinfo = { |
296 | | { (JSJitGetterOp)get_requestingWindow }, |
297 | | { prototypes::id::PopupBlockedEvent }, |
298 | | { PrototypeTraits<prototypes::id::PopupBlockedEvent>::Depth }, |
299 | | JSJitInfo::Getter, |
300 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
301 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
302 | | false, /* isInfallible. False in setters. */ |
303 | | false, /* isMovable. Not relevant for setters. */ |
304 | | false, /* isEliminatable. Not relevant for setters. */ |
305 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
306 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
307 | | false, /* isTypedMethod. Only relevant for methods. */ |
308 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
309 | | }; |
310 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
311 | | static_assert(0 < 1, "There is no slot for us"); |
312 | | |
313 | | MOZ_CAN_RUN_SCRIPT static bool |
314 | | get_popupWindowURI(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PopupBlockedEvent* self, JSJitGetterCallArgs args) |
315 | 0 | { |
316 | 0 | AUTO_PROFILER_LABEL_FAST("get PopupBlockedEvent.popupWindowURI", DOM, cx); |
317 | 0 |
|
318 | 0 | auto result(StrongOrRawPtr<nsIURI>(self->GetPopupWindowURI())); |
319 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
320 | 0 | if (!result) { |
321 | 0 | args.rval().setNull(); |
322 | 0 | return true; |
323 | 0 | } |
324 | 0 | if (!WrapObject(cx, result, &NS_GET_IID(nsIURI), args.rval())) { |
325 | 0 | return false; |
326 | 0 | } |
327 | 0 | return true; |
328 | 0 | } |
329 | | |
330 | | static const JSJitInfo popupWindowURI_getterinfo = { |
331 | | { (JSJitGetterOp)get_popupWindowURI }, |
332 | | { prototypes::id::PopupBlockedEvent }, |
333 | | { PrototypeTraits<prototypes::id::PopupBlockedEvent>::Depth }, |
334 | | JSJitInfo::Getter, |
335 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
336 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
337 | | false, /* isInfallible. False in setters. */ |
338 | | false, /* isMovable. Not relevant for setters. */ |
339 | | false, /* isEliminatable. Not relevant for setters. */ |
340 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
341 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
342 | | false, /* isTypedMethod. Only relevant for methods. */ |
343 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
344 | | }; |
345 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
346 | | static_assert(0 < 1, "There is no slot for us"); |
347 | | |
348 | | MOZ_CAN_RUN_SCRIPT static bool |
349 | | get_popupWindowName(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PopupBlockedEvent* self, JSJitGetterCallArgs args) |
350 | 0 | { |
351 | 0 | AUTO_PROFILER_LABEL_FAST("get PopupBlockedEvent.popupWindowName", DOM, cx); |
352 | 0 |
|
353 | 0 | DOMString result; |
354 | 0 | self->GetPopupWindowName(result); |
355 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
356 | 0 | if (!xpc::StringToJsval(cx, result, args.rval())) { |
357 | 0 | return false; |
358 | 0 | } |
359 | 0 | return true; |
360 | 0 | } |
361 | | |
362 | | static const JSJitInfo popupWindowName_getterinfo = { |
363 | | { (JSJitGetterOp)get_popupWindowName }, |
364 | | { prototypes::id::PopupBlockedEvent }, |
365 | | { PrototypeTraits<prototypes::id::PopupBlockedEvent>::Depth }, |
366 | | JSJitInfo::Getter, |
367 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
368 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
369 | | false, /* isInfallible. False in setters. */ |
370 | | false, /* isMovable. Not relevant for setters. */ |
371 | | false, /* isEliminatable. Not relevant for setters. */ |
372 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
373 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
374 | | false, /* isTypedMethod. Only relevant for methods. */ |
375 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
376 | | }; |
377 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
378 | | static_assert(0 < 1, "There is no slot for us"); |
379 | | |
380 | | MOZ_CAN_RUN_SCRIPT static bool |
381 | | get_popupWindowFeatures(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PopupBlockedEvent* self, JSJitGetterCallArgs args) |
382 | 0 | { |
383 | 0 | AUTO_PROFILER_LABEL_FAST("get PopupBlockedEvent.popupWindowFeatures", DOM, cx); |
384 | 0 |
|
385 | 0 | DOMString result; |
386 | 0 | self->GetPopupWindowFeatures(result); |
387 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
388 | 0 | if (!xpc::StringToJsval(cx, result, args.rval())) { |
389 | 0 | return false; |
390 | 0 | } |
391 | 0 | return true; |
392 | 0 | } |
393 | | |
394 | | static const JSJitInfo popupWindowFeatures_getterinfo = { |
395 | | { (JSJitGetterOp)get_popupWindowFeatures }, |
396 | | { prototypes::id::PopupBlockedEvent }, |
397 | | { PrototypeTraits<prototypes::id::PopupBlockedEvent>::Depth }, |
398 | | JSJitInfo::Getter, |
399 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
400 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
401 | | false, /* isInfallible. False in setters. */ |
402 | | false, /* isMovable. Not relevant for setters. */ |
403 | | false, /* isEliminatable. Not relevant for setters. */ |
404 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
405 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
406 | | false, /* isTypedMethod. Only relevant for methods. */ |
407 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
408 | | }; |
409 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
410 | | static_assert(0 < 1, "There is no slot for us"); |
411 | | |
412 | | MOZ_CAN_RUN_SCRIPT static bool |
413 | | get_isTrusted(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::PopupBlockedEvent* self, JSJitGetterCallArgs args) |
414 | 0 | { |
415 | 0 | AUTO_PROFILER_LABEL_FAST("get PopupBlockedEvent.isTrusted", DOM, cx); |
416 | 0 |
|
417 | 0 | bool result(self->IsTrusted()); |
418 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
419 | 0 | args.rval().setBoolean(result); |
420 | 0 | return true; |
421 | 0 | } |
422 | | |
423 | | static const JSJitInfo isTrusted_getterinfo = { |
424 | | { (JSJitGetterOp)get_isTrusted }, |
425 | | { prototypes::id::PopupBlockedEvent }, |
426 | | { PrototypeTraits<prototypes::id::PopupBlockedEvent>::Depth }, |
427 | | JSJitInfo::Getter, |
428 | | JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ |
429 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
430 | | true, /* isInfallible. False in setters. */ |
431 | | true, /* isMovable. Not relevant for setters. */ |
432 | | true, /* isEliminatable. Not relevant for setters. */ |
433 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
434 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
435 | | false, /* isTypedMethod. Only relevant for methods. */ |
436 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
437 | | }; |
438 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
439 | | static_assert(0 < 1, "There is no slot for us"); |
440 | | |
441 | | static bool |
442 | | _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val) |
443 | 0 | { |
444 | 0 | mozilla::dom::PopupBlockedEvent* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::PopupBlockedEvent>(obj); |
445 | 0 | // We don't want to preserve if we don't have a wrapper, and we |
446 | 0 | // obviously can't preserve if we're not initialized. |
447 | 0 | if (self && self->GetWrapperPreserveColor()) { |
448 | 0 | PreserveWrapper(self); |
449 | 0 | } |
450 | 0 | return true; |
451 | 0 | } |
452 | | |
453 | | static void |
454 | | _finalize(js::FreeOp* fop, JSObject* obj) |
455 | 0 | { |
456 | 0 | mozilla::dom::PopupBlockedEvent* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::PopupBlockedEvent>(obj); |
457 | 0 | if (self) { |
458 | 0 | ClearWrapper(self, self, obj); |
459 | 0 | AddForDeferredFinalization<mozilla::dom::PopupBlockedEvent>(self); |
460 | 0 | } |
461 | 0 | } |
462 | | |
463 | | static size_t |
464 | | _objectMoved(JSObject* obj, JSObject* old) |
465 | 0 | { |
466 | 0 | mozilla::dom::PopupBlockedEvent* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::PopupBlockedEvent>(obj); |
467 | 0 | if (self) { |
468 | 0 | UpdateWrapper(self, self, obj, old); |
469 | 0 | } |
470 | 0 |
|
471 | 0 | return 0; |
472 | 0 | } |
473 | | |
474 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
475 | | #if defined(__clang__) |
476 | | #pragma clang diagnostic push |
477 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
478 | | #endif |
479 | | static const JSPropertySpec sAttributes_specs[] = { |
480 | | { "requestingWindow", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &requestingWindow_getterinfo, nullptr, nullptr }, |
481 | | { "popupWindowURI", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &popupWindowURI_getterinfo, nullptr, nullptr }, |
482 | | { "popupWindowName", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &popupWindowName_getterinfo, nullptr, nullptr }, |
483 | | { "popupWindowFeatures", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &popupWindowFeatures_getterinfo, nullptr, nullptr }, |
484 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr } |
485 | | }; |
486 | | #if defined(__clang__) |
487 | | #pragma clang diagnostic pop |
488 | | #endif |
489 | | |
490 | | |
491 | | static const Prefable<const JSPropertySpec> sAttributes[] = { |
492 | | { nullptr, &sAttributes_specs[0] }, |
493 | | { nullptr, nullptr } |
494 | | }; |
495 | | |
496 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
497 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
498 | | static_assert(4 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
499 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
500 | | |
501 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
502 | | #if defined(__clang__) |
503 | | #pragma clang diagnostic push |
504 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
505 | | #endif |
506 | | static const JSPropertySpec sUnforgeableAttributes_specs[] = { |
507 | | { "isTrusted", JSPROP_ENUMERATE | JSPROP_PERMANENT, GenericGetter<NormalThisPolicy, ThrowExceptions>, &isTrusted_getterinfo, nullptr, nullptr }, |
508 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr } |
509 | | }; |
510 | | #if defined(__clang__) |
511 | | #pragma clang diagnostic pop |
512 | | #endif |
513 | | |
514 | | |
515 | | static const Prefable<const JSPropertySpec> sUnforgeableAttributes[] = { |
516 | | { nullptr, &sUnforgeableAttributes_specs[0] }, |
517 | | { nullptr, nullptr } |
518 | | }; |
519 | | |
520 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
521 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
522 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
523 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
524 | | |
525 | | |
526 | | static uint16_t sNativeProperties_sortedPropertyIndices[5]; |
527 | | static PropertyInfo sNativeProperties_propertyInfos[5]; |
528 | | |
529 | | static const NativePropertiesN<2> sNativeProperties = { |
530 | | false, 0, |
531 | | false, 0, |
532 | | false, 0, |
533 | | true, 0 /* sAttributes */, |
534 | | false, 0, |
535 | | true, 1 /* sUnforgeableAttributes */, |
536 | | false, 0, |
537 | | -1, |
538 | | 5, |
539 | | sNativeProperties_sortedPropertyIndices, |
540 | | { |
541 | | { sAttributes, &sNativeProperties_propertyInfos[0] }, |
542 | | { sUnforgeableAttributes, &sNativeProperties_propertyInfos[4] } |
543 | | } |
544 | | }; |
545 | | static_assert(5 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount), |
546 | | "We have a property info count that is oversized"); |
547 | | |
548 | | static bool |
549 | | _constructor(JSContext* cx, unsigned argc, JS::Value* vp) |
550 | 0 | { |
551 | 0 | AUTO_PROFILER_LABEL_FAST("PopupBlockedEvent constructor", DOM, cx); |
552 | 0 |
|
553 | 0 | JS::CallArgs args = JS::CallArgsFromVp(argc, vp); |
554 | 0 | JS::Rooted<JSObject*> obj(cx, &args.callee()); |
555 | 0 | if (!args.isConstructing()) { |
556 | 0 | // XXXbz wish I could get the name from the callee instead of |
557 | 0 | // Adding more relocations |
558 | 0 | return ThrowConstructorWithoutNew(cx, "PopupBlockedEvent"); |
559 | 0 | } |
560 | 0 | |
561 | 0 | JS::Rooted<JSObject*> desiredProto(cx); |
562 | 0 | if (!GetDesiredProto(cx, args, &desiredProto)) { |
563 | 0 | return false; |
564 | 0 | } |
565 | 0 | |
566 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
567 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PopupBlockedEvent"); |
568 | 0 | } |
569 | 0 | GlobalObject global(cx, obj); |
570 | 0 | if (global.Failed()) { |
571 | 0 | return false; |
572 | 0 | } |
573 | 0 | |
574 | 0 | bool objIsXray = xpc::WrapperFactory::IsXrayWrapper(obj); |
575 | 0 | binding_detail::FakeString arg0; |
576 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
577 | 0 | return false; |
578 | 0 | } |
579 | 0 | binding_detail::FastPopupBlockedEventInit arg1; |
580 | 0 | if (!arg1.Init(cx, (args.hasDefined(1)) ? args[1] : JS::NullHandleValue, "Argument 2 of PopupBlockedEvent.constructor", false)) { |
581 | 0 | return false; |
582 | 0 | } |
583 | 0 | Maybe<JSAutoRealm> ar; |
584 | 0 | if (objIsXray) { |
585 | 0 | obj = js::CheckedUnwrap(obj); |
586 | 0 | if (!obj) { |
587 | 0 | return false; |
588 | 0 | } |
589 | 0 | ar.emplace(cx, obj); |
590 | 0 | if (!JS_WrapObject(cx, &desiredProto)) { |
591 | 0 | return false; |
592 | 0 | } |
593 | 0 | } |
594 | 0 | FastErrorResult rv; |
595 | 0 | auto result(StrongOrRawPtr<mozilla::dom::PopupBlockedEvent>(mozilla::dom::PopupBlockedEvent::Constructor(global, NonNullHelper(Constify(arg0)), Constify(arg1), rv))); |
596 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
597 | 0 | return false; |
598 | 0 | } |
599 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
600 | 0 | static_assert(!IsPointer<decltype(result)>::value, |
601 | 0 | "NewObject implies that we need to keep the object alive with a strong reference."); |
602 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval(), desiredProto)) { |
603 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
604 | 0 | return false; |
605 | 0 | } |
606 | 0 | return true; |
607 | 0 | } |
608 | | |
609 | | static const js::ClassOps sInterfaceObjectClassOps = { |
610 | | nullptr, /* addProperty */ |
611 | | nullptr, /* delProperty */ |
612 | | nullptr, /* enumerate */ |
613 | | nullptr, /* newEnumerate */ |
614 | | nullptr, /* resolve */ |
615 | | nullptr, /* mayResolve */ |
616 | | nullptr, /* finalize */ |
617 | | _constructor, /* call */ |
618 | | nullptr, /* hasInstance */ |
619 | | _constructor, /* construct */ |
620 | | nullptr, /* trace */ |
621 | | }; |
622 | | |
623 | | static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = { |
624 | | { |
625 | | "Function", |
626 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE), |
627 | | &sInterfaceObjectClassOps, |
628 | | JS_NULL_CLASS_SPEC, |
629 | | JS_NULL_CLASS_EXT, |
630 | | &sInterfaceObjectClassObjectOps |
631 | | }, |
632 | | eInterface, |
633 | | true, |
634 | | prototypes::id::PopupBlockedEvent, |
635 | | PrototypeTraits<prototypes::id::PopupBlockedEvent>::Depth, |
636 | | sNativePropertyHooks, |
637 | | "function PopupBlockedEvent() {\n [native code]\n}", |
638 | | Event_Binding::GetConstructorObject |
639 | | }; |
640 | | |
641 | | static const DOMIfaceAndProtoJSClass sPrototypeClass = { |
642 | | { |
643 | | "PopupBlockedEventPrototype", |
644 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE + 1 /* slot for the JSObject holding the unforgeable properties */), |
645 | | JS_NULL_CLASS_OPS, |
646 | | JS_NULL_CLASS_SPEC, |
647 | | JS_NULL_CLASS_EXT, |
648 | | JS_NULL_OBJECT_OPS |
649 | | }, |
650 | | eInterfacePrototype, |
651 | | false, |
652 | | prototypes::id::PopupBlockedEvent, |
653 | | PrototypeTraits<prototypes::id::PopupBlockedEvent>::Depth, |
654 | | sNativePropertyHooks, |
655 | | "[object PopupBlockedEventPrototype]", |
656 | | Event_Binding::GetProtoObject |
657 | | }; |
658 | | |
659 | | static const js::ClassOps sClassOps = { |
660 | | _addProperty, /* addProperty */ |
661 | | nullptr, /* delProperty */ |
662 | | nullptr, /* enumerate */ |
663 | | nullptr, /* newEnumerate */ |
664 | | nullptr, /* resolve */ |
665 | | nullptr, /* mayResolve */ |
666 | | _finalize, /* finalize */ |
667 | | nullptr, /* call */ |
668 | | nullptr, /* hasInstance */ |
669 | | nullptr, /* construct */ |
670 | | nullptr, /* trace */ |
671 | | }; |
672 | | |
673 | | static const js::ClassExtension sClassExtension = { |
674 | | nullptr, /* weakmapKeyDelegateOp */ |
675 | | _objectMoved /* objectMovedOp */ |
676 | | }; |
677 | | |
678 | | static const DOMJSClass sClass = { |
679 | | { "PopupBlockedEvent", |
680 | | JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1) | JSCLASS_SKIP_NURSERY_FINALIZE, |
681 | | &sClassOps, |
682 | | JS_NULL_CLASS_SPEC, |
683 | | &sClassExtension, |
684 | | JS_NULL_OBJECT_OPS |
685 | | }, |
686 | | { prototypes::id::Event, prototypes::id::PopupBlockedEvent, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count }, |
687 | | IsBaseOf<nsISupports, mozilla::dom::PopupBlockedEvent >::value, |
688 | | sNativePropertyHooks, |
689 | | FindAssociatedGlobalForNative<mozilla::dom::PopupBlockedEvent>::Get, |
690 | | GetProtoObjectHandle, |
691 | | GetCCParticipant<mozilla::dom::PopupBlockedEvent>::Get() |
692 | | }; |
693 | | static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS, |
694 | | "Must have the right minimal number of reserved slots."); |
695 | | static_assert(1 >= 1, |
696 | | "Must have enough reserved slots."); |
697 | | |
698 | | const JSClass* |
699 | | GetJSClass() |
700 | 0 | { |
701 | 0 | return sClass.ToJSClass(); |
702 | 0 | } |
703 | | |
704 | | bool |
705 | | Wrap(JSContext* aCx, mozilla::dom::PopupBlockedEvent* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector) |
706 | 0 | { |
707 | 0 | static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::dom::PopupBlockedEvent>::value, |
708 | 0 | "Shouldn't have wrappercached things that are not refcounted."); |
709 | 0 | MOZ_ASSERT(static_cast<mozilla::dom::PopupBlockedEvent*>(aObject) == |
710 | 0 | reinterpret_cast<mozilla::dom::PopupBlockedEvent*>(aObject), |
711 | 0 | "Multiple inheritance for mozilla::dom::PopupBlockedEvent is broken."); |
712 | 0 | MOZ_ASSERT(static_cast<mozilla::dom::Event*>(aObject) == |
713 | 0 | reinterpret_cast<mozilla::dom::Event*>(aObject), |
714 | 0 | "Multiple inheritance for mozilla::dom::Event is broken."); |
715 | 0 | MOZ_ASSERT(ToSupportsIsCorrect(aObject)); |
716 | 0 | MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx)); |
717 | 0 | MOZ_ASSERT(!aCache->GetWrapper(), |
718 | 0 | "You should probably not be using Wrap() directly; use " |
719 | 0 | "GetOrCreateDOMReflector instead"); |
720 | 0 |
|
721 | 0 | MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache), |
722 | 0 | "nsISupports must be on our primary inheritance chain"); |
723 | 0 |
|
724 | 0 | JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject())); |
725 | 0 | if (!global) { |
726 | 0 | return false; |
727 | 0 | } |
728 | 0 | MOZ_ASSERT(JS_IsGlobalObject(global)); |
729 | 0 | MOZ_ASSERT(JS::ObjectIsNotGray(global)); |
730 | 0 |
|
731 | 0 | // That might have ended up wrapping us already, due to the wonders |
732 | 0 | // of XBL. Check for that, and bail out as needed. |
733 | 0 | aReflector.set(aCache->GetWrapper()); |
734 | 0 | if (aReflector) { |
735 | | #ifdef DEBUG |
736 | | AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto); |
737 | | #endif // DEBUG |
738 | | return true; |
739 | 0 | } |
740 | 0 |
|
741 | 0 | JSAutoRealm ar(aCx, global); |
742 | 0 | JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx); |
743 | 0 | if (!canonicalProto) { |
744 | 0 | return false; |
745 | 0 | } |
746 | 0 | JS::Rooted<JSObject*> proto(aCx); |
747 | 0 | if (aGivenProto) { |
748 | 0 | proto = aGivenProto; |
749 | 0 | // Unfortunately, while aGivenProto was in the compartment of aCx |
750 | 0 | // coming in, we changed compartments to that of "parent" so may need |
751 | 0 | // to wrap the proto here. |
752 | 0 | if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) { |
753 | 0 | if (!JS_WrapObject(aCx, &proto)) { |
754 | 0 | return false; |
755 | 0 | } |
756 | 0 | } |
757 | 0 | } else { |
758 | 0 | proto = canonicalProto; |
759 | 0 | } |
760 | 0 |
|
761 | 0 | BindingJSObjectCreator<mozilla::dom::PopupBlockedEvent> creator(aCx); |
762 | 0 | creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector); |
763 | 0 | if (!aReflector) { |
764 | 0 | return false; |
765 | 0 | } |
766 | 0 | |
767 | 0 | aCache->SetWrapper(aReflector); |
768 | 0 |
|
769 | 0 | // Important: do unforgeable property setup after we have handed |
770 | 0 | // over ownership of the C++ object to obj as needed, so that if |
771 | 0 | // we fail and it ends up GCed it won't have problems in the |
772 | 0 | // finalizer trying to drop its ownership of the C++ object. |
773 | 0 | JS::Rooted<JSObject*> unforgeableHolder(aCx, |
774 | 0 | &js::GetReservedSlot(canonicalProto, DOM_INTERFACE_PROTO_SLOTS_BASE).toObject()); |
775 | 0 | if (!JS_InitializePropertiesFromCompatibleNativeObject(aCx, aReflector, unforgeableHolder)) { |
776 | 0 | aCache->ReleaseWrapper(aObject); |
777 | 0 | aCache->ClearWrapper(); |
778 | 0 | return false; |
779 | 0 | } |
780 | 0 | creator.InitializationSucceeded(); |
781 | 0 |
|
782 | 0 | MOZ_ASSERT(aCache->GetWrapperPreserveColor() && |
783 | 0 | aCache->GetWrapperPreserveColor() == aReflector); |
784 | 0 | // If proto != canonicalProto, we have to preserve our wrapper; |
785 | 0 | // otherwise we won't be able to properly recreate it later, since |
786 | 0 | // we won't know what proto to use. Note that we don't check |
787 | 0 | // aGivenProto here, since it's entirely possible (and even |
788 | 0 | // somewhat common) to have a non-null aGivenProto which is the |
789 | 0 | // same as canonicalProto. |
790 | 0 | if (proto != canonicalProto) { |
791 | 0 | PreserveWrapper(aObject); |
792 | 0 | } |
793 | 0 |
|
794 | 0 | return true; |
795 | 0 | } |
796 | | |
797 | | const NativePropertyHooks sNativePropertyHooks[] = { { |
798 | | nullptr, |
799 | | nullptr, |
800 | | nullptr, |
801 | | { sNativeProperties.Upcast(), nullptr }, |
802 | | prototypes::id::PopupBlockedEvent, |
803 | | constructors::id::PopupBlockedEvent, |
804 | | Event_Binding::sNativePropertyHooks, |
805 | | &DefaultXrayExpandoObjectClass |
806 | | } }; |
807 | | |
808 | | void |
809 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal) |
810 | 0 | { |
811 | 0 | JS::Handle<JSObject*> parentProto(Event_Binding::GetProtoObjectHandle(aCx)); |
812 | 0 | if (!parentProto) { |
813 | 0 | return; |
814 | 0 | } |
815 | 0 | |
816 | 0 | JS::Handle<JSObject*> constructorProto(Event_Binding::GetConstructorObjectHandle(aCx)); |
817 | 0 | if (!constructorProto) { |
818 | 0 | return; |
819 | 0 | } |
820 | 0 | |
821 | 0 | static bool sIdsInited = false; |
822 | 0 | if (!sIdsInited && NS_IsMainThread()) { |
823 | 0 | if (!InitIds(aCx, sNativeProperties.Upcast())) { |
824 | 0 | return; |
825 | 0 | } |
826 | 0 | sIdsInited = true; |
827 | 0 | } |
828 | 0 |
|
829 | 0 | JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::PopupBlockedEvent); |
830 | 0 | JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::PopupBlockedEvent); |
831 | 0 | dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, |
832 | 0 | &sPrototypeClass.mBase, protoCache, |
833 | 0 | nullptr, |
834 | 0 | constructorProto, &sInterfaceObjectClass.mBase, 1, nullptr, |
835 | 0 | interfaceCache, |
836 | 0 | sNativeProperties.Upcast(), |
837 | 0 | nullptr, |
838 | 0 | "PopupBlockedEvent", aDefineOnGlobal, |
839 | 0 | nullptr, |
840 | 0 | false); |
841 | 0 |
|
842 | 0 | JS::Rooted<JSObject*> unforgeableHolder(aCx); |
843 | 0 | { |
844 | 0 | JS::Rooted<JSObject*> holderProto(aCx, *protoCache); |
845 | 0 | unforgeableHolder = JS_NewObjectWithoutMetadata(aCx, sClass.ToJSClass(), holderProto); |
846 | 0 | if (!unforgeableHolder) { |
847 | 0 | *protoCache = nullptr; |
848 | 0 | if (interfaceCache) { |
849 | 0 | *interfaceCache = nullptr; |
850 | 0 | } |
851 | 0 | return; |
852 | 0 | } |
853 | 0 | } |
854 | 0 |
|
855 | 0 | if (!DefineUnforgeableAttributes(aCx, unforgeableHolder, sUnforgeableAttributes)) { |
856 | 0 | *protoCache = nullptr; |
857 | 0 | if (interfaceCache) { |
858 | 0 | *interfaceCache = nullptr; |
859 | 0 | } |
860 | 0 | return; |
861 | 0 | } |
862 | 0 |
|
863 | 0 | if (*protoCache) { |
864 | 0 | js::SetReservedSlot(*protoCache, DOM_INTERFACE_PROTO_SLOTS_BASE, |
865 | 0 | JS::ObjectValue(*unforgeableHolder)); |
866 | 0 | } |
867 | 0 | } |
868 | | |
869 | | JSObject* |
870 | | GetConstructorObject(JSContext* aCx) |
871 | 0 | { |
872 | 0 | return GetConstructorObjectHandle(aCx); |
873 | 0 | } |
874 | | |
875 | | } // namespace PopupBlockedEvent_Binding |
876 | | |
877 | | |
878 | | |
879 | | } // namespace dom |
880 | | } // namespace mozilla |