| 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(WEB_RTC_DTMF) |
| 24 | |
| 25 | #include "JSRTCDTMFSender.h" |
| 26 | |
| 27 | #include "EventNames.h" |
| 28 | #include "JSDOMAttribute.h" |
| 29 | #include "JSDOMBinding.h" |
| 30 | #include "JSDOMConstructorNotConstructable.h" |
| 31 | #include "JSDOMConvertBoolean.h" |
| 32 | #include "JSDOMConvertInterface.h" |
| 33 | #include "JSDOMConvertNumbers.h" |
| 34 | #include "JSDOMConvertStrings.h" |
| 35 | #include "JSDOMExceptionHandling.h" |
| 36 | #include "JSDOMGlobalObject.h" |
| 37 | #include "JSDOMOperation.h" |
| 38 | #include "JSDOMWrapperCache.h" |
| 39 | #include "JSEventListener.h" |
| 40 | #include "JSMediaStreamTrack.h" |
| 41 | #include "ScriptExecutionContext.h" |
| 42 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
| 43 | #include <JavaScriptCore/JSCInlines.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 jsRTCDTMFSenderPrototypeFunctionInsertDTMF(JSC::ExecState*); |
| 55 | |
| 56 | // Attributes |
| 57 | |
| 58 | JSC::EncodedJSValue jsRTCDTMFSenderConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 59 | bool setJSRTCDTMFSenderConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 60 | JSC::EncodedJSValue jsRTCDTMFSenderOntonechange(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 61 | bool setJSRTCDTMFSenderOntonechange(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 62 | JSC::EncodedJSValue jsRTCDTMFSenderToneBuffer(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 63 | JSC::EncodedJSValue jsRTCDTMFSenderCanInsertDTMF(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 64 | JSC::EncodedJSValue jsRTCDTMFSenderTrack(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 65 | JSC::EncodedJSValue jsRTCDTMFSenderDuration(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 66 | JSC::EncodedJSValue jsRTCDTMFSenderInterToneGap(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 67 | |
| 68 | class JSRTCDTMFSenderPrototype : public JSC::JSNonFinalObject { |
| 69 | public: |
| 70 | using Base = JSC::JSNonFinalObject; |
| 71 | static JSRTCDTMFSenderPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
| 72 | { |
| 73 | JSRTCDTMFSenderPrototype* ptr = new (NotNull, JSC::allocateCell<JSRTCDTMFSenderPrototype>(vm.heap)) JSRTCDTMFSenderPrototype(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 | JSRTCDTMFSenderPrototype(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 JSRTCDTMFSenderConstructor = JSDOMConstructorNotConstructable<JSRTCDTMFSender>; |
| 94 | |
| 95 | template<> JSValue JSRTCDTMFSenderConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
| 96 | { |
| 97 | return JSEventTarget::getConstructor(vm, &globalObject); |
| 98 | } |
| 99 | |
| 100 | template<> void JSRTCDTMFSenderConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
| 101 | { |
| 102 | putDirect(vm, vm.propertyNames->prototype, JSRTCDTMFSender::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 103 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("RTCDTMFSender"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 104 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 105 | } |
| 106 | |
| 107 | template<> const ClassInfo JSRTCDTMFSenderConstructor::s_info = { "RTCDTMFSender" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSRTCDTMFSenderConstructor) }; |
| 108 | |
| 109 | /* Hash table for prototype */ |
| 110 | |
| 111 | static const HashTableValue JSRTCDTMFSenderPrototypeTableValues[] = |
| 112 | { |
| 113 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRTCDTMFSenderConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSRTCDTMFSenderConstructor) } }, |
| 114 | { "ontonechange" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRTCDTMFSenderOntonechange), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSRTCDTMFSenderOntonechange) } }, |
| 115 | { "toneBuffer" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRTCDTMFSenderToneBuffer), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 116 | { "canInsertDTMF" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRTCDTMFSenderCanInsertDTMF), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 117 | { "track" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRTCDTMFSenderTrack), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 118 | { "duration" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRTCDTMFSenderDuration), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 119 | { "interToneGap" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRTCDTMFSenderInterToneGap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 120 | { "insertDTMF" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsRTCDTMFSenderPrototypeFunctionInsertDTMF), (intptr_t) (1) } }, |
| 121 | }; |
| 122 | |
| 123 | const ClassInfo JSRTCDTMFSenderPrototype::s_info = { "RTCDTMFSenderPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSRTCDTMFSenderPrototype) }; |
| 124 | |
| 125 | void JSRTCDTMFSenderPrototype::finishCreation(VM& vm) |
| 126 | { |
| 127 | Base::finishCreation(vm); |
| 128 | reifyStaticProperties(vm, JSRTCDTMFSender::info(), JSRTCDTMFSenderPrototypeTableValues, *this); |
| 129 | } |
| 130 | |
| 131 | const ClassInfo JSRTCDTMFSender::s_info = { "RTCDTMFSender" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSRTCDTMFSender) }; |
| 132 | |
| 133 | JSRTCDTMFSender::JSRTCDTMFSender(Structure* structure, JSDOMGlobalObject& globalObject, Ref<RTCDTMFSender>&& impl) |
| 134 | : JSEventTarget(structure, globalObject, WTFMove(impl)) |
| 135 | { |
| 136 | } |
| 137 | |
| 138 | void JSRTCDTMFSender::finishCreation(VM& vm) |
| 139 | { |
| 140 | Base::finishCreation(vm); |
| 141 | ASSERT(inherits(vm, info())); |
| 142 | |
| 143 | } |
| 144 | |
| 145 | JSObject* JSRTCDTMFSender::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
| 146 | { |
| 147 | return JSRTCDTMFSenderPrototype::create(vm, &globalObject, JSRTCDTMFSenderPrototype::createStructure(vm, &globalObject, JSEventTarget::prototype(vm, globalObject))); |
| 148 | } |
| 149 | |
| 150 | JSObject* JSRTCDTMFSender::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
| 151 | { |
| 152 | return getDOMPrototype<JSRTCDTMFSender>(vm, globalObject); |
| 153 | } |
| 154 | |
| 155 | JSValue JSRTCDTMFSender::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
| 156 | { |
| 157 | return getDOMConstructor<JSRTCDTMFSenderConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
| 158 | } |
| 159 | |
| 160 | template<> inline JSRTCDTMFSender* IDLAttribute<JSRTCDTMFSender>::cast(ExecState& state, EncodedJSValue thisValue) |
| 161 | { |
| 162 | return jsDynamicCast<JSRTCDTMFSender*>(state.vm(), JSValue::decode(thisValue)); |
| 163 | } |
| 164 | |
| 165 | template<> inline JSRTCDTMFSender* IDLOperation<JSRTCDTMFSender>::cast(ExecState& state) |
| 166 | { |
| 167 | return jsDynamicCast<JSRTCDTMFSender*>(state.vm(), state.thisValue()); |
| 168 | } |
| 169 | |
| 170 | EncodedJSValue jsRTCDTMFSenderConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 171 | { |
| 172 | VM& vm = state->vm(); |
| 173 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 174 | auto* prototype = jsDynamicCast<JSRTCDTMFSenderPrototype*>(vm, JSValue::decode(thisValue)); |
| 175 | if (UNLIKELY(!prototype)) |
| 176 | return throwVMTypeError(state, throwScope); |
| 177 | return JSValue::encode(JSRTCDTMFSender::getConstructor(state->vm(), prototype->globalObject())); |
| 178 | } |
| 179 | |
| 180 | bool setJSRTCDTMFSenderConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 181 | { |
| 182 | VM& vm = state->vm(); |
| 183 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 184 | auto* prototype = jsDynamicCast<JSRTCDTMFSenderPrototype*>(vm, JSValue::decode(thisValue)); |
| 185 | if (UNLIKELY(!prototype)) { |
| 186 | throwVMTypeError(state, throwScope); |
| 187 | return false; |
| 188 | } |
| 189 | // Shadowing a built-in constructor |
| 190 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
| 191 | } |
| 192 | |
| 193 | static inline JSValue jsRTCDTMFSenderOntonechangeGetter(ExecState& state, JSRTCDTMFSender& thisObject, ThrowScope& throwScope) |
| 194 | { |
| 195 | UNUSED_PARAM(throwScope); |
| 196 | UNUSED_PARAM(state); |
| 197 | return eventHandlerAttribute(thisObject.wrapped(), eventNames().tonechangeEvent, worldForDOMObject(thisObject)); |
| 198 | } |
| 199 | |
| 200 | EncodedJSValue jsRTCDTMFSenderOntonechange(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 201 | { |
| 202 | return IDLAttribute<JSRTCDTMFSender>::get<jsRTCDTMFSenderOntonechangeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "ontonechange" ); |
| 203 | } |
| 204 | |
| 205 | static inline bool setJSRTCDTMFSenderOntonechangeSetter(ExecState& state, JSRTCDTMFSender& thisObject, JSValue value, ThrowScope& throwScope) |
| 206 | { |
| 207 | UNUSED_PARAM(throwScope); |
| 208 | setEventHandlerAttribute(state, thisObject, thisObject.wrapped(), eventNames().tonechangeEvent, value); |
| 209 | return true; |
| 210 | } |
| 211 | |
| 212 | bool setJSRTCDTMFSenderOntonechange(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 213 | { |
| 214 | return IDLAttribute<JSRTCDTMFSender>::set<setJSRTCDTMFSenderOntonechangeSetter>(*state, thisValue, encodedValue, "ontonechange" ); |
| 215 | } |
| 216 | |
| 217 | static inline JSValue jsRTCDTMFSenderToneBufferGetter(ExecState& state, JSRTCDTMFSender& thisObject, ThrowScope& throwScope) |
| 218 | { |
| 219 | UNUSED_PARAM(throwScope); |
| 220 | UNUSED_PARAM(state); |
| 221 | auto& impl = thisObject.wrapped(); |
| 222 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.toneBuffer()); |
| 223 | return result; |
| 224 | } |
| 225 | |
| 226 | EncodedJSValue jsRTCDTMFSenderToneBuffer(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 227 | { |
| 228 | return IDLAttribute<JSRTCDTMFSender>::get<jsRTCDTMFSenderToneBufferGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "toneBuffer" ); |
| 229 | } |
| 230 | |
| 231 | static inline JSValue jsRTCDTMFSenderCanInsertDTMFGetter(ExecState& state, JSRTCDTMFSender& thisObject, ThrowScope& throwScope) |
| 232 | { |
| 233 | UNUSED_PARAM(throwScope); |
| 234 | UNUSED_PARAM(state); |
| 235 | auto& impl = thisObject.wrapped(); |
| 236 | JSValue result = toJS<IDLBoolean>(state, throwScope, impl.canInsertDTMF()); |
| 237 | return result; |
| 238 | } |
| 239 | |
| 240 | EncodedJSValue jsRTCDTMFSenderCanInsertDTMF(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 241 | { |
| 242 | return IDLAttribute<JSRTCDTMFSender>::get<jsRTCDTMFSenderCanInsertDTMFGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "canInsertDTMF" ); |
| 243 | } |
| 244 | |
| 245 | static inline JSValue jsRTCDTMFSenderTrackGetter(ExecState& state, JSRTCDTMFSender& thisObject, ThrowScope& throwScope) |
| 246 | { |
| 247 | UNUSED_PARAM(throwScope); |
| 248 | UNUSED_PARAM(state); |
| 249 | auto& impl = thisObject.wrapped(); |
| 250 | JSValue result = toJS<IDLInterface<MediaStreamTrack>>(state, *thisObject.globalObject(), throwScope, impl.track()); |
| 251 | return result; |
| 252 | } |
| 253 | |
| 254 | EncodedJSValue jsRTCDTMFSenderTrack(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 255 | { |
| 256 | return IDLAttribute<JSRTCDTMFSender>::get<jsRTCDTMFSenderTrackGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "track" ); |
| 257 | } |
| 258 | |
| 259 | static inline JSValue jsRTCDTMFSenderDurationGetter(ExecState& state, JSRTCDTMFSender& thisObject, ThrowScope& throwScope) |
| 260 | { |
| 261 | UNUSED_PARAM(throwScope); |
| 262 | UNUSED_PARAM(state); |
| 263 | auto& impl = thisObject.wrapped(); |
| 264 | JSValue result = toJS<IDLLong>(state, throwScope, impl.duration()); |
| 265 | return result; |
| 266 | } |
| 267 | |
| 268 | EncodedJSValue jsRTCDTMFSenderDuration(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 269 | { |
| 270 | return IDLAttribute<JSRTCDTMFSender>::get<jsRTCDTMFSenderDurationGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "duration" ); |
| 271 | } |
| 272 | |
| 273 | static inline JSValue jsRTCDTMFSenderInterToneGapGetter(ExecState& state, JSRTCDTMFSender& thisObject, ThrowScope& throwScope) |
| 274 | { |
| 275 | UNUSED_PARAM(throwScope); |
| 276 | UNUSED_PARAM(state); |
| 277 | auto& impl = thisObject.wrapped(); |
| 278 | JSValue result = toJS<IDLLong>(state, throwScope, impl.interToneGap()); |
| 279 | return result; |
| 280 | } |
| 281 | |
| 282 | EncodedJSValue jsRTCDTMFSenderInterToneGap(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 283 | { |
| 284 | return IDLAttribute<JSRTCDTMFSender>::get<jsRTCDTMFSenderInterToneGapGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "interToneGap" ); |
| 285 | } |
| 286 | |
| 287 | static inline JSC::EncodedJSValue jsRTCDTMFSenderPrototypeFunctionInsertDTMFBody(JSC::ExecState* state, typename IDLOperation<JSRTCDTMFSender>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
| 288 | { |
| 289 | UNUSED_PARAM(state); |
| 290 | UNUSED_PARAM(throwScope); |
| 291 | auto& impl = castedThis->wrapped(); |
| 292 | if (UNLIKELY(state->argumentCount() < 1)) |
| 293 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
| 294 | auto tones = convert<IDLDOMString>(*state, state->uncheckedArgument(0)); |
| 295 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| 296 | auto duration = state->argument(1).isUndefined() ? Optional<Converter<IDLLong>::ReturnType>() : Optional<Converter<IDLLong>::ReturnType>(convert<IDLLong>(*state, state->uncheckedArgument(1))); |
| 297 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| 298 | auto interToneGap = state->argument(2).isUndefined() ? Optional<Converter<IDLLong>::ReturnType>() : Optional<Converter<IDLLong>::ReturnType>(convert<IDLLong>(*state, state->uncheckedArgument(2))); |
| 299 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| 300 | propagateException(*state, throwScope, impl.insertDTMF(WTFMove(tones), WTFMove(duration), WTFMove(interToneGap))); |
| 301 | return JSValue::encode(jsUndefined()); |
| 302 | } |
| 303 | |
| 304 | EncodedJSValue JSC_HOST_CALL jsRTCDTMFSenderPrototypeFunctionInsertDTMF(ExecState* state) |
| 305 | { |
| 306 | return IDLOperation<JSRTCDTMFSender>::call<jsRTCDTMFSenderPrototypeFunctionInsertDTMFBody>(*state, "insertDTMF" ); |
| 307 | } |
| 308 | |
| 309 | void JSRTCDTMFSender::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
| 310 | { |
| 311 | auto* thisObject = jsCast<JSRTCDTMFSender*>(cell); |
| 312 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
| 313 | if (thisObject->scriptExecutionContext()) |
| 314 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
| 315 | Base::heapSnapshot(cell, builder); |
| 316 | } |
| 317 | |
| 318 | bool JSRTCDTMFSenderOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason) |
| 319 | { |
| 320 | auto* jsRTCDTMFSender = jsCast<JSRTCDTMFSender*>(handle.slot()->asCell()); |
| 321 | if (jsRTCDTMFSender->wrapped().hasPendingActivity()) { |
| 322 | if (UNLIKELY(reason)) |
| 323 | *reason = "ActiveDOMObject with pending activity" ; |
| 324 | return true; |
| 325 | } |
| 326 | if (jsRTCDTMFSender->wrapped().isFiringEventListeners()) { |
| 327 | if (UNLIKELY(reason)) |
| 328 | *reason = "EventTarget firing event listeners" ; |
| 329 | return true; |
| 330 | } |
| 331 | UNUSED_PARAM(visitor); |
| 332 | UNUSED_PARAM(reason); |
| 333 | return false; |
| 334 | } |
| 335 | |
| 336 | void JSRTCDTMFSenderOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) |
| 337 | { |
| 338 | auto* jsRTCDTMFSender = static_cast<JSRTCDTMFSender*>(handle.slot()->asCell()); |
| 339 | auto& world = *static_cast<DOMWrapperWorld*>(context); |
| 340 | uncacheWrapper(world, &jsRTCDTMFSender->wrapped(), jsRTCDTMFSender); |
| 341 | } |
| 342 | |
| 343 | #if ENABLE(BINDING_INTEGRITY) |
| 344 | #if PLATFORM(WIN) |
| 345 | #pragma warning(disable: 4483) |
| 346 | extern "C" { extern void (*const __identifier("??_7RTCDTMFSender@WebCore@@6B@" )[])(); } |
| 347 | #else |
| 348 | extern "C" { extern void* _ZTVN7WebCore13RTCDTMFSenderE[]; } |
| 349 | #endif |
| 350 | #endif |
| 351 | |
| 352 | JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<RTCDTMFSender>&& impl) |
| 353 | { |
| 354 | |
| 355 | #if ENABLE(BINDING_INTEGRITY) |
| 356 | void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr())); |
| 357 | #if PLATFORM(WIN) |
| 358 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(__identifier("??_7RTCDTMFSender@WebCore@@6B@" )); |
| 359 | #else |
| 360 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(&_ZTVN7WebCore13RTCDTMFSenderE[2]); |
| 361 | #endif |
| 362 | |
| 363 | // If this fails RTCDTMFSender does not have a vtable, so you need to add the |
| 364 | // ImplementationLacksVTable attribute to the interface definition |
| 365 | static_assert(std::is_polymorphic<RTCDTMFSender>::value, "RTCDTMFSender is not polymorphic" ); |
| 366 | |
| 367 | // If you hit this assertion you either have a use after free bug, or |
| 368 | // RTCDTMFSender has subclasses. If RTCDTMFSender has subclasses that get passed |
| 369 | // to toJS() we currently require RTCDTMFSender you to opt out of binding hardening |
| 370 | // by adding the SkipVTableValidation attribute to the interface IDL definition |
| 371 | RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); |
| 372 | #endif |
| 373 | return createWrapper<RTCDTMFSender>(globalObject, WTFMove(impl)); |
| 374 | } |
| 375 | |
| 376 | JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, RTCDTMFSender& impl) |
| 377 | { |
| 378 | return wrap(state, globalObject, impl); |
| 379 | } |
| 380 | |
| 381 | RTCDTMFSender* JSRTCDTMFSender::toWrapped(JSC::VM& vm, JSC::JSValue value) |
| 382 | { |
| 383 | if (auto* wrapper = jsDynamicCast<JSRTCDTMFSender*>(vm, value)) |
| 384 | return &wrapper->wrapped(); |
| 385 | return nullptr; |
| 386 | } |
| 387 | |
| 388 | } |
| 389 | |
| 390 | #endif // ENABLE(WEB_RTC_DTMF) |
| 391 | |