static void onmessageAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
    MessagePort* imp = V8MessagePort::toNative(info.Holder());
    transferHiddenDependency(info.Holder(), imp->onmessage(), value, V8MessagePort::eventListenerCacheIndex);
    imp->setOnmessage(V8DOMWrapper::getEventListener(value, true, ListenerFindOrCreate));
    return;
}
Exemplo n.º 2
0
JSValue jsMessagePortOnmessage(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSMessagePort* castedThis = static_cast<JSMessagePort*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    MessagePort* imp = static_cast<MessagePort*>(castedThis->impl());
    if (EventListener* listener = imp->onmessage()) {
        if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
            if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
                return jsFunction;
        }
    }
    return jsNull();
}
static v8::Handle<v8::Value> onmessageAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    MessagePort* imp = V8MessagePort::toNative(info.Holder());
    return imp->onmessage() ? v8::Handle<v8::Value>(static_cast<V8AbstractEventListener*>(imp->onmessage())->getListenerObject(imp->scriptExecutionContext())) : v8::Handle<v8::Value>(v8Null(info.GetIsolate()));
}