| 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 "JSHTMLScriptElement.h" |
| 23 | |
| 24 | #include "CustomElementReactionQueue.h" |
| 25 | #include "Document.h" |
| 26 | #include "HTMLNames.h" |
| 27 | #include "JSDOMAttribute.h" |
| 28 | #include "JSDOMBinding.h" |
| 29 | #include "JSDOMConstructorNotConstructable.h" |
| 30 | #include "JSDOMConvertBoolean.h" |
| 31 | #include "JSDOMConvertNullable.h" |
| 32 | #include "JSDOMConvertStrings.h" |
| 33 | #include "JSDOMExceptionHandling.h" |
| 34 | #include "JSDOMWrapperCache.h" |
| 35 | #include "ScriptExecutionContext.h" |
| 36 | #include "Settings.h" |
| 37 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
| 38 | #include <JavaScriptCore/JSCInlines.h> |
| 39 | #include <wtf/GetPtr.h> |
| 40 | #include <wtf/PointerPreparations.h> |
| 41 | #include <wtf/URL.h> |
| 42 | |
| 43 | |
| 44 | namespace WebCore { |
| 45 | using namespace JSC; |
| 46 | |
| 47 | // Attributes |
| 48 | |
| 49 | JSC::EncodedJSValue jsHTMLScriptElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 50 | bool setJSHTMLScriptElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 51 | JSC::EncodedJSValue jsHTMLScriptElementText(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 52 | bool setJSHTMLScriptElementText(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 53 | JSC::EncodedJSValue jsHTMLScriptElementHtmlFor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 54 | bool setJSHTMLScriptElementHtmlFor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 55 | JSC::EncodedJSValue jsHTMLScriptElementEvent(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 56 | bool setJSHTMLScriptElementEvent(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 57 | JSC::EncodedJSValue jsHTMLScriptElementCharset(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 58 | bool setJSHTMLScriptElementCharset(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 59 | JSC::EncodedJSValue jsHTMLScriptElementAsync(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 60 | bool setJSHTMLScriptElementAsync(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 61 | JSC::EncodedJSValue jsHTMLScriptElementDefer(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 62 | bool setJSHTMLScriptElementDefer(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 63 | JSC::EncodedJSValue jsHTMLScriptElementSrc(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 64 | bool setJSHTMLScriptElementSrc(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 65 | JSC::EncodedJSValue jsHTMLScriptElementType(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 66 | bool setJSHTMLScriptElementType(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 67 | JSC::EncodedJSValue jsHTMLScriptElementCrossOrigin(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 68 | bool setJSHTMLScriptElementCrossOrigin(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 69 | JSC::EncodedJSValue jsHTMLScriptElementNonce(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 70 | bool setJSHTMLScriptElementNonce(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 71 | JSC::EncodedJSValue jsHTMLScriptElementNoModule(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 72 | bool setJSHTMLScriptElementNoModule(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 73 | JSC::EncodedJSValue jsHTMLScriptElementIntegrity(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 74 | bool setJSHTMLScriptElementIntegrity(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 75 | |
| 76 | class JSHTMLScriptElementPrototype : public JSC::JSNonFinalObject { |
| 77 | public: |
| 78 | using Base = JSC::JSNonFinalObject; |
| 79 | static JSHTMLScriptElementPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
| 80 | { |
| 81 | JSHTMLScriptElementPrototype* ptr = new (NotNull, JSC::allocateCell<JSHTMLScriptElementPrototype>(vm.heap)) JSHTMLScriptElementPrototype(vm, globalObject, structure); |
| 82 | ptr->finishCreation(vm); |
| 83 | return ptr; |
| 84 | } |
| 85 | |
| 86 | DECLARE_INFO; |
| 87 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
| 88 | { |
| 89 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
| 90 | } |
| 91 | |
| 92 | private: |
| 93 | JSHTMLScriptElementPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
| 94 | : JSC::JSNonFinalObject(vm, structure) |
| 95 | { |
| 96 | } |
| 97 | |
| 98 | void finishCreation(JSC::VM&); |
| 99 | }; |
| 100 | |
| 101 | using JSHTMLScriptElementConstructor = JSDOMConstructorNotConstructable<JSHTMLScriptElement>; |
| 102 | |
| 103 | template<> JSValue JSHTMLScriptElementConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
| 104 | { |
| 105 | return JSHTMLElement::getConstructor(vm, &globalObject); |
| 106 | } |
| 107 | |
| 108 | template<> void JSHTMLScriptElementConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
| 109 | { |
| 110 | putDirect(vm, vm.propertyNames->prototype, JSHTMLScriptElement::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 111 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("HTMLScriptElement"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 112 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 113 | } |
| 114 | |
| 115 | template<> const ClassInfo JSHTMLScriptElementConstructor::s_info = { "HTMLScriptElement" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLScriptElementConstructor) }; |
| 116 | |
| 117 | /* Hash table for prototype */ |
| 118 | |
| 119 | static const HashTableValue JSHTMLScriptElementPrototypeTableValues[] = |
| 120 | { |
| 121 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLScriptElementConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLScriptElementConstructor) } }, |
| 122 | { "text" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLScriptElementText), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLScriptElementText) } }, |
| 123 | { "htmlFor" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLScriptElementHtmlFor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLScriptElementHtmlFor) } }, |
| 124 | { "event" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLScriptElementEvent), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLScriptElementEvent) } }, |
| 125 | { "charset" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLScriptElementCharset), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLScriptElementCharset) } }, |
| 126 | { "async" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLScriptElementAsync), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLScriptElementAsync) } }, |
| 127 | { "defer" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLScriptElementDefer), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLScriptElementDefer) } }, |
| 128 | { "src" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLScriptElementSrc), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLScriptElementSrc) } }, |
| 129 | { "type" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLScriptElementType), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLScriptElementType) } }, |
| 130 | { "crossOrigin" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLScriptElementCrossOrigin), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLScriptElementCrossOrigin) } }, |
| 131 | { "nonce" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLScriptElementNonce), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLScriptElementNonce) } }, |
| 132 | { "noModule" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLScriptElementNoModule), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLScriptElementNoModule) } }, |
| 133 | { "integrity" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLScriptElementIntegrity), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLScriptElementIntegrity) } }, |
| 134 | }; |
| 135 | |
| 136 | const ClassInfo JSHTMLScriptElementPrototype::s_info = { "HTMLScriptElementPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLScriptElementPrototype) }; |
| 137 | |
| 138 | void JSHTMLScriptElementPrototype::finishCreation(VM& vm) |
| 139 | { |
| 140 | Base::finishCreation(vm); |
| 141 | reifyStaticProperties(vm, JSHTMLScriptElement::info(), JSHTMLScriptElementPrototypeTableValues, *this); |
| 142 | bool hasDisabledRuntimeProperties = false; |
| 143 | if (!downcast<Document>(jsCast<JSDOMGlobalObject*>(globalObject())->scriptExecutionContext())->settings().subresourceIntegrityEnabled()) { |
| 144 | hasDisabledRuntimeProperties = true; |
| 145 | auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("integrity" ), strlen("integrity" )); |
| 146 | VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable); |
| 147 | JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName); |
| 148 | } |
| 149 | if (hasDisabledRuntimeProperties && structure()->isDictionary()) |
| 150 | flattenDictionaryObject(vm); |
| 151 | } |
| 152 | |
| 153 | const ClassInfo JSHTMLScriptElement::s_info = { "HTMLScriptElement" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLScriptElement) }; |
| 154 | |
| 155 | JSHTMLScriptElement::JSHTMLScriptElement(Structure* structure, JSDOMGlobalObject& globalObject, Ref<HTMLScriptElement>&& impl) |
| 156 | : JSHTMLElement(structure, globalObject, WTFMove(impl)) |
| 157 | { |
| 158 | } |
| 159 | |
| 160 | void JSHTMLScriptElement::finishCreation(VM& vm) |
| 161 | { |
| 162 | Base::finishCreation(vm); |
| 163 | ASSERT(inherits(vm, info())); |
| 164 | |
| 165 | } |
| 166 | |
| 167 | JSObject* JSHTMLScriptElement::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
| 168 | { |
| 169 | return JSHTMLScriptElementPrototype::create(vm, &globalObject, JSHTMLScriptElementPrototype::createStructure(vm, &globalObject, JSHTMLElement::prototype(vm, globalObject))); |
| 170 | } |
| 171 | |
| 172 | JSObject* JSHTMLScriptElement::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
| 173 | { |
| 174 | return getDOMPrototype<JSHTMLScriptElement>(vm, globalObject); |
| 175 | } |
| 176 | |
| 177 | JSValue JSHTMLScriptElement::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
| 178 | { |
| 179 | return getDOMConstructor<JSHTMLScriptElementConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
| 180 | } |
| 181 | |
| 182 | template<> inline JSHTMLScriptElement* IDLAttribute<JSHTMLScriptElement>::cast(ExecState& state, EncodedJSValue thisValue) |
| 183 | { |
| 184 | return jsDynamicCast<JSHTMLScriptElement*>(state.vm(), JSValue::decode(thisValue)); |
| 185 | } |
| 186 | |
| 187 | EncodedJSValue jsHTMLScriptElementConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 188 | { |
| 189 | VM& vm = state->vm(); |
| 190 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 191 | auto* prototype = jsDynamicCast<JSHTMLScriptElementPrototype*>(vm, JSValue::decode(thisValue)); |
| 192 | if (UNLIKELY(!prototype)) |
| 193 | return throwVMTypeError(state, throwScope); |
| 194 | return JSValue::encode(JSHTMLScriptElement::getConstructor(state->vm(), prototype->globalObject())); |
| 195 | } |
| 196 | |
| 197 | bool setJSHTMLScriptElementConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 198 | { |
| 199 | VM& vm = state->vm(); |
| 200 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 201 | auto* prototype = jsDynamicCast<JSHTMLScriptElementPrototype*>(vm, JSValue::decode(thisValue)); |
| 202 | if (UNLIKELY(!prototype)) { |
| 203 | throwVMTypeError(state, throwScope); |
| 204 | return false; |
| 205 | } |
| 206 | // Shadowing a built-in constructor |
| 207 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
| 208 | } |
| 209 | |
| 210 | static inline JSValue jsHTMLScriptElementTextGetter(ExecState& state, JSHTMLScriptElement& thisObject, ThrowScope& throwScope) |
| 211 | { |
| 212 | UNUSED_PARAM(throwScope); |
| 213 | UNUSED_PARAM(state); |
| 214 | auto& impl = thisObject.wrapped(); |
| 215 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.text()); |
| 216 | return result; |
| 217 | } |
| 218 | |
| 219 | EncodedJSValue jsHTMLScriptElementText(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 220 | { |
| 221 | return IDLAttribute<JSHTMLScriptElement>::get<jsHTMLScriptElementTextGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "text" ); |
| 222 | } |
| 223 | |
| 224 | static inline bool setJSHTMLScriptElementTextSetter(ExecState& state, JSHTMLScriptElement& thisObject, JSValue value, ThrowScope& throwScope) |
| 225 | { |
| 226 | UNUSED_PARAM(throwScope); |
| 227 | CustomElementReactionDisallowedScope customElementReactionDisallowedScope; |
| 228 | auto& impl = thisObject.wrapped(); |
| 229 | auto nativeValue = convert<IDLDOMString>(state, value); |
| 230 | RETURN_IF_EXCEPTION(throwScope, false); |
| 231 | AttributeSetter::call(state, throwScope, [&] { |
| 232 | return impl.setText(WTFMove(nativeValue)); |
| 233 | }); |
| 234 | return true; |
| 235 | } |
| 236 | |
| 237 | bool setJSHTMLScriptElementText(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 238 | { |
| 239 | return IDLAttribute<JSHTMLScriptElement>::set<setJSHTMLScriptElementTextSetter>(*state, thisValue, encodedValue, "text" ); |
| 240 | } |
| 241 | |
| 242 | static inline JSValue jsHTMLScriptElementHtmlForGetter(ExecState& state, JSHTMLScriptElement& thisObject, ThrowScope& throwScope) |
| 243 | { |
| 244 | UNUSED_PARAM(throwScope); |
| 245 | UNUSED_PARAM(state); |
| 246 | auto& impl = thisObject.wrapped(); |
| 247 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.attributeWithoutSynchronization(WebCore::HTMLNames::forAttr)); |
| 248 | return result; |
| 249 | } |
| 250 | |
| 251 | EncodedJSValue jsHTMLScriptElementHtmlFor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 252 | { |
| 253 | return IDLAttribute<JSHTMLScriptElement>::get<jsHTMLScriptElementHtmlForGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "htmlFor" ); |
| 254 | } |
| 255 | |
| 256 | static inline bool setJSHTMLScriptElementHtmlForSetter(ExecState& state, JSHTMLScriptElement& thisObject, JSValue value, ThrowScope& throwScope) |
| 257 | { |
| 258 | UNUSED_PARAM(throwScope); |
| 259 | CustomElementReactionDisallowedScope customElementReactionDisallowedScope; |
| 260 | auto& impl = thisObject.wrapped(); |
| 261 | auto nativeValue = convert<IDLDOMString>(state, value); |
| 262 | RETURN_IF_EXCEPTION(throwScope, false); |
| 263 | AttributeSetter::call(state, throwScope, [&] { |
| 264 | return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::forAttr, WTFMove(nativeValue)); |
| 265 | }); |
| 266 | return true; |
| 267 | } |
| 268 | |
| 269 | bool setJSHTMLScriptElementHtmlFor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 270 | { |
| 271 | return IDLAttribute<JSHTMLScriptElement>::set<setJSHTMLScriptElementHtmlForSetter>(*state, thisValue, encodedValue, "htmlFor" ); |
| 272 | } |
| 273 | |
| 274 | static inline JSValue jsHTMLScriptElementEventGetter(ExecState& state, JSHTMLScriptElement& thisObject, ThrowScope& throwScope) |
| 275 | { |
| 276 | UNUSED_PARAM(throwScope); |
| 277 | UNUSED_PARAM(state); |
| 278 | auto& impl = thisObject.wrapped(); |
| 279 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.attributeWithoutSynchronization(WebCore::HTMLNames::eventAttr)); |
| 280 | return result; |
| 281 | } |
| 282 | |
| 283 | EncodedJSValue jsHTMLScriptElementEvent(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 284 | { |
| 285 | return IDLAttribute<JSHTMLScriptElement>::get<jsHTMLScriptElementEventGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "event" ); |
| 286 | } |
| 287 | |
| 288 | static inline bool setJSHTMLScriptElementEventSetter(ExecState& state, JSHTMLScriptElement& thisObject, JSValue value, ThrowScope& throwScope) |
| 289 | { |
| 290 | UNUSED_PARAM(throwScope); |
| 291 | CustomElementReactionDisallowedScope customElementReactionDisallowedScope; |
| 292 | auto& impl = thisObject.wrapped(); |
| 293 | auto nativeValue = convert<IDLDOMString>(state, value); |
| 294 | RETURN_IF_EXCEPTION(throwScope, false); |
| 295 | AttributeSetter::call(state, throwScope, [&] { |
| 296 | return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::eventAttr, WTFMove(nativeValue)); |
| 297 | }); |
| 298 | return true; |
| 299 | } |
| 300 | |
| 301 | bool setJSHTMLScriptElementEvent(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 302 | { |
| 303 | return IDLAttribute<JSHTMLScriptElement>::set<setJSHTMLScriptElementEventSetter>(*state, thisValue, encodedValue, "event" ); |
| 304 | } |
| 305 | |
| 306 | static inline JSValue jsHTMLScriptElementCharsetGetter(ExecState& state, JSHTMLScriptElement& thisObject, ThrowScope& throwScope) |
| 307 | { |
| 308 | UNUSED_PARAM(throwScope); |
| 309 | UNUSED_PARAM(state); |
| 310 | auto& impl = thisObject.wrapped(); |
| 311 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.attributeWithoutSynchronization(WebCore::HTMLNames::charsetAttr)); |
| 312 | return result; |
| 313 | } |
| 314 | |
| 315 | EncodedJSValue jsHTMLScriptElementCharset(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 316 | { |
| 317 | return IDLAttribute<JSHTMLScriptElement>::get<jsHTMLScriptElementCharsetGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "charset" ); |
| 318 | } |
| 319 | |
| 320 | static inline bool setJSHTMLScriptElementCharsetSetter(ExecState& state, JSHTMLScriptElement& thisObject, JSValue value, ThrowScope& throwScope) |
| 321 | { |
| 322 | UNUSED_PARAM(throwScope); |
| 323 | CustomElementReactionDisallowedScope customElementReactionDisallowedScope; |
| 324 | auto& impl = thisObject.wrapped(); |
| 325 | auto nativeValue = convert<IDLDOMString>(state, value); |
| 326 | RETURN_IF_EXCEPTION(throwScope, false); |
| 327 | AttributeSetter::call(state, throwScope, [&] { |
| 328 | return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::charsetAttr, WTFMove(nativeValue)); |
| 329 | }); |
| 330 | return true; |
| 331 | } |
| 332 | |
| 333 | bool setJSHTMLScriptElementCharset(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 334 | { |
| 335 | return IDLAttribute<JSHTMLScriptElement>::set<setJSHTMLScriptElementCharsetSetter>(*state, thisValue, encodedValue, "charset" ); |
| 336 | } |
| 337 | |
| 338 | static inline JSValue jsHTMLScriptElementAsyncGetter(ExecState& state, JSHTMLScriptElement& thisObject, ThrowScope& throwScope) |
| 339 | { |
| 340 | UNUSED_PARAM(throwScope); |
| 341 | UNUSED_PARAM(state); |
| 342 | auto& impl = thisObject.wrapped(); |
| 343 | JSValue result = toJS<IDLBoolean>(state, throwScope, impl.async()); |
| 344 | return result; |
| 345 | } |
| 346 | |
| 347 | EncodedJSValue jsHTMLScriptElementAsync(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 348 | { |
| 349 | return IDLAttribute<JSHTMLScriptElement>::get<jsHTMLScriptElementAsyncGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "async" ); |
| 350 | } |
| 351 | |
| 352 | static inline bool setJSHTMLScriptElementAsyncSetter(ExecState& state, JSHTMLScriptElement& thisObject, JSValue value, ThrowScope& throwScope) |
| 353 | { |
| 354 | UNUSED_PARAM(throwScope); |
| 355 | CustomElementReactionDisallowedScope customElementReactionDisallowedScope; |
| 356 | auto& impl = thisObject.wrapped(); |
| 357 | auto nativeValue = convert<IDLBoolean>(state, value); |
| 358 | RETURN_IF_EXCEPTION(throwScope, false); |
| 359 | AttributeSetter::call(state, throwScope, [&] { |
| 360 | return impl.setAsync(WTFMove(nativeValue)); |
| 361 | }); |
| 362 | return true; |
| 363 | } |
| 364 | |
| 365 | bool setJSHTMLScriptElementAsync(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 366 | { |
| 367 | return IDLAttribute<JSHTMLScriptElement>::set<setJSHTMLScriptElementAsyncSetter>(*state, thisValue, encodedValue, "async" ); |
| 368 | } |
| 369 | |
| 370 | static inline JSValue jsHTMLScriptElementDeferGetter(ExecState& state, JSHTMLScriptElement& thisObject, ThrowScope& throwScope) |
| 371 | { |
| 372 | UNUSED_PARAM(throwScope); |
| 373 | UNUSED_PARAM(state); |
| 374 | auto& impl = thisObject.wrapped(); |
| 375 | JSValue result = toJS<IDLBoolean>(state, throwScope, impl.hasAttributeWithoutSynchronization(WebCore::HTMLNames::deferAttr)); |
| 376 | return result; |
| 377 | } |
| 378 | |
| 379 | EncodedJSValue jsHTMLScriptElementDefer(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 380 | { |
| 381 | return IDLAttribute<JSHTMLScriptElement>::get<jsHTMLScriptElementDeferGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "defer" ); |
| 382 | } |
| 383 | |
| 384 | static inline bool setJSHTMLScriptElementDeferSetter(ExecState& state, JSHTMLScriptElement& thisObject, JSValue value, ThrowScope& throwScope) |
| 385 | { |
| 386 | UNUSED_PARAM(throwScope); |
| 387 | CustomElementReactionDisallowedScope customElementReactionDisallowedScope; |
| 388 | auto& impl = thisObject.wrapped(); |
| 389 | auto nativeValue = convert<IDLBoolean>(state, value); |
| 390 | RETURN_IF_EXCEPTION(throwScope, false); |
| 391 | AttributeSetter::call(state, throwScope, [&] { |
| 392 | return impl.setBooleanAttribute(WebCore::HTMLNames::deferAttr, WTFMove(nativeValue)); |
| 393 | }); |
| 394 | return true; |
| 395 | } |
| 396 | |
| 397 | bool setJSHTMLScriptElementDefer(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 398 | { |
| 399 | return IDLAttribute<JSHTMLScriptElement>::set<setJSHTMLScriptElementDeferSetter>(*state, thisValue, encodedValue, "defer" ); |
| 400 | } |
| 401 | |
| 402 | static inline JSValue jsHTMLScriptElementSrcGetter(ExecState& state, JSHTMLScriptElement& thisObject, ThrowScope& throwScope) |
| 403 | { |
| 404 | UNUSED_PARAM(throwScope); |
| 405 | UNUSED_PARAM(state); |
| 406 | auto& impl = thisObject.wrapped(); |
| 407 | JSValue result = toJS<IDLUSVString>(state, throwScope, impl.getURLAttribute(WebCore::HTMLNames::srcAttr)); |
| 408 | return result; |
| 409 | } |
| 410 | |
| 411 | EncodedJSValue jsHTMLScriptElementSrc(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 412 | { |
| 413 | return IDLAttribute<JSHTMLScriptElement>::get<jsHTMLScriptElementSrcGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "src" ); |
| 414 | } |
| 415 | |
| 416 | static inline bool setJSHTMLScriptElementSrcSetter(ExecState& state, JSHTMLScriptElement& thisObject, JSValue value, ThrowScope& throwScope) |
| 417 | { |
| 418 | UNUSED_PARAM(throwScope); |
| 419 | CustomElementReactionDisallowedScope customElementReactionDisallowedScope; |
| 420 | auto& impl = thisObject.wrapped(); |
| 421 | auto nativeValue = convert<IDLUSVString>(state, value); |
| 422 | RETURN_IF_EXCEPTION(throwScope, false); |
| 423 | AttributeSetter::call(state, throwScope, [&] { |
| 424 | return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::srcAttr, WTFMove(nativeValue)); |
| 425 | }); |
| 426 | return true; |
| 427 | } |
| 428 | |
| 429 | bool setJSHTMLScriptElementSrc(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 430 | { |
| 431 | return IDLAttribute<JSHTMLScriptElement>::set<setJSHTMLScriptElementSrcSetter>(*state, thisValue, encodedValue, "src" ); |
| 432 | } |
| 433 | |
| 434 | static inline JSValue jsHTMLScriptElementTypeGetter(ExecState& state, JSHTMLScriptElement& thisObject, ThrowScope& throwScope) |
| 435 | { |
| 436 | UNUSED_PARAM(throwScope); |
| 437 | UNUSED_PARAM(state); |
| 438 | auto& impl = thisObject.wrapped(); |
| 439 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.attributeWithoutSynchronization(WebCore::HTMLNames::typeAttr)); |
| 440 | return result; |
| 441 | } |
| 442 | |
| 443 | EncodedJSValue jsHTMLScriptElementType(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 444 | { |
| 445 | return IDLAttribute<JSHTMLScriptElement>::get<jsHTMLScriptElementTypeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "type" ); |
| 446 | } |
| 447 | |
| 448 | static inline bool setJSHTMLScriptElementTypeSetter(ExecState& state, JSHTMLScriptElement& thisObject, JSValue value, ThrowScope& throwScope) |
| 449 | { |
| 450 | UNUSED_PARAM(throwScope); |
| 451 | CustomElementReactionDisallowedScope customElementReactionDisallowedScope; |
| 452 | auto& impl = thisObject.wrapped(); |
| 453 | auto nativeValue = convert<IDLDOMString>(state, value); |
| 454 | RETURN_IF_EXCEPTION(throwScope, false); |
| 455 | AttributeSetter::call(state, throwScope, [&] { |
| 456 | return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::typeAttr, WTFMove(nativeValue)); |
| 457 | }); |
| 458 | return true; |
| 459 | } |
| 460 | |
| 461 | bool setJSHTMLScriptElementType(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 462 | { |
| 463 | return IDLAttribute<JSHTMLScriptElement>::set<setJSHTMLScriptElementTypeSetter>(*state, thisValue, encodedValue, "type" ); |
| 464 | } |
| 465 | |
| 466 | static inline JSValue jsHTMLScriptElementCrossOriginGetter(ExecState& state, JSHTMLScriptElement& thisObject, ThrowScope& throwScope) |
| 467 | { |
| 468 | UNUSED_PARAM(throwScope); |
| 469 | UNUSED_PARAM(state); |
| 470 | auto& impl = thisObject.wrapped(); |
| 471 | JSValue result = toJS<IDLNullable<IDLDOMString>>(state, throwScope, impl.crossOrigin()); |
| 472 | return result; |
| 473 | } |
| 474 | |
| 475 | EncodedJSValue jsHTMLScriptElementCrossOrigin(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 476 | { |
| 477 | return IDLAttribute<JSHTMLScriptElement>::get<jsHTMLScriptElementCrossOriginGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "crossOrigin" ); |
| 478 | } |
| 479 | |
| 480 | static inline bool setJSHTMLScriptElementCrossOriginSetter(ExecState& state, JSHTMLScriptElement& thisObject, JSValue value, ThrowScope& throwScope) |
| 481 | { |
| 482 | UNUSED_PARAM(throwScope); |
| 483 | CustomElementReactionDisallowedScope customElementReactionDisallowedScope; |
| 484 | auto& impl = thisObject.wrapped(); |
| 485 | auto nativeValue = convert<IDLNullable<IDLDOMString>>(state, value); |
| 486 | RETURN_IF_EXCEPTION(throwScope, false); |
| 487 | AttributeSetter::call(state, throwScope, [&] { |
| 488 | return impl.setCrossOrigin(WTFMove(nativeValue)); |
| 489 | }); |
| 490 | return true; |
| 491 | } |
| 492 | |
| 493 | bool setJSHTMLScriptElementCrossOrigin(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 494 | { |
| 495 | return IDLAttribute<JSHTMLScriptElement>::set<setJSHTMLScriptElementCrossOriginSetter>(*state, thisValue, encodedValue, "crossOrigin" ); |
| 496 | } |
| 497 | |
| 498 | static inline JSValue jsHTMLScriptElementNonceGetter(ExecState& state, JSHTMLScriptElement& thisObject, ThrowScope& throwScope) |
| 499 | { |
| 500 | UNUSED_PARAM(throwScope); |
| 501 | UNUSED_PARAM(state); |
| 502 | auto& impl = thisObject.wrapped(); |
| 503 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.attributeWithoutSynchronization(WebCore::HTMLNames::nonceAttr)); |
| 504 | return result; |
| 505 | } |
| 506 | |
| 507 | EncodedJSValue jsHTMLScriptElementNonce(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 508 | { |
| 509 | return IDLAttribute<JSHTMLScriptElement>::get<jsHTMLScriptElementNonceGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "nonce" ); |
| 510 | } |
| 511 | |
| 512 | static inline bool setJSHTMLScriptElementNonceSetter(ExecState& state, JSHTMLScriptElement& thisObject, JSValue value, ThrowScope& throwScope) |
| 513 | { |
| 514 | UNUSED_PARAM(throwScope); |
| 515 | auto& impl = thisObject.wrapped(); |
| 516 | auto nativeValue = convert<IDLDOMString>(state, value); |
| 517 | RETURN_IF_EXCEPTION(throwScope, false); |
| 518 | AttributeSetter::call(state, throwScope, [&] { |
| 519 | return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::nonceAttr, WTFMove(nativeValue)); |
| 520 | }); |
| 521 | return true; |
| 522 | } |
| 523 | |
| 524 | bool setJSHTMLScriptElementNonce(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 525 | { |
| 526 | return IDLAttribute<JSHTMLScriptElement>::set<setJSHTMLScriptElementNonceSetter>(*state, thisValue, encodedValue, "nonce" ); |
| 527 | } |
| 528 | |
| 529 | static inline JSValue jsHTMLScriptElementNoModuleGetter(ExecState& state, JSHTMLScriptElement& thisObject, ThrowScope& throwScope) |
| 530 | { |
| 531 | UNUSED_PARAM(throwScope); |
| 532 | UNUSED_PARAM(state); |
| 533 | auto& impl = thisObject.wrapped(); |
| 534 | JSValue result = toJS<IDLBoolean>(state, throwScope, impl.hasAttributeWithoutSynchronization(WebCore::HTMLNames::nomoduleAttr)); |
| 535 | return result; |
| 536 | } |
| 537 | |
| 538 | EncodedJSValue jsHTMLScriptElementNoModule(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 539 | { |
| 540 | return IDLAttribute<JSHTMLScriptElement>::get<jsHTMLScriptElementNoModuleGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "noModule" ); |
| 541 | } |
| 542 | |
| 543 | static inline bool setJSHTMLScriptElementNoModuleSetter(ExecState& state, JSHTMLScriptElement& thisObject, JSValue value, ThrowScope& throwScope) |
| 544 | { |
| 545 | UNUSED_PARAM(throwScope); |
| 546 | CustomElementReactionDisallowedScope customElementReactionDisallowedScope; |
| 547 | auto& impl = thisObject.wrapped(); |
| 548 | auto nativeValue = convert<IDLBoolean>(state, value); |
| 549 | RETURN_IF_EXCEPTION(throwScope, false); |
| 550 | AttributeSetter::call(state, throwScope, [&] { |
| 551 | return impl.setBooleanAttribute(WebCore::HTMLNames::nomoduleAttr, WTFMove(nativeValue)); |
| 552 | }); |
| 553 | return true; |
| 554 | } |
| 555 | |
| 556 | bool setJSHTMLScriptElementNoModule(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 557 | { |
| 558 | return IDLAttribute<JSHTMLScriptElement>::set<setJSHTMLScriptElementNoModuleSetter>(*state, thisValue, encodedValue, "noModule" ); |
| 559 | } |
| 560 | |
| 561 | static inline JSValue jsHTMLScriptElementIntegrityGetter(ExecState& state, JSHTMLScriptElement& thisObject, ThrowScope& throwScope) |
| 562 | { |
| 563 | UNUSED_PARAM(throwScope); |
| 564 | UNUSED_PARAM(state); |
| 565 | auto& impl = thisObject.wrapped(); |
| 566 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.attributeWithoutSynchronization(WebCore::HTMLNames::integrityAttr)); |
| 567 | return result; |
| 568 | } |
| 569 | |
| 570 | EncodedJSValue jsHTMLScriptElementIntegrity(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 571 | { |
| 572 | return IDLAttribute<JSHTMLScriptElement>::get<jsHTMLScriptElementIntegrityGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "integrity" ); |
| 573 | } |
| 574 | |
| 575 | static inline bool setJSHTMLScriptElementIntegritySetter(ExecState& state, JSHTMLScriptElement& thisObject, JSValue value, ThrowScope& throwScope) |
| 576 | { |
| 577 | UNUSED_PARAM(throwScope); |
| 578 | CustomElementReactionDisallowedScope customElementReactionDisallowedScope; |
| 579 | auto& impl = thisObject.wrapped(); |
| 580 | auto nativeValue = convert<IDLDOMString>(state, value); |
| 581 | RETURN_IF_EXCEPTION(throwScope, false); |
| 582 | AttributeSetter::call(state, throwScope, [&] { |
| 583 | return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::integrityAttr, WTFMove(nativeValue)); |
| 584 | }); |
| 585 | return true; |
| 586 | } |
| 587 | |
| 588 | bool setJSHTMLScriptElementIntegrity(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 589 | { |
| 590 | return IDLAttribute<JSHTMLScriptElement>::set<setJSHTMLScriptElementIntegritySetter>(*state, thisValue, encodedValue, "integrity" ); |
| 591 | } |
| 592 | |
| 593 | void JSHTMLScriptElement::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
| 594 | { |
| 595 | auto* thisObject = jsCast<JSHTMLScriptElement*>(cell); |
| 596 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
| 597 | if (thisObject->scriptExecutionContext()) |
| 598 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
| 599 | Base::heapSnapshot(cell, builder); |
| 600 | } |
| 601 | |
| 602 | |
| 603 | } |
| 604 | |