| 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(SPEECH_SYNTHESIS) |
| 24 | |
| 25 | #include "JSSpeechSynthesisUtterance.h" |
| 26 | |
| 27 | #include "EventNames.h" |
| 28 | #include "JSDOMAttribute.h" |
| 29 | #include "JSDOMBinding.h" |
| 30 | #include "JSDOMConstructor.h" |
| 31 | #include "JSDOMConvertInterface.h" |
| 32 | #include "JSDOMConvertNullable.h" |
| 33 | #include "JSDOMConvertNumbers.h" |
| 34 | #include "JSDOMConvertStrings.h" |
| 35 | #include "JSDOMExceptionHandling.h" |
| 36 | #include "JSDOMGlobalObject.h" |
| 37 | #include "JSDOMWrapperCache.h" |
| 38 | #include "JSEventListener.h" |
| 39 | #include "JSSpeechSynthesisVoice.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 jsSpeechSynthesisUtteranceConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 54 | bool setJSSpeechSynthesisUtteranceConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 55 | JSC::EncodedJSValue jsSpeechSynthesisUtteranceText(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 56 | bool setJSSpeechSynthesisUtteranceText(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 57 | JSC::EncodedJSValue jsSpeechSynthesisUtteranceLang(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 58 | bool setJSSpeechSynthesisUtteranceLang(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 59 | JSC::EncodedJSValue jsSpeechSynthesisUtteranceVoice(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 60 | bool setJSSpeechSynthesisUtteranceVoice(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 61 | JSC::EncodedJSValue jsSpeechSynthesisUtteranceVolume(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 62 | bool setJSSpeechSynthesisUtteranceVolume(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 63 | JSC::EncodedJSValue jsSpeechSynthesisUtteranceRate(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 64 | bool setJSSpeechSynthesisUtteranceRate(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 65 | JSC::EncodedJSValue jsSpeechSynthesisUtterancePitch(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 66 | bool setJSSpeechSynthesisUtterancePitch(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 67 | JSC::EncodedJSValue jsSpeechSynthesisUtteranceOnstart(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 68 | bool setJSSpeechSynthesisUtteranceOnstart(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 69 | JSC::EncodedJSValue jsSpeechSynthesisUtteranceOnend(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 70 | bool setJSSpeechSynthesisUtteranceOnend(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 71 | JSC::EncodedJSValue jsSpeechSynthesisUtteranceOnerror(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 72 | bool setJSSpeechSynthesisUtteranceOnerror(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 73 | JSC::EncodedJSValue jsSpeechSynthesisUtteranceOnpause(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 74 | bool setJSSpeechSynthesisUtteranceOnpause(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 75 | JSC::EncodedJSValue jsSpeechSynthesisUtteranceOnresume(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 76 | bool setJSSpeechSynthesisUtteranceOnresume(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 77 | JSC::EncodedJSValue jsSpeechSynthesisUtteranceOnmark(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 78 | bool setJSSpeechSynthesisUtteranceOnmark(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 79 | JSC::EncodedJSValue jsSpeechSynthesisUtteranceOnboundary(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 80 | bool setJSSpeechSynthesisUtteranceOnboundary(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 81 | |
| 82 | class JSSpeechSynthesisUtterancePrototype : public JSC::JSNonFinalObject { |
| 83 | public: |
| 84 | using Base = JSC::JSNonFinalObject; |
| 85 | static JSSpeechSynthesisUtterancePrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
| 86 | { |
| 87 | JSSpeechSynthesisUtterancePrototype* ptr = new (NotNull, JSC::allocateCell<JSSpeechSynthesisUtterancePrototype>(vm.heap)) JSSpeechSynthesisUtterancePrototype(vm, globalObject, structure); |
| 88 | ptr->finishCreation(vm); |
| 89 | return ptr; |
| 90 | } |
| 91 | |
| 92 | DECLARE_INFO; |
| 93 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
| 94 | { |
| 95 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
| 96 | } |
| 97 | |
| 98 | private: |
| 99 | JSSpeechSynthesisUtterancePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
| 100 | : JSC::JSNonFinalObject(vm, structure) |
| 101 | { |
| 102 | } |
| 103 | |
| 104 | void finishCreation(JSC::VM&); |
| 105 | }; |
| 106 | |
| 107 | using JSSpeechSynthesisUtteranceConstructor = JSDOMConstructor<JSSpeechSynthesisUtterance>; |
| 108 | |
| 109 | template<> EncodedJSValue JSC_HOST_CALL JSSpeechSynthesisUtteranceConstructor::construct(ExecState* state) |
| 110 | { |
| 111 | VM& vm = state->vm(); |
| 112 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 113 | UNUSED_PARAM(throwScope); |
| 114 | auto* castedThis = jsCast<JSSpeechSynthesisUtteranceConstructor*>(state->jsCallee()); |
| 115 | ASSERT(castedThis); |
| 116 | auto* context = castedThis->scriptExecutionContext(); |
| 117 | if (UNLIKELY(!context)) |
| 118 | return throwConstructorScriptExecutionContextUnavailableError(*state, throwScope, "SpeechSynthesisUtterance" ); |
| 119 | auto text = state->argument(0).isUndefined() ? String() : convert<IDLDOMString>(*state, state->uncheckedArgument(0)); |
| 120 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| 121 | auto object = SpeechSynthesisUtterance::create(*context, WTFMove(text)); |
| 122 | return JSValue::encode(toJSNewlyCreated<IDLInterface<SpeechSynthesisUtterance>>(*state, *castedThis->globalObject(), WTFMove(object))); |
| 123 | } |
| 124 | |
| 125 | template<> JSValue JSSpeechSynthesisUtteranceConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
| 126 | { |
| 127 | return JSEventTarget::getConstructor(vm, &globalObject); |
| 128 | } |
| 129 | |
| 130 | template<> void JSSpeechSynthesisUtteranceConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
| 131 | { |
| 132 | putDirect(vm, vm.propertyNames->prototype, JSSpeechSynthesisUtterance::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 133 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("SpeechSynthesisUtterance"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 134 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 135 | } |
| 136 | |
| 137 | template<> const ClassInfo JSSpeechSynthesisUtteranceConstructor::s_info = { "SpeechSynthesisUtterance" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSpeechSynthesisUtteranceConstructor) }; |
| 138 | |
| 139 | /* Hash table for prototype */ |
| 140 | |
| 141 | static const HashTableValue JSSpeechSynthesisUtterancePrototypeTableValues[] = |
| 142 | { |
| 143 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSpeechSynthesisUtteranceConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSpeechSynthesisUtteranceConstructor) } }, |
| 144 | { "text" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSpeechSynthesisUtteranceText), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSpeechSynthesisUtteranceText) } }, |
| 145 | { "lang" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSpeechSynthesisUtteranceLang), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSpeechSynthesisUtteranceLang) } }, |
| 146 | { "voice" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSpeechSynthesisUtteranceVoice), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSpeechSynthesisUtteranceVoice) } }, |
| 147 | { "volume" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSpeechSynthesisUtteranceVolume), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSpeechSynthesisUtteranceVolume) } }, |
| 148 | { "rate" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSpeechSynthesisUtteranceRate), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSpeechSynthesisUtteranceRate) } }, |
| 149 | { "pitch" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSpeechSynthesisUtterancePitch), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSpeechSynthesisUtterancePitch) } }, |
| 150 | { "onstart" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSpeechSynthesisUtteranceOnstart), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSpeechSynthesisUtteranceOnstart) } }, |
| 151 | { "onend" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSpeechSynthesisUtteranceOnend), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSpeechSynthesisUtteranceOnend) } }, |
| 152 | { "onerror" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSpeechSynthesisUtteranceOnerror), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSpeechSynthesisUtteranceOnerror) } }, |
| 153 | { "onpause" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSpeechSynthesisUtteranceOnpause), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSpeechSynthesisUtteranceOnpause) } }, |
| 154 | { "onresume" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSpeechSynthesisUtteranceOnresume), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSpeechSynthesisUtteranceOnresume) } }, |
| 155 | { "onmark" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSpeechSynthesisUtteranceOnmark), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSpeechSynthesisUtteranceOnmark) } }, |
| 156 | { "onboundary" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSpeechSynthesisUtteranceOnboundary), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSpeechSynthesisUtteranceOnboundary) } }, |
| 157 | }; |
| 158 | |
| 159 | const ClassInfo JSSpeechSynthesisUtterancePrototype::s_info = { "SpeechSynthesisUtterancePrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSpeechSynthesisUtterancePrototype) }; |
| 160 | |
| 161 | void JSSpeechSynthesisUtterancePrototype::finishCreation(VM& vm) |
| 162 | { |
| 163 | Base::finishCreation(vm); |
| 164 | reifyStaticProperties(vm, JSSpeechSynthesisUtterance::info(), JSSpeechSynthesisUtterancePrototypeTableValues, *this); |
| 165 | } |
| 166 | |
| 167 | const ClassInfo JSSpeechSynthesisUtterance::s_info = { "SpeechSynthesisUtterance" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSpeechSynthesisUtterance) }; |
| 168 | |
| 169 | JSSpeechSynthesisUtterance::JSSpeechSynthesisUtterance(Structure* structure, JSDOMGlobalObject& globalObject, Ref<SpeechSynthesisUtterance>&& impl) |
| 170 | : JSEventTarget(structure, globalObject, WTFMove(impl)) |
| 171 | { |
| 172 | } |
| 173 | |
| 174 | void JSSpeechSynthesisUtterance::finishCreation(VM& vm) |
| 175 | { |
| 176 | Base::finishCreation(vm); |
| 177 | ASSERT(inherits(vm, info())); |
| 178 | |
| 179 | } |
| 180 | |
| 181 | JSObject* JSSpeechSynthesisUtterance::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
| 182 | { |
| 183 | return JSSpeechSynthesisUtterancePrototype::create(vm, &globalObject, JSSpeechSynthesisUtterancePrototype::createStructure(vm, &globalObject, JSEventTarget::prototype(vm, globalObject))); |
| 184 | } |
| 185 | |
| 186 | JSObject* JSSpeechSynthesisUtterance::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
| 187 | { |
| 188 | return getDOMPrototype<JSSpeechSynthesisUtterance>(vm, globalObject); |
| 189 | } |
| 190 | |
| 191 | JSValue JSSpeechSynthesisUtterance::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
| 192 | { |
| 193 | return getDOMConstructor<JSSpeechSynthesisUtteranceConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
| 194 | } |
| 195 | |
| 196 | template<> inline JSSpeechSynthesisUtterance* IDLAttribute<JSSpeechSynthesisUtterance>::cast(ExecState& state, EncodedJSValue thisValue) |
| 197 | { |
| 198 | return jsDynamicCast<JSSpeechSynthesisUtterance*>(state.vm(), JSValue::decode(thisValue)); |
| 199 | } |
| 200 | |
| 201 | EncodedJSValue jsSpeechSynthesisUtteranceConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 202 | { |
| 203 | VM& vm = state->vm(); |
| 204 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 205 | auto* prototype = jsDynamicCast<JSSpeechSynthesisUtterancePrototype*>(vm, JSValue::decode(thisValue)); |
| 206 | if (UNLIKELY(!prototype)) |
| 207 | return throwVMTypeError(state, throwScope); |
| 208 | return JSValue::encode(JSSpeechSynthesisUtterance::getConstructor(state->vm(), prototype->globalObject())); |
| 209 | } |
| 210 | |
| 211 | bool setJSSpeechSynthesisUtteranceConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 212 | { |
| 213 | VM& vm = state->vm(); |
| 214 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 215 | auto* prototype = jsDynamicCast<JSSpeechSynthesisUtterancePrototype*>(vm, JSValue::decode(thisValue)); |
| 216 | if (UNLIKELY(!prototype)) { |
| 217 | throwVMTypeError(state, throwScope); |
| 218 | return false; |
| 219 | } |
| 220 | // Shadowing a built-in constructor |
| 221 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
| 222 | } |
| 223 | |
| 224 | static inline JSValue jsSpeechSynthesisUtteranceTextGetter(ExecState& state, JSSpeechSynthesisUtterance& thisObject, ThrowScope& throwScope) |
| 225 | { |
| 226 | UNUSED_PARAM(throwScope); |
| 227 | UNUSED_PARAM(state); |
| 228 | auto& impl = thisObject.wrapped(); |
| 229 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.text()); |
| 230 | return result; |
| 231 | } |
| 232 | |
| 233 | EncodedJSValue jsSpeechSynthesisUtteranceText(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 234 | { |
| 235 | return IDLAttribute<JSSpeechSynthesisUtterance>::get<jsSpeechSynthesisUtteranceTextGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "text" ); |
| 236 | } |
| 237 | |
| 238 | static inline bool setJSSpeechSynthesisUtteranceTextSetter(ExecState& state, JSSpeechSynthesisUtterance& thisObject, JSValue value, ThrowScope& throwScope) |
| 239 | { |
| 240 | UNUSED_PARAM(throwScope); |
| 241 | auto& impl = thisObject.wrapped(); |
| 242 | auto nativeValue = convert<IDLDOMString>(state, value); |
| 243 | RETURN_IF_EXCEPTION(throwScope, false); |
| 244 | AttributeSetter::call(state, throwScope, [&] { |
| 245 | return impl.setText(WTFMove(nativeValue)); |
| 246 | }); |
| 247 | return true; |
| 248 | } |
| 249 | |
| 250 | bool setJSSpeechSynthesisUtteranceText(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 251 | { |
| 252 | return IDLAttribute<JSSpeechSynthesisUtterance>::set<setJSSpeechSynthesisUtteranceTextSetter>(*state, thisValue, encodedValue, "text" ); |
| 253 | } |
| 254 | |
| 255 | static inline JSValue jsSpeechSynthesisUtteranceLangGetter(ExecState& state, JSSpeechSynthesisUtterance& thisObject, ThrowScope& throwScope) |
| 256 | { |
| 257 | UNUSED_PARAM(throwScope); |
| 258 | UNUSED_PARAM(state); |
| 259 | auto& impl = thisObject.wrapped(); |
| 260 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.lang()); |
| 261 | return result; |
| 262 | } |
| 263 | |
| 264 | EncodedJSValue jsSpeechSynthesisUtteranceLang(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 265 | { |
| 266 | return IDLAttribute<JSSpeechSynthesisUtterance>::get<jsSpeechSynthesisUtteranceLangGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "lang" ); |
| 267 | } |
| 268 | |
| 269 | static inline bool setJSSpeechSynthesisUtteranceLangSetter(ExecState& state, JSSpeechSynthesisUtterance& thisObject, JSValue value, ThrowScope& throwScope) |
| 270 | { |
| 271 | UNUSED_PARAM(throwScope); |
| 272 | auto& impl = thisObject.wrapped(); |
| 273 | auto nativeValue = convert<IDLDOMString>(state, value); |
| 274 | RETURN_IF_EXCEPTION(throwScope, false); |
| 275 | AttributeSetter::call(state, throwScope, [&] { |
| 276 | return impl.setLang(WTFMove(nativeValue)); |
| 277 | }); |
| 278 | return true; |
| 279 | } |
| 280 | |
| 281 | bool setJSSpeechSynthesisUtteranceLang(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 282 | { |
| 283 | return IDLAttribute<JSSpeechSynthesisUtterance>::set<setJSSpeechSynthesisUtteranceLangSetter>(*state, thisValue, encodedValue, "lang" ); |
| 284 | } |
| 285 | |
| 286 | static inline JSValue jsSpeechSynthesisUtteranceVoiceGetter(ExecState& state, JSSpeechSynthesisUtterance& thisObject, ThrowScope& throwScope) |
| 287 | { |
| 288 | UNUSED_PARAM(throwScope); |
| 289 | UNUSED_PARAM(state); |
| 290 | auto& impl = thisObject.wrapped(); |
| 291 | JSValue result = toJS<IDLNullable<IDLInterface<SpeechSynthesisVoice>>>(state, *thisObject.globalObject(), throwScope, impl.voice()); |
| 292 | return result; |
| 293 | } |
| 294 | |
| 295 | EncodedJSValue jsSpeechSynthesisUtteranceVoice(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 296 | { |
| 297 | return IDLAttribute<JSSpeechSynthesisUtterance>::get<jsSpeechSynthesisUtteranceVoiceGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "voice" ); |
| 298 | } |
| 299 | |
| 300 | static inline bool setJSSpeechSynthesisUtteranceVoiceSetter(ExecState& state, JSSpeechSynthesisUtterance& thisObject, JSValue value, ThrowScope& throwScope) |
| 301 | { |
| 302 | UNUSED_PARAM(throwScope); |
| 303 | auto& impl = thisObject.wrapped(); |
| 304 | auto nativeValue = convert<IDLNullable<IDLInterface<SpeechSynthesisVoice>>>(state, value, [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwAttributeTypeError(state, scope, "SpeechSynthesisUtterance" , "voice" , "SpeechSynthesisVoice" ); }); |
| 305 | RETURN_IF_EXCEPTION(throwScope, false); |
| 306 | AttributeSetter::call(state, throwScope, [&] { |
| 307 | return impl.setVoice(WTFMove(nativeValue)); |
| 308 | }); |
| 309 | return true; |
| 310 | } |
| 311 | |
| 312 | bool setJSSpeechSynthesisUtteranceVoice(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 313 | { |
| 314 | return IDLAttribute<JSSpeechSynthesisUtterance>::set<setJSSpeechSynthesisUtteranceVoiceSetter>(*state, thisValue, encodedValue, "voice" ); |
| 315 | } |
| 316 | |
| 317 | static inline JSValue jsSpeechSynthesisUtteranceVolumeGetter(ExecState& state, JSSpeechSynthesisUtterance& thisObject, ThrowScope& throwScope) |
| 318 | { |
| 319 | UNUSED_PARAM(throwScope); |
| 320 | UNUSED_PARAM(state); |
| 321 | auto& impl = thisObject.wrapped(); |
| 322 | JSValue result = toJS<IDLUnrestrictedFloat>(state, throwScope, impl.volume()); |
| 323 | return result; |
| 324 | } |
| 325 | |
| 326 | EncodedJSValue jsSpeechSynthesisUtteranceVolume(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 327 | { |
| 328 | return IDLAttribute<JSSpeechSynthesisUtterance>::get<jsSpeechSynthesisUtteranceVolumeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "volume" ); |
| 329 | } |
| 330 | |
| 331 | static inline bool setJSSpeechSynthesisUtteranceVolumeSetter(ExecState& state, JSSpeechSynthesisUtterance& thisObject, JSValue value, ThrowScope& throwScope) |
| 332 | { |
| 333 | UNUSED_PARAM(throwScope); |
| 334 | auto& impl = thisObject.wrapped(); |
| 335 | auto nativeValue = convert<IDLUnrestrictedFloat>(state, value); |
| 336 | RETURN_IF_EXCEPTION(throwScope, false); |
| 337 | AttributeSetter::call(state, throwScope, [&] { |
| 338 | return impl.setVolume(WTFMove(nativeValue)); |
| 339 | }); |
| 340 | return true; |
| 341 | } |
| 342 | |
| 343 | bool setJSSpeechSynthesisUtteranceVolume(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 344 | { |
| 345 | return IDLAttribute<JSSpeechSynthesisUtterance>::set<setJSSpeechSynthesisUtteranceVolumeSetter>(*state, thisValue, encodedValue, "volume" ); |
| 346 | } |
| 347 | |
| 348 | static inline JSValue jsSpeechSynthesisUtteranceRateGetter(ExecState& state, JSSpeechSynthesisUtterance& thisObject, ThrowScope& throwScope) |
| 349 | { |
| 350 | UNUSED_PARAM(throwScope); |
| 351 | UNUSED_PARAM(state); |
| 352 | auto& impl = thisObject.wrapped(); |
| 353 | JSValue result = toJS<IDLUnrestrictedFloat>(state, throwScope, impl.rate()); |
| 354 | return result; |
| 355 | } |
| 356 | |
| 357 | EncodedJSValue jsSpeechSynthesisUtteranceRate(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 358 | { |
| 359 | return IDLAttribute<JSSpeechSynthesisUtterance>::get<jsSpeechSynthesisUtteranceRateGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "rate" ); |
| 360 | } |
| 361 | |
| 362 | static inline bool setJSSpeechSynthesisUtteranceRateSetter(ExecState& state, JSSpeechSynthesisUtterance& thisObject, JSValue value, ThrowScope& throwScope) |
| 363 | { |
| 364 | UNUSED_PARAM(throwScope); |
| 365 | auto& impl = thisObject.wrapped(); |
| 366 | auto nativeValue = convert<IDLUnrestrictedFloat>(state, value); |
| 367 | RETURN_IF_EXCEPTION(throwScope, false); |
| 368 | AttributeSetter::call(state, throwScope, [&] { |
| 369 | return impl.setRate(WTFMove(nativeValue)); |
| 370 | }); |
| 371 | return true; |
| 372 | } |
| 373 | |
| 374 | bool setJSSpeechSynthesisUtteranceRate(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 375 | { |
| 376 | return IDLAttribute<JSSpeechSynthesisUtterance>::set<setJSSpeechSynthesisUtteranceRateSetter>(*state, thisValue, encodedValue, "rate" ); |
| 377 | } |
| 378 | |
| 379 | static inline JSValue jsSpeechSynthesisUtterancePitchGetter(ExecState& state, JSSpeechSynthesisUtterance& thisObject, ThrowScope& throwScope) |
| 380 | { |
| 381 | UNUSED_PARAM(throwScope); |
| 382 | UNUSED_PARAM(state); |
| 383 | auto& impl = thisObject.wrapped(); |
| 384 | JSValue result = toJS<IDLUnrestrictedFloat>(state, throwScope, impl.pitch()); |
| 385 | return result; |
| 386 | } |
| 387 | |
| 388 | EncodedJSValue jsSpeechSynthesisUtterancePitch(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 389 | { |
| 390 | return IDLAttribute<JSSpeechSynthesisUtterance>::get<jsSpeechSynthesisUtterancePitchGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "pitch" ); |
| 391 | } |
| 392 | |
| 393 | static inline bool setJSSpeechSynthesisUtterancePitchSetter(ExecState& state, JSSpeechSynthesisUtterance& thisObject, JSValue value, ThrowScope& throwScope) |
| 394 | { |
| 395 | UNUSED_PARAM(throwScope); |
| 396 | auto& impl = thisObject.wrapped(); |
| 397 | auto nativeValue = convert<IDLUnrestrictedFloat>(state, value); |
| 398 | RETURN_IF_EXCEPTION(throwScope, false); |
| 399 | AttributeSetter::call(state, throwScope, [&] { |
| 400 | return impl.setPitch(WTFMove(nativeValue)); |
| 401 | }); |
| 402 | return true; |
| 403 | } |
| 404 | |
| 405 | bool setJSSpeechSynthesisUtterancePitch(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 406 | { |
| 407 | return IDLAttribute<JSSpeechSynthesisUtterance>::set<setJSSpeechSynthesisUtterancePitchSetter>(*state, thisValue, encodedValue, "pitch" ); |
| 408 | } |
| 409 | |
| 410 | static inline JSValue jsSpeechSynthesisUtteranceOnstartGetter(ExecState& state, JSSpeechSynthesisUtterance& thisObject, ThrowScope& throwScope) |
| 411 | { |
| 412 | UNUSED_PARAM(throwScope); |
| 413 | UNUSED_PARAM(state); |
| 414 | return eventHandlerAttribute(thisObject.wrapped(), eventNames().startEvent, worldForDOMObject(thisObject)); |
| 415 | } |
| 416 | |
| 417 | EncodedJSValue jsSpeechSynthesisUtteranceOnstart(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 418 | { |
| 419 | return IDLAttribute<JSSpeechSynthesisUtterance>::get<jsSpeechSynthesisUtteranceOnstartGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "onstart" ); |
| 420 | } |
| 421 | |
| 422 | static inline bool setJSSpeechSynthesisUtteranceOnstartSetter(ExecState& state, JSSpeechSynthesisUtterance& thisObject, JSValue value, ThrowScope& throwScope) |
| 423 | { |
| 424 | UNUSED_PARAM(throwScope); |
| 425 | setEventHandlerAttribute(state, thisObject, thisObject.wrapped(), eventNames().startEvent, value); |
| 426 | return true; |
| 427 | } |
| 428 | |
| 429 | bool setJSSpeechSynthesisUtteranceOnstart(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 430 | { |
| 431 | return IDLAttribute<JSSpeechSynthesisUtterance>::set<setJSSpeechSynthesisUtteranceOnstartSetter>(*state, thisValue, encodedValue, "onstart" ); |
| 432 | } |
| 433 | |
| 434 | static inline JSValue jsSpeechSynthesisUtteranceOnendGetter(ExecState& state, JSSpeechSynthesisUtterance& thisObject, ThrowScope& throwScope) |
| 435 | { |
| 436 | UNUSED_PARAM(throwScope); |
| 437 | UNUSED_PARAM(state); |
| 438 | return eventHandlerAttribute(thisObject.wrapped(), eventNames().endEvent, worldForDOMObject(thisObject)); |
| 439 | } |
| 440 | |
| 441 | EncodedJSValue jsSpeechSynthesisUtteranceOnend(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 442 | { |
| 443 | return IDLAttribute<JSSpeechSynthesisUtterance>::get<jsSpeechSynthesisUtteranceOnendGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "onend" ); |
| 444 | } |
| 445 | |
| 446 | static inline bool setJSSpeechSynthesisUtteranceOnendSetter(ExecState& state, JSSpeechSynthesisUtterance& thisObject, JSValue value, ThrowScope& throwScope) |
| 447 | { |
| 448 | UNUSED_PARAM(throwScope); |
| 449 | setEventHandlerAttribute(state, thisObject, thisObject.wrapped(), eventNames().endEvent, value); |
| 450 | return true; |
| 451 | } |
| 452 | |
| 453 | bool setJSSpeechSynthesisUtteranceOnend(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 454 | { |
| 455 | return IDLAttribute<JSSpeechSynthesisUtterance>::set<setJSSpeechSynthesisUtteranceOnendSetter>(*state, thisValue, encodedValue, "onend" ); |
| 456 | } |
| 457 | |
| 458 | static inline JSValue jsSpeechSynthesisUtteranceOnerrorGetter(ExecState& state, JSSpeechSynthesisUtterance& thisObject, ThrowScope& throwScope) |
| 459 | { |
| 460 | UNUSED_PARAM(throwScope); |
| 461 | UNUSED_PARAM(state); |
| 462 | return eventHandlerAttribute(thisObject.wrapped(), eventNames().errorEvent, worldForDOMObject(thisObject)); |
| 463 | } |
| 464 | |
| 465 | EncodedJSValue jsSpeechSynthesisUtteranceOnerror(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 466 | { |
| 467 | return IDLAttribute<JSSpeechSynthesisUtterance>::get<jsSpeechSynthesisUtteranceOnerrorGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "onerror" ); |
| 468 | } |
| 469 | |
| 470 | static inline bool setJSSpeechSynthesisUtteranceOnerrorSetter(ExecState& state, JSSpeechSynthesisUtterance& thisObject, JSValue value, ThrowScope& throwScope) |
| 471 | { |
| 472 | UNUSED_PARAM(throwScope); |
| 473 | setEventHandlerAttribute(state, thisObject, thisObject.wrapped(), eventNames().errorEvent, value); |
| 474 | return true; |
| 475 | } |
| 476 | |
| 477 | bool setJSSpeechSynthesisUtteranceOnerror(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 478 | { |
| 479 | return IDLAttribute<JSSpeechSynthesisUtterance>::set<setJSSpeechSynthesisUtteranceOnerrorSetter>(*state, thisValue, encodedValue, "onerror" ); |
| 480 | } |
| 481 | |
| 482 | static inline JSValue jsSpeechSynthesisUtteranceOnpauseGetter(ExecState& state, JSSpeechSynthesisUtterance& thisObject, ThrowScope& throwScope) |
| 483 | { |
| 484 | UNUSED_PARAM(throwScope); |
| 485 | UNUSED_PARAM(state); |
| 486 | return eventHandlerAttribute(thisObject.wrapped(), eventNames().pauseEvent, worldForDOMObject(thisObject)); |
| 487 | } |
| 488 | |
| 489 | EncodedJSValue jsSpeechSynthesisUtteranceOnpause(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 490 | { |
| 491 | return IDLAttribute<JSSpeechSynthesisUtterance>::get<jsSpeechSynthesisUtteranceOnpauseGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "onpause" ); |
| 492 | } |
| 493 | |
| 494 | static inline bool setJSSpeechSynthesisUtteranceOnpauseSetter(ExecState& state, JSSpeechSynthesisUtterance& thisObject, JSValue value, ThrowScope& throwScope) |
| 495 | { |
| 496 | UNUSED_PARAM(throwScope); |
| 497 | setEventHandlerAttribute(state, thisObject, thisObject.wrapped(), eventNames().pauseEvent, value); |
| 498 | return true; |
| 499 | } |
| 500 | |
| 501 | bool setJSSpeechSynthesisUtteranceOnpause(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 502 | { |
| 503 | return IDLAttribute<JSSpeechSynthesisUtterance>::set<setJSSpeechSynthesisUtteranceOnpauseSetter>(*state, thisValue, encodedValue, "onpause" ); |
| 504 | } |
| 505 | |
| 506 | static inline JSValue jsSpeechSynthesisUtteranceOnresumeGetter(ExecState& state, JSSpeechSynthesisUtterance& thisObject, ThrowScope& throwScope) |
| 507 | { |
| 508 | UNUSED_PARAM(throwScope); |
| 509 | UNUSED_PARAM(state); |
| 510 | return eventHandlerAttribute(thisObject.wrapped(), eventNames().resumeEvent, worldForDOMObject(thisObject)); |
| 511 | } |
| 512 | |
| 513 | EncodedJSValue jsSpeechSynthesisUtteranceOnresume(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 514 | { |
| 515 | return IDLAttribute<JSSpeechSynthesisUtterance>::get<jsSpeechSynthesisUtteranceOnresumeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "onresume" ); |
| 516 | } |
| 517 | |
| 518 | static inline bool setJSSpeechSynthesisUtteranceOnresumeSetter(ExecState& state, JSSpeechSynthesisUtterance& thisObject, JSValue value, ThrowScope& throwScope) |
| 519 | { |
| 520 | UNUSED_PARAM(throwScope); |
| 521 | setEventHandlerAttribute(state, thisObject, thisObject.wrapped(), eventNames().resumeEvent, value); |
| 522 | return true; |
| 523 | } |
| 524 | |
| 525 | bool setJSSpeechSynthesisUtteranceOnresume(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 526 | { |
| 527 | return IDLAttribute<JSSpeechSynthesisUtterance>::set<setJSSpeechSynthesisUtteranceOnresumeSetter>(*state, thisValue, encodedValue, "onresume" ); |
| 528 | } |
| 529 | |
| 530 | static inline JSValue jsSpeechSynthesisUtteranceOnmarkGetter(ExecState& state, JSSpeechSynthesisUtterance& thisObject, ThrowScope& throwScope) |
| 531 | { |
| 532 | UNUSED_PARAM(throwScope); |
| 533 | UNUSED_PARAM(state); |
| 534 | return eventHandlerAttribute(thisObject.wrapped(), eventNames().markEvent, worldForDOMObject(thisObject)); |
| 535 | } |
| 536 | |
| 537 | EncodedJSValue jsSpeechSynthesisUtteranceOnmark(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 538 | { |
| 539 | return IDLAttribute<JSSpeechSynthesisUtterance>::get<jsSpeechSynthesisUtteranceOnmarkGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "onmark" ); |
| 540 | } |
| 541 | |
| 542 | static inline bool setJSSpeechSynthesisUtteranceOnmarkSetter(ExecState& state, JSSpeechSynthesisUtterance& thisObject, JSValue value, ThrowScope& throwScope) |
| 543 | { |
| 544 | UNUSED_PARAM(throwScope); |
| 545 | setEventHandlerAttribute(state, thisObject, thisObject.wrapped(), eventNames().markEvent, value); |
| 546 | return true; |
| 547 | } |
| 548 | |
| 549 | bool setJSSpeechSynthesisUtteranceOnmark(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 550 | { |
| 551 | return IDLAttribute<JSSpeechSynthesisUtterance>::set<setJSSpeechSynthesisUtteranceOnmarkSetter>(*state, thisValue, encodedValue, "onmark" ); |
| 552 | } |
| 553 | |
| 554 | static inline JSValue jsSpeechSynthesisUtteranceOnboundaryGetter(ExecState& state, JSSpeechSynthesisUtterance& thisObject, ThrowScope& throwScope) |
| 555 | { |
| 556 | UNUSED_PARAM(throwScope); |
| 557 | UNUSED_PARAM(state); |
| 558 | return eventHandlerAttribute(thisObject.wrapped(), eventNames().boundaryEvent, worldForDOMObject(thisObject)); |
| 559 | } |
| 560 | |
| 561 | EncodedJSValue jsSpeechSynthesisUtteranceOnboundary(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 562 | { |
| 563 | return IDLAttribute<JSSpeechSynthesisUtterance>::get<jsSpeechSynthesisUtteranceOnboundaryGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "onboundary" ); |
| 564 | } |
| 565 | |
| 566 | static inline bool setJSSpeechSynthesisUtteranceOnboundarySetter(ExecState& state, JSSpeechSynthesisUtterance& thisObject, JSValue value, ThrowScope& throwScope) |
| 567 | { |
| 568 | UNUSED_PARAM(throwScope); |
| 569 | setEventHandlerAttribute(state, thisObject, thisObject.wrapped(), eventNames().boundaryEvent, value); |
| 570 | return true; |
| 571 | } |
| 572 | |
| 573 | bool setJSSpeechSynthesisUtteranceOnboundary(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 574 | { |
| 575 | return IDLAttribute<JSSpeechSynthesisUtterance>::set<setJSSpeechSynthesisUtteranceOnboundarySetter>(*state, thisValue, encodedValue, "onboundary" ); |
| 576 | } |
| 577 | |
| 578 | void JSSpeechSynthesisUtterance::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
| 579 | { |
| 580 | auto* thisObject = jsCast<JSSpeechSynthesisUtterance*>(cell); |
| 581 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
| 582 | if (thisObject->scriptExecutionContext()) |
| 583 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
| 584 | Base::heapSnapshot(cell, builder); |
| 585 | } |
| 586 | |
| 587 | #if ENABLE(BINDING_INTEGRITY) |
| 588 | #if PLATFORM(WIN) |
| 589 | #pragma warning(disable: 4483) |
| 590 | extern "C" { extern void (*const __identifier("??_7SpeechSynthesisUtterance@WebCore@@6B@" )[])(); } |
| 591 | #else |
| 592 | extern "C" { extern void* _ZTVN7WebCore24SpeechSynthesisUtteranceE[]; } |
| 593 | #endif |
| 594 | #endif |
| 595 | |
| 596 | JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<SpeechSynthesisUtterance>&& impl) |
| 597 | { |
| 598 | |
| 599 | #if ENABLE(BINDING_INTEGRITY) |
| 600 | void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr())); |
| 601 | #if PLATFORM(WIN) |
| 602 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(__identifier("??_7SpeechSynthesisUtterance@WebCore@@6B@" )); |
| 603 | #else |
| 604 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(&_ZTVN7WebCore24SpeechSynthesisUtteranceE[2]); |
| 605 | #endif |
| 606 | |
| 607 | // If this fails SpeechSynthesisUtterance does not have a vtable, so you need to add the |
| 608 | // ImplementationLacksVTable attribute to the interface definition |
| 609 | static_assert(std::is_polymorphic<SpeechSynthesisUtterance>::value, "SpeechSynthesisUtterance is not polymorphic" ); |
| 610 | |
| 611 | // If you hit this assertion you either have a use after free bug, or |
| 612 | // SpeechSynthesisUtterance has subclasses. If SpeechSynthesisUtterance has subclasses that get passed |
| 613 | // to toJS() we currently require SpeechSynthesisUtterance you to opt out of binding hardening |
| 614 | // by adding the SkipVTableValidation attribute to the interface IDL definition |
| 615 | RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); |
| 616 | #endif |
| 617 | return createWrapper<SpeechSynthesisUtterance>(globalObject, WTFMove(impl)); |
| 618 | } |
| 619 | |
| 620 | JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, SpeechSynthesisUtterance& impl) |
| 621 | { |
| 622 | return wrap(state, globalObject, impl); |
| 623 | } |
| 624 | |
| 625 | SpeechSynthesisUtterance* JSSpeechSynthesisUtterance::toWrapped(JSC::VM& vm, JSC::JSValue value) |
| 626 | { |
| 627 | if (auto* wrapper = jsDynamicCast<JSSpeechSynthesisUtterance*>(vm, value)) |
| 628 | return &wrapper->wrapped(); |
| 629 | return nullptr; |
| 630 | } |
| 631 | |
| 632 | } |
| 633 | |
| 634 | #endif // ENABLE(SPEECH_SYNTHESIS) |
| 635 | |