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 "JSCharacterData.h" |
23 | |
24 | #include "CustomElementReactionQueue.h" |
25 | #include "JSDOMAttribute.h" |
26 | #include "JSDOMBinding.h" |
27 | #include "JSDOMConstructorNotConstructable.h" |
28 | #include "JSDOMConvertInterface.h" |
29 | #include "JSDOMConvertNullable.h" |
30 | #include "JSDOMConvertNumbers.h" |
31 | #include "JSDOMConvertStrings.h" |
32 | #include "JSDOMConvertUnion.h" |
33 | #include "JSDOMConvertVariadic.h" |
34 | #include "JSDOMExceptionHandling.h" |
35 | #include "JSDOMGlobalObject.h" |
36 | #include "JSDOMOperation.h" |
37 | #include "JSDOMWrapperCache.h" |
38 | #include "JSElement.h" |
39 | #include "ScriptExecutionContext.h" |
40 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
41 | #include <JavaScriptCore/JSCInlines.h> |
42 | #include <JavaScriptCore/ObjectConstructor.h> |
43 | #include <wtf/GetPtr.h> |
44 | #include <wtf/PointerPreparations.h> |
45 | #include <wtf/URL.h> |
46 | #include <wtf/Variant.h> |
47 | |
48 | |
49 | namespace WebCore { |
50 | using namespace JSC; |
51 | |
52 | // Functions |
53 | |
54 | JSC::EncodedJSValue JSC_HOST_CALL jsCharacterDataPrototypeFunctionSubstringData(JSC::ExecState*); |
55 | JSC::EncodedJSValue JSC_HOST_CALL jsCharacterDataPrototypeFunctionAppendData(JSC::ExecState*); |
56 | JSC::EncodedJSValue JSC_HOST_CALL jsCharacterDataPrototypeFunctionInsertData(JSC::ExecState*); |
57 | JSC::EncodedJSValue JSC_HOST_CALL jsCharacterDataPrototypeFunctionDeleteData(JSC::ExecState*); |
58 | JSC::EncodedJSValue JSC_HOST_CALL jsCharacterDataPrototypeFunctionReplaceData(JSC::ExecState*); |
59 | JSC::EncodedJSValue JSC_HOST_CALL jsCharacterDataPrototypeFunctionBefore(JSC::ExecState*); |
60 | JSC::EncodedJSValue JSC_HOST_CALL jsCharacterDataPrototypeFunctionAfter(JSC::ExecState*); |
61 | JSC::EncodedJSValue JSC_HOST_CALL jsCharacterDataPrototypeFunctionReplaceWith(JSC::ExecState*); |
62 | JSC::EncodedJSValue JSC_HOST_CALL jsCharacterDataPrototypeFunctionRemove(JSC::ExecState*); |
63 | |
64 | // Attributes |
65 | |
66 | JSC::EncodedJSValue jsCharacterDataConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
67 | bool setJSCharacterDataConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
68 | JSC::EncodedJSValue jsCharacterDataData(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
69 | bool setJSCharacterDataData(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
70 | JSC::EncodedJSValue jsCharacterDataLength(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
71 | JSC::EncodedJSValue jsCharacterDataPreviousElementSibling(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
72 | JSC::EncodedJSValue jsCharacterDataNextElementSibling(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
73 | |
74 | class JSCharacterDataPrototype : public JSC::JSNonFinalObject { |
75 | public: |
76 | using Base = JSC::JSNonFinalObject; |
77 | static JSCharacterDataPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
78 | { |
79 | JSCharacterDataPrototype* ptr = new (NotNull, JSC::allocateCell<JSCharacterDataPrototype>(vm.heap)) JSCharacterDataPrototype(vm, globalObject, structure); |
80 | ptr->finishCreation(vm); |
81 | return ptr; |
82 | } |
83 | |
84 | DECLARE_INFO; |
85 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
86 | { |
87 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
88 | } |
89 | |
90 | private: |
91 | JSCharacterDataPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
92 | : JSC::JSNonFinalObject(vm, structure) |
93 | { |
94 | } |
95 | |
96 | void finishCreation(JSC::VM&); |
97 | }; |
98 | |
99 | using JSCharacterDataConstructor = JSDOMConstructorNotConstructable<JSCharacterData>; |
100 | |
101 | template<> JSValue JSCharacterDataConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
102 | { |
103 | return JSNode::getConstructor(vm, &globalObject); |
104 | } |
105 | |
106 | template<> void JSCharacterDataConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
107 | { |
108 | putDirect(vm, vm.propertyNames->prototype, JSCharacterData::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
109 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("CharacterData"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
110 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
111 | } |
112 | |
113 | template<> const ClassInfo JSCharacterDataConstructor::s_info = { "CharacterData" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCharacterDataConstructor) }; |
114 | |
115 | /* Hash table for prototype */ |
116 | |
117 | static const HashTableValue JSCharacterDataPrototypeTableValues[] = |
118 | { |
119 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCharacterDataConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSCharacterDataConstructor) } }, |
120 | { "data" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCharacterDataData), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSCharacterDataData) } }, |
121 | { "length" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCharacterDataLength), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
122 | { "previousElementSibling" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCharacterDataPreviousElementSibling), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
123 | { "nextElementSibling" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCharacterDataNextElementSibling), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
124 | { "substringData" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsCharacterDataPrototypeFunctionSubstringData), (intptr_t) (2) } }, |
125 | { "appendData" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsCharacterDataPrototypeFunctionAppendData), (intptr_t) (1) } }, |
126 | { "insertData" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsCharacterDataPrototypeFunctionInsertData), (intptr_t) (2) } }, |
127 | { "deleteData" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsCharacterDataPrototypeFunctionDeleteData), (intptr_t) (2) } }, |
128 | { "replaceData" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsCharacterDataPrototypeFunctionReplaceData), (intptr_t) (3) } }, |
129 | { "before" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsCharacterDataPrototypeFunctionBefore), (intptr_t) (0) } }, |
130 | { "after" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsCharacterDataPrototypeFunctionAfter), (intptr_t) (0) } }, |
131 | { "replaceWith" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsCharacterDataPrototypeFunctionReplaceWith), (intptr_t) (0) } }, |
132 | { "remove" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsCharacterDataPrototypeFunctionRemove), (intptr_t) (0) } }, |
133 | }; |
134 | |
135 | const ClassInfo JSCharacterDataPrototype::s_info = { "CharacterDataPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCharacterDataPrototype) }; |
136 | |
137 | void JSCharacterDataPrototype::finishCreation(VM& vm) |
138 | { |
139 | Base::finishCreation(vm); |
140 | reifyStaticProperties(vm, JSCharacterData::info(), JSCharacterDataPrototypeTableValues, *this); |
141 | JSObject& unscopables = *constructEmptyObject(globalObject()->globalExec(), globalObject()->nullPrototypeObjectStructure()); |
142 | unscopables.putDirect(vm, Identifier::fromString(&vm, "before" ), jsBoolean(true)); |
143 | unscopables.putDirect(vm, Identifier::fromString(&vm, "after" ), jsBoolean(true)); |
144 | unscopables.putDirect(vm, Identifier::fromString(&vm, "replaceWith" ), jsBoolean(true)); |
145 | unscopables.putDirect(vm, Identifier::fromString(&vm, "remove" ), jsBoolean(true)); |
146 | putDirectWithoutTransition(vm, vm.propertyNames->unscopablesSymbol, &unscopables, JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::ReadOnly); |
147 | } |
148 | |
149 | const ClassInfo JSCharacterData::s_info = { "CharacterData" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCharacterData) }; |
150 | |
151 | JSCharacterData::JSCharacterData(Structure* structure, JSDOMGlobalObject& globalObject, Ref<CharacterData>&& impl) |
152 | : JSNode(structure, globalObject, WTFMove(impl)) |
153 | { |
154 | } |
155 | |
156 | void JSCharacterData::finishCreation(VM& vm) |
157 | { |
158 | Base::finishCreation(vm); |
159 | ASSERT(inherits(vm, info())); |
160 | |
161 | } |
162 | |
163 | JSObject* JSCharacterData::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
164 | { |
165 | return JSCharacterDataPrototype::create(vm, &globalObject, JSCharacterDataPrototype::createStructure(vm, &globalObject, JSNode::prototype(vm, globalObject))); |
166 | } |
167 | |
168 | JSObject* JSCharacterData::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
169 | { |
170 | return getDOMPrototype<JSCharacterData>(vm, globalObject); |
171 | } |
172 | |
173 | JSValue JSCharacterData::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
174 | { |
175 | return getDOMConstructor<JSCharacterDataConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
176 | } |
177 | |
178 | template<> inline JSCharacterData* IDLAttribute<JSCharacterData>::cast(ExecState& state, EncodedJSValue thisValue) |
179 | { |
180 | return jsDynamicCast<JSCharacterData*>(state.vm(), JSValue::decode(thisValue)); |
181 | } |
182 | |
183 | template<> inline JSCharacterData* IDLOperation<JSCharacterData>::cast(ExecState& state) |
184 | { |
185 | return jsDynamicCast<JSCharacterData*>(state.vm(), state.thisValue()); |
186 | } |
187 | |
188 | EncodedJSValue jsCharacterDataConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
189 | { |
190 | VM& vm = state->vm(); |
191 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
192 | auto* prototype = jsDynamicCast<JSCharacterDataPrototype*>(vm, JSValue::decode(thisValue)); |
193 | if (UNLIKELY(!prototype)) |
194 | return throwVMTypeError(state, throwScope); |
195 | return JSValue::encode(JSCharacterData::getConstructor(state->vm(), prototype->globalObject())); |
196 | } |
197 | |
198 | bool setJSCharacterDataConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
199 | { |
200 | VM& vm = state->vm(); |
201 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
202 | auto* prototype = jsDynamicCast<JSCharacterDataPrototype*>(vm, JSValue::decode(thisValue)); |
203 | if (UNLIKELY(!prototype)) { |
204 | throwVMTypeError(state, throwScope); |
205 | return false; |
206 | } |
207 | // Shadowing a built-in constructor |
208 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
209 | } |
210 | |
211 | static inline JSValue jsCharacterDataDataGetter(ExecState& state, JSCharacterData& thisObject, ThrowScope& throwScope) |
212 | { |
213 | UNUSED_PARAM(throwScope); |
214 | UNUSED_PARAM(state); |
215 | auto& impl = thisObject.wrapped(); |
216 | JSValue result = toJS<IDLTreatNullAsEmptyAdaptor<IDLDOMString>>(state, throwScope, impl.data()); |
217 | return result; |
218 | } |
219 | |
220 | EncodedJSValue jsCharacterDataData(ExecState* state, EncodedJSValue thisValue, PropertyName) |
221 | { |
222 | return IDLAttribute<JSCharacterData>::get<jsCharacterDataDataGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "data" ); |
223 | } |
224 | |
225 | static inline bool setJSCharacterDataDataSetter(ExecState& state, JSCharacterData& thisObject, JSValue value, ThrowScope& throwScope) |
226 | { |
227 | UNUSED_PARAM(throwScope); |
228 | auto& impl = thisObject.wrapped(); |
229 | auto nativeValue = convert<IDLTreatNullAsEmptyAdaptor<IDLDOMString>>(state, value); |
230 | RETURN_IF_EXCEPTION(throwScope, false); |
231 | AttributeSetter::call(state, throwScope, [&] { |
232 | return impl.setData(WTFMove(nativeValue)); |
233 | }); |
234 | return true; |
235 | } |
236 | |
237 | bool setJSCharacterDataData(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
238 | { |
239 | return IDLAttribute<JSCharacterData>::set<setJSCharacterDataDataSetter>(*state, thisValue, encodedValue, "data" ); |
240 | } |
241 | |
242 | static inline JSValue jsCharacterDataLengthGetter(ExecState& state, JSCharacterData& thisObject, ThrowScope& throwScope) |
243 | { |
244 | UNUSED_PARAM(throwScope); |
245 | UNUSED_PARAM(state); |
246 | auto& impl = thisObject.wrapped(); |
247 | JSValue result = toJS<IDLUnsignedLong>(state, throwScope, impl.length()); |
248 | return result; |
249 | } |
250 | |
251 | EncodedJSValue jsCharacterDataLength(ExecState* state, EncodedJSValue thisValue, PropertyName) |
252 | { |
253 | return IDLAttribute<JSCharacterData>::get<jsCharacterDataLengthGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "length" ); |
254 | } |
255 | |
256 | static inline JSValue jsCharacterDataPreviousElementSiblingGetter(ExecState& state, JSCharacterData& thisObject, ThrowScope& throwScope) |
257 | { |
258 | UNUSED_PARAM(throwScope); |
259 | UNUSED_PARAM(state); |
260 | auto& impl = thisObject.wrapped(); |
261 | JSValue result = toJS<IDLNullable<IDLInterface<Element>>>(state, *thisObject.globalObject(), throwScope, impl.previousElementSibling()); |
262 | return result; |
263 | } |
264 | |
265 | EncodedJSValue jsCharacterDataPreviousElementSibling(ExecState* state, EncodedJSValue thisValue, PropertyName) |
266 | { |
267 | return IDLAttribute<JSCharacterData>::get<jsCharacterDataPreviousElementSiblingGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "previousElementSibling" ); |
268 | } |
269 | |
270 | static inline JSValue jsCharacterDataNextElementSiblingGetter(ExecState& state, JSCharacterData& thisObject, ThrowScope& throwScope) |
271 | { |
272 | UNUSED_PARAM(throwScope); |
273 | UNUSED_PARAM(state); |
274 | auto& impl = thisObject.wrapped(); |
275 | JSValue result = toJS<IDLNullable<IDLInterface<Element>>>(state, *thisObject.globalObject(), throwScope, impl.nextElementSibling()); |
276 | return result; |
277 | } |
278 | |
279 | EncodedJSValue jsCharacterDataNextElementSibling(ExecState* state, EncodedJSValue thisValue, PropertyName) |
280 | { |
281 | return IDLAttribute<JSCharacterData>::get<jsCharacterDataNextElementSiblingGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "nextElementSibling" ); |
282 | } |
283 | |
284 | static inline JSC::EncodedJSValue jsCharacterDataPrototypeFunctionSubstringDataBody(JSC::ExecState* state, typename IDLOperation<JSCharacterData>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
285 | { |
286 | UNUSED_PARAM(state); |
287 | UNUSED_PARAM(throwScope); |
288 | auto& impl = castedThis->wrapped(); |
289 | if (UNLIKELY(state->argumentCount() < 2)) |
290 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
291 | auto offset = convert<IDLUnsignedLong>(*state, state->uncheckedArgument(0)); |
292 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
293 | auto count = convert<IDLUnsignedLong>(*state, state->uncheckedArgument(1)); |
294 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
295 | return JSValue::encode(toJS<IDLDOMString>(*state, throwScope, impl.substringData(WTFMove(offset), WTFMove(count)))); |
296 | } |
297 | |
298 | EncodedJSValue JSC_HOST_CALL jsCharacterDataPrototypeFunctionSubstringData(ExecState* state) |
299 | { |
300 | return IDLOperation<JSCharacterData>::call<jsCharacterDataPrototypeFunctionSubstringDataBody>(*state, "substringData" ); |
301 | } |
302 | |
303 | static inline JSC::EncodedJSValue jsCharacterDataPrototypeFunctionAppendDataBody(JSC::ExecState* state, typename IDLOperation<JSCharacterData>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
304 | { |
305 | UNUSED_PARAM(state); |
306 | UNUSED_PARAM(throwScope); |
307 | auto& impl = castedThis->wrapped(); |
308 | if (UNLIKELY(state->argumentCount() < 1)) |
309 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
310 | auto data = convert<IDLDOMString>(*state, state->uncheckedArgument(0)); |
311 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
312 | impl.appendData(WTFMove(data)); |
313 | return JSValue::encode(jsUndefined()); |
314 | } |
315 | |
316 | EncodedJSValue JSC_HOST_CALL jsCharacterDataPrototypeFunctionAppendData(ExecState* state) |
317 | { |
318 | return IDLOperation<JSCharacterData>::call<jsCharacterDataPrototypeFunctionAppendDataBody>(*state, "appendData" ); |
319 | } |
320 | |
321 | static inline JSC::EncodedJSValue jsCharacterDataPrototypeFunctionInsertDataBody(JSC::ExecState* state, typename IDLOperation<JSCharacterData>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
322 | { |
323 | UNUSED_PARAM(state); |
324 | UNUSED_PARAM(throwScope); |
325 | auto& impl = castedThis->wrapped(); |
326 | if (UNLIKELY(state->argumentCount() < 2)) |
327 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
328 | auto offset = convert<IDLUnsignedLong>(*state, state->uncheckedArgument(0)); |
329 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
330 | auto data = convert<IDLDOMString>(*state, state->uncheckedArgument(1)); |
331 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
332 | propagateException(*state, throwScope, impl.insertData(WTFMove(offset), WTFMove(data))); |
333 | return JSValue::encode(jsUndefined()); |
334 | } |
335 | |
336 | EncodedJSValue JSC_HOST_CALL jsCharacterDataPrototypeFunctionInsertData(ExecState* state) |
337 | { |
338 | return IDLOperation<JSCharacterData>::call<jsCharacterDataPrototypeFunctionInsertDataBody>(*state, "insertData" ); |
339 | } |
340 | |
341 | static inline JSC::EncodedJSValue jsCharacterDataPrototypeFunctionDeleteDataBody(JSC::ExecState* state, typename IDLOperation<JSCharacterData>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
342 | { |
343 | UNUSED_PARAM(state); |
344 | UNUSED_PARAM(throwScope); |
345 | auto& impl = castedThis->wrapped(); |
346 | if (UNLIKELY(state->argumentCount() < 2)) |
347 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
348 | auto offset = convert<IDLUnsignedLong>(*state, state->uncheckedArgument(0)); |
349 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
350 | auto count = convert<IDLUnsignedLong>(*state, state->uncheckedArgument(1)); |
351 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
352 | propagateException(*state, throwScope, impl.deleteData(WTFMove(offset), WTFMove(count))); |
353 | return JSValue::encode(jsUndefined()); |
354 | } |
355 | |
356 | EncodedJSValue JSC_HOST_CALL jsCharacterDataPrototypeFunctionDeleteData(ExecState* state) |
357 | { |
358 | return IDLOperation<JSCharacterData>::call<jsCharacterDataPrototypeFunctionDeleteDataBody>(*state, "deleteData" ); |
359 | } |
360 | |
361 | static inline JSC::EncodedJSValue jsCharacterDataPrototypeFunctionReplaceDataBody(JSC::ExecState* state, typename IDLOperation<JSCharacterData>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
362 | { |
363 | UNUSED_PARAM(state); |
364 | UNUSED_PARAM(throwScope); |
365 | auto& impl = castedThis->wrapped(); |
366 | if (UNLIKELY(state->argumentCount() < 3)) |
367 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
368 | auto offset = convert<IDLUnsignedLong>(*state, state->uncheckedArgument(0)); |
369 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
370 | auto count = convert<IDLUnsignedLong>(*state, state->uncheckedArgument(1)); |
371 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
372 | auto data = convert<IDLDOMString>(*state, state->uncheckedArgument(2)); |
373 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
374 | propagateException(*state, throwScope, impl.replaceData(WTFMove(offset), WTFMove(count), WTFMove(data))); |
375 | return JSValue::encode(jsUndefined()); |
376 | } |
377 | |
378 | EncodedJSValue JSC_HOST_CALL jsCharacterDataPrototypeFunctionReplaceData(ExecState* state) |
379 | { |
380 | return IDLOperation<JSCharacterData>::call<jsCharacterDataPrototypeFunctionReplaceDataBody>(*state, "replaceData" ); |
381 | } |
382 | |
383 | static inline JSC::EncodedJSValue jsCharacterDataPrototypeFunctionBeforeBody(JSC::ExecState* state, typename IDLOperation<JSCharacterData>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
384 | { |
385 | UNUSED_PARAM(state); |
386 | UNUSED_PARAM(throwScope); |
387 | CustomElementReactionStack customElementReactionStack(*state); |
388 | auto& impl = castedThis->wrapped(); |
389 | auto nodes = convertVariadicArguments<IDLUnion<IDLInterface<Node>, IDLDOMString>>(*state, 0); |
390 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
391 | propagateException(*state, throwScope, impl.before(WTFMove(nodes))); |
392 | return JSValue::encode(jsUndefined()); |
393 | } |
394 | |
395 | EncodedJSValue JSC_HOST_CALL jsCharacterDataPrototypeFunctionBefore(ExecState* state) |
396 | { |
397 | return IDLOperation<JSCharacterData>::call<jsCharacterDataPrototypeFunctionBeforeBody>(*state, "before" ); |
398 | } |
399 | |
400 | static inline JSC::EncodedJSValue jsCharacterDataPrototypeFunctionAfterBody(JSC::ExecState* state, typename IDLOperation<JSCharacterData>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
401 | { |
402 | UNUSED_PARAM(state); |
403 | UNUSED_PARAM(throwScope); |
404 | CustomElementReactionStack customElementReactionStack(*state); |
405 | auto& impl = castedThis->wrapped(); |
406 | auto nodes = convertVariadicArguments<IDLUnion<IDLInterface<Node>, IDLDOMString>>(*state, 0); |
407 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
408 | propagateException(*state, throwScope, impl.after(WTFMove(nodes))); |
409 | return JSValue::encode(jsUndefined()); |
410 | } |
411 | |
412 | EncodedJSValue JSC_HOST_CALL jsCharacterDataPrototypeFunctionAfter(ExecState* state) |
413 | { |
414 | return IDLOperation<JSCharacterData>::call<jsCharacterDataPrototypeFunctionAfterBody>(*state, "after" ); |
415 | } |
416 | |
417 | static inline JSC::EncodedJSValue jsCharacterDataPrototypeFunctionReplaceWithBody(JSC::ExecState* state, typename IDLOperation<JSCharacterData>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
418 | { |
419 | UNUSED_PARAM(state); |
420 | UNUSED_PARAM(throwScope); |
421 | CustomElementReactionStack customElementReactionStack(*state); |
422 | auto& impl = castedThis->wrapped(); |
423 | auto nodes = convertVariadicArguments<IDLUnion<IDLInterface<Node>, IDLDOMString>>(*state, 0); |
424 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
425 | propagateException(*state, throwScope, impl.replaceWith(WTFMove(nodes))); |
426 | return JSValue::encode(jsUndefined()); |
427 | } |
428 | |
429 | EncodedJSValue JSC_HOST_CALL jsCharacterDataPrototypeFunctionReplaceWith(ExecState* state) |
430 | { |
431 | return IDLOperation<JSCharacterData>::call<jsCharacterDataPrototypeFunctionReplaceWithBody>(*state, "replaceWith" ); |
432 | } |
433 | |
434 | static inline JSC::EncodedJSValue jsCharacterDataPrototypeFunctionRemoveBody(JSC::ExecState* state, typename IDLOperation<JSCharacterData>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
435 | { |
436 | UNUSED_PARAM(state); |
437 | UNUSED_PARAM(throwScope); |
438 | CustomElementReactionStack customElementReactionStack(*state); |
439 | auto& impl = castedThis->wrapped(); |
440 | propagateException(*state, throwScope, impl.remove()); |
441 | return JSValue::encode(jsUndefined()); |
442 | } |
443 | |
444 | EncodedJSValue JSC_HOST_CALL jsCharacterDataPrototypeFunctionRemove(ExecState* state) |
445 | { |
446 | return IDLOperation<JSCharacterData>::call<jsCharacterDataPrototypeFunctionRemoveBody>(*state, "remove" ); |
447 | } |
448 | |
449 | void JSCharacterData::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
450 | { |
451 | auto* thisObject = jsCast<JSCharacterData*>(cell); |
452 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
453 | if (thisObject->scriptExecutionContext()) |
454 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
455 | Base::heapSnapshot(cell, builder); |
456 | } |
457 | |
458 | |
459 | } |
460 | |