blob: 7f7e8a1fd99bfd3fd510b95c4b4a5c565f26a3c4 [file] [log] [blame]
/*
This file is part of the WebKit open source project.
This file has been generated by generate-bindings.pl. DO NOT MODIFY!
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "config.h"
#include "JSHTMLScriptElement.h"
#include "HTMLNames.h"
#include "JSDOMBinding.h"
#include "JSDOMConstructor.h"
#include "URL.h"
#include <runtime/JSString.h>
#include <wtf/GetPtr.h>
using namespace JSC;
namespace WebCore {
// Attributes
JSC::EncodedJSValue jsHTMLScriptElementText(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSHTMLScriptElementText(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsHTMLScriptElementHtmlFor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSHTMLScriptElementHtmlFor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsHTMLScriptElementEvent(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSHTMLScriptElementEvent(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsHTMLScriptElementCharset(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSHTMLScriptElementCharset(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsHTMLScriptElementAsync(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSHTMLScriptElementAsync(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsHTMLScriptElementDefer(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSHTMLScriptElementDefer(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsHTMLScriptElementSrc(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSHTMLScriptElementSrc(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsHTMLScriptElementType(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSHTMLScriptElementType(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsHTMLScriptElementCrossOrigin(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSHTMLScriptElementCrossOrigin(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsHTMLScriptElementNonce(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSHTMLScriptElementNonce(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsHTMLScriptElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSHTMLScriptElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
class JSHTMLScriptElementPrototype : public JSC::JSNonFinalObject {
public:
typedef JSC::JSNonFinalObject Base;
static JSHTMLScriptElementPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
{
JSHTMLScriptElementPrototype* ptr = new (NotNull, JSC::allocateCell<JSHTMLScriptElementPrototype>(vm.heap)) JSHTMLScriptElementPrototype(vm, globalObject, structure);
ptr->finishCreation(vm);
return ptr;
}
DECLARE_INFO;
static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
{
return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
}
private:
JSHTMLScriptElementPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
: JSC::JSNonFinalObject(vm, structure)
{
}
void finishCreation(JSC::VM&);
};
typedef JSDOMConstructorNotConstructable<JSHTMLScriptElement> JSHTMLScriptElementConstructor;
template<> JSValue JSHTMLScriptElementConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
{
return JSHTMLElement::getConstructor(vm, &globalObject);
}
template<> void JSHTMLScriptElementConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
{
putDirect(vm, vm.propertyNames->prototype, JSHTMLScriptElement::prototype(vm, &globalObject), DontDelete | ReadOnly | DontEnum);
putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("HTMLScriptElement"))), ReadOnly | DontEnum);
putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum);
}
template<> const ClassInfo JSHTMLScriptElementConstructor::s_info = { "HTMLScriptElement", &Base::s_info, 0, CREATE_METHOD_TABLE(JSHTMLScriptElementConstructor) };
/* Hash table for prototype */
static const HashTableValue JSHTMLScriptElementPrototypeTableValues[] =
{
{ "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLScriptElementConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLScriptElementConstructor) } },
{ "text", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLScriptElementText), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLScriptElementText) } },
{ "htmlFor", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLScriptElementHtmlFor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLScriptElementHtmlFor) } },
{ "event", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLScriptElementEvent), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLScriptElementEvent) } },
{ "charset", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLScriptElementCharset), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLScriptElementCharset) } },
{ "async", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLScriptElementAsync), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLScriptElementAsync) } },
{ "defer", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLScriptElementDefer), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLScriptElementDefer) } },
{ "src", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLScriptElementSrc), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLScriptElementSrc) } },
{ "type", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLScriptElementType), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLScriptElementType) } },
{ "crossOrigin", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLScriptElementCrossOrigin), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLScriptElementCrossOrigin) } },
{ "nonce", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLScriptElementNonce), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLScriptElementNonce) } },
};
const ClassInfo JSHTMLScriptElementPrototype::s_info = { "HTMLScriptElementPrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSHTMLScriptElementPrototype) };
void JSHTMLScriptElementPrototype::finishCreation(VM& vm)
{
Base::finishCreation(vm);
reifyStaticProperties(vm, JSHTMLScriptElementPrototypeTableValues, *this);
}
const ClassInfo JSHTMLScriptElement::s_info = { "HTMLScriptElement", &Base::s_info, 0, CREATE_METHOD_TABLE(JSHTMLScriptElement) };
JSHTMLScriptElement::JSHTMLScriptElement(Structure* structure, JSDOMGlobalObject& globalObject, Ref<HTMLScriptElement>&& impl)
: JSHTMLElement(structure, globalObject, WTFMove(impl))
{
}
JSObject* JSHTMLScriptElement::createPrototype(VM& vm, JSGlobalObject* globalObject)
{
return JSHTMLScriptElementPrototype::create(vm, globalObject, JSHTMLScriptElementPrototype::createStructure(vm, globalObject, JSHTMLElement::prototype(vm, globalObject)));
}
JSObject* JSHTMLScriptElement::prototype(VM& vm, JSGlobalObject* globalObject)
{
return getDOMPrototype<JSHTMLScriptElement>(vm, globalObject);
}
EncodedJSValue jsHTMLScriptElementText(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSHTMLScriptElement*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "HTMLScriptElement", "text");
}
auto& impl = castedThis->wrapped();
JSValue result = jsStringWithCache(state, impl.text());
return JSValue::encode(result);
}
EncodedJSValue jsHTMLScriptElementHtmlFor(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSHTMLScriptElement*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "HTMLScriptElement", "htmlFor");
}
auto& impl = castedThis->wrapped();
JSValue result = jsStringWithCache(state, impl.attributeWithoutSynchronization(WebCore::HTMLNames::forAttr));
return JSValue::encode(result);
}
EncodedJSValue jsHTMLScriptElementEvent(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSHTMLScriptElement*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "HTMLScriptElement", "event");
}
auto& impl = castedThis->wrapped();
JSValue result = jsStringWithCache(state, impl.attributeWithoutSynchronization(WebCore::HTMLNames::eventAttr));
return JSValue::encode(result);
}
EncodedJSValue jsHTMLScriptElementCharset(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSHTMLScriptElement*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "HTMLScriptElement", "charset");
}
auto& impl = castedThis->wrapped();
JSValue result = jsStringWithCache(state, impl.attributeWithoutSynchronization(WebCore::HTMLNames::charsetAttr));
return JSValue::encode(result);
}
EncodedJSValue jsHTMLScriptElementAsync(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSHTMLScriptElement*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "HTMLScriptElement", "async");
}
auto& impl = castedThis->wrapped();
JSValue result = jsBoolean(impl.async());
return JSValue::encode(result);
}
EncodedJSValue jsHTMLScriptElementDefer(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSHTMLScriptElement*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "HTMLScriptElement", "defer");
}
auto& impl = castedThis->wrapped();
JSValue result = jsBoolean(impl.hasAttributeWithoutSynchronization(WebCore::HTMLNames::deferAttr));
return JSValue::encode(result);
}
EncodedJSValue jsHTMLScriptElementSrc(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSHTMLScriptElement*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "HTMLScriptElement", "src");
}
auto& impl = castedThis->wrapped();
JSValue result = jsStringWithCache(state, impl.getURLAttribute(WebCore::HTMLNames::srcAttr));
return JSValue::encode(result);
}
EncodedJSValue jsHTMLScriptElementType(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSHTMLScriptElement*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "HTMLScriptElement", "type");
}
auto& impl = castedThis->wrapped();
JSValue result = jsStringWithCache(state, impl.attributeWithoutSynchronization(WebCore::HTMLNames::typeAttr));
return JSValue::encode(result);
}
EncodedJSValue jsHTMLScriptElementCrossOrigin(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSHTMLScriptElement*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "HTMLScriptElement", "crossOrigin");
}
auto& impl = castedThis->wrapped();
JSValue result = jsStringOrNull(state, impl.crossOrigin());
return JSValue::encode(result);
}
EncodedJSValue jsHTMLScriptElementNonce(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSHTMLScriptElement*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "HTMLScriptElement", "nonce");
}
auto& impl = castedThis->wrapped();
JSValue result = jsStringWithCache(state, impl.attributeWithoutSynchronization(WebCore::HTMLNames::nonceAttr));
return JSValue::encode(result);
}
EncodedJSValue jsHTMLScriptElementConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
JSHTMLScriptElementPrototype* domObject = jsDynamicCast<JSHTMLScriptElementPrototype*>(JSValue::decode(thisValue));
if (UNLIKELY(!domObject))
return throwVMTypeError(state, throwScope);
return JSValue::encode(JSHTMLScriptElement::getConstructor(state->vm(), domObject->globalObject()));
}
bool setJSHTMLScriptElementConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
JSValue value = JSValue::decode(encodedValue);
JSHTMLScriptElementPrototype* domObject = jsDynamicCast<JSHTMLScriptElementPrototype*>(JSValue::decode(thisValue));
if (UNLIKELY(!domObject)) {
throwVMTypeError(state, throwScope);
return false;
}
// Shadowing a built-in constructor
return domObject->putDirect(state->vm(), state->propertyNames().constructor, value);
}
bool setJSHTMLScriptElementText(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue value = JSValue::decode(encodedValue);
UNUSED_PARAM(thisValue);
JSHTMLScriptElement* castedThis = jsDynamicCast<JSHTMLScriptElement*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, throwScope, "HTMLScriptElement", "text");
}
auto& impl = castedThis->wrapped();
auto nativeValue = value.toWTFString(state);
RETURN_IF_EXCEPTION(throwScope, false);
impl.setText(WTFMove(nativeValue));
return true;
}
bool setJSHTMLScriptElementHtmlFor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue value = JSValue::decode(encodedValue);
UNUSED_PARAM(thisValue);
JSHTMLScriptElement* castedThis = jsDynamicCast<JSHTMLScriptElement*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, throwScope, "HTMLScriptElement", "htmlFor");
}
auto& impl = castedThis->wrapped();
auto nativeValue = value.toWTFString(state);
RETURN_IF_EXCEPTION(throwScope, false);
impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::forAttr, WTFMove(nativeValue));
return true;
}
bool setJSHTMLScriptElementEvent(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue value = JSValue::decode(encodedValue);
UNUSED_PARAM(thisValue);
JSHTMLScriptElement* castedThis = jsDynamicCast<JSHTMLScriptElement*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, throwScope, "HTMLScriptElement", "event");
}
auto& impl = castedThis->wrapped();
auto nativeValue = value.toWTFString(state);
RETURN_IF_EXCEPTION(throwScope, false);
impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::eventAttr, WTFMove(nativeValue));
return true;
}
bool setJSHTMLScriptElementCharset(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue value = JSValue::decode(encodedValue);
UNUSED_PARAM(thisValue);
JSHTMLScriptElement* castedThis = jsDynamicCast<JSHTMLScriptElement*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, throwScope, "HTMLScriptElement", "charset");
}
auto& impl = castedThis->wrapped();
auto nativeValue = value.toWTFString(state);
RETURN_IF_EXCEPTION(throwScope, false);
impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::charsetAttr, WTFMove(nativeValue));
return true;
}
bool setJSHTMLScriptElementAsync(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue value = JSValue::decode(encodedValue);
UNUSED_PARAM(thisValue);
JSHTMLScriptElement* castedThis = jsDynamicCast<JSHTMLScriptElement*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, throwScope, "HTMLScriptElement", "async");
}
auto& impl = castedThis->wrapped();
auto nativeValue = value.toBoolean(state);
RETURN_IF_EXCEPTION(throwScope, false);
impl.setAsync(WTFMove(nativeValue));
return true;
}
bool setJSHTMLScriptElementDefer(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue value = JSValue::decode(encodedValue);
UNUSED_PARAM(thisValue);
JSHTMLScriptElement* castedThis = jsDynamicCast<JSHTMLScriptElement*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, throwScope, "HTMLScriptElement", "defer");
}
auto& impl = castedThis->wrapped();
auto nativeValue = value.toBoolean(state);
RETURN_IF_EXCEPTION(throwScope, false);
impl.setBooleanAttribute(WebCore::HTMLNames::deferAttr, WTFMove(nativeValue));
return true;
}
bool setJSHTMLScriptElementSrc(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue value = JSValue::decode(encodedValue);
UNUSED_PARAM(thisValue);
JSHTMLScriptElement* castedThis = jsDynamicCast<JSHTMLScriptElement*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, throwScope, "HTMLScriptElement", "src");
}
auto& impl = castedThis->wrapped();
auto nativeValue = valueToUSVString(state, value);
RETURN_IF_EXCEPTION(throwScope, false);
impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::srcAttr, WTFMove(nativeValue));
return true;
}
bool setJSHTMLScriptElementType(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue value = JSValue::decode(encodedValue);
UNUSED_PARAM(thisValue);
JSHTMLScriptElement* castedThis = jsDynamicCast<JSHTMLScriptElement*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, throwScope, "HTMLScriptElement", "type");
}
auto& impl = castedThis->wrapped();
auto nativeValue = value.toWTFString(state);
RETURN_IF_EXCEPTION(throwScope, false);
impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::typeAttr, WTFMove(nativeValue));
return true;
}
bool setJSHTMLScriptElementCrossOrigin(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue value = JSValue::decode(encodedValue);
UNUSED_PARAM(thisValue);
JSHTMLScriptElement* castedThis = jsDynamicCast<JSHTMLScriptElement*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, throwScope, "HTMLScriptElement", "crossOrigin");
}
auto& impl = castedThis->wrapped();
auto nativeValue = valueToStringWithUndefinedOrNullCheck(state, value);
RETURN_IF_EXCEPTION(throwScope, false);
impl.setCrossOrigin(WTFMove(nativeValue));
return true;
}
bool setJSHTMLScriptElementNonce(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue value = JSValue::decode(encodedValue);
UNUSED_PARAM(thisValue);
JSHTMLScriptElement* castedThis = jsDynamicCast<JSHTMLScriptElement*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, throwScope, "HTMLScriptElement", "nonce");
}
auto& impl = castedThis->wrapped();
auto nativeValue = value.toWTFString(state);
RETURN_IF_EXCEPTION(throwScope, false);
impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::nonceAttr, WTFMove(nativeValue));
return true;
}
JSValue JSHTMLScriptElement::getConstructor(VM& vm, const JSGlobalObject* globalObject)
{
return getDOMConstructor<JSHTMLScriptElementConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
}
void JSHTMLScriptElement::visitChildren(JSCell* cell, SlotVisitor& visitor)
{
auto* thisObject = jsCast<JSHTMLScriptElement*>(cell);
ASSERT_GC_OBJECT_INHERITS(thisObject, info());
Base::visitChildren(thisObject, visitor);
thisObject->wrapped().visitJSEventListeners(visitor);
}
}