コード例 #1
0
ファイル: JSCustomEvent.cpp プロジェクト: youtube/h5vcc_hh
JSValue jsCustomEventDetail(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSCustomEvent* castedThis = static_cast<JSCustomEvent*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    CustomEvent* imp = static_cast<CustomEvent*>(castedThis->impl());
    JSValue result = imp->detail().jsValue();;
    return result;
}
コード例 #2
0
void V8CustomEvent::detailAttributeGetterCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    CustomEvent* event = V8CustomEvent::toImpl(info.Holder());

    v8::Local<v8::Value> result = V8HiddenValue::getHiddenValue(info.GetIsolate(), info.Holder(), V8HiddenValue::detail(info.GetIsolate()));

    if (!result.IsEmpty()) {
        v8SetReturnValue(info, result);
        return;
    }

    // Be careful not to return a V8 value which is created in different world.
    v8::Local<v8::Value> detail;
    if (SerializedScriptValue* serializedValue = event->serializedDetail())
        detail = serializedValue->deserialize();
    else
        detail = event->detail().v8ValueFor(ScriptState::current(info.GetIsolate()));
    // |detail| should be null when it is an empty handle because its default value is null.
    if (detail.IsEmpty())
        detail = v8::Null(info.GetIsolate());
    v8SetReturnValue(info, cacheState(info.GetIsolate(), info.Holder(), detail));
}