blob: ce3b32b47893c8c23ecbe351b284035df1d07b09 [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 "JSHTMLMetaElement.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 jsHTMLMetaElementContent(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSHTMLMetaElementContent(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsHTMLMetaElementHttpEquiv(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSHTMLMetaElementHttpEquiv(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsHTMLMetaElementName(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSHTMLMetaElementName(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsHTMLMetaElementScheme(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSHTMLMetaElementScheme(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsHTMLMetaElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSHTMLMetaElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
class JSHTMLMetaElementPrototype : public JSC::JSNonFinalObject {
public:
typedef JSC::JSNonFinalObject Base;
static JSHTMLMetaElementPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
{
JSHTMLMetaElementPrototype* ptr = new (NotNull, JSC::allocateCell<JSHTMLMetaElementPrototype>(vm.heap)) JSHTMLMetaElementPrototype(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:
JSHTMLMetaElementPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
: JSC::JSNonFinalObject(vm, structure)
{
}
void finishCreation(JSC::VM&);
};
typedef JSDOMConstructorNotConstructable<JSHTMLMetaElement> JSHTMLMetaElementConstructor;
template<> JSValue JSHTMLMetaElementConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
{
return JSHTMLElement::getConstructor(vm, &globalObject);
}
template<> void JSHTMLMetaElementConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
{
putDirect(vm, vm.propertyNames->prototype, JSHTMLMetaElement::prototype(vm, &globalObject), DontDelete | ReadOnly | DontEnum);
putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("HTMLMetaElement"))), ReadOnly | DontEnum);
putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum);
}
template<> const ClassInfo JSHTMLMetaElementConstructor::s_info = { "HTMLMetaElement", &Base::s_info, 0, CREATE_METHOD_TABLE(JSHTMLMetaElementConstructor) };
/* Hash table for prototype */
static const HashTableValue JSHTMLMetaElementPrototypeTableValues[] =
{
{ "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLMetaElementConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLMetaElementConstructor) } },
{ "content", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLMetaElementContent), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLMetaElementContent) } },
{ "httpEquiv", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLMetaElementHttpEquiv), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLMetaElementHttpEquiv) } },
{ "name", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLMetaElementName), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLMetaElementName) } },
{ "scheme", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLMetaElementScheme), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLMetaElementScheme) } },
};
const ClassInfo JSHTMLMetaElementPrototype::s_info = { "HTMLMetaElementPrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSHTMLMetaElementPrototype) };
void JSHTMLMetaElementPrototype::finishCreation(VM& vm)
{
Base::finishCreation(vm);
reifyStaticProperties(vm, JSHTMLMetaElementPrototypeTableValues, *this);
}
const ClassInfo JSHTMLMetaElement::s_info = { "HTMLMetaElement", &Base::s_info, 0, CREATE_METHOD_TABLE(JSHTMLMetaElement) };
JSHTMLMetaElement::JSHTMLMetaElement(Structure* structure, JSDOMGlobalObject& globalObject, Ref<HTMLMetaElement>&& impl)
: JSHTMLElement(structure, globalObject, WTFMove(impl))
{
}
JSObject* JSHTMLMetaElement::createPrototype(VM& vm, JSGlobalObject* globalObject)
{
return JSHTMLMetaElementPrototype::create(vm, globalObject, JSHTMLMetaElementPrototype::createStructure(vm, globalObject, JSHTMLElement::prototype(vm, globalObject)));
}
JSObject* JSHTMLMetaElement::prototype(VM& vm, JSGlobalObject* globalObject)
{
return getDOMPrototype<JSHTMLMetaElement>(vm, globalObject);
}
EncodedJSValue jsHTMLMetaElementContent(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<JSHTMLMetaElement*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "HTMLMetaElement", "content");
}
auto& impl = castedThis->wrapped();
JSValue result = jsStringWithCache(state, impl.attributeWithoutSynchronization(WebCore::HTMLNames::contentAttr));
return JSValue::encode(result);
}
EncodedJSValue jsHTMLMetaElementHttpEquiv(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<JSHTMLMetaElement*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "HTMLMetaElement", "httpEquiv");
}
auto& impl = castedThis->wrapped();
JSValue result = jsStringWithCache(state, impl.attributeWithoutSynchronization(WebCore::HTMLNames::http_equivAttr));
return JSValue::encode(result);
}
EncodedJSValue jsHTMLMetaElementName(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<JSHTMLMetaElement*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "HTMLMetaElement", "name");
}
auto& impl = castedThis->wrapped();
JSValue result = jsStringWithCache(state, impl.getNameAttribute());
return JSValue::encode(result);
}
EncodedJSValue jsHTMLMetaElementScheme(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<JSHTMLMetaElement*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "HTMLMetaElement", "scheme");
}
auto& impl = castedThis->wrapped();
JSValue result = jsStringWithCache(state, impl.attributeWithoutSynchronization(WebCore::HTMLNames::schemeAttr));
return JSValue::encode(result);
}
EncodedJSValue jsHTMLMetaElementConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
JSHTMLMetaElementPrototype* domObject = jsDynamicCast<JSHTMLMetaElementPrototype*>(JSValue::decode(thisValue));
if (UNLIKELY(!domObject))
return throwVMTypeError(state, throwScope);
return JSValue::encode(JSHTMLMetaElement::getConstructor(state->vm(), domObject->globalObject()));
}
bool setJSHTMLMetaElementConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
JSValue value = JSValue::decode(encodedValue);
JSHTMLMetaElementPrototype* domObject = jsDynamicCast<JSHTMLMetaElementPrototype*>(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 setJSHTMLMetaElementContent(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);
JSHTMLMetaElement* castedThis = jsDynamicCast<JSHTMLMetaElement*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, throwScope, "HTMLMetaElement", "content");
}
auto& impl = castedThis->wrapped();
auto nativeValue = value.toWTFString(state);
RETURN_IF_EXCEPTION(throwScope, false);
impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::contentAttr, WTFMove(nativeValue));
return true;
}
bool setJSHTMLMetaElementHttpEquiv(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);
JSHTMLMetaElement* castedThis = jsDynamicCast<JSHTMLMetaElement*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, throwScope, "HTMLMetaElement", "httpEquiv");
}
auto& impl = castedThis->wrapped();
auto nativeValue = value.toWTFString(state);
RETURN_IF_EXCEPTION(throwScope, false);
impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::http_equivAttr, WTFMove(nativeValue));
return true;
}
bool setJSHTMLMetaElementName(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);
JSHTMLMetaElement* castedThis = jsDynamicCast<JSHTMLMetaElement*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, throwScope, "HTMLMetaElement", "name");
}
auto& impl = castedThis->wrapped();
auto nativeValue = value.toWTFString(state);
RETURN_IF_EXCEPTION(throwScope, false);
impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::nameAttr, WTFMove(nativeValue));
return true;
}
bool setJSHTMLMetaElementScheme(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);
JSHTMLMetaElement* castedThis = jsDynamicCast<JSHTMLMetaElement*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, throwScope, "HTMLMetaElement", "scheme");
}
auto& impl = castedThis->wrapped();
auto nativeValue = value.toWTFString(state);
RETURN_IF_EXCEPTION(throwScope, false);
impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::schemeAttr, WTFMove(nativeValue));
return true;
}
JSValue JSHTMLMetaElement::getConstructor(VM& vm, const JSGlobalObject* globalObject)
{
return getDOMConstructor<JSHTMLMetaElementConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
}
void JSHTMLMetaElement::visitChildren(JSCell* cell, SlotVisitor& visitor)
{
auto* thisObject = jsCast<JSHTMLMetaElement*>(cell);
ASSERT_GC_OBJECT_INHERITS(thisObject, info());
Base::visitChildren(thisObject, visitor);
thisObject->wrapped().visitJSEventListeners(visitor);
}
}