/** @file JSMOMMessageEventCustom.cpp
 *
 * Copyright (C) Espial Limited 2014 - Company confidential - All rights reserved.
 *
 */

#include "config.h"

#if ENABLE(RMAI)

#include "MOMException.h"

#include "JSMOMMessageEvent.h"
#include "MOMMessageEvent.h"

using namespace JSC;

namespace WebCore {

bool JSMOMMessageEvent::getOwnPropertySlotByIndex(JSC::JSObject* object, JSC::ExecState* exec, unsigned propertyName, JSC::PropertySlot& slot)
{
    if (propertyName >= mom_event_MESSAGE_DATA_COUNT) {
        slot.setUndefined();
        return true;
    }
    JSMOMMessageEvent* thisObject = jsCast<JSMOMMessageEvent*>(object);
    slot.setValue(object, JSC::DontEnum, jsNumber(thisObject->wrapped().item(propertyName)));
    return true;
}

bool JSMOMMessageEvent::getOwnPropertySlot(JSC::JSObject* object, JSC::ExecState* exec, JSC::PropertyName propertyName, JSC::PropertySlot& slot)
{
    JSMOMMessageEvent* thisObject = jsCast<JSMOMMessageEvent*>(object);
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
    const HashTableValue* entry = s_info.staticPropHashTable ->entry(propertyName);
    if (entry) {
        slot.setCustom(thisObject, entry->attributes(), entry->propertyGetter());
        return true;
    }
    return Base::getOwnPropertySlot(thisObject, exec, propertyName, slot);
}

} // namespace WebCore

#endif // ENABLE(RMAI)

