| 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 | |
| 23 | #if ENABLE(VIDEO_TRACK) |
| 24 | |
| 25 | #include "JSHTMLTrackElement.h" |
| 26 | |
| 27 | #include "CustomElementReactionQueue.h" |
| 28 | #include "HTMLNames.h" |
| 29 | #include "JSDOMAttribute.h" |
| 30 | #include "JSDOMBinding.h" |
| 31 | #include "JSDOMConstructorNotConstructable.h" |
| 32 | #include "JSDOMConvertBoolean.h" |
| 33 | #include "JSDOMConvertInterface.h" |
| 34 | #include "JSDOMConvertNumbers.h" |
| 35 | #include "JSDOMConvertStrings.h" |
| 36 | #include "JSDOMExceptionHandling.h" |
| 37 | #include "JSDOMGlobalObject.h" |
| 38 | #include "JSDOMWrapperCache.h" |
| 39 | #include "JSTextTrack.h" |
| 40 | #include "ScriptExecutionContext.h" |
| 41 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
| 42 | #include <JavaScriptCore/JSCInlines.h> |
| 43 | #include <wtf/GetPtr.h> |
| 44 | #include <wtf/PointerPreparations.h> |
| 45 | #include <wtf/URL.h> |
| 46 | |
| 47 | |
| 48 | namespace WebCore { |
| 49 | using namespace JSC; |
| 50 | |
| 51 | // Attributes |
| 52 | |
| 53 | JSC::EncodedJSValue jsHTMLTrackElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 54 | bool setJSHTMLTrackElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 55 | JSC::EncodedJSValue jsHTMLTrackElementKind(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 56 | bool setJSHTMLTrackElementKind(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 57 | JSC::EncodedJSValue jsHTMLTrackElementSrc(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 58 | bool setJSHTMLTrackElementSrc(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 59 | JSC::EncodedJSValue jsHTMLTrackElementSrclang(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 60 | bool setJSHTMLTrackElementSrclang(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 61 | JSC::EncodedJSValue jsHTMLTrackElementLabel(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 62 | bool setJSHTMLTrackElementLabel(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 63 | JSC::EncodedJSValue jsHTMLTrackElementDefault(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 64 | bool setJSHTMLTrackElementDefault(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 65 | JSC::EncodedJSValue jsHTMLTrackElementReadyState(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 66 | JSC::EncodedJSValue jsHTMLTrackElementTrack(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 67 | |
| 68 | class JSHTMLTrackElementPrototype : public JSC::JSNonFinalObject { |
| 69 | public: |
| 70 | using Base = JSC::JSNonFinalObject; |
| 71 | static JSHTMLTrackElementPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
| 72 | { |
| 73 | JSHTMLTrackElementPrototype* ptr = new (NotNull, JSC::allocateCell<JSHTMLTrackElementPrototype>(vm.heap)) JSHTMLTrackElementPrototype(vm, globalObject, structure); |
| 74 | ptr->finishCreation(vm); |
| 75 | return ptr; |
| 76 | } |
| 77 | |
| 78 | DECLARE_INFO; |
| 79 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
| 80 | { |
| 81 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
| 82 | } |
| 83 | |
| 84 | private: |
| 85 | JSHTMLTrackElementPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
| 86 | : JSC::JSNonFinalObject(vm, structure) |
| 87 | { |
| 88 | } |
| 89 | |
| 90 | void finishCreation(JSC::VM&); |
| 91 | }; |
| 92 | |
| 93 | using JSHTMLTrackElementConstructor = JSDOMConstructorNotConstructable<JSHTMLTrackElement>; |
| 94 | |
| 95 | /* Hash table for constructor */ |
| 96 | |
| 97 | static const HashTableValue JSHTMLTrackElementConstructorTableValues[] = |
| 98 | { |
| 99 | { "NONE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0) } }, |
| 100 | { "LOADING" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(1) } }, |
| 101 | { "LOADED" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(2) } }, |
| 102 | { "ERROR" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(3) } }, |
| 103 | }; |
| 104 | |
| 105 | static_assert(HTMLTrackElement::NONE == 0, "NONE in HTMLTrackElement does not match value from IDL" ); |
| 106 | static_assert(HTMLTrackElement::LOADING == 1, "LOADING in HTMLTrackElement does not match value from IDL" ); |
| 107 | static_assert(HTMLTrackElement::LOADED == 2, "LOADED in HTMLTrackElement does not match value from IDL" ); |
| 108 | static_assert(HTMLTrackElement::TRACK_ERROR == 3, "TRACK_ERROR in HTMLTrackElement does not match value from IDL" ); |
| 109 | |
| 110 | template<> JSValue JSHTMLTrackElementConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
| 111 | { |
| 112 | return JSHTMLElement::getConstructor(vm, &globalObject); |
| 113 | } |
| 114 | |
| 115 | template<> void JSHTMLTrackElementConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
| 116 | { |
| 117 | putDirect(vm, vm.propertyNames->prototype, JSHTMLTrackElement::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 118 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("HTMLTrackElement"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 119 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 120 | reifyStaticProperties(vm, JSHTMLTrackElement::info(), JSHTMLTrackElementConstructorTableValues, *this); |
| 121 | } |
| 122 | |
| 123 | template<> const ClassInfo JSHTMLTrackElementConstructor::s_info = { "HTMLTrackElement" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLTrackElementConstructor) }; |
| 124 | |
| 125 | /* Hash table for prototype */ |
| 126 | |
| 127 | static const HashTableValue JSHTMLTrackElementPrototypeTableValues[] = |
| 128 | { |
| 129 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLTrackElementConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLTrackElementConstructor) } }, |
| 130 | { "kind" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLTrackElementKind), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLTrackElementKind) } }, |
| 131 | { "src" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLTrackElementSrc), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLTrackElementSrc) } }, |
| 132 | { "srclang" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLTrackElementSrclang), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLTrackElementSrclang) } }, |
| 133 | { "label" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLTrackElementLabel), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLTrackElementLabel) } }, |
| 134 | { "default" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLTrackElementDefault), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLTrackElementDefault) } }, |
| 135 | { "readyState" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLTrackElementReadyState), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 136 | { "track" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLTrackElementTrack), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 137 | { "NONE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0) } }, |
| 138 | { "LOADING" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(1) } }, |
| 139 | { "LOADED" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(2) } }, |
| 140 | { "ERROR" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(3) } }, |
| 141 | }; |
| 142 | |
| 143 | const ClassInfo JSHTMLTrackElementPrototype::s_info = { "HTMLTrackElementPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLTrackElementPrototype) }; |
| 144 | |
| 145 | void JSHTMLTrackElementPrototype::finishCreation(VM& vm) |
| 146 | { |
| 147 | Base::finishCreation(vm); |
| 148 | reifyStaticProperties(vm, JSHTMLTrackElement::info(), JSHTMLTrackElementPrototypeTableValues, *this); |
| 149 | } |
| 150 | |
| 151 | const ClassInfo JSHTMLTrackElement::s_info = { "HTMLTrackElement" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLTrackElement) }; |
| 152 | |
| 153 | JSHTMLTrackElement::JSHTMLTrackElement(Structure* structure, JSDOMGlobalObject& globalObject, Ref<HTMLTrackElement>&& impl) |
| 154 | : JSHTMLElement(structure, globalObject, WTFMove(impl)) |
| 155 | { |
| 156 | } |
| 157 | |
| 158 | void JSHTMLTrackElement::finishCreation(VM& vm) |
| 159 | { |
| 160 | Base::finishCreation(vm); |
| 161 | ASSERT(inherits(vm, info())); |
| 162 | |
| 163 | } |
| 164 | |
| 165 | JSObject* JSHTMLTrackElement::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
| 166 | { |
| 167 | return JSHTMLTrackElementPrototype::create(vm, &globalObject, JSHTMLTrackElementPrototype::createStructure(vm, &globalObject, JSHTMLElement::prototype(vm, globalObject))); |
| 168 | } |
| 169 | |
| 170 | JSObject* JSHTMLTrackElement::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
| 171 | { |
| 172 | return getDOMPrototype<JSHTMLTrackElement>(vm, globalObject); |
| 173 | } |
| 174 | |
| 175 | JSValue JSHTMLTrackElement::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
| 176 | { |
| 177 | return getDOMConstructor<JSHTMLTrackElementConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
| 178 | } |
| 179 | |
| 180 | template<> inline JSHTMLTrackElement* IDLAttribute<JSHTMLTrackElement>::cast(ExecState& state, EncodedJSValue thisValue) |
| 181 | { |
| 182 | return jsDynamicCast<JSHTMLTrackElement*>(state.vm(), JSValue::decode(thisValue)); |
| 183 | } |
| 184 | |
| 185 | EncodedJSValue jsHTMLTrackElementConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 186 | { |
| 187 | VM& vm = state->vm(); |
| 188 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 189 | auto* prototype = jsDynamicCast<JSHTMLTrackElementPrototype*>(vm, JSValue::decode(thisValue)); |
| 190 | if (UNLIKELY(!prototype)) |
| 191 | return throwVMTypeError(state, throwScope); |
| 192 | return JSValue::encode(JSHTMLTrackElement::getConstructor(state->vm(), prototype->globalObject())); |
| 193 | } |
| 194 | |
| 195 | bool setJSHTMLTrackElementConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 196 | { |
| 197 | VM& vm = state->vm(); |
| 198 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 199 | auto* prototype = jsDynamicCast<JSHTMLTrackElementPrototype*>(vm, JSValue::decode(thisValue)); |
| 200 | if (UNLIKELY(!prototype)) { |
| 201 | throwVMTypeError(state, throwScope); |
| 202 | return false; |
| 203 | } |
| 204 | // Shadowing a built-in constructor |
| 205 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
| 206 | } |
| 207 | |
| 208 | static inline JSValue jsHTMLTrackElementKindGetter(ExecState& state, JSHTMLTrackElement& thisObject, ThrowScope& throwScope) |
| 209 | { |
| 210 | UNUSED_PARAM(throwScope); |
| 211 | UNUSED_PARAM(state); |
| 212 | auto& impl = thisObject.wrapped(); |
| 213 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.kind()); |
| 214 | return result; |
| 215 | } |
| 216 | |
| 217 | EncodedJSValue jsHTMLTrackElementKind(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 218 | { |
| 219 | return IDLAttribute<JSHTMLTrackElement>::get<jsHTMLTrackElementKindGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "kind" ); |
| 220 | } |
| 221 | |
| 222 | static inline bool setJSHTMLTrackElementKindSetter(ExecState& state, JSHTMLTrackElement& thisObject, JSValue value, ThrowScope& throwScope) |
| 223 | { |
| 224 | UNUSED_PARAM(throwScope); |
| 225 | CustomElementReactionDisallowedScope customElementReactionDisallowedScope; |
| 226 | auto& impl = thisObject.wrapped(); |
| 227 | auto nativeValue = convert<IDLDOMString>(state, value); |
| 228 | RETURN_IF_EXCEPTION(throwScope, false); |
| 229 | AttributeSetter::call(state, throwScope, [&] { |
| 230 | return impl.setKind(WTFMove(nativeValue)); |
| 231 | }); |
| 232 | return true; |
| 233 | } |
| 234 | |
| 235 | bool setJSHTMLTrackElementKind(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 236 | { |
| 237 | return IDLAttribute<JSHTMLTrackElement>::set<setJSHTMLTrackElementKindSetter>(*state, thisValue, encodedValue, "kind" ); |
| 238 | } |
| 239 | |
| 240 | static inline JSValue jsHTMLTrackElementSrcGetter(ExecState& state, JSHTMLTrackElement& thisObject, ThrowScope& throwScope) |
| 241 | { |
| 242 | UNUSED_PARAM(throwScope); |
| 243 | UNUSED_PARAM(state); |
| 244 | auto& impl = thisObject.wrapped(); |
| 245 | JSValue result = toJS<IDLUSVString>(state, throwScope, impl.getURLAttribute(WebCore::HTMLNames::srcAttr)); |
| 246 | return result; |
| 247 | } |
| 248 | |
| 249 | EncodedJSValue jsHTMLTrackElementSrc(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 250 | { |
| 251 | return IDLAttribute<JSHTMLTrackElement>::get<jsHTMLTrackElementSrcGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "src" ); |
| 252 | } |
| 253 | |
| 254 | static inline bool setJSHTMLTrackElementSrcSetter(ExecState& state, JSHTMLTrackElement& thisObject, JSValue value, ThrowScope& throwScope) |
| 255 | { |
| 256 | UNUSED_PARAM(throwScope); |
| 257 | CustomElementReactionDisallowedScope customElementReactionDisallowedScope; |
| 258 | auto& impl = thisObject.wrapped(); |
| 259 | auto nativeValue = convert<IDLUSVString>(state, value); |
| 260 | RETURN_IF_EXCEPTION(throwScope, false); |
| 261 | AttributeSetter::call(state, throwScope, [&] { |
| 262 | return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::srcAttr, WTFMove(nativeValue)); |
| 263 | }); |
| 264 | return true; |
| 265 | } |
| 266 | |
| 267 | bool setJSHTMLTrackElementSrc(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 268 | { |
| 269 | return IDLAttribute<JSHTMLTrackElement>::set<setJSHTMLTrackElementSrcSetter>(*state, thisValue, encodedValue, "src" ); |
| 270 | } |
| 271 | |
| 272 | static inline JSValue jsHTMLTrackElementSrclangGetter(ExecState& state, JSHTMLTrackElement& thisObject, ThrowScope& throwScope) |
| 273 | { |
| 274 | UNUSED_PARAM(throwScope); |
| 275 | UNUSED_PARAM(state); |
| 276 | auto& impl = thisObject.wrapped(); |
| 277 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.attributeWithoutSynchronization(WebCore::HTMLNames::srclangAttr)); |
| 278 | return result; |
| 279 | } |
| 280 | |
| 281 | EncodedJSValue jsHTMLTrackElementSrclang(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 282 | { |
| 283 | return IDLAttribute<JSHTMLTrackElement>::get<jsHTMLTrackElementSrclangGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "srclang" ); |
| 284 | } |
| 285 | |
| 286 | static inline bool setJSHTMLTrackElementSrclangSetter(ExecState& state, JSHTMLTrackElement& thisObject, JSValue value, ThrowScope& throwScope) |
| 287 | { |
| 288 | UNUSED_PARAM(throwScope); |
| 289 | CustomElementReactionDisallowedScope customElementReactionDisallowedScope; |
| 290 | auto& impl = thisObject.wrapped(); |
| 291 | auto nativeValue = convert<IDLDOMString>(state, value); |
| 292 | RETURN_IF_EXCEPTION(throwScope, false); |
| 293 | AttributeSetter::call(state, throwScope, [&] { |
| 294 | return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::srclangAttr, WTFMove(nativeValue)); |
| 295 | }); |
| 296 | return true; |
| 297 | } |
| 298 | |
| 299 | bool setJSHTMLTrackElementSrclang(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 300 | { |
| 301 | return IDLAttribute<JSHTMLTrackElement>::set<setJSHTMLTrackElementSrclangSetter>(*state, thisValue, encodedValue, "srclang" ); |
| 302 | } |
| 303 | |
| 304 | static inline JSValue jsHTMLTrackElementLabelGetter(ExecState& state, JSHTMLTrackElement& thisObject, ThrowScope& throwScope) |
| 305 | { |
| 306 | UNUSED_PARAM(throwScope); |
| 307 | UNUSED_PARAM(state); |
| 308 | auto& impl = thisObject.wrapped(); |
| 309 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.attributeWithoutSynchronization(WebCore::HTMLNames::labelAttr)); |
| 310 | return result; |
| 311 | } |
| 312 | |
| 313 | EncodedJSValue jsHTMLTrackElementLabel(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 314 | { |
| 315 | return IDLAttribute<JSHTMLTrackElement>::get<jsHTMLTrackElementLabelGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "label" ); |
| 316 | } |
| 317 | |
| 318 | static inline bool setJSHTMLTrackElementLabelSetter(ExecState& state, JSHTMLTrackElement& thisObject, JSValue value, ThrowScope& throwScope) |
| 319 | { |
| 320 | UNUSED_PARAM(throwScope); |
| 321 | CustomElementReactionDisallowedScope customElementReactionDisallowedScope; |
| 322 | auto& impl = thisObject.wrapped(); |
| 323 | auto nativeValue = convert<IDLDOMString>(state, value); |
| 324 | RETURN_IF_EXCEPTION(throwScope, false); |
| 325 | AttributeSetter::call(state, throwScope, [&] { |
| 326 | return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::labelAttr, WTFMove(nativeValue)); |
| 327 | }); |
| 328 | return true; |
| 329 | } |
| 330 | |
| 331 | bool setJSHTMLTrackElementLabel(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 332 | { |
| 333 | return IDLAttribute<JSHTMLTrackElement>::set<setJSHTMLTrackElementLabelSetter>(*state, thisValue, encodedValue, "label" ); |
| 334 | } |
| 335 | |
| 336 | static inline JSValue jsHTMLTrackElementDefaultGetter(ExecState& state, JSHTMLTrackElement& thisObject, ThrowScope& throwScope) |
| 337 | { |
| 338 | UNUSED_PARAM(throwScope); |
| 339 | UNUSED_PARAM(state); |
| 340 | auto& impl = thisObject.wrapped(); |
| 341 | JSValue result = toJS<IDLBoolean>(state, throwScope, impl.hasAttributeWithoutSynchronization(WebCore::HTMLNames::defaultAttr)); |
| 342 | return result; |
| 343 | } |
| 344 | |
| 345 | EncodedJSValue jsHTMLTrackElementDefault(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 346 | { |
| 347 | return IDLAttribute<JSHTMLTrackElement>::get<jsHTMLTrackElementDefaultGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "default" ); |
| 348 | } |
| 349 | |
| 350 | static inline bool setJSHTMLTrackElementDefaultSetter(ExecState& state, JSHTMLTrackElement& thisObject, JSValue value, ThrowScope& throwScope) |
| 351 | { |
| 352 | UNUSED_PARAM(throwScope); |
| 353 | CustomElementReactionDisallowedScope customElementReactionDisallowedScope; |
| 354 | auto& impl = thisObject.wrapped(); |
| 355 | auto nativeValue = convert<IDLBoolean>(state, value); |
| 356 | RETURN_IF_EXCEPTION(throwScope, false); |
| 357 | AttributeSetter::call(state, throwScope, [&] { |
| 358 | return impl.setBooleanAttribute(WebCore::HTMLNames::defaultAttr, WTFMove(nativeValue)); |
| 359 | }); |
| 360 | return true; |
| 361 | } |
| 362 | |
| 363 | bool setJSHTMLTrackElementDefault(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 364 | { |
| 365 | return IDLAttribute<JSHTMLTrackElement>::set<setJSHTMLTrackElementDefaultSetter>(*state, thisValue, encodedValue, "default" ); |
| 366 | } |
| 367 | |
| 368 | static inline JSValue jsHTMLTrackElementReadyStateGetter(ExecState& state, JSHTMLTrackElement& thisObject, ThrowScope& throwScope) |
| 369 | { |
| 370 | UNUSED_PARAM(throwScope); |
| 371 | UNUSED_PARAM(state); |
| 372 | auto& impl = thisObject.wrapped(); |
| 373 | JSValue result = toJS<IDLUnsignedShort>(state, throwScope, impl.readyState()); |
| 374 | return result; |
| 375 | } |
| 376 | |
| 377 | EncodedJSValue jsHTMLTrackElementReadyState(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 378 | { |
| 379 | return IDLAttribute<JSHTMLTrackElement>::get<jsHTMLTrackElementReadyStateGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "readyState" ); |
| 380 | } |
| 381 | |
| 382 | static inline JSValue jsHTMLTrackElementTrackGetter(ExecState& state, JSHTMLTrackElement& thisObject, ThrowScope& throwScope) |
| 383 | { |
| 384 | UNUSED_PARAM(throwScope); |
| 385 | UNUSED_PARAM(state); |
| 386 | auto& impl = thisObject.wrapped(); |
| 387 | JSValue result = toJS<IDLInterface<TextTrack>>(state, *thisObject.globalObject(), throwScope, impl.track()); |
| 388 | return result; |
| 389 | } |
| 390 | |
| 391 | EncodedJSValue jsHTMLTrackElementTrack(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 392 | { |
| 393 | return IDLAttribute<JSHTMLTrackElement>::get<jsHTMLTrackElementTrackGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "track" ); |
| 394 | } |
| 395 | |
| 396 | void JSHTMLTrackElement::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
| 397 | { |
| 398 | auto* thisObject = jsCast<JSHTMLTrackElement*>(cell); |
| 399 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
| 400 | if (thisObject->scriptExecutionContext()) |
| 401 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
| 402 | Base::heapSnapshot(cell, builder); |
| 403 | } |
| 404 | |
| 405 | |
| 406 | } |
| 407 | |
| 408 | #endif // ENABLE(VIDEO_TRACK) |
| 409 | |