blob: 2ee203bdcbe46a75d7d3d3e8770a4a7c1436ee7a [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 "JSPageTransitionEvent.h"
#include "JSDOMBinding.h"
#include "JSDOMConstructor.h"
#include "JSDictionary.h"
#include <runtime/Error.h>
#include <wtf/GetPtr.h>
using namespace JSC;
namespace WebCore {
// Attributes
JSC::EncodedJSValue jsPageTransitionEventPersisted(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
JSC::EncodedJSValue jsPageTransitionEventConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSPageTransitionEventConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
class JSPageTransitionEventPrototype : public JSC::JSNonFinalObject {
public:
typedef JSC::JSNonFinalObject Base;
static JSPageTransitionEventPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
{
JSPageTransitionEventPrototype* ptr = new (NotNull, JSC::allocateCell<JSPageTransitionEventPrototype>(vm.heap)) JSPageTransitionEventPrototype(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:
JSPageTransitionEventPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
: JSC::JSNonFinalObject(vm, structure)
{
}
void finishCreation(JSC::VM&);
};
typedef JSDOMConstructor<JSPageTransitionEvent> JSPageTransitionEventConstructor;
template<> EncodedJSValue JSC_HOST_CALL JSPageTransitionEventConstructor::construct(ExecState* state)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
auto* jsConstructor = jsCast<JSPageTransitionEventConstructor*>(state->callee());
ASSERT(jsConstructor);
if (!jsConstructor->scriptExecutionContext())
return throwConstructorScriptExecutionContextUnavailableError(*state, throwScope, "PageTransitionEvent");
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());
PageTransitionEventInit 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 (!fillPageTransitionEventInit(eventInit, dictionary))
return JSValue::encode(jsUndefined());
}
Ref<PageTransitionEvent> event = PageTransitionEvent::createForBindings(eventType, eventInit);
return JSValue::encode(createWrapper<PageTransitionEvent>(jsConstructor->globalObject(), WTFMove(event)));
}
bool fillPageTransitionEventInit(PageTransitionEventInit& eventInit, JSDictionary& dictionary)
{
if (!fillEventInit(eventInit, dictionary))
return false;
if (!dictionary.tryGetProperty("persisted", eventInit.persisted))
return false;
return true;
}
template<> JSValue JSPageTransitionEventConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
{
return JSEvent::getConstructor(vm, &globalObject);
}
template<> void JSPageTransitionEventConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
{
putDirect(vm, vm.propertyNames->prototype, JSPageTransitionEvent::prototype(vm, &globalObject), DontDelete | ReadOnly | DontEnum);
putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("PageTransitionEvent"))), ReadOnly | DontEnum);
putDirect(vm, vm.propertyNames->length, jsNumber(1), ReadOnly | DontEnum);
}
template<> const ClassInfo JSPageTransitionEventConstructor::s_info = { "PageTransitionEvent", &Base::s_info, 0, CREATE_METHOD_TABLE(JSPageTransitionEventConstructor) };
/* Hash table for prototype */
static const HashTableValue JSPageTransitionEventPrototypeTableValues[] =
{
{ "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPageTransitionEventConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSPageTransitionEventConstructor) } },
{ "persisted", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPageTransitionEventPersisted), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
};
const ClassInfo JSPageTransitionEventPrototype::s_info = { "PageTransitionEventPrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSPageTransitionEventPrototype) };
void JSPageTransitionEventPrototype::finishCreation(VM& vm)
{
Base::finishCreation(vm);
reifyStaticProperties(vm, JSPageTransitionEventPrototypeTableValues, *this);
}
const ClassInfo JSPageTransitionEvent::s_info = { "PageTransitionEvent", &Base::s_info, 0, CREATE_METHOD_TABLE(JSPageTransitionEvent) };
JSPageTransitionEvent::JSPageTransitionEvent(Structure* structure, JSDOMGlobalObject& globalObject, Ref<PageTransitionEvent>&& impl)
: JSEvent(structure, globalObject, WTFMove(impl))
{
}
JSObject* JSPageTransitionEvent::createPrototype(VM& vm, JSGlobalObject* globalObject)
{
return JSPageTransitionEventPrototype::create(vm, globalObject, JSPageTransitionEventPrototype::createStructure(vm, globalObject, JSEvent::prototype(vm, globalObject)));
}
JSObject* JSPageTransitionEvent::prototype(VM& vm, JSGlobalObject* globalObject)
{
return getDOMPrototype<JSPageTransitionEvent>(vm, globalObject);
}
EncodedJSValue jsPageTransitionEventPersisted(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<JSPageTransitionEvent*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "PageTransitionEvent", "persisted");
}
auto& impl = castedThis->wrapped();
JSValue result = jsBoolean(impl.persisted());
return JSValue::encode(result);
}
EncodedJSValue jsPageTransitionEventConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
JSPageTransitionEventPrototype* domObject = jsDynamicCast<JSPageTransitionEventPrototype*>(JSValue::decode(thisValue));
if (UNLIKELY(!domObject))
return throwVMTypeError(state, throwScope);
return JSValue::encode(JSPageTransitionEvent::getConstructor(state->vm(), domObject->globalObject()));
}
bool setJSPageTransitionEventConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
JSValue value = JSValue::decode(encodedValue);
JSPageTransitionEventPrototype* domObject = jsDynamicCast<JSPageTransitionEventPrototype*>(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 JSPageTransitionEvent::getConstructor(VM& vm, const JSGlobalObject* globalObject)
{
return getDOMConstructor<JSPageTransitionEventConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
}
}