| 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 "JSDataTransferItemList.h" |
| 23 | |
| 24 | #include "JSDOMAttribute.h" |
| 25 | #include "JSDOMBinding.h" |
| 26 | #include "JSDOMConstructorNotConstructable.h" |
| 27 | #include "JSDOMConvertInterface.h" |
| 28 | #include "JSDOMConvertNullable.h" |
| 29 | #include "JSDOMConvertNumbers.h" |
| 30 | #include "JSDOMConvertStrings.h" |
| 31 | #include "JSDOMExceptionHandling.h" |
| 32 | #include "JSDOMGlobalObject.h" |
| 33 | #include "JSDOMOperation.h" |
| 34 | #include "JSDOMWrapperCache.h" |
| 35 | #include "JSDataTransferItem.h" |
| 36 | #include "JSFile.h" |
| 37 | #include "ScriptExecutionContext.h" |
| 38 | #include <JavaScriptCore/ArrayPrototype.h> |
| 39 | #include <JavaScriptCore/BuiltinNames.h> |
| 40 | #include <JavaScriptCore/FunctionPrototype.h> |
| 41 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
| 42 | #include <JavaScriptCore/JSCInlines.h> |
| 43 | #include <JavaScriptCore/PropertyNameArray.h> |
| 44 | #include <wtf/GetPtr.h> |
| 45 | #include <wtf/PointerPreparations.h> |
| 46 | #include <wtf/URL.h> |
| 47 | |
| 48 | |
| 49 | namespace WebCore { |
| 50 | using namespace JSC; |
| 51 | |
| 52 | // Functions |
| 53 | |
| 54 | JSC::EncodedJSValue JSC_HOST_CALL jsDataTransferItemListPrototypeFunctionItem(JSC::ExecState*); |
| 55 | JSC::EncodedJSValue JSC_HOST_CALL jsDataTransferItemListPrototypeFunctionAdd(JSC::ExecState*); |
| 56 | JSC::EncodedJSValue JSC_HOST_CALL jsDataTransferItemListPrototypeFunctionRemove(JSC::ExecState*); |
| 57 | JSC::EncodedJSValue JSC_HOST_CALL jsDataTransferItemListPrototypeFunctionClear(JSC::ExecState*); |
| 58 | |
| 59 | // Attributes |
| 60 | |
| 61 | JSC::EncodedJSValue jsDataTransferItemListConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 62 | bool setJSDataTransferItemListConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 63 | JSC::EncodedJSValue jsDataTransferItemListLength(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 64 | |
| 65 | class JSDataTransferItemListPrototype : public JSC::JSNonFinalObject { |
| 66 | public: |
| 67 | using Base = JSC::JSNonFinalObject; |
| 68 | static JSDataTransferItemListPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
| 69 | { |
| 70 | JSDataTransferItemListPrototype* ptr = new (NotNull, JSC::allocateCell<JSDataTransferItemListPrototype>(vm.heap)) JSDataTransferItemListPrototype(vm, globalObject, structure); |
| 71 | ptr->finishCreation(vm); |
| 72 | return ptr; |
| 73 | } |
| 74 | |
| 75 | DECLARE_INFO; |
| 76 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
| 77 | { |
| 78 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
| 79 | } |
| 80 | |
| 81 | private: |
| 82 | JSDataTransferItemListPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
| 83 | : JSC::JSNonFinalObject(vm, structure) |
| 84 | { |
| 85 | } |
| 86 | |
| 87 | void finishCreation(JSC::VM&); |
| 88 | }; |
| 89 | |
| 90 | using JSDataTransferItemListConstructor = JSDOMConstructorNotConstructable<JSDataTransferItemList>; |
| 91 | |
| 92 | template<> JSValue JSDataTransferItemListConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
| 93 | { |
| 94 | UNUSED_PARAM(vm); |
| 95 | return globalObject.functionPrototype(); |
| 96 | } |
| 97 | |
| 98 | template<> void JSDataTransferItemListConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
| 99 | { |
| 100 | putDirect(vm, vm.propertyNames->prototype, JSDataTransferItemList::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 101 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("DataTransferItemList"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 102 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 103 | } |
| 104 | |
| 105 | template<> const ClassInfo JSDataTransferItemListConstructor::s_info = { "DataTransferItemList" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDataTransferItemListConstructor) }; |
| 106 | |
| 107 | /* Hash table for prototype */ |
| 108 | |
| 109 | static const HashTableValue JSDataTransferItemListPrototypeTableValues[] = |
| 110 | { |
| 111 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDataTransferItemListConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSDataTransferItemListConstructor) } }, |
| 112 | { "length" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDataTransferItemListLength), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 113 | { "item" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsDataTransferItemListPrototypeFunctionItem), (intptr_t) (1) } }, |
| 114 | { "add" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsDataTransferItemListPrototypeFunctionAdd), (intptr_t) (1) } }, |
| 115 | { "remove" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsDataTransferItemListPrototypeFunctionRemove), (intptr_t) (1) } }, |
| 116 | { "clear" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsDataTransferItemListPrototypeFunctionClear), (intptr_t) (0) } }, |
| 117 | }; |
| 118 | |
| 119 | const ClassInfo JSDataTransferItemListPrototype::s_info = { "DataTransferItemListPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDataTransferItemListPrototype) }; |
| 120 | |
| 121 | void JSDataTransferItemListPrototype::finishCreation(VM& vm) |
| 122 | { |
| 123 | Base::finishCreation(vm); |
| 124 | reifyStaticProperties(vm, JSDataTransferItemList::info(), JSDataTransferItemListPrototypeTableValues, *this); |
| 125 | putDirect(vm, vm.propertyNames->iteratorSymbol, globalObject()->arrayPrototype()->getDirect(vm, vm.propertyNames->builtinNames().valuesPrivateName()), static_cast<unsigned>(JSC::PropertyAttribute::DontEnum)); |
| 126 | } |
| 127 | |
| 128 | const ClassInfo JSDataTransferItemList::s_info = { "DataTransferItemList" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDataTransferItemList) }; |
| 129 | |
| 130 | JSDataTransferItemList::JSDataTransferItemList(Structure* structure, JSDOMGlobalObject& globalObject, Ref<DataTransferItemList>&& impl) |
| 131 | : JSDOMWrapper<DataTransferItemList>(structure, globalObject, WTFMove(impl)) |
| 132 | { |
| 133 | } |
| 134 | |
| 135 | void JSDataTransferItemList::finishCreation(VM& vm) |
| 136 | { |
| 137 | Base::finishCreation(vm); |
| 138 | ASSERT(inherits(vm, info())); |
| 139 | |
| 140 | } |
| 141 | |
| 142 | JSObject* JSDataTransferItemList::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
| 143 | { |
| 144 | return JSDataTransferItemListPrototype::create(vm, &globalObject, JSDataTransferItemListPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); |
| 145 | } |
| 146 | |
| 147 | JSObject* JSDataTransferItemList::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
| 148 | { |
| 149 | return getDOMPrototype<JSDataTransferItemList>(vm, globalObject); |
| 150 | } |
| 151 | |
| 152 | JSValue JSDataTransferItemList::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
| 153 | { |
| 154 | return getDOMConstructor<JSDataTransferItemListConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
| 155 | } |
| 156 | |
| 157 | void JSDataTransferItemList::destroy(JSC::JSCell* cell) |
| 158 | { |
| 159 | JSDataTransferItemList* thisObject = static_cast<JSDataTransferItemList*>(cell); |
| 160 | thisObject->JSDataTransferItemList::~JSDataTransferItemList(); |
| 161 | } |
| 162 | |
| 163 | bool JSDataTransferItemList::getOwnPropertySlot(JSObject* object, ExecState* state, PropertyName propertyName, PropertySlot& slot) |
| 164 | { |
| 165 | auto* thisObject = jsCast<JSDataTransferItemList*>(object); |
| 166 | ASSERT_GC_OBJECT_INHERITS(thisObject, info()); |
| 167 | if (auto index = parseIndex(propertyName)) { |
| 168 | if (index.value() < thisObject->wrapped().length()) { |
| 169 | auto value = toJS<IDLInterface<DataTransferItem>>(*state, *thisObject->globalObject(), thisObject->wrapped().item(index.value())); |
| 170 | slot.setValue(thisObject, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly), value); |
| 171 | return true; |
| 172 | } |
| 173 | } |
| 174 | return JSObject::getOwnPropertySlot(object, state, propertyName, slot); |
| 175 | } |
| 176 | |
| 177 | bool JSDataTransferItemList::getOwnPropertySlotByIndex(JSObject* object, ExecState* state, unsigned index, PropertySlot& slot) |
| 178 | { |
| 179 | auto* thisObject = jsCast<JSDataTransferItemList*>(object); |
| 180 | ASSERT_GC_OBJECT_INHERITS(thisObject, info()); |
| 181 | if (LIKELY(index <= MAX_ARRAY_INDEX)) { |
| 182 | if (index < thisObject->wrapped().length()) { |
| 183 | auto value = toJS<IDLInterface<DataTransferItem>>(*state, *thisObject->globalObject(), thisObject->wrapped().item(index)); |
| 184 | slot.setValue(thisObject, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly), value); |
| 185 | return true; |
| 186 | } |
| 187 | } |
| 188 | return JSObject::getOwnPropertySlotByIndex(object, state, index, slot); |
| 189 | } |
| 190 | |
| 191 | void JSDataTransferItemList::getOwnPropertyNames(JSObject* object, ExecState* state, PropertyNameArray& propertyNames, EnumerationMode mode) |
| 192 | { |
| 193 | auto* thisObject = jsCast<JSDataTransferItemList*>(object); |
| 194 | ASSERT_GC_OBJECT_INHERITS(object, info()); |
| 195 | for (unsigned i = 0, count = thisObject->wrapped().length(); i < count; ++i) |
| 196 | propertyNames.add(Identifier::from(state, i)); |
| 197 | JSObject::getOwnPropertyNames(object, state, propertyNames, mode); |
| 198 | } |
| 199 | |
| 200 | template<> inline JSDataTransferItemList* IDLAttribute<JSDataTransferItemList>::cast(ExecState& state, EncodedJSValue thisValue) |
| 201 | { |
| 202 | return jsDynamicCast<JSDataTransferItemList*>(state.vm(), JSValue::decode(thisValue)); |
| 203 | } |
| 204 | |
| 205 | template<> inline JSDataTransferItemList* IDLOperation<JSDataTransferItemList>::cast(ExecState& state) |
| 206 | { |
| 207 | return jsDynamicCast<JSDataTransferItemList*>(state.vm(), state.thisValue()); |
| 208 | } |
| 209 | |
| 210 | EncodedJSValue jsDataTransferItemListConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 211 | { |
| 212 | VM& vm = state->vm(); |
| 213 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 214 | auto* prototype = jsDynamicCast<JSDataTransferItemListPrototype*>(vm, JSValue::decode(thisValue)); |
| 215 | if (UNLIKELY(!prototype)) |
| 216 | return throwVMTypeError(state, throwScope); |
| 217 | return JSValue::encode(JSDataTransferItemList::getConstructor(state->vm(), prototype->globalObject())); |
| 218 | } |
| 219 | |
| 220 | bool setJSDataTransferItemListConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 221 | { |
| 222 | VM& vm = state->vm(); |
| 223 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 224 | auto* prototype = jsDynamicCast<JSDataTransferItemListPrototype*>(vm, JSValue::decode(thisValue)); |
| 225 | if (UNLIKELY(!prototype)) { |
| 226 | throwVMTypeError(state, throwScope); |
| 227 | return false; |
| 228 | } |
| 229 | // Shadowing a built-in constructor |
| 230 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
| 231 | } |
| 232 | |
| 233 | static inline JSValue jsDataTransferItemListLengthGetter(ExecState& state, JSDataTransferItemList& thisObject, ThrowScope& throwScope) |
| 234 | { |
| 235 | UNUSED_PARAM(throwScope); |
| 236 | UNUSED_PARAM(state); |
| 237 | auto& impl = thisObject.wrapped(); |
| 238 | JSValue result = toJS<IDLLong>(state, throwScope, impl.length()); |
| 239 | return result; |
| 240 | } |
| 241 | |
| 242 | EncodedJSValue jsDataTransferItemListLength(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 243 | { |
| 244 | return IDLAttribute<JSDataTransferItemList>::get<jsDataTransferItemListLengthGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "length" ); |
| 245 | } |
| 246 | |
| 247 | static inline JSC::EncodedJSValue jsDataTransferItemListPrototypeFunctionItemBody(JSC::ExecState* state, typename IDLOperation<JSDataTransferItemList>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
| 248 | { |
| 249 | UNUSED_PARAM(state); |
| 250 | UNUSED_PARAM(throwScope); |
| 251 | auto& impl = castedThis->wrapped(); |
| 252 | if (UNLIKELY(state->argumentCount() < 1)) |
| 253 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
| 254 | auto index = convert<IDLUnsignedLong>(*state, state->uncheckedArgument(0)); |
| 255 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| 256 | return JSValue::encode(toJS<IDLInterface<DataTransferItem>>(*state, *castedThis->globalObject(), impl.item(WTFMove(index)))); |
| 257 | } |
| 258 | |
| 259 | EncodedJSValue JSC_HOST_CALL jsDataTransferItemListPrototypeFunctionItem(ExecState* state) |
| 260 | { |
| 261 | return IDLOperation<JSDataTransferItemList>::call<jsDataTransferItemListPrototypeFunctionItemBody>(*state, "item" ); |
| 262 | } |
| 263 | |
| 264 | static inline JSC::EncodedJSValue jsDataTransferItemListPrototypeFunctionAdd1Body(JSC::ExecState* state, typename IDLOperation<JSDataTransferItemList>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
| 265 | { |
| 266 | UNUSED_PARAM(state); |
| 267 | UNUSED_PARAM(throwScope); |
| 268 | auto& impl = castedThis->wrapped(); |
| 269 | auto data = convert<IDLDOMString>(*state, state->uncheckedArgument(0)); |
| 270 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| 271 | auto type = convert<IDLDOMString>(*state, state->uncheckedArgument(1)); |
| 272 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| 273 | return JSValue::encode(toJS<IDLNullable<IDLInterface<DataTransferItem>>>(*state, *castedThis->globalObject(), throwScope, impl.add(WTFMove(data), WTFMove(type)))); |
| 274 | } |
| 275 | |
| 276 | static inline JSC::EncodedJSValue jsDataTransferItemListPrototypeFunctionAdd2Body(JSC::ExecState* state, typename IDLOperation<JSDataTransferItemList>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
| 277 | { |
| 278 | UNUSED_PARAM(state); |
| 279 | UNUSED_PARAM(throwScope); |
| 280 | auto& impl = castedThis->wrapped(); |
| 281 | auto file = convert<IDLInterface<File>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "file" , "DataTransferItemList" , "add" , "File" ); }); |
| 282 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| 283 | return JSValue::encode(toJS<IDLNullable<IDLInterface<DataTransferItem>>>(*state, *castedThis->globalObject(), impl.add(*file))); |
| 284 | } |
| 285 | |
| 286 | static inline JSC::EncodedJSValue jsDataTransferItemListPrototypeFunctionAddOverloadDispatcher(JSC::ExecState* state, typename IDLOperation<JSDataTransferItemList>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
| 287 | { |
| 288 | UNUSED_PARAM(state); |
| 289 | UNUSED_PARAM(throwScope); |
| 290 | VM& vm = state->vm(); |
| 291 | UNUSED_PARAM(vm); |
| 292 | size_t argsCount = std::min<size_t>(2, state->argumentCount()); |
| 293 | if (argsCount == 1) { |
| 294 | return jsDataTransferItemListPrototypeFunctionAdd2Body(state, castedThis, throwScope); |
| 295 | } |
| 296 | if (argsCount == 2) { |
| 297 | return jsDataTransferItemListPrototypeFunctionAdd1Body(state, castedThis, throwScope); |
| 298 | } |
| 299 | return argsCount < 1 ? throwVMError(state, throwScope, createNotEnoughArgumentsError(state)) : throwVMTypeError(state, throwScope); |
| 300 | } |
| 301 | |
| 302 | EncodedJSValue JSC_HOST_CALL jsDataTransferItemListPrototypeFunctionAdd(ExecState* state) |
| 303 | { |
| 304 | return IDLOperation<JSDataTransferItemList>::call<jsDataTransferItemListPrototypeFunctionAddOverloadDispatcher>(*state, "add" ); |
| 305 | } |
| 306 | |
| 307 | static inline JSC::EncodedJSValue jsDataTransferItemListPrototypeFunctionRemoveBody(JSC::ExecState* state, typename IDLOperation<JSDataTransferItemList>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
| 308 | { |
| 309 | UNUSED_PARAM(state); |
| 310 | UNUSED_PARAM(throwScope); |
| 311 | auto& impl = castedThis->wrapped(); |
| 312 | if (UNLIKELY(state->argumentCount() < 1)) |
| 313 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
| 314 | auto index = convert<IDLUnsignedLong>(*state, state->uncheckedArgument(0)); |
| 315 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| 316 | propagateException(*state, throwScope, impl.remove(WTFMove(index))); |
| 317 | return JSValue::encode(jsUndefined()); |
| 318 | } |
| 319 | |
| 320 | EncodedJSValue JSC_HOST_CALL jsDataTransferItemListPrototypeFunctionRemove(ExecState* state) |
| 321 | { |
| 322 | return IDLOperation<JSDataTransferItemList>::call<jsDataTransferItemListPrototypeFunctionRemoveBody>(*state, "remove" ); |
| 323 | } |
| 324 | |
| 325 | static inline JSC::EncodedJSValue jsDataTransferItemListPrototypeFunctionClearBody(JSC::ExecState* state, typename IDLOperation<JSDataTransferItemList>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
| 326 | { |
| 327 | UNUSED_PARAM(state); |
| 328 | UNUSED_PARAM(throwScope); |
| 329 | auto& impl = castedThis->wrapped(); |
| 330 | impl.clear(); |
| 331 | return JSValue::encode(jsUndefined()); |
| 332 | } |
| 333 | |
| 334 | EncodedJSValue JSC_HOST_CALL jsDataTransferItemListPrototypeFunctionClear(ExecState* state) |
| 335 | { |
| 336 | return IDLOperation<JSDataTransferItemList>::call<jsDataTransferItemListPrototypeFunctionClearBody>(*state, "clear" ); |
| 337 | } |
| 338 | |
| 339 | void JSDataTransferItemList::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
| 340 | { |
| 341 | auto* thisObject = jsCast<JSDataTransferItemList*>(cell); |
| 342 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
| 343 | if (thisObject->scriptExecutionContext()) |
| 344 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
| 345 | Base::heapSnapshot(cell, builder); |
| 346 | } |
| 347 | |
| 348 | bool JSDataTransferItemListOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason) |
| 349 | { |
| 350 | UNUSED_PARAM(handle); |
| 351 | UNUSED_PARAM(visitor); |
| 352 | UNUSED_PARAM(reason); |
| 353 | return false; |
| 354 | } |
| 355 | |
| 356 | void JSDataTransferItemListOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) |
| 357 | { |
| 358 | auto* jsDataTransferItemList = static_cast<JSDataTransferItemList*>(handle.slot()->asCell()); |
| 359 | auto& world = *static_cast<DOMWrapperWorld*>(context); |
| 360 | uncacheWrapper(world, &jsDataTransferItemList->wrapped(), jsDataTransferItemList); |
| 361 | } |
| 362 | |
| 363 | JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<DataTransferItemList>&& impl) |
| 364 | { |
| 365 | // If you hit this failure the interface definition has the ImplementationLacksVTable |
| 366 | // attribute. You should remove that attribute. If the class has subclasses |
| 367 | // that may be passed through this toJS() function you should use the SkipVTableValidation |
| 368 | // attribute to DataTransferItemList. |
| 369 | static_assert(!std::is_polymorphic<DataTransferItemList>::value, "DataTransferItemList is polymorphic but the IDL claims it is not" ); |
| 370 | return createWrapper<DataTransferItemList>(globalObject, WTFMove(impl)); |
| 371 | } |
| 372 | |
| 373 | JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, DataTransferItemList& impl) |
| 374 | { |
| 375 | return wrap(state, globalObject, impl); |
| 376 | } |
| 377 | |
| 378 | DataTransferItemList* JSDataTransferItemList::toWrapped(JSC::VM& vm, JSC::JSValue value) |
| 379 | { |
| 380 | if (auto* wrapper = jsDynamicCast<JSDataTransferItemList*>(vm, value)) |
| 381 | return &wrapper->wrapped(); |
| 382 | return nullptr; |
| 383 | } |
| 384 | |
| 385 | } |
| 386 | |