This source file includes following definitions.
- cacheState
- detailAttributeGetterCustom
- initCustomEventMethodCustom
#include "config.h"
#include "V8CustomEvent.h"
#include "RuntimeEnabledFeatures.h"
#include "V8Event.h"
#include "bindings/v8/Dictionary.h"
#include "bindings/v8/ScriptState.h"
#include "bindings/v8/SerializedScriptValue.h"
#include "bindings/v8/V8Binding.h"
#include "bindings/v8/V8DOMWrapper.h"
#include "bindings/v8/V8HiddenValue.h"
#include "core/dom/ContextFeatures.h"
namespace WebCore {
static v8::Handle<v8::Value> cacheState(v8::Handle<v8::Object> customEvent, v8::Handle<v8::Value> detail, v8::Isolate* isolate)
{
V8HiddenValue::setHiddenValue(isolate, customEvent, V8HiddenValue::detail(isolate), detail);
return detail;
}
void V8CustomEvent::detailAttributeGetterCustom(const v8::PropertyCallbackInfo<v8::Value>& info)
{
CustomEvent* event = V8CustomEvent::toNative(info.Holder());
v8::Handle<v8::Value> result = V8HiddenValue::getHiddenValue(info.GetIsolate(), info.Holder(), V8HiddenValue::detail(info.GetIsolate()));
if (!result.IsEmpty()) {
v8SetReturnValue(info, result);
return;
}
if (!event->serializedDetail()) {
v8::Local<v8::Value> mainWorldDetail = V8HiddenValue::getHiddenValueFromMainWorldWrapper(info.GetIsolate(), event, V8HiddenValue::detail(info.GetIsolate()));
if (!mainWorldDetail.IsEmpty())
event->setSerializedDetail(SerializedScriptValue::createAndSwallowExceptions(mainWorldDetail, info.GetIsolate()));
}
if (event->serializedDetail()) {
result = event->serializedDetail()->deserialize();
v8SetReturnValue(info, cacheState(info.Holder(), result, info.GetIsolate()));
return;
}
v8SetReturnValue(info, cacheState(info.Holder(), v8::Null(info.GetIsolate()), info.GetIsolate()));
}
void V8CustomEvent::initCustomEventMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
{
CustomEvent* event = V8CustomEvent::toNative(info.Holder());
ASSERT(!event->serializedDetail());
V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, typeArg, info[0]);
V8TRYCATCH_VOID(bool, canBubbleArg, info[1]->BooleanValue());
V8TRYCATCH_VOID(bool, cancelableArg, info[2]->BooleanValue());
v8::Handle<v8::Value> detailsArg = info[3];
event->initEvent(typeArg, canBubbleArg, cancelableArg);
if (!detailsArg.IsEmpty()) {
V8HiddenValue::setHiddenValue(info.GetIsolate(), info.Holder(), V8HiddenValue::detail(info.GetIsolate()), detailsArg);
if (DOMWrapperWorld::current(info.GetIsolate()).isIsolatedWorld())
event->setSerializedDetail(SerializedScriptValue::createAndSwallowExceptions(detailsArg, info.GetIsolate()));
}
}
}