| 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 "JSSVGPathSegList.h" |
| 23 | |
| 24 | #include "JSDOMAttribute.h" |
| 25 | #include "JSDOMBinding.h" |
| 26 | #include "JSDOMConstructorNotConstructable.h" |
| 27 | #include "JSDOMConvertInterface.h" |
| 28 | #include "JSDOMConvertNumbers.h" |
| 29 | #include "JSDOMExceptionHandling.h" |
| 30 | #include "JSDOMGlobalObject.h" |
| 31 | #include "JSDOMOperation.h" |
| 32 | #include "JSDOMWrapperCache.h" |
| 33 | #include "JSSVGPathSeg.h" |
| 34 | #include "ScriptExecutionContext.h" |
| 35 | #include <JavaScriptCore/FunctionPrototype.h> |
| 36 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
| 37 | #include <JavaScriptCore/JSCInlines.h> |
| 38 | #include <wtf/GetPtr.h> |
| 39 | #include <wtf/PointerPreparations.h> |
| 40 | #include <wtf/URL.h> |
| 41 | |
| 42 | |
| 43 | namespace WebCore { |
| 44 | using namespace JSC; |
| 45 | |
| 46 | // Functions |
| 47 | |
| 48 | JSC::EncodedJSValue JSC_HOST_CALL jsSVGPathSegListPrototypeFunctionClear(JSC::ExecState*); |
| 49 | JSC::EncodedJSValue JSC_HOST_CALL jsSVGPathSegListPrototypeFunctionInitialize(JSC::ExecState*); |
| 50 | JSC::EncodedJSValue JSC_HOST_CALL jsSVGPathSegListPrototypeFunctionGetItem(JSC::ExecState*); |
| 51 | JSC::EncodedJSValue JSC_HOST_CALL jsSVGPathSegListPrototypeFunctionInsertItemBefore(JSC::ExecState*); |
| 52 | JSC::EncodedJSValue JSC_HOST_CALL jsSVGPathSegListPrototypeFunctionReplaceItem(JSC::ExecState*); |
| 53 | JSC::EncodedJSValue JSC_HOST_CALL jsSVGPathSegListPrototypeFunctionRemoveItem(JSC::ExecState*); |
| 54 | JSC::EncodedJSValue JSC_HOST_CALL jsSVGPathSegListPrototypeFunctionAppendItem(JSC::ExecState*); |
| 55 | |
| 56 | // Attributes |
| 57 | |
| 58 | JSC::EncodedJSValue jsSVGPathSegListConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 59 | bool setJSSVGPathSegListConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 60 | JSC::EncodedJSValue jsSVGPathSegListNumberOfItems(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 61 | |
| 62 | class JSSVGPathSegListPrototype : public JSC::JSNonFinalObject { |
| 63 | public: |
| 64 | using Base = JSC::JSNonFinalObject; |
| 65 | static JSSVGPathSegListPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
| 66 | { |
| 67 | JSSVGPathSegListPrototype* ptr = new (NotNull, JSC::allocateCell<JSSVGPathSegListPrototype>(vm.heap)) JSSVGPathSegListPrototype(vm, globalObject, structure); |
| 68 | ptr->finishCreation(vm); |
| 69 | return ptr; |
| 70 | } |
| 71 | |
| 72 | DECLARE_INFO; |
| 73 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
| 74 | { |
| 75 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
| 76 | } |
| 77 | |
| 78 | private: |
| 79 | JSSVGPathSegListPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
| 80 | : JSC::JSNonFinalObject(vm, structure) |
| 81 | { |
| 82 | } |
| 83 | |
| 84 | void finishCreation(JSC::VM&); |
| 85 | }; |
| 86 | |
| 87 | using JSSVGPathSegListConstructor = JSDOMConstructorNotConstructable<JSSVGPathSegList>; |
| 88 | |
| 89 | template<> JSValue JSSVGPathSegListConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
| 90 | { |
| 91 | UNUSED_PARAM(vm); |
| 92 | return globalObject.functionPrototype(); |
| 93 | } |
| 94 | |
| 95 | template<> void JSSVGPathSegListConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
| 96 | { |
| 97 | putDirect(vm, vm.propertyNames->prototype, JSSVGPathSegList::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 98 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("SVGPathSegList"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 99 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 100 | } |
| 101 | |
| 102 | template<> const ClassInfo JSSVGPathSegListConstructor::s_info = { "SVGPathSegList" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGPathSegListConstructor) }; |
| 103 | |
| 104 | /* Hash table for prototype */ |
| 105 | |
| 106 | static const HashTableValue JSSVGPathSegListPrototypeTableValues[] = |
| 107 | { |
| 108 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegListConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGPathSegListConstructor) } }, |
| 109 | { "numberOfItems" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGPathSegListNumberOfItems), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 110 | { "clear" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsSVGPathSegListPrototypeFunctionClear), (intptr_t) (0) } }, |
| 111 | { "initialize" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsSVGPathSegListPrototypeFunctionInitialize), (intptr_t) (1) } }, |
| 112 | { "getItem" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsSVGPathSegListPrototypeFunctionGetItem), (intptr_t) (1) } }, |
| 113 | { "insertItemBefore" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsSVGPathSegListPrototypeFunctionInsertItemBefore), (intptr_t) (2) } }, |
| 114 | { "replaceItem" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsSVGPathSegListPrototypeFunctionReplaceItem), (intptr_t) (2) } }, |
| 115 | { "removeItem" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsSVGPathSegListPrototypeFunctionRemoveItem), (intptr_t) (1) } }, |
| 116 | { "appendItem" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsSVGPathSegListPrototypeFunctionAppendItem), (intptr_t) (1) } }, |
| 117 | }; |
| 118 | |
| 119 | const ClassInfo JSSVGPathSegListPrototype::s_info = { "SVGPathSegListPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGPathSegListPrototype) }; |
| 120 | |
| 121 | void JSSVGPathSegListPrototype::finishCreation(VM& vm) |
| 122 | { |
| 123 | Base::finishCreation(vm); |
| 124 | reifyStaticProperties(vm, JSSVGPathSegList::info(), JSSVGPathSegListPrototypeTableValues, *this); |
| 125 | } |
| 126 | |
| 127 | const ClassInfo JSSVGPathSegList::s_info = { "SVGPathSegList" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGPathSegList) }; |
| 128 | |
| 129 | JSSVGPathSegList::JSSVGPathSegList(Structure* structure, JSDOMGlobalObject& globalObject, Ref<SVGPathSegList>&& impl) |
| 130 | : JSDOMWrapper<SVGPathSegList>(structure, globalObject, WTFMove(impl)) |
| 131 | { |
| 132 | } |
| 133 | |
| 134 | void JSSVGPathSegList::finishCreation(VM& vm) |
| 135 | { |
| 136 | Base::finishCreation(vm); |
| 137 | ASSERT(inherits(vm, info())); |
| 138 | |
| 139 | } |
| 140 | |
| 141 | JSObject* JSSVGPathSegList::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
| 142 | { |
| 143 | return JSSVGPathSegListPrototype::create(vm, &globalObject, JSSVGPathSegListPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); |
| 144 | } |
| 145 | |
| 146 | JSObject* JSSVGPathSegList::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
| 147 | { |
| 148 | return getDOMPrototype<JSSVGPathSegList>(vm, globalObject); |
| 149 | } |
| 150 | |
| 151 | JSValue JSSVGPathSegList::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
| 152 | { |
| 153 | return getDOMConstructor<JSSVGPathSegListConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
| 154 | } |
| 155 | |
| 156 | void JSSVGPathSegList::destroy(JSC::JSCell* cell) |
| 157 | { |
| 158 | JSSVGPathSegList* thisObject = static_cast<JSSVGPathSegList*>(cell); |
| 159 | thisObject->JSSVGPathSegList::~JSSVGPathSegList(); |
| 160 | } |
| 161 | |
| 162 | template<> inline JSSVGPathSegList* IDLAttribute<JSSVGPathSegList>::cast(ExecState& state, EncodedJSValue thisValue) |
| 163 | { |
| 164 | return jsDynamicCast<JSSVGPathSegList*>(state.vm(), JSValue::decode(thisValue)); |
| 165 | } |
| 166 | |
| 167 | template<> inline JSSVGPathSegList* IDLOperation<JSSVGPathSegList>::cast(ExecState& state) |
| 168 | { |
| 169 | return jsDynamicCast<JSSVGPathSegList*>(state.vm(), state.thisValue()); |
| 170 | } |
| 171 | |
| 172 | EncodedJSValue jsSVGPathSegListConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 173 | { |
| 174 | VM& vm = state->vm(); |
| 175 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 176 | auto* prototype = jsDynamicCast<JSSVGPathSegListPrototype*>(vm, JSValue::decode(thisValue)); |
| 177 | if (UNLIKELY(!prototype)) |
| 178 | return throwVMTypeError(state, throwScope); |
| 179 | return JSValue::encode(JSSVGPathSegList::getConstructor(state->vm(), prototype->globalObject())); |
| 180 | } |
| 181 | |
| 182 | bool setJSSVGPathSegListConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 183 | { |
| 184 | VM& vm = state->vm(); |
| 185 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 186 | auto* prototype = jsDynamicCast<JSSVGPathSegListPrototype*>(vm, JSValue::decode(thisValue)); |
| 187 | if (UNLIKELY(!prototype)) { |
| 188 | throwVMTypeError(state, throwScope); |
| 189 | return false; |
| 190 | } |
| 191 | // Shadowing a built-in constructor |
| 192 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
| 193 | } |
| 194 | |
| 195 | static inline JSValue jsSVGPathSegListNumberOfItemsGetter(ExecState& state, JSSVGPathSegList& thisObject, ThrowScope& throwScope) |
| 196 | { |
| 197 | UNUSED_PARAM(throwScope); |
| 198 | UNUSED_PARAM(state); |
| 199 | auto& impl = thisObject.wrapped(); |
| 200 | JSValue result = toJS<IDLUnsignedLong>(state, throwScope, impl.numberOfItems()); |
| 201 | return result; |
| 202 | } |
| 203 | |
| 204 | EncodedJSValue jsSVGPathSegListNumberOfItems(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 205 | { |
| 206 | return IDLAttribute<JSSVGPathSegList>::get<jsSVGPathSegListNumberOfItemsGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "numberOfItems" ); |
| 207 | } |
| 208 | |
| 209 | static inline JSC::EncodedJSValue jsSVGPathSegListPrototypeFunctionClearBody(JSC::ExecState* state, typename IDLOperation<JSSVGPathSegList>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
| 210 | { |
| 211 | UNUSED_PARAM(state); |
| 212 | UNUSED_PARAM(throwScope); |
| 213 | auto& impl = castedThis->wrapped(); |
| 214 | propagateException(*state, throwScope, impl.clear()); |
| 215 | return JSValue::encode(jsUndefined()); |
| 216 | } |
| 217 | |
| 218 | EncodedJSValue JSC_HOST_CALL jsSVGPathSegListPrototypeFunctionClear(ExecState* state) |
| 219 | { |
| 220 | return IDLOperation<JSSVGPathSegList>::call<jsSVGPathSegListPrototypeFunctionClearBody>(*state, "clear" ); |
| 221 | } |
| 222 | |
| 223 | static inline JSC::EncodedJSValue jsSVGPathSegListPrototypeFunctionInitializeBody(JSC::ExecState* state, typename IDLOperation<JSSVGPathSegList>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
| 224 | { |
| 225 | UNUSED_PARAM(state); |
| 226 | UNUSED_PARAM(throwScope); |
| 227 | auto& impl = castedThis->wrapped(); |
| 228 | if (UNLIKELY(state->argumentCount() < 1)) |
| 229 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
| 230 | auto newItem = convert<IDLInterface<SVGPathSeg>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "newItem" , "SVGPathSegList" , "initialize" , "SVGPathSeg" ); }); |
| 231 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| 232 | return JSValue::encode(toJS<IDLInterface<SVGPathSeg>>(*state, *castedThis->globalObject(), throwScope, impl.initialize(*newItem))); |
| 233 | } |
| 234 | |
| 235 | EncodedJSValue JSC_HOST_CALL jsSVGPathSegListPrototypeFunctionInitialize(ExecState* state) |
| 236 | { |
| 237 | return IDLOperation<JSSVGPathSegList>::call<jsSVGPathSegListPrototypeFunctionInitializeBody>(*state, "initialize" ); |
| 238 | } |
| 239 | |
| 240 | static inline JSC::EncodedJSValue jsSVGPathSegListPrototypeFunctionGetItemBody(JSC::ExecState* state, typename IDLOperation<JSSVGPathSegList>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
| 241 | { |
| 242 | UNUSED_PARAM(state); |
| 243 | UNUSED_PARAM(throwScope); |
| 244 | auto& impl = castedThis->wrapped(); |
| 245 | if (UNLIKELY(state->argumentCount() < 1)) |
| 246 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
| 247 | auto index = convert<IDLUnsignedLong>(*state, state->uncheckedArgument(0)); |
| 248 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| 249 | return JSValue::encode(toJS<IDLInterface<SVGPathSeg>>(*state, *castedThis->globalObject(), throwScope, impl.getItem(WTFMove(index)))); |
| 250 | } |
| 251 | |
| 252 | EncodedJSValue JSC_HOST_CALL jsSVGPathSegListPrototypeFunctionGetItem(ExecState* state) |
| 253 | { |
| 254 | return IDLOperation<JSSVGPathSegList>::call<jsSVGPathSegListPrototypeFunctionGetItemBody>(*state, "getItem" ); |
| 255 | } |
| 256 | |
| 257 | static inline JSC::EncodedJSValue jsSVGPathSegListPrototypeFunctionInsertItemBeforeBody(JSC::ExecState* state, typename IDLOperation<JSSVGPathSegList>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
| 258 | { |
| 259 | UNUSED_PARAM(state); |
| 260 | UNUSED_PARAM(throwScope); |
| 261 | auto& impl = castedThis->wrapped(); |
| 262 | if (UNLIKELY(state->argumentCount() < 2)) |
| 263 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
| 264 | auto newItem = convert<IDLInterface<SVGPathSeg>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "newItem" , "SVGPathSegList" , "insertItemBefore" , "SVGPathSeg" ); }); |
| 265 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| 266 | auto index = convert<IDLUnsignedLong>(*state, state->uncheckedArgument(1)); |
| 267 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| 268 | return JSValue::encode(toJS<IDLInterface<SVGPathSeg>>(*state, *castedThis->globalObject(), throwScope, impl.insertItemBefore(*newItem, WTFMove(index)))); |
| 269 | } |
| 270 | |
| 271 | EncodedJSValue JSC_HOST_CALL jsSVGPathSegListPrototypeFunctionInsertItemBefore(ExecState* state) |
| 272 | { |
| 273 | return IDLOperation<JSSVGPathSegList>::call<jsSVGPathSegListPrototypeFunctionInsertItemBeforeBody>(*state, "insertItemBefore" ); |
| 274 | } |
| 275 | |
| 276 | static inline JSC::EncodedJSValue jsSVGPathSegListPrototypeFunctionReplaceItemBody(JSC::ExecState* state, typename IDLOperation<JSSVGPathSegList>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
| 277 | { |
| 278 | UNUSED_PARAM(state); |
| 279 | UNUSED_PARAM(throwScope); |
| 280 | auto& impl = castedThis->wrapped(); |
| 281 | if (UNLIKELY(state->argumentCount() < 2)) |
| 282 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
| 283 | auto newItem = convert<IDLInterface<SVGPathSeg>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "newItem" , "SVGPathSegList" , "replaceItem" , "SVGPathSeg" ); }); |
| 284 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| 285 | auto index = convert<IDLUnsignedLong>(*state, state->uncheckedArgument(1)); |
| 286 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| 287 | return JSValue::encode(toJS<IDLInterface<SVGPathSeg>>(*state, *castedThis->globalObject(), throwScope, impl.replaceItem(*newItem, WTFMove(index)))); |
| 288 | } |
| 289 | |
| 290 | EncodedJSValue JSC_HOST_CALL jsSVGPathSegListPrototypeFunctionReplaceItem(ExecState* state) |
| 291 | { |
| 292 | return IDLOperation<JSSVGPathSegList>::call<jsSVGPathSegListPrototypeFunctionReplaceItemBody>(*state, "replaceItem" ); |
| 293 | } |
| 294 | |
| 295 | static inline JSC::EncodedJSValue jsSVGPathSegListPrototypeFunctionRemoveItemBody(JSC::ExecState* state, typename IDLOperation<JSSVGPathSegList>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
| 296 | { |
| 297 | UNUSED_PARAM(state); |
| 298 | UNUSED_PARAM(throwScope); |
| 299 | auto& impl = castedThis->wrapped(); |
| 300 | if (UNLIKELY(state->argumentCount() < 1)) |
| 301 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
| 302 | auto index = convert<IDLUnsignedLong>(*state, state->uncheckedArgument(0)); |
| 303 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| 304 | return JSValue::encode(toJS<IDLInterface<SVGPathSeg>>(*state, *castedThis->globalObject(), throwScope, impl.removeItem(WTFMove(index)))); |
| 305 | } |
| 306 | |
| 307 | EncodedJSValue JSC_HOST_CALL jsSVGPathSegListPrototypeFunctionRemoveItem(ExecState* state) |
| 308 | { |
| 309 | return IDLOperation<JSSVGPathSegList>::call<jsSVGPathSegListPrototypeFunctionRemoveItemBody>(*state, "removeItem" ); |
| 310 | } |
| 311 | |
| 312 | static inline JSC::EncodedJSValue jsSVGPathSegListPrototypeFunctionAppendItemBody(JSC::ExecState* state, typename IDLOperation<JSSVGPathSegList>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
| 313 | { |
| 314 | UNUSED_PARAM(state); |
| 315 | UNUSED_PARAM(throwScope); |
| 316 | auto& impl = castedThis->wrapped(); |
| 317 | if (UNLIKELY(state->argumentCount() < 1)) |
| 318 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
| 319 | auto newItem = convert<IDLInterface<SVGPathSeg>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "newItem" , "SVGPathSegList" , "appendItem" , "SVGPathSeg" ); }); |
| 320 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| 321 | return JSValue::encode(toJS<IDLInterface<SVGPathSeg>>(*state, *castedThis->globalObject(), throwScope, impl.appendItem(*newItem))); |
| 322 | } |
| 323 | |
| 324 | EncodedJSValue JSC_HOST_CALL jsSVGPathSegListPrototypeFunctionAppendItem(ExecState* state) |
| 325 | { |
| 326 | return IDLOperation<JSSVGPathSegList>::call<jsSVGPathSegListPrototypeFunctionAppendItemBody>(*state, "appendItem" ); |
| 327 | } |
| 328 | |
| 329 | void JSSVGPathSegList::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
| 330 | { |
| 331 | auto* thisObject = jsCast<JSSVGPathSegList*>(cell); |
| 332 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
| 333 | if (thisObject->scriptExecutionContext()) |
| 334 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
| 335 | Base::heapSnapshot(cell, builder); |
| 336 | } |
| 337 | |
| 338 | bool JSSVGPathSegListOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason) |
| 339 | { |
| 340 | UNUSED_PARAM(handle); |
| 341 | UNUSED_PARAM(visitor); |
| 342 | UNUSED_PARAM(reason); |
| 343 | return false; |
| 344 | } |
| 345 | |
| 346 | void JSSVGPathSegListOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) |
| 347 | { |
| 348 | auto* jsSVGPathSegList = static_cast<JSSVGPathSegList*>(handle.slot()->asCell()); |
| 349 | auto& world = *static_cast<DOMWrapperWorld*>(context); |
| 350 | uncacheWrapper(world, &jsSVGPathSegList->wrapped(), jsSVGPathSegList); |
| 351 | } |
| 352 | |
| 353 | #if ENABLE(BINDING_INTEGRITY) |
| 354 | #if PLATFORM(WIN) |
| 355 | #pragma warning(disable: 4483) |
| 356 | extern "C" { extern void (*const __identifier("??_7SVGPathSegList@WebCore@@6B@" )[])(); } |
| 357 | #else |
| 358 | extern "C" { extern void* _ZTVN7WebCore14SVGPathSegListE[]; } |
| 359 | #endif |
| 360 | #endif |
| 361 | |
| 362 | JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<SVGPathSegList>&& impl) |
| 363 | { |
| 364 | |
| 365 | #if ENABLE(BINDING_INTEGRITY) |
| 366 | void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr())); |
| 367 | #if PLATFORM(WIN) |
| 368 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(__identifier("??_7SVGPathSegList@WebCore@@6B@" )); |
| 369 | #else |
| 370 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(&_ZTVN7WebCore14SVGPathSegListE[2]); |
| 371 | #endif |
| 372 | |
| 373 | // If this fails SVGPathSegList does not have a vtable, so you need to add the |
| 374 | // ImplementationLacksVTable attribute to the interface definition |
| 375 | static_assert(std::is_polymorphic<SVGPathSegList>::value, "SVGPathSegList is not polymorphic" ); |
| 376 | |
| 377 | // If you hit this assertion you either have a use after free bug, or |
| 378 | // SVGPathSegList has subclasses. If SVGPathSegList has subclasses that get passed |
| 379 | // to toJS() we currently require SVGPathSegList you to opt out of binding hardening |
| 380 | // by adding the SkipVTableValidation attribute to the interface IDL definition |
| 381 | RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); |
| 382 | #endif |
| 383 | return createWrapper<SVGPathSegList>(globalObject, WTFMove(impl)); |
| 384 | } |
| 385 | |
| 386 | JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, SVGPathSegList& impl) |
| 387 | { |
| 388 | return wrap(state, globalObject, impl); |
| 389 | } |
| 390 | |
| 391 | SVGPathSegList* JSSVGPathSegList::toWrapped(JSC::VM& vm, JSC::JSValue value) |
| 392 | { |
| 393 | if (auto* wrapper = jsDynamicCast<JSSVGPathSegList*>(vm, value)) |
| 394 | return &wrapper->wrapped(); |
| 395 | return nullptr; |
| 396 | } |
| 397 | |
| 398 | } |
| 399 | |