/work/obj-fuzz/dom/bindings/HTMLFrameElementBinding.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* THIS FILE IS AUTOGENERATED FROM HTMLFrameElement.webidl BY Codegen.py - DO NOT EDIT */ |
2 | | |
3 | | #include "HTMLElementBinding.h" |
4 | | #include "HTMLFrameElementBinding.h" |
5 | | #include "WrapperFactory.h" |
6 | | #include "mozilla/OwningNonNull.h" |
7 | | #include "mozilla/dom/BindingUtils.h" |
8 | | #include "mozilla/dom/CustomElementRegistry.h" |
9 | | #include "mozilla/dom/DOMJSClass.h" |
10 | | #include "mozilla/dom/DocGroup.h" |
11 | | #include "mozilla/dom/HTMLFrameElement.h" |
12 | | #include "mozilla/dom/HTMLIFrameElement.h" |
13 | | #include "mozilla/dom/NonRefcountedDOMObject.h" |
14 | | #include "mozilla/dom/Nullable.h" |
15 | | #include "mozilla/dom/PrimitiveConversions.h" |
16 | | #include "mozilla/dom/XULFrameElement.h" |
17 | | #include "mozilla/dom/XrayExpandoClass.h" |
18 | | #include "nsContentUtils.h" |
19 | | #include "nsFrameLoader.h" |
20 | | #include "nsIDocument.h" |
21 | | #include "nsPIDOMWindow.h" |
22 | | |
23 | | namespace mozilla { |
24 | | namespace dom { |
25 | | |
26 | | namespace binding_detail {}; // Just to make sure it's known as a namespace |
27 | | using namespace mozilla::dom::binding_detail; |
28 | | |
29 | | |
30 | | namespace HTMLFrameElement_Binding { |
31 | | |
32 | | static_assert(IsRefcounted<NativeType>::value == IsRefcounted<HTMLElement_Binding::NativeType>::value, |
33 | | "Can't inherit from an interface with a different ownership model."); |
34 | | |
35 | | MOZ_CAN_RUN_SCRIPT static bool |
36 | | get_name(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, JSJitGetterCallArgs args) |
37 | 0 | { |
38 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLFrameElement.name", DOM, cx); |
39 | 0 |
|
40 | 0 | DOMString result; |
41 | 0 | self->GetName(result); |
42 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
43 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
44 | 0 | return false; |
45 | 0 | } |
46 | 0 | return true; |
47 | 0 | } |
48 | | |
49 | | MOZ_CAN_RUN_SCRIPT static bool |
50 | | set_name(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, JSJitSetterCallArgs args) |
51 | 0 | { |
52 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLFrameElement.name", DOM, cx); |
53 | 0 |
|
54 | 0 | binding_detail::FakeString arg0; |
55 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
56 | 0 | return false; |
57 | 0 | } |
58 | 0 | Maybe<AutoCEReaction> ceReaction; |
59 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
60 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
61 | 0 | if (docGroup) { |
62 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
63 | 0 | } |
64 | 0 | } |
65 | 0 | FastErrorResult rv; |
66 | 0 | self->SetName(NonNullHelper(Constify(arg0)), rv); |
67 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
68 | 0 | return false; |
69 | 0 | } |
70 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
71 | 0 |
|
72 | 0 | return true; |
73 | 0 | } |
74 | | |
75 | | static const JSJitInfo name_getterinfo = { |
76 | | { (JSJitGetterOp)get_name }, |
77 | | { prototypes::id::HTMLFrameElement }, |
78 | | { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth }, |
79 | | JSJitInfo::Getter, |
80 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
81 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
82 | | false, /* isInfallible. False in setters. */ |
83 | | false, /* isMovable. Not relevant for setters. */ |
84 | | false, /* isEliminatable. Not relevant for setters. */ |
85 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
86 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
87 | | false, /* isTypedMethod. Only relevant for methods. */ |
88 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
89 | | }; |
90 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
91 | | static_assert(0 < 1, "There is no slot for us"); |
92 | | static const JSJitInfo name_setterinfo = { |
93 | | { (JSJitGetterOp)set_name }, |
94 | | { prototypes::id::HTMLFrameElement }, |
95 | | { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth }, |
96 | | JSJitInfo::Setter, |
97 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
98 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
99 | | false, /* isInfallible. False in setters. */ |
100 | | false, /* isMovable. Not relevant for setters. */ |
101 | | false, /* isEliminatable. Not relevant for setters. */ |
102 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
103 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
104 | | false, /* isTypedMethod. Only relevant for methods. */ |
105 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
106 | | }; |
107 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
108 | | static_assert(0 < 1, "There is no slot for us"); |
109 | | |
110 | | MOZ_CAN_RUN_SCRIPT static bool |
111 | | get_scrolling(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, JSJitGetterCallArgs args) |
112 | 0 | { |
113 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLFrameElement.scrolling", DOM, cx); |
114 | 0 |
|
115 | 0 | DOMString result; |
116 | 0 | self->GetScrolling(result); |
117 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
118 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
119 | 0 | return false; |
120 | 0 | } |
121 | 0 | return true; |
122 | 0 | } |
123 | | |
124 | | MOZ_CAN_RUN_SCRIPT static bool |
125 | | set_scrolling(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, JSJitSetterCallArgs args) |
126 | 0 | { |
127 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLFrameElement.scrolling", DOM, cx); |
128 | 0 |
|
129 | 0 | binding_detail::FakeString arg0; |
130 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
131 | 0 | return false; |
132 | 0 | } |
133 | 0 | Maybe<AutoCEReaction> ceReaction; |
134 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
135 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
136 | 0 | if (docGroup) { |
137 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
138 | 0 | } |
139 | 0 | } |
140 | 0 | FastErrorResult rv; |
141 | 0 | self->SetScrolling(NonNullHelper(Constify(arg0)), rv); |
142 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
143 | 0 | return false; |
144 | 0 | } |
145 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
146 | 0 |
|
147 | 0 | return true; |
148 | 0 | } |
149 | | |
150 | | static const JSJitInfo scrolling_getterinfo = { |
151 | | { (JSJitGetterOp)get_scrolling }, |
152 | | { prototypes::id::HTMLFrameElement }, |
153 | | { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth }, |
154 | | JSJitInfo::Getter, |
155 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
156 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
157 | | false, /* isInfallible. False in setters. */ |
158 | | false, /* isMovable. Not relevant for setters. */ |
159 | | false, /* isEliminatable. Not relevant for setters. */ |
160 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
161 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
162 | | false, /* isTypedMethod. Only relevant for methods. */ |
163 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
164 | | }; |
165 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
166 | | static_assert(0 < 1, "There is no slot for us"); |
167 | | static const JSJitInfo scrolling_setterinfo = { |
168 | | { (JSJitGetterOp)set_scrolling }, |
169 | | { prototypes::id::HTMLFrameElement }, |
170 | | { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth }, |
171 | | JSJitInfo::Setter, |
172 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
173 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
174 | | false, /* isInfallible. False in setters. */ |
175 | | false, /* isMovable. Not relevant for setters. */ |
176 | | false, /* isEliminatable. Not relevant for setters. */ |
177 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
178 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
179 | | false, /* isTypedMethod. Only relevant for methods. */ |
180 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
181 | | }; |
182 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
183 | | static_assert(0 < 1, "There is no slot for us"); |
184 | | |
185 | | MOZ_CAN_RUN_SCRIPT static bool |
186 | | get_src(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, JSJitGetterCallArgs args) |
187 | 0 | { |
188 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLFrameElement.src", DOM, cx); |
189 | 0 |
|
190 | 0 | DOMString result; |
191 | 0 | self->GetSrc(result); |
192 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
193 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
194 | 0 | return false; |
195 | 0 | } |
196 | 0 | return true; |
197 | 0 | } |
198 | | |
199 | | MOZ_CAN_RUN_SCRIPT static bool |
200 | | set_src(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, JSJitSetterCallArgs args) |
201 | 0 | { |
202 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLFrameElement.src", DOM, cx); |
203 | 0 |
|
204 | 0 | binding_detail::FakeString arg0; |
205 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
206 | 0 | return false; |
207 | 0 | } |
208 | 0 | Maybe<AutoCEReaction> ceReaction; |
209 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
210 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
211 | 0 | if (docGroup) { |
212 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
213 | 0 | } |
214 | 0 | } |
215 | 0 | FastErrorResult rv; |
216 | 0 | nsIPrincipal* subjectPrincipal; |
217 | 0 | { |
218 | 0 | JS::Realm* realm = js::GetContextRealm(cx); |
219 | 0 | MOZ_ASSERT(realm); |
220 | 0 | JSPrincipals* principals = JS::GetRealmPrincipals(realm); |
221 | 0 | nsIPrincipal* principal = nsJSPrincipals::get(principals); |
222 | 0 | if (nsContentUtils::IsSystemPrincipal(principal)) { |
223 | 0 | principal = nullptr; |
224 | 0 | } |
225 | 0 |
|
226 | 0 | subjectPrincipal = principal; |
227 | 0 | } |
228 | 0 | self->SetSrc(NonNullHelper(Constify(arg0)), subjectPrincipal, rv); |
229 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
230 | 0 | return false; |
231 | 0 | } |
232 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
233 | 0 |
|
234 | 0 | return true; |
235 | 0 | } |
236 | | |
237 | | static const JSJitInfo src_getterinfo = { |
238 | | { (JSJitGetterOp)get_src }, |
239 | | { prototypes::id::HTMLFrameElement }, |
240 | | { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth }, |
241 | | JSJitInfo::Getter, |
242 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
243 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
244 | | false, /* isInfallible. False in setters. */ |
245 | | false, /* isMovable. Not relevant for setters. */ |
246 | | false, /* isEliminatable. Not relevant for setters. */ |
247 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
248 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
249 | | false, /* isTypedMethod. Only relevant for methods. */ |
250 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
251 | | }; |
252 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
253 | | static_assert(0 < 1, "There is no slot for us"); |
254 | | static const JSJitInfo src_setterinfo = { |
255 | | { (JSJitGetterOp)set_src }, |
256 | | { prototypes::id::HTMLFrameElement }, |
257 | | { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth }, |
258 | | JSJitInfo::Setter, |
259 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
260 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
261 | | false, /* isInfallible. False in setters. */ |
262 | | false, /* isMovable. Not relevant for setters. */ |
263 | | false, /* isEliminatable. Not relevant for setters. */ |
264 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
265 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
266 | | false, /* isTypedMethod. Only relevant for methods. */ |
267 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
268 | | }; |
269 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
270 | | static_assert(0 < 1, "There is no slot for us"); |
271 | | |
272 | | MOZ_CAN_RUN_SCRIPT static bool |
273 | | get_frameBorder(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, JSJitGetterCallArgs args) |
274 | 0 | { |
275 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLFrameElement.frameBorder", DOM, cx); |
276 | 0 |
|
277 | 0 | DOMString result; |
278 | 0 | self->GetFrameBorder(result); |
279 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
280 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
281 | 0 | return false; |
282 | 0 | } |
283 | 0 | return true; |
284 | 0 | } |
285 | | |
286 | | MOZ_CAN_RUN_SCRIPT static bool |
287 | | set_frameBorder(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, JSJitSetterCallArgs args) |
288 | 0 | { |
289 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLFrameElement.frameBorder", DOM, cx); |
290 | 0 |
|
291 | 0 | binding_detail::FakeString arg0; |
292 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
293 | 0 | return false; |
294 | 0 | } |
295 | 0 | Maybe<AutoCEReaction> ceReaction; |
296 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
297 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
298 | 0 | if (docGroup) { |
299 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
300 | 0 | } |
301 | 0 | } |
302 | 0 | FastErrorResult rv; |
303 | 0 | self->SetFrameBorder(NonNullHelper(Constify(arg0)), rv); |
304 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
305 | 0 | return false; |
306 | 0 | } |
307 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
308 | 0 |
|
309 | 0 | return true; |
310 | 0 | } |
311 | | |
312 | | static const JSJitInfo frameBorder_getterinfo = { |
313 | | { (JSJitGetterOp)get_frameBorder }, |
314 | | { prototypes::id::HTMLFrameElement }, |
315 | | { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth }, |
316 | | JSJitInfo::Getter, |
317 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
318 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
319 | | false, /* isInfallible. False in setters. */ |
320 | | false, /* isMovable. Not relevant for setters. */ |
321 | | false, /* isEliminatable. Not relevant for setters. */ |
322 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
323 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
324 | | false, /* isTypedMethod. Only relevant for methods. */ |
325 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
326 | | }; |
327 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
328 | | static_assert(0 < 1, "There is no slot for us"); |
329 | | static const JSJitInfo frameBorder_setterinfo = { |
330 | | { (JSJitGetterOp)set_frameBorder }, |
331 | | { prototypes::id::HTMLFrameElement }, |
332 | | { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth }, |
333 | | JSJitInfo::Setter, |
334 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
335 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
336 | | false, /* isInfallible. False in setters. */ |
337 | | false, /* isMovable. Not relevant for setters. */ |
338 | | false, /* isEliminatable. Not relevant for setters. */ |
339 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
340 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
341 | | false, /* isTypedMethod. Only relevant for methods. */ |
342 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
343 | | }; |
344 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
345 | | static_assert(0 < 1, "There is no slot for us"); |
346 | | |
347 | | MOZ_CAN_RUN_SCRIPT static bool |
348 | | get_longDesc(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, JSJitGetterCallArgs args) |
349 | 0 | { |
350 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLFrameElement.longDesc", DOM, cx); |
351 | 0 |
|
352 | 0 | DOMString result; |
353 | 0 | self->GetLongDesc(result); |
354 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
355 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
356 | 0 | return false; |
357 | 0 | } |
358 | 0 | return true; |
359 | 0 | } |
360 | | |
361 | | MOZ_CAN_RUN_SCRIPT static bool |
362 | | set_longDesc(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, JSJitSetterCallArgs args) |
363 | 0 | { |
364 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLFrameElement.longDesc", DOM, cx); |
365 | 0 |
|
366 | 0 | binding_detail::FakeString arg0; |
367 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
368 | 0 | return false; |
369 | 0 | } |
370 | 0 | Maybe<AutoCEReaction> ceReaction; |
371 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
372 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
373 | 0 | if (docGroup) { |
374 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
375 | 0 | } |
376 | 0 | } |
377 | 0 | FastErrorResult rv; |
378 | 0 | self->SetLongDesc(NonNullHelper(Constify(arg0)), rv); |
379 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
380 | 0 | return false; |
381 | 0 | } |
382 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
383 | 0 |
|
384 | 0 | return true; |
385 | 0 | } |
386 | | |
387 | | static const JSJitInfo longDesc_getterinfo = { |
388 | | { (JSJitGetterOp)get_longDesc }, |
389 | | { prototypes::id::HTMLFrameElement }, |
390 | | { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth }, |
391 | | JSJitInfo::Getter, |
392 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
393 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
394 | | false, /* isInfallible. False in setters. */ |
395 | | false, /* isMovable. Not relevant for setters. */ |
396 | | false, /* isEliminatable. Not relevant for setters. */ |
397 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
398 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
399 | | false, /* isTypedMethod. Only relevant for methods. */ |
400 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
401 | | }; |
402 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
403 | | static_assert(0 < 1, "There is no slot for us"); |
404 | | static const JSJitInfo longDesc_setterinfo = { |
405 | | { (JSJitGetterOp)set_longDesc }, |
406 | | { prototypes::id::HTMLFrameElement }, |
407 | | { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth }, |
408 | | JSJitInfo::Setter, |
409 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
410 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
411 | | false, /* isInfallible. False in setters. */ |
412 | | false, /* isMovable. Not relevant for setters. */ |
413 | | false, /* isEliminatable. Not relevant for setters. */ |
414 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
415 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
416 | | false, /* isTypedMethod. Only relevant for methods. */ |
417 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
418 | | }; |
419 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
420 | | static_assert(0 < 1, "There is no slot for us"); |
421 | | |
422 | | MOZ_CAN_RUN_SCRIPT static bool |
423 | | get_noResize(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, JSJitGetterCallArgs args) |
424 | 0 | { |
425 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLFrameElement.noResize", DOM, cx); |
426 | 0 |
|
427 | 0 | bool result(self->NoResize()); |
428 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
429 | 0 | args.rval().setBoolean(result); |
430 | 0 | return true; |
431 | 0 | } |
432 | | |
433 | | MOZ_CAN_RUN_SCRIPT static bool |
434 | | set_noResize(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, JSJitSetterCallArgs args) |
435 | 0 | { |
436 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLFrameElement.noResize", DOM, cx); |
437 | 0 |
|
438 | 0 | bool arg0; |
439 | 0 | if (!ValueToPrimitive<bool, eDefault>(cx, args[0], &arg0)) { |
440 | 0 | return false; |
441 | 0 | } |
442 | 0 | Maybe<AutoCEReaction> ceReaction; |
443 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
444 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
445 | 0 | if (docGroup) { |
446 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
447 | 0 | } |
448 | 0 | } |
449 | 0 | FastErrorResult rv; |
450 | 0 | self->SetNoResize(arg0, rv); |
451 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
452 | 0 | return false; |
453 | 0 | } |
454 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
455 | 0 |
|
456 | 0 | return true; |
457 | 0 | } |
458 | | |
459 | | static const JSJitInfo noResize_getterinfo = { |
460 | | { (JSJitGetterOp)get_noResize }, |
461 | | { prototypes::id::HTMLFrameElement }, |
462 | | { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth }, |
463 | | JSJitInfo::Getter, |
464 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
465 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
466 | | true, /* isInfallible. False in setters. */ |
467 | | false, /* isMovable. Not relevant for setters. */ |
468 | | false, /* isEliminatable. Not relevant for setters. */ |
469 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
470 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
471 | | false, /* isTypedMethod. Only relevant for methods. */ |
472 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
473 | | }; |
474 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
475 | | static_assert(0 < 1, "There is no slot for us"); |
476 | | static const JSJitInfo noResize_setterinfo = { |
477 | | { (JSJitGetterOp)set_noResize }, |
478 | | { prototypes::id::HTMLFrameElement }, |
479 | | { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth }, |
480 | | JSJitInfo::Setter, |
481 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
482 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
483 | | false, /* isInfallible. False in setters. */ |
484 | | false, /* isMovable. Not relevant for setters. */ |
485 | | false, /* isEliminatable. Not relevant for setters. */ |
486 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
487 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
488 | | false, /* isTypedMethod. Only relevant for methods. */ |
489 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
490 | | }; |
491 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
492 | | static_assert(0 < 1, "There is no slot for us"); |
493 | | |
494 | | MOZ_CAN_RUN_SCRIPT static bool |
495 | | get_contentDocument(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, JSJitGetterCallArgs args) |
496 | 0 | { |
497 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLFrameElement.contentDocument", DOM, cx); |
498 | 0 |
|
499 | 0 | NonNull<nsIPrincipal> subjectPrincipal; |
500 | 0 | { |
501 | 0 | JS::Realm* realm = js::GetContextRealm(cx); |
502 | 0 | MOZ_ASSERT(realm); |
503 | 0 | JSPrincipals* principals = JS::GetRealmPrincipals(realm); |
504 | 0 | nsIPrincipal* principal = nsJSPrincipals::get(principals); |
505 | 0 |
|
506 | 0 | subjectPrincipal = principal; |
507 | 0 | } |
508 | 0 | auto result(StrongOrRawPtr<nsIDocument>(self->GetContentDocument(subjectPrincipal))); |
509 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
510 | 0 | if (!result) { |
511 | 0 | args.rval().setNull(); |
512 | 0 | return true; |
513 | 0 | } |
514 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
515 | 0 | MOZ_CRASH("Looks like bug 1488480/1405521, with getting the reflector failing"); |
516 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
517 | 0 | return false; |
518 | 0 | } |
519 | 0 | return true; |
520 | 0 | } |
521 | | |
522 | | static const JSJitInfo contentDocument_getterinfo = { |
523 | | { (JSJitGetterOp)get_contentDocument }, |
524 | | { prototypes::id::HTMLFrameElement }, |
525 | | { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth }, |
526 | | JSJitInfo::Getter, |
527 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
528 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
529 | | false, /* isInfallible. False in setters. */ |
530 | | false, /* isMovable. Not relevant for setters. */ |
531 | | false, /* isEliminatable. Not relevant for setters. */ |
532 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
533 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
534 | | false, /* isTypedMethod. Only relevant for methods. */ |
535 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
536 | | }; |
537 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
538 | | static_assert(0 < 1, "There is no slot for us"); |
539 | | |
540 | | MOZ_CAN_RUN_SCRIPT static bool |
541 | | get_contentWindow(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, JSJitGetterCallArgs args) |
542 | 0 | { |
543 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLFrameElement.contentWindow", DOM, cx); |
544 | 0 |
|
545 | 0 | auto result(StrongOrRawPtr<nsPIDOMWindowOuter>(self->GetContentWindow())); |
546 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
547 | 0 | if (!result) { |
548 | 0 | args.rval().setNull(); |
549 | 0 | return true; |
550 | 0 | } |
551 | 0 | if (!WrapObject(cx, result, args.rval())) { |
552 | 0 | return false; |
553 | 0 | } |
554 | 0 | return true; |
555 | 0 | } |
556 | | |
557 | | static const JSJitInfo contentWindow_getterinfo = { |
558 | | { (JSJitGetterOp)get_contentWindow }, |
559 | | { prototypes::id::HTMLFrameElement }, |
560 | | { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth }, |
561 | | JSJitInfo::Getter, |
562 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
563 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
564 | | false, /* isInfallible. False in setters. */ |
565 | | false, /* isMovable. Not relevant for setters. */ |
566 | | false, /* isEliminatable. Not relevant for setters. */ |
567 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
568 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
569 | | false, /* isTypedMethod. Only relevant for methods. */ |
570 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
571 | | }; |
572 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
573 | | static_assert(0 < 1, "There is no slot for us"); |
574 | | |
575 | | MOZ_CAN_RUN_SCRIPT static bool |
576 | | get_marginHeight(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, JSJitGetterCallArgs args) |
577 | 0 | { |
578 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLFrameElement.marginHeight", DOM, cx); |
579 | 0 |
|
580 | 0 | DOMString result; |
581 | 0 | self->GetMarginHeight(result); |
582 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
583 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
584 | 0 | return false; |
585 | 0 | } |
586 | 0 | return true; |
587 | 0 | } |
588 | | |
589 | | MOZ_CAN_RUN_SCRIPT static bool |
590 | | set_marginHeight(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, JSJitSetterCallArgs args) |
591 | 0 | { |
592 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLFrameElement.marginHeight", DOM, cx); |
593 | 0 |
|
594 | 0 | binding_detail::FakeString arg0; |
595 | 0 | if (!ConvertJSValueToString(cx, args[0], eEmpty, eStringify, arg0)) { |
596 | 0 | return false; |
597 | 0 | } |
598 | 0 | Maybe<AutoCEReaction> ceReaction; |
599 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
600 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
601 | 0 | if (docGroup) { |
602 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
603 | 0 | } |
604 | 0 | } |
605 | 0 | FastErrorResult rv; |
606 | 0 | self->SetMarginHeight(NonNullHelper(Constify(arg0)), rv); |
607 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
608 | 0 | return false; |
609 | 0 | } |
610 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
611 | 0 |
|
612 | 0 | return true; |
613 | 0 | } |
614 | | |
615 | | static const JSJitInfo marginHeight_getterinfo = { |
616 | | { (JSJitGetterOp)get_marginHeight }, |
617 | | { prototypes::id::HTMLFrameElement }, |
618 | | { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth }, |
619 | | JSJitInfo::Getter, |
620 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
621 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
622 | | false, /* isInfallible. False in setters. */ |
623 | | false, /* isMovable. Not relevant for setters. */ |
624 | | false, /* isEliminatable. Not relevant for setters. */ |
625 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
626 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
627 | | false, /* isTypedMethod. Only relevant for methods. */ |
628 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
629 | | }; |
630 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
631 | | static_assert(0 < 1, "There is no slot for us"); |
632 | | static const JSJitInfo marginHeight_setterinfo = { |
633 | | { (JSJitGetterOp)set_marginHeight }, |
634 | | { prototypes::id::HTMLFrameElement }, |
635 | | { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth }, |
636 | | JSJitInfo::Setter, |
637 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
638 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
639 | | false, /* isInfallible. False in setters. */ |
640 | | false, /* isMovable. Not relevant for setters. */ |
641 | | false, /* isEliminatable. Not relevant for setters. */ |
642 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
643 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
644 | | false, /* isTypedMethod. Only relevant for methods. */ |
645 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
646 | | }; |
647 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
648 | | static_assert(0 < 1, "There is no slot for us"); |
649 | | |
650 | | MOZ_CAN_RUN_SCRIPT static bool |
651 | | get_marginWidth(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, JSJitGetterCallArgs args) |
652 | 0 | { |
653 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLFrameElement.marginWidth", DOM, cx); |
654 | 0 |
|
655 | 0 | DOMString result; |
656 | 0 | self->GetMarginWidth(result); |
657 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
658 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
659 | 0 | return false; |
660 | 0 | } |
661 | 0 | return true; |
662 | 0 | } |
663 | | |
664 | | MOZ_CAN_RUN_SCRIPT static bool |
665 | | set_marginWidth(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, JSJitSetterCallArgs args) |
666 | 0 | { |
667 | 0 | AUTO_PROFILER_LABEL_FAST("set HTMLFrameElement.marginWidth", DOM, cx); |
668 | 0 |
|
669 | 0 | binding_detail::FakeString arg0; |
670 | 0 | if (!ConvertJSValueToString(cx, args[0], eEmpty, eStringify, arg0)) { |
671 | 0 | return false; |
672 | 0 | } |
673 | 0 | Maybe<AutoCEReaction> ceReaction; |
674 | 0 | if (CustomElementRegistry::IsCustomElementEnabled(cx, obj)) { |
675 | 0 | DocGroup* docGroup = self->GetDocGroup(); |
676 | 0 | if (docGroup) { |
677 | 0 | ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); |
678 | 0 | } |
679 | 0 | } |
680 | 0 | FastErrorResult rv; |
681 | 0 | self->SetMarginWidth(NonNullHelper(Constify(arg0)), rv); |
682 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
683 | 0 | return false; |
684 | 0 | } |
685 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
686 | 0 |
|
687 | 0 | return true; |
688 | 0 | } |
689 | | |
690 | | static const JSJitInfo marginWidth_getterinfo = { |
691 | | { (JSJitGetterOp)get_marginWidth }, |
692 | | { prototypes::id::HTMLFrameElement }, |
693 | | { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth }, |
694 | | JSJitInfo::Getter, |
695 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
696 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
697 | | false, /* isInfallible. False in setters. */ |
698 | | false, /* isMovable. Not relevant for setters. */ |
699 | | false, /* isEliminatable. Not relevant for setters. */ |
700 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
701 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
702 | | false, /* isTypedMethod. Only relevant for methods. */ |
703 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
704 | | }; |
705 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
706 | | static_assert(0 < 1, "There is no slot for us"); |
707 | | static const JSJitInfo marginWidth_setterinfo = { |
708 | | { (JSJitGetterOp)set_marginWidth }, |
709 | | { prototypes::id::HTMLFrameElement }, |
710 | | { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth }, |
711 | | JSJitInfo::Setter, |
712 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
713 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
714 | | false, /* isInfallible. False in setters. */ |
715 | | false, /* isMovable. Not relevant for setters. */ |
716 | | false, /* isEliminatable. Not relevant for setters. */ |
717 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
718 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
719 | | false, /* isTypedMethod. Only relevant for methods. */ |
720 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
721 | | }; |
722 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
723 | | static_assert(0 < 1, "There is no slot for us"); |
724 | | |
725 | | MOZ_CAN_RUN_SCRIPT static bool |
726 | | get_frameLoader(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, JSJitGetterCallArgs args) |
727 | 0 | { |
728 | 0 | AUTO_PROFILER_LABEL_FAST("get HTMLFrameElement.frameLoader", DOM, cx); |
729 | 0 |
|
730 | 0 | auto result(StrongOrRawPtr<nsFrameLoader>(self->GetFrameLoader())); |
731 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
732 | 0 | if (!result) { |
733 | 0 | args.rval().setNull(); |
734 | 0 | return true; |
735 | 0 | } |
736 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
737 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
738 | 0 | return false; |
739 | 0 | } |
740 | 0 | return true; |
741 | 0 | } |
742 | | |
743 | | static const JSJitInfo frameLoader_getterinfo = { |
744 | | { (JSJitGetterOp)get_frameLoader }, |
745 | | { prototypes::id::HTMLFrameElement }, |
746 | | { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth }, |
747 | | JSJitInfo::Getter, |
748 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
749 | | JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ |
750 | | false, /* isInfallible. False in setters. */ |
751 | | false, /* isMovable. Not relevant for setters. */ |
752 | | false, /* isEliminatable. Not relevant for setters. */ |
753 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
754 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
755 | | false, /* isTypedMethod. Only relevant for methods. */ |
756 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
757 | | }; |
758 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
759 | | static_assert(0 < 1, "There is no slot for us"); |
760 | | |
761 | | MOZ_CAN_RUN_SCRIPT static bool |
762 | | presetOpenerWindow(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, const JSJitMethodCallArgs& args) |
763 | 0 | { |
764 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLFrameElement.presetOpenerWindow", DOM, cx); |
765 | 0 |
|
766 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
767 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLFrameElement.presetOpenerWindow"); |
768 | 0 | } |
769 | 0 | nsPIDOMWindowOuter* arg0; |
770 | 0 | RefPtr<nsPIDOMWindowOuter> arg0_holder; |
771 | 0 | if (args[0].isObject()) { |
772 | 0 | JS::Rooted<JSObject*> source(cx, &args[0].toObject()); |
773 | 0 | if (NS_FAILED(UnwrapArg<nsPIDOMWindowOuter>(cx, source, getter_AddRefs(arg0_holder)))) { |
774 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of HTMLFrameElement.presetOpenerWindow", "WindowProxy"); |
775 | 0 | return false; |
776 | 0 | } |
777 | 0 | MOZ_ASSERT(arg0_holder); |
778 | 0 | arg0 = arg0_holder; |
779 | 0 | } else if (args[0].isNullOrUndefined()) { |
780 | 0 | arg0 = nullptr; |
781 | 0 | } else { |
782 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of HTMLFrameElement.presetOpenerWindow"); |
783 | 0 | return false; |
784 | 0 | } |
785 | 0 | FastErrorResult rv; |
786 | 0 | self->PresetOpenerWindow(MOZ_KnownLive(Constify(arg0)), rv); |
787 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
788 | 0 | return false; |
789 | 0 | } |
790 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
791 | 0 | args.rval().setUndefined(); |
792 | 0 | return true; |
793 | 0 | } |
794 | | |
795 | | static const JSJitInfo presetOpenerWindow_methodinfo = { |
796 | | { (JSJitGetterOp)presetOpenerWindow }, |
797 | | { prototypes::id::HTMLFrameElement }, |
798 | | { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth }, |
799 | | JSJitInfo::Method, |
800 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
801 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
802 | | false, /* isInfallible. False in setters. */ |
803 | | false, /* isMovable. Not relevant for setters. */ |
804 | | false, /* isEliminatable. Not relevant for setters. */ |
805 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
806 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
807 | | false, /* isTypedMethod. Only relevant for methods. */ |
808 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
809 | | }; |
810 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
811 | | static_assert(0 < 1, "There is no slot for us"); |
812 | | |
813 | | MOZ_CAN_RUN_SCRIPT static bool |
814 | | swapFrameLoaders(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::HTMLFrameElement* self, const JSJitMethodCallArgs& args) |
815 | 0 | { |
816 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLFrameElement.swapFrameLoaders", DOM, cx); |
817 | 0 |
|
818 | 0 | unsigned argcount = std::min(args.length(), 1u); |
819 | 0 | switch (argcount) { |
820 | 0 | case 1: { |
821 | 0 | if (args[0].isObject()) { |
822 | 0 | do { |
823 | 0 | NonNull<mozilla::dom::XULFrameElement> arg0; |
824 | 0 | { |
825 | 0 | nsresult rv = UnwrapObject<prototypes::id::XULFrameElement, mozilla::dom::XULFrameElement>(args[0], arg0); |
826 | 0 | if (NS_FAILED(rv)) { |
827 | 0 | break; |
828 | 0 | } |
829 | 0 | } |
830 | 0 | FastErrorResult rv; |
831 | 0 | self->SwapFrameLoaders(MOZ_KnownLive(NonNullHelper(arg0)), rv); |
832 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
833 | 0 | return false; |
834 | 0 | } |
835 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
836 | 0 | args.rval().setUndefined(); |
837 | 0 | return true; |
838 | 0 | } while (false); |
839 | 0 | do { |
840 | 0 | NonNull<mozilla::dom::HTMLIFrameElement> arg0; |
841 | 0 | { |
842 | 0 | nsresult rv = UnwrapObject<prototypes::id::HTMLIFrameElement, mozilla::dom::HTMLIFrameElement>(args[0], arg0); |
843 | 0 | if (NS_FAILED(rv)) { |
844 | 0 | break; |
845 | 0 | } |
846 | 0 | } |
847 | 0 | FastErrorResult rv; |
848 | 0 | self->SwapFrameLoaders(MOZ_KnownLive(NonNullHelper(arg0)), rv); |
849 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
850 | 0 | return false; |
851 | 0 | } |
852 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
853 | 0 | args.rval().setUndefined(); |
854 | 0 | return true; |
855 | 0 | } while (false); |
856 | 0 | } |
857 | 0 | return ThrowErrorMessage(cx, MSG_OVERLOAD_RESOLUTION_FAILED, "1", "1", "HTMLFrameElement.swapFrameLoaders"); |
858 | 0 | break; |
859 | 0 | } |
860 | 0 | default: { |
861 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "HTMLFrameElement.swapFrameLoaders"); |
862 | 0 | break; |
863 | 0 | } |
864 | 0 | } |
865 | 0 | MOZ_CRASH("We have an always-returning default case"); |
866 | 0 | return false; |
867 | 0 | } |
868 | | |
869 | | static const JSJitInfo swapFrameLoaders_methodinfo = { |
870 | | { (JSJitGetterOp)swapFrameLoaders }, |
871 | | { prototypes::id::HTMLFrameElement }, |
872 | | { PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth }, |
873 | | JSJitInfo::Method, |
874 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
875 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
876 | | false, /* isInfallible. False in setters. */ |
877 | | false, /* isMovable. Not relevant for setters. */ |
878 | | false, /* isEliminatable. Not relevant for setters. */ |
879 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
880 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
881 | | false, /* isTypedMethod. Only relevant for methods. */ |
882 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
883 | | }; |
884 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
885 | | static_assert(0 < 1, "There is no slot for us"); |
886 | | |
887 | | static bool |
888 | | _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val) |
889 | 0 | { |
890 | 0 | mozilla::dom::HTMLFrameElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLFrameElement>(obj); |
891 | 0 | // We don't want to preserve if we don't have a wrapper, and we |
892 | 0 | // obviously can't preserve if we're not initialized. |
893 | 0 | if (self && self->GetWrapperPreserveColor()) { |
894 | 0 | PreserveWrapper(self); |
895 | 0 | } |
896 | 0 | return true; |
897 | 0 | } |
898 | | |
899 | | static void |
900 | | _finalize(js::FreeOp* fop, JSObject* obj) |
901 | 0 | { |
902 | 0 | mozilla::dom::HTMLFrameElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLFrameElement>(obj); |
903 | 0 | if (self) { |
904 | 0 | ClearWrapper(self, self, obj); |
905 | 0 | AddForDeferredFinalization<mozilla::dom::HTMLFrameElement>(self); |
906 | 0 | } |
907 | 0 | } |
908 | | |
909 | | static size_t |
910 | | _objectMoved(JSObject* obj, JSObject* old) |
911 | 0 | { |
912 | 0 | mozilla::dom::HTMLFrameElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::HTMLFrameElement>(obj); |
913 | 0 | if (self) { |
914 | 0 | UpdateWrapper(self, self, obj, old); |
915 | 0 | } |
916 | 0 |
|
917 | 0 | return 0; |
918 | 0 | } |
919 | | |
920 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
921 | | #if defined(__clang__) |
922 | | #pragma clang diagnostic push |
923 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
924 | | #endif |
925 | | static const JSFunctionSpec sChromeMethods_specs[] = { |
926 | | JS_FNSPEC("presetOpenerWindow", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&presetOpenerWindow_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
927 | | JS_FNSPEC("swapFrameLoaders", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&swapFrameLoaders_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
928 | | JS_FS_END |
929 | | }; |
930 | | #if defined(__clang__) |
931 | | #pragma clang diagnostic pop |
932 | | #endif |
933 | | |
934 | | |
935 | | static const Prefable<const JSFunctionSpec> sChromeMethods[] = { |
936 | | { nullptr, &sChromeMethods_specs[0] }, |
937 | | { nullptr, nullptr } |
938 | | }; |
939 | | |
940 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
941 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
942 | | static_assert(2 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
943 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
944 | | |
945 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
946 | | #if defined(__clang__) |
947 | | #pragma clang diagnostic push |
948 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
949 | | #endif |
950 | | static const JSPropertySpec sAttributes_specs[] = { |
951 | | { "name", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &name_getterinfo, GenericSetter<NormalThisPolicy>, &name_setterinfo }, |
952 | | { "scrolling", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &scrolling_getterinfo, GenericSetter<NormalThisPolicy>, &scrolling_setterinfo }, |
953 | | { "src", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &src_getterinfo, GenericSetter<NormalThisPolicy>, &src_setterinfo }, |
954 | | { "frameBorder", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &frameBorder_getterinfo, GenericSetter<NormalThisPolicy>, &frameBorder_setterinfo }, |
955 | | { "longDesc", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &longDesc_getterinfo, GenericSetter<NormalThisPolicy>, &longDesc_setterinfo }, |
956 | | { "noResize", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &noResize_getterinfo, GenericSetter<NormalThisPolicy>, &noResize_setterinfo }, |
957 | | { "contentDocument", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &contentDocument_getterinfo, nullptr, nullptr }, |
958 | | { "contentWindow", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &contentWindow_getterinfo, nullptr, nullptr }, |
959 | | { "marginHeight", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &marginHeight_getterinfo, GenericSetter<NormalThisPolicy>, &marginHeight_setterinfo }, |
960 | | { "marginWidth", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &marginWidth_getterinfo, GenericSetter<NormalThisPolicy>, &marginWidth_setterinfo }, |
961 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr } |
962 | | }; |
963 | | #if defined(__clang__) |
964 | | #pragma clang diagnostic pop |
965 | | #endif |
966 | | |
967 | | |
968 | | static const Prefable<const JSPropertySpec> sAttributes[] = { |
969 | | { nullptr, &sAttributes_specs[0] }, |
970 | | { nullptr, nullptr } |
971 | | }; |
972 | | |
973 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
974 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
975 | | static_assert(10 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
976 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
977 | | |
978 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
979 | | #if defined(__clang__) |
980 | | #pragma clang diagnostic push |
981 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
982 | | #endif |
983 | | static const JSPropertySpec sChromeAttributes_specs[] = { |
984 | | { "frameLoader", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &frameLoader_getterinfo, nullptr, nullptr }, |
985 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr } |
986 | | }; |
987 | | #if defined(__clang__) |
988 | | #pragma clang diagnostic pop |
989 | | #endif |
990 | | |
991 | | |
992 | | static const Prefable<const JSPropertySpec> sChromeAttributes[] = { |
993 | | { nullptr, &sChromeAttributes_specs[0] }, |
994 | | { nullptr, nullptr } |
995 | | }; |
996 | | |
997 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
998 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
999 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
1000 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
1001 | | |
1002 | | |
1003 | | static uint16_t sNativeProperties_sortedPropertyIndices[10]; |
1004 | | static PropertyInfo sNativeProperties_propertyInfos[10]; |
1005 | | |
1006 | | static const NativePropertiesN<1> sNativeProperties = { |
1007 | | false, 0, |
1008 | | false, 0, |
1009 | | false, 0, |
1010 | | true, 0 /* sAttributes */, |
1011 | | false, 0, |
1012 | | false, 0, |
1013 | | false, 0, |
1014 | | -1, |
1015 | | 10, |
1016 | | sNativeProperties_sortedPropertyIndices, |
1017 | | { |
1018 | | { sAttributes, &sNativeProperties_propertyInfos[0] } |
1019 | | } |
1020 | | }; |
1021 | | static_assert(10 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount), |
1022 | | "We have a property info count that is oversized"); |
1023 | | |
1024 | | static uint16_t sChromeOnlyNativeProperties_sortedPropertyIndices[3]; |
1025 | | static PropertyInfo sChromeOnlyNativeProperties_propertyInfos[3]; |
1026 | | |
1027 | | static const NativePropertiesN<2> sChromeOnlyNativeProperties = { |
1028 | | false, 0, |
1029 | | false, 0, |
1030 | | true, 0 /* sChromeMethods */, |
1031 | | true, 1 /* sChromeAttributes */, |
1032 | | false, 0, |
1033 | | false, 0, |
1034 | | false, 0, |
1035 | | -1, |
1036 | | 3, |
1037 | | sChromeOnlyNativeProperties_sortedPropertyIndices, |
1038 | | { |
1039 | | { sChromeMethods, &sChromeOnlyNativeProperties_propertyInfos[0] }, |
1040 | | { sChromeAttributes, &sChromeOnlyNativeProperties_propertyInfos[2] } |
1041 | | } |
1042 | | }; |
1043 | | static_assert(3 < 1ull << CHAR_BIT * sizeof(sChromeOnlyNativeProperties.propertyInfoCount), |
1044 | | "We have a property info count that is oversized"); |
1045 | | |
1046 | | static bool |
1047 | | _constructor(JSContext* cx, unsigned argc, JS::Value* vp) |
1048 | 0 | { |
1049 | 0 | AUTO_PROFILER_LABEL_FAST("HTMLFrameElement constructor", DOM, cx); |
1050 | 0 |
|
1051 | 0 | return HTMLConstructor(cx, argc, vp, |
1052 | 0 | constructors::id::HTMLFrameElement, |
1053 | 0 | prototypes::id::HTMLFrameElement, |
1054 | 0 | CreateInterfaceObjects); |
1055 | 0 | } |
1056 | | |
1057 | | static const js::ClassOps sInterfaceObjectClassOps = { |
1058 | | nullptr, /* addProperty */ |
1059 | | nullptr, /* delProperty */ |
1060 | | nullptr, /* enumerate */ |
1061 | | nullptr, /* newEnumerate */ |
1062 | | nullptr, /* resolve */ |
1063 | | nullptr, /* mayResolve */ |
1064 | | nullptr, /* finalize */ |
1065 | | _constructor, /* call */ |
1066 | | nullptr, /* hasInstance */ |
1067 | | _constructor, /* construct */ |
1068 | | nullptr, /* trace */ |
1069 | | }; |
1070 | | |
1071 | | static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = { |
1072 | | { |
1073 | | "Function", |
1074 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE), |
1075 | | &sInterfaceObjectClassOps, |
1076 | | JS_NULL_CLASS_SPEC, |
1077 | | JS_NULL_CLASS_EXT, |
1078 | | &sInterfaceObjectClassObjectOps |
1079 | | }, |
1080 | | eInterface, |
1081 | | true, |
1082 | | prototypes::id::HTMLFrameElement, |
1083 | | PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth, |
1084 | | sNativePropertyHooks, |
1085 | | "function HTMLFrameElement() {\n [native code]\n}", |
1086 | | HTMLElement_Binding::GetConstructorObject |
1087 | | }; |
1088 | | |
1089 | | static const DOMIfaceAndProtoJSClass sPrototypeClass = { |
1090 | | { |
1091 | | "HTMLFrameElementPrototype", |
1092 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE), |
1093 | | JS_NULL_CLASS_OPS, |
1094 | | JS_NULL_CLASS_SPEC, |
1095 | | JS_NULL_CLASS_EXT, |
1096 | | JS_NULL_OBJECT_OPS |
1097 | | }, |
1098 | | eInterfacePrototype, |
1099 | | false, |
1100 | | prototypes::id::HTMLFrameElement, |
1101 | | PrototypeTraits<prototypes::id::HTMLFrameElement>::Depth, |
1102 | | sNativePropertyHooks, |
1103 | | "[object HTMLFrameElementPrototype]", |
1104 | | HTMLElement_Binding::GetProtoObject |
1105 | | }; |
1106 | | |
1107 | | static const js::ClassOps sClassOps = { |
1108 | | _addProperty, /* addProperty */ |
1109 | | nullptr, /* delProperty */ |
1110 | | nullptr, /* enumerate */ |
1111 | | nullptr, /* newEnumerate */ |
1112 | | nullptr, /* resolve */ |
1113 | | nullptr, /* mayResolve */ |
1114 | | _finalize, /* finalize */ |
1115 | | nullptr, /* call */ |
1116 | | nullptr, /* hasInstance */ |
1117 | | nullptr, /* construct */ |
1118 | | nullptr, /* trace */ |
1119 | | }; |
1120 | | |
1121 | | static const js::ClassExtension sClassExtension = { |
1122 | | nullptr, /* weakmapKeyDelegateOp */ |
1123 | | _objectMoved /* objectMovedOp */ |
1124 | | }; |
1125 | | |
1126 | | static const DOMJSClass sClass = { |
1127 | | { "HTMLFrameElement", |
1128 | | JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1), |
1129 | | &sClassOps, |
1130 | | JS_NULL_CLASS_SPEC, |
1131 | | &sClassExtension, |
1132 | | JS_NULL_OBJECT_OPS |
1133 | | }, |
1134 | | { prototypes::id::EventTarget, prototypes::id::Node, prototypes::id::Element, prototypes::id::HTMLElement, prototypes::id::HTMLFrameElement, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count }, |
1135 | | IsBaseOf<nsISupports, mozilla::dom::HTMLFrameElement >::value, |
1136 | | sNativePropertyHooks, |
1137 | | FindAssociatedGlobalForNative<mozilla::dom::HTMLFrameElement>::Get, |
1138 | | GetProtoObjectHandle, |
1139 | | GetCCParticipant<mozilla::dom::HTMLFrameElement>::Get() |
1140 | | }; |
1141 | | static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS, |
1142 | | "Must have the right minimal number of reserved slots."); |
1143 | | static_assert(1 >= 1, |
1144 | | "Must have enough reserved slots."); |
1145 | | |
1146 | | const JSClass* |
1147 | | GetJSClass() |
1148 | 0 | { |
1149 | 0 | return sClass.ToJSClass(); |
1150 | 0 | } |
1151 | | |
1152 | | bool |
1153 | | Wrap(JSContext* aCx, mozilla::dom::HTMLFrameElement* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector) |
1154 | 0 | { |
1155 | 0 | static_assert(!IsBaseOf<NonRefcountedDOMObject, mozilla::dom::HTMLFrameElement>::value, |
1156 | 0 | "Shouldn't have wrappercached things that are not refcounted."); |
1157 | 0 | MOZ_ASSERT(static_cast<mozilla::dom::HTMLFrameElement*>(aObject) == |
1158 | 0 | reinterpret_cast<mozilla::dom::HTMLFrameElement*>(aObject), |
1159 | 0 | "Multiple inheritance for mozilla::dom::HTMLFrameElement is broken."); |
1160 | 0 | MOZ_ASSERT(static_cast<nsGenericHTMLElement*>(aObject) == |
1161 | 0 | reinterpret_cast<nsGenericHTMLElement*>(aObject), |
1162 | 0 | "Multiple inheritance for nsGenericHTMLElement is broken."); |
1163 | 0 | MOZ_ASSERT(static_cast<mozilla::dom::Element*>(aObject) == |
1164 | 0 | reinterpret_cast<mozilla::dom::Element*>(aObject), |
1165 | 0 | "Multiple inheritance for mozilla::dom::Element is broken."); |
1166 | 0 | MOZ_ASSERT(static_cast<nsINode*>(aObject) == |
1167 | 0 | reinterpret_cast<nsINode*>(aObject), |
1168 | 0 | "Multiple inheritance for nsINode is broken."); |
1169 | 0 | MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) == |
1170 | 0 | reinterpret_cast<mozilla::dom::EventTarget*>(aObject), |
1171 | 0 | "Multiple inheritance for mozilla::dom::EventTarget is broken."); |
1172 | 0 | MOZ_ASSERT(ToSupportsIsCorrect(aObject)); |
1173 | 0 | MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx)); |
1174 | 0 | MOZ_ASSERT(!aCache->GetWrapper(), |
1175 | 0 | "You should probably not be using Wrap() directly; use " |
1176 | 0 | "GetOrCreateDOMReflector instead"); |
1177 | 0 |
|
1178 | 0 | MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache), |
1179 | 0 | "nsISupports must be on our primary inheritance chain"); |
1180 | 0 |
|
1181 | 0 | JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject())); |
1182 | 0 | if (!global) { |
1183 | 0 | return false; |
1184 | 0 | } |
1185 | 0 | MOZ_ASSERT(JS_IsGlobalObject(global)); |
1186 | 0 | MOZ_ASSERT(JS::ObjectIsNotGray(global)); |
1187 | 0 |
|
1188 | 0 | // That might have ended up wrapping us already, due to the wonders |
1189 | 0 | // of XBL. Check for that, and bail out as needed. |
1190 | 0 | aReflector.set(aCache->GetWrapper()); |
1191 | 0 | if (aReflector) { |
1192 | | #ifdef DEBUG |
1193 | | AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto); |
1194 | | #endif // DEBUG |
1195 | | return true; |
1196 | 0 | } |
1197 | 0 |
|
1198 | 0 | JSAutoRealm ar(aCx, global); |
1199 | 0 | JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx); |
1200 | 0 | if (!canonicalProto) { |
1201 | 0 | return false; |
1202 | 0 | } |
1203 | 0 | JS::Rooted<JSObject*> proto(aCx); |
1204 | 0 | if (aGivenProto) { |
1205 | 0 | proto = aGivenProto; |
1206 | 0 | // Unfortunately, while aGivenProto was in the compartment of aCx |
1207 | 0 | // coming in, we changed compartments to that of "parent" so may need |
1208 | 0 | // to wrap the proto here. |
1209 | 0 | if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) { |
1210 | 0 | if (!JS_WrapObject(aCx, &proto)) { |
1211 | 0 | return false; |
1212 | 0 | } |
1213 | 0 | } |
1214 | 0 | } else { |
1215 | 0 | proto = canonicalProto; |
1216 | 0 | } |
1217 | 0 |
|
1218 | 0 | BindingJSObjectCreator<mozilla::dom::HTMLFrameElement> creator(aCx); |
1219 | 0 | creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector); |
1220 | 0 | if (!aReflector) { |
1221 | 0 | return false; |
1222 | 0 | } |
1223 | 0 | |
1224 | 0 | aCache->SetWrapper(aReflector); |
1225 | 0 | creator.InitializationSucceeded(); |
1226 | 0 |
|
1227 | 0 | MOZ_ASSERT(aCache->GetWrapperPreserveColor() && |
1228 | 0 | aCache->GetWrapperPreserveColor() == aReflector); |
1229 | 0 | // If proto != canonicalProto, we have to preserve our wrapper; |
1230 | 0 | // otherwise we won't be able to properly recreate it later, since |
1231 | 0 | // we won't know what proto to use. Note that we don't check |
1232 | 0 | // aGivenProto here, since it's entirely possible (and even |
1233 | 0 | // somewhat common) to have a non-null aGivenProto which is the |
1234 | 0 | // same as canonicalProto. |
1235 | 0 | if (proto != canonicalProto) { |
1236 | 0 | PreserveWrapper(aObject); |
1237 | 0 | } |
1238 | 0 |
|
1239 | 0 | return true; |
1240 | 0 | } |
1241 | | |
1242 | | const NativePropertyHooks sNativePropertyHooks[] = { { |
1243 | | nullptr, |
1244 | | nullptr, |
1245 | | nullptr, |
1246 | | { sNativeProperties.Upcast(), sChromeOnlyNativeProperties.Upcast() }, |
1247 | | prototypes::id::HTMLFrameElement, |
1248 | | constructors::id::HTMLFrameElement, |
1249 | | HTMLElement_Binding::sNativePropertyHooks, |
1250 | | &DefaultXrayExpandoObjectClass |
1251 | | } }; |
1252 | | |
1253 | | void |
1254 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal) |
1255 | 0 | { |
1256 | 0 | JS::Handle<JSObject*> parentProto(HTMLElement_Binding::GetProtoObjectHandle(aCx)); |
1257 | 0 | if (!parentProto) { |
1258 | 0 | return; |
1259 | 0 | } |
1260 | 0 | |
1261 | 0 | JS::Handle<JSObject*> constructorProto(HTMLElement_Binding::GetConstructorObjectHandle(aCx)); |
1262 | 0 | if (!constructorProto) { |
1263 | 0 | return; |
1264 | 0 | } |
1265 | 0 | |
1266 | 0 | static bool sIdsInited = false; |
1267 | 0 | if (!sIdsInited && NS_IsMainThread()) { |
1268 | 0 | if (!InitIds(aCx, sNativeProperties.Upcast())) { |
1269 | 0 | return; |
1270 | 0 | } |
1271 | 0 | if (!InitIds(aCx, sChromeOnlyNativeProperties.Upcast())) { |
1272 | 0 | return; |
1273 | 0 | } |
1274 | 0 | sIdsInited = true; |
1275 | 0 | } |
1276 | 0 |
|
1277 | 0 | JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::HTMLFrameElement); |
1278 | 0 | JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::HTMLFrameElement); |
1279 | 0 | dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, |
1280 | 0 | &sPrototypeClass.mBase, protoCache, |
1281 | 0 | nullptr, |
1282 | 0 | constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr, |
1283 | 0 | interfaceCache, |
1284 | 0 | sNativeProperties.Upcast(), |
1285 | 0 | sChromeOnlyNativeProperties.Upcast(), |
1286 | 0 | "HTMLFrameElement", aDefineOnGlobal, |
1287 | 0 | nullptr, |
1288 | 0 | false); |
1289 | 0 | } |
1290 | | |
1291 | | JSObject* |
1292 | | GetConstructorObject(JSContext* aCx) |
1293 | 0 | { |
1294 | 0 | return GetConstructorObjectHandle(aCx); |
1295 | 0 | } |
1296 | | |
1297 | | } // namespace HTMLFrameElement_Binding |
1298 | | |
1299 | | |
1300 | | |
1301 | | } // namespace dom |
1302 | | } // namespace mozilla |