blob: b75f4b0f5cd8b12aba46d17f56efd7875e832283 [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"
#if ENABLE(INDIE_UI)
#include "JSUIRequestEvent.h"
#include "JSDOMBinding.h"
#include "JSDOMConstructor.h"
#include "JSDictionary.h"
#include "JSEventTarget.h"
#include <runtime/Error.h>
#include <wtf/GetPtr.h>
using namespace JSC;
namespace WebCore {
// Attributes
JSC::EncodedJSValue jsUIRequestEventReceiver(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
JSC::EncodedJSValue jsUIRequestEventConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSUIRequestEventConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
class JSUIRequestEventPrototype : public JSC::JSNonFinalObject {
public:
typedef JSC::JSNonFinalObject Base;
static JSUIRequestEventPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
{
JSUIRequestEventPrototype* ptr = new (NotNull, JSC::allocateCell<JSUIRequestEventPrototype>(vm.heap)) JSUIRequestEventPrototype(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:
JSUIRequestEventPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
: JSC::JSNonFinalObject(vm, structure)
{
}
void finishCreation(JSC::VM&);
};
typedef JSDOMConstructor<JSUIRequestEvent> JSUIRequestEventConstructor;
template<> EncodedJSValue JSC_HOST_CALL JSUIRequestEventConstructor::construct(ExecState* state)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
auto* jsConstructor = jsCast<JSUIRequestEventConstructor*>(state->callee());
ASSERT(jsConstructor);
if (!jsConstructor->scriptExecutionContext())
return throwConstructorScriptExecutionContextUnavailableError(*state, throwScope, "UIRequestEvent");
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
AtomicString eventType = state->uncheckedArgument(0).toString(state)->toAtomicString(state);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
UIRequestEventInit eventInit;
JSValue initializerValue = state->argument(1);
if (!initializerValue.isUndefinedOrNull()) {
// Given the above test, this will always yield an object.
JSObject* initializerObject = initializerValue.toObject(state);
ASSERT(!throwScope.exception());
// Create the dictionary wrapper from the initializer object.
JSDictionary dictionary(state, initializerObject);
// Attempt to fill in the EventInit.
if (!fillUIRequestEventInit(eventInit, dictionary))
return JSValue::encode(jsUndefined());
}
Ref<UIRequestEvent> event = UIRequestEvent::createForBindings(eventType, eventInit);
return JSValue::encode(createWrapper<UIRequestEvent>(jsConstructor->globalObject(), WTFMove(event)));
}
bool fillUIRequestEventInit(UIRequestEventInit& eventInit, JSDictionary& dictionary)
{
if (!fillUIEventInit(eventInit, dictionary))
return false;
return true;
}
template<> JSValue JSUIRequestEventConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
{
return JSUIEvent::getConstructor(vm, &globalObject);
}
template<> void JSUIRequestEventConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
{
putDirect(vm, vm.propertyNames->prototype, JSUIRequestEvent::prototype(vm, &globalObject), DontDelete | ReadOnly | DontEnum);
putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("UIRequestEvent"))), ReadOnly | DontEnum);
putDirect(vm, vm.propertyNames->length, jsNumber(1), ReadOnly | DontEnum);
}
template<> const ClassInfo JSUIRequestEventConstructor::s_info = { "UIRequestEvent", &Base::s_info, 0, CREATE_METHOD_TABLE(JSUIRequestEventConstructor) };
/* Hash table for prototype */
static const HashTableValue JSUIRequestEventPrototypeTableValues[] =
{
{ "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsUIRequestEventConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSUIRequestEventConstructor) } },
{ "receiver", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsUIRequestEventReceiver), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
};
const ClassInfo JSUIRequestEventPrototype::s_info = { "UIRequestEventPrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSUIRequestEventPrototype) };
void JSUIRequestEventPrototype::finishCreation(VM& vm)
{
Base::finishCreation(vm);
reifyStaticProperties(vm, JSUIRequestEventPrototypeTableValues, *this);
}
const ClassInfo JSUIRequestEvent::s_info = { "UIRequestEvent", &Base::s_info, 0, CREATE_METHOD_TABLE(JSUIRequestEvent) };
JSUIRequestEvent::JSUIRequestEvent(Structure* structure, JSDOMGlobalObject& globalObject, Ref<UIRequestEvent>&& impl)
: JSUIEvent(structure, globalObject, WTFMove(impl))
{
}
JSObject* JSUIRequestEvent::createPrototype(VM& vm, JSGlobalObject* globalObject)
{
return JSUIRequestEventPrototype::create(vm, globalObject, JSUIRequestEventPrototype::createStructure(vm, globalObject, JSUIEvent::prototype(vm, globalObject)));
}
JSObject* JSUIRequestEvent::prototype(VM& vm, JSGlobalObject* globalObject)
{
return getDOMPrototype<JSUIRequestEvent>(vm, globalObject);
}
EncodedJSValue jsUIRequestEventReceiver(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<JSUIRequestEvent*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "UIRequestEvent", "receiver");
}
auto& impl = castedThis->wrapped();
JSValue result = toJS(state, castedThis->globalObject(), impl.receiver());
return JSValue::encode(result);
}
EncodedJSValue jsUIRequestEventConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
JSUIRequestEventPrototype* domObject = jsDynamicCast<JSUIRequestEventPrototype*>(JSValue::decode(thisValue));
if (UNLIKELY(!domObject))
return throwVMTypeError(state, throwScope);
return JSValue::encode(JSUIRequestEvent::getConstructor(state->vm(), domObject->globalObject()));
}
bool setJSUIRequestEventConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
JSValue value = JSValue::decode(encodedValue);
JSUIRequestEventPrototype* domObject = jsDynamicCast<JSUIRequestEventPrototype*>(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);
}
JSValue JSUIRequestEvent::getConstructor(VM& vm, const JSGlobalObject* globalObject)
{
return getDOMConstructor<JSUIRequestEventConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
}
}
#endif // ENABLE(INDIE_UI)