1 | /* |
2 | This file is part of the WebKit open source project. |
3 | This file has been generated by generate-bindings.pl. DO NOT MODIFY! |
4 | |
5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. |
9 | |
10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. |
14 | |
15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 | Boston, MA 02110-1301, USA. |
19 | */ |
20 | |
21 | #include "config.h" |
22 | #include "JSShadowRoot.h" |
23 | |
24 | #include "CustomElementReactionQueue.h" |
25 | #include "JSDOMAttribute.h" |
26 | #include "JSDOMBinding.h" |
27 | #include "JSDOMConstructorNotConstructable.h" |
28 | #include "JSDOMConvertEnumeration.h" |
29 | #include "JSDOMConvertInterface.h" |
30 | #include "JSDOMConvertNullable.h" |
31 | #include "JSDOMConvertNumbers.h" |
32 | #include "JSDOMConvertSequences.h" |
33 | #include "JSDOMConvertStrings.h" |
34 | #include "JSDOMExceptionHandling.h" |
35 | #include "JSDOMGlobalObject.h" |
36 | #include "JSDOMOperation.h" |
37 | #include "JSDOMWrapperCache.h" |
38 | #include "JSElement.h" |
39 | #include "JSShadowRootMode.h" |
40 | #include "JSStyleSheetList.h" |
41 | #include "ScriptExecutionContext.h" |
42 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
43 | #include <JavaScriptCore/JSArray.h> |
44 | #include <JavaScriptCore/JSCInlines.h> |
45 | #include <wtf/GetPtr.h> |
46 | #include <wtf/PointerPreparations.h> |
47 | #include <wtf/URL.h> |
48 | |
49 | |
50 | namespace WebCore { |
51 | using namespace JSC; |
52 | |
53 | // Functions |
54 | |
55 | JSC::EncodedJSValue JSC_HOST_CALL jsShadowRootPrototypeFunctionElementFromPoint(JSC::ExecState*); |
56 | JSC::EncodedJSValue JSC_HOST_CALL jsShadowRootPrototypeFunctionElementsFromPoint(JSC::ExecState*); |
57 | |
58 | // Attributes |
59 | |
60 | JSC::EncodedJSValue jsShadowRootConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
61 | bool setJSShadowRootConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
62 | JSC::EncodedJSValue jsShadowRootMode(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
63 | JSC::EncodedJSValue jsShadowRootHost(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
64 | JSC::EncodedJSValue jsShadowRootInnerHTML(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
65 | bool setJSShadowRootInnerHTML(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
66 | JSC::EncodedJSValue jsShadowRootActiveElement(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
67 | JSC::EncodedJSValue jsShadowRootStyleSheets(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
68 | #if ENABLE(POINTER_LOCK) |
69 | JSC::EncodedJSValue jsShadowRootPointerLockElement(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
70 | #endif |
71 | |
72 | class JSShadowRootPrototype : public JSC::JSNonFinalObject { |
73 | public: |
74 | using Base = JSC::JSNonFinalObject; |
75 | static JSShadowRootPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
76 | { |
77 | JSShadowRootPrototype* ptr = new (NotNull, JSC::allocateCell<JSShadowRootPrototype>(vm.heap)) JSShadowRootPrototype(vm, globalObject, structure); |
78 | ptr->finishCreation(vm); |
79 | return ptr; |
80 | } |
81 | |
82 | DECLARE_INFO; |
83 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
84 | { |
85 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
86 | } |
87 | |
88 | private: |
89 | JSShadowRootPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
90 | : JSC::JSNonFinalObject(vm, structure) |
91 | { |
92 | } |
93 | |
94 | void finishCreation(JSC::VM&); |
95 | }; |
96 | |
97 | using JSShadowRootConstructor = JSDOMConstructorNotConstructable<JSShadowRoot>; |
98 | |
99 | template<> JSValue JSShadowRootConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
100 | { |
101 | return JSDocumentFragment::getConstructor(vm, &globalObject); |
102 | } |
103 | |
104 | template<> void JSShadowRootConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
105 | { |
106 | putDirect(vm, vm.propertyNames->prototype, JSShadowRoot::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
107 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("ShadowRoot"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
108 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
109 | } |
110 | |
111 | template<> const ClassInfo JSShadowRootConstructor::s_info = { "ShadowRoot" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSShadowRootConstructor) }; |
112 | |
113 | /* Hash table for prototype */ |
114 | |
115 | static const HashTableValue JSShadowRootPrototypeTableValues[] = |
116 | { |
117 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsShadowRootConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSShadowRootConstructor) } }, |
118 | { "mode" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsShadowRootMode), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
119 | { "host" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsShadowRootHost), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
120 | { "innerHTML" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsShadowRootInnerHTML), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSShadowRootInnerHTML) } }, |
121 | { "activeElement" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsShadowRootActiveElement), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
122 | { "styleSheets" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsShadowRootStyleSheets), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
123 | #if ENABLE(POINTER_LOCK) |
124 | { "pointerLockElement" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsShadowRootPointerLockElement), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
125 | #else |
126 | { 0, 0, NoIntrinsic, { 0, 0 } }, |
127 | #endif |
128 | { "elementFromPoint" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsShadowRootPrototypeFunctionElementFromPoint), (intptr_t) (2) } }, |
129 | { "elementsFromPoint" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsShadowRootPrototypeFunctionElementsFromPoint), (intptr_t) (2) } }, |
130 | }; |
131 | |
132 | const ClassInfo JSShadowRootPrototype::s_info = { "ShadowRootPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSShadowRootPrototype) }; |
133 | |
134 | void JSShadowRootPrototype::finishCreation(VM& vm) |
135 | { |
136 | Base::finishCreation(vm); |
137 | reifyStaticProperties(vm, JSShadowRoot::info(), JSShadowRootPrototypeTableValues, *this); |
138 | } |
139 | |
140 | const ClassInfo JSShadowRoot::s_info = { "ShadowRoot" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSShadowRoot) }; |
141 | |
142 | JSShadowRoot::JSShadowRoot(Structure* structure, JSDOMGlobalObject& globalObject, Ref<ShadowRoot>&& impl) |
143 | : JSDocumentFragment(structure, globalObject, WTFMove(impl)) |
144 | { |
145 | } |
146 | |
147 | void JSShadowRoot::finishCreation(VM& vm) |
148 | { |
149 | Base::finishCreation(vm); |
150 | ASSERT(inherits(vm, info())); |
151 | |
152 | } |
153 | |
154 | JSObject* JSShadowRoot::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
155 | { |
156 | return JSShadowRootPrototype::create(vm, &globalObject, JSShadowRootPrototype::createStructure(vm, &globalObject, JSDocumentFragment::prototype(vm, globalObject))); |
157 | } |
158 | |
159 | JSObject* JSShadowRoot::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
160 | { |
161 | return getDOMPrototype<JSShadowRoot>(vm, globalObject); |
162 | } |
163 | |
164 | JSValue JSShadowRoot::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
165 | { |
166 | return getDOMConstructor<JSShadowRootConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
167 | } |
168 | |
169 | template<> inline JSShadowRoot* IDLAttribute<JSShadowRoot>::cast(ExecState& state, EncodedJSValue thisValue) |
170 | { |
171 | return jsDynamicCast<JSShadowRoot*>(state.vm(), JSValue::decode(thisValue)); |
172 | } |
173 | |
174 | template<> inline JSShadowRoot* IDLOperation<JSShadowRoot>::cast(ExecState& state) |
175 | { |
176 | return jsDynamicCast<JSShadowRoot*>(state.vm(), state.thisValue()); |
177 | } |
178 | |
179 | EncodedJSValue jsShadowRootConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
180 | { |
181 | VM& vm = state->vm(); |
182 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
183 | auto* prototype = jsDynamicCast<JSShadowRootPrototype*>(vm, JSValue::decode(thisValue)); |
184 | if (UNLIKELY(!prototype)) |
185 | return throwVMTypeError(state, throwScope); |
186 | return JSValue::encode(JSShadowRoot::getConstructor(state->vm(), prototype->globalObject())); |
187 | } |
188 | |
189 | bool setJSShadowRootConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
190 | { |
191 | VM& vm = state->vm(); |
192 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
193 | auto* prototype = jsDynamicCast<JSShadowRootPrototype*>(vm, JSValue::decode(thisValue)); |
194 | if (UNLIKELY(!prototype)) { |
195 | throwVMTypeError(state, throwScope); |
196 | return false; |
197 | } |
198 | // Shadowing a built-in constructor |
199 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
200 | } |
201 | |
202 | static inline JSValue jsShadowRootModeGetter(ExecState& state, JSShadowRoot& thisObject, ThrowScope& throwScope) |
203 | { |
204 | UNUSED_PARAM(throwScope); |
205 | UNUSED_PARAM(state); |
206 | auto& impl = thisObject.wrapped(); |
207 | JSValue result = toJS<IDLEnumeration<ShadowRootMode>>(state, throwScope, impl.mode()); |
208 | return result; |
209 | } |
210 | |
211 | EncodedJSValue jsShadowRootMode(ExecState* state, EncodedJSValue thisValue, PropertyName) |
212 | { |
213 | return IDLAttribute<JSShadowRoot>::get<jsShadowRootModeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "mode" ); |
214 | } |
215 | |
216 | static inline JSValue jsShadowRootHostGetter(ExecState& state, JSShadowRoot& thisObject, ThrowScope& throwScope) |
217 | { |
218 | UNUSED_PARAM(throwScope); |
219 | UNUSED_PARAM(state); |
220 | auto& impl = thisObject.wrapped(); |
221 | JSValue result = toJS<IDLInterface<Element>>(state, *thisObject.globalObject(), throwScope, impl.host()); |
222 | return result; |
223 | } |
224 | |
225 | EncodedJSValue jsShadowRootHost(ExecState* state, EncodedJSValue thisValue, PropertyName) |
226 | { |
227 | return IDLAttribute<JSShadowRoot>::get<jsShadowRootHostGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "host" ); |
228 | } |
229 | |
230 | static inline JSValue jsShadowRootInnerHTMLGetter(ExecState& state, JSShadowRoot& thisObject, ThrowScope& throwScope) |
231 | { |
232 | UNUSED_PARAM(throwScope); |
233 | UNUSED_PARAM(state); |
234 | auto& impl = thisObject.wrapped(); |
235 | JSValue result = toJS<IDLTreatNullAsEmptyAdaptor<IDLDOMString>>(state, throwScope, impl.innerHTML()); |
236 | return result; |
237 | } |
238 | |
239 | EncodedJSValue jsShadowRootInnerHTML(ExecState* state, EncodedJSValue thisValue, PropertyName) |
240 | { |
241 | return IDLAttribute<JSShadowRoot>::get<jsShadowRootInnerHTMLGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "innerHTML" ); |
242 | } |
243 | |
244 | static inline bool setJSShadowRootInnerHTMLSetter(ExecState& state, JSShadowRoot& thisObject, JSValue value, ThrowScope& throwScope) |
245 | { |
246 | UNUSED_PARAM(throwScope); |
247 | CustomElementReactionStack customElementReactionStack(state); |
248 | auto& impl = thisObject.wrapped(); |
249 | auto nativeValue = convert<IDLTreatNullAsEmptyAdaptor<IDLDOMString>>(state, value); |
250 | RETURN_IF_EXCEPTION(throwScope, false); |
251 | AttributeSetter::call(state, throwScope, [&] { |
252 | return impl.setInnerHTML(WTFMove(nativeValue)); |
253 | }); |
254 | return true; |
255 | } |
256 | |
257 | bool setJSShadowRootInnerHTML(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
258 | { |
259 | return IDLAttribute<JSShadowRoot>::set<setJSShadowRootInnerHTMLSetter>(*state, thisValue, encodedValue, "innerHTML" ); |
260 | } |
261 | |
262 | static inline JSValue jsShadowRootActiveElementGetter(ExecState& state, JSShadowRoot& thisObject, ThrowScope& throwScope) |
263 | { |
264 | UNUSED_PARAM(throwScope); |
265 | UNUSED_PARAM(state); |
266 | auto& impl = thisObject.wrapped(); |
267 | JSValue result = toJS<IDLNullable<IDLInterface<Element>>>(state, *thisObject.globalObject(), throwScope, impl.activeElement()); |
268 | return result; |
269 | } |
270 | |
271 | EncodedJSValue jsShadowRootActiveElement(ExecState* state, EncodedJSValue thisValue, PropertyName) |
272 | { |
273 | return IDLAttribute<JSShadowRoot>::get<jsShadowRootActiveElementGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "activeElement" ); |
274 | } |
275 | |
276 | static inline JSValue jsShadowRootStyleSheetsGetter(ExecState& state, JSShadowRoot& thisObject, ThrowScope& throwScope) |
277 | { |
278 | UNUSED_PARAM(throwScope); |
279 | UNUSED_PARAM(state); |
280 | auto& impl = thisObject.wrapped(); |
281 | JSValue result = toJS<IDLInterface<StyleSheetList>>(state, *thisObject.globalObject(), throwScope, impl.styleSheets()); |
282 | return result; |
283 | } |
284 | |
285 | EncodedJSValue jsShadowRootStyleSheets(ExecState* state, EncodedJSValue thisValue, PropertyName) |
286 | { |
287 | return IDLAttribute<JSShadowRoot>::get<jsShadowRootStyleSheetsGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "styleSheets" ); |
288 | } |
289 | |
290 | #if ENABLE(POINTER_LOCK) |
291 | static inline JSValue jsShadowRootPointerLockElementGetter(ExecState& state, JSShadowRoot& thisObject, ThrowScope& throwScope) |
292 | { |
293 | UNUSED_PARAM(throwScope); |
294 | UNUSED_PARAM(state); |
295 | auto& impl = thisObject.wrapped(); |
296 | JSValue result = toJS<IDLNullable<IDLInterface<Element>>>(state, *thisObject.globalObject(), throwScope, impl.pointerLockElement()); |
297 | return result; |
298 | } |
299 | |
300 | EncodedJSValue jsShadowRootPointerLockElement(ExecState* state, EncodedJSValue thisValue, PropertyName) |
301 | { |
302 | return IDLAttribute<JSShadowRoot>::get<jsShadowRootPointerLockElementGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "pointerLockElement" ); |
303 | } |
304 | |
305 | #endif |
306 | |
307 | static inline JSC::EncodedJSValue jsShadowRootPrototypeFunctionElementFromPointBody(JSC::ExecState* state, typename IDLOperation<JSShadowRoot>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
308 | { |
309 | UNUSED_PARAM(state); |
310 | UNUSED_PARAM(throwScope); |
311 | auto& impl = castedThis->wrapped(); |
312 | if (UNLIKELY(state->argumentCount() < 2)) |
313 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
314 | auto x = convert<IDLDouble>(*state, state->uncheckedArgument(0)); |
315 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
316 | auto y = convert<IDLDouble>(*state, state->uncheckedArgument(1)); |
317 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
318 | return JSValue::encode(toJS<IDLNullable<IDLInterface<Element>>>(*state, *castedThis->globalObject(), impl.elementFromPoint(WTFMove(x), WTFMove(y)))); |
319 | } |
320 | |
321 | EncodedJSValue JSC_HOST_CALL jsShadowRootPrototypeFunctionElementFromPoint(ExecState* state) |
322 | { |
323 | return IDLOperation<JSShadowRoot>::call<jsShadowRootPrototypeFunctionElementFromPointBody>(*state, "elementFromPoint" ); |
324 | } |
325 | |
326 | static inline JSC::EncodedJSValue jsShadowRootPrototypeFunctionElementsFromPointBody(JSC::ExecState* state, typename IDLOperation<JSShadowRoot>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
327 | { |
328 | UNUSED_PARAM(state); |
329 | UNUSED_PARAM(throwScope); |
330 | auto& impl = castedThis->wrapped(); |
331 | if (UNLIKELY(state->argumentCount() < 2)) |
332 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
333 | auto x = convert<IDLDouble>(*state, state->uncheckedArgument(0)); |
334 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
335 | auto y = convert<IDLDouble>(*state, state->uncheckedArgument(1)); |
336 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
337 | return JSValue::encode(toJS<IDLSequence<IDLInterface<Element>>>(*state, *castedThis->globalObject(), impl.elementsFromPoint(WTFMove(x), WTFMove(y)))); |
338 | } |
339 | |
340 | EncodedJSValue JSC_HOST_CALL jsShadowRootPrototypeFunctionElementsFromPoint(ExecState* state) |
341 | { |
342 | return IDLOperation<JSShadowRoot>::call<jsShadowRootPrototypeFunctionElementsFromPointBody>(*state, "elementsFromPoint" ); |
343 | } |
344 | |
345 | void JSShadowRoot::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
346 | { |
347 | auto* thisObject = jsCast<JSShadowRoot*>(cell); |
348 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
349 | if (thisObject->scriptExecutionContext()) |
350 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
351 | Base::heapSnapshot(cell, builder); |
352 | } |
353 | |
354 | #if ENABLE(BINDING_INTEGRITY) |
355 | #if PLATFORM(WIN) |
356 | #pragma warning(disable: 4483) |
357 | extern "C" { extern void (*const __identifier("??_7ShadowRoot@WebCore@@6B@" )[])(); } |
358 | #else |
359 | extern "C" { extern void* _ZTVN7WebCore10ShadowRootE[]; } |
360 | #endif |
361 | #endif |
362 | |
363 | JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<ShadowRoot>&& impl) |
364 | { |
365 | |
366 | #if ENABLE(BINDING_INTEGRITY) |
367 | void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr())); |
368 | #if PLATFORM(WIN) |
369 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(__identifier("??_7ShadowRoot@WebCore@@6B@" )); |
370 | #else |
371 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(&_ZTVN7WebCore10ShadowRootE[2]); |
372 | #endif |
373 | |
374 | // If this fails ShadowRoot does not have a vtable, so you need to add the |
375 | // ImplementationLacksVTable attribute to the interface definition |
376 | static_assert(std::is_polymorphic<ShadowRoot>::value, "ShadowRoot is not polymorphic" ); |
377 | |
378 | // If you hit this assertion you either have a use after free bug, or |
379 | // ShadowRoot has subclasses. If ShadowRoot has subclasses that get passed |
380 | // to toJS() we currently require ShadowRoot you to opt out of binding hardening |
381 | // by adding the SkipVTableValidation attribute to the interface IDL definition |
382 | RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); |
383 | #endif |
384 | return createWrapper<ShadowRoot>(globalObject, WTFMove(impl)); |
385 | } |
386 | |
387 | JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, ShadowRoot& impl) |
388 | { |
389 | return wrap(state, globalObject, impl); |
390 | } |
391 | |
392 | |
393 | } |
394 | |