#ifndef JSNPObject_h
#define JSNPObject_h
#include <JavaScriptCore/JSGlobalObject.h>
#include <JavaScriptCore/JSObject.h>
#include <JavaScriptCore/ObjectPrototype.h>
typedef void* NPIdentifier;
struct NPObject;
namespace WebKit {
class NPRuntimeObjectMap;
class JSNPObject : public JSC::JSNonFinalObject {
public:
typedef JSC::JSNonFinalObject Base;
static JSNPObject* create(JSC::JSGlobalObject* globalObject, NPRuntimeObjectMap* objectMap, NPObject* npObject)
{
JSC::Structure* structure = createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype());
JSNPObject* object = new (JSC::allocateCell<JSNPObject>(globalObject->globalData().heap)) JSNPObject(globalObject, structure, objectMap, npObject);
object->finishCreation(globalObject);
return object;
}
~JSNPObject();
static void destroy(JSCell*);
void invalidate();
NPObject* leakNPObject();
JSC::JSValue callMethod(JSC::ExecState*, NPIdentifier methodName);
JSC::JSValue callObject(JSC::ExecState*);
JSC::JSValue callConstructor(JSC::ExecState*);
static const JSC::ClassInfo s_info;
NPObject* npObject() const { return m_npObject; }
protected:
void finishCreation(JSC::JSGlobalObject*);
private:
JSNPObject(JSC::JSGlobalObject*, JSC::Structure*, NPRuntimeObjectMap*, NPObject*);
static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::OverridesGetPropertyNames | JSObject::StructureFlags;
static JSC::Structure* createStructure(JSC::JSGlobalData& globalData, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
{
return JSC::Structure::create(globalData, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), &s_info);
}
static JSC::CallType getCallData(JSC::JSCell*, JSC::CallData&);
static JSC::ConstructType getConstructData(JSC::JSCell*, JSC::ConstructData&);
static bool getOwnPropertySlot(JSC::JSCell*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&);
static bool getOwnPropertyDescriptor(JSC::JSObject*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&);
static void put(JSC::JSCell*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSValue, JSC::PutPropertySlot&);
static bool deleteProperty(JSC::JSCell*, JSC::ExecState*, const JSC::Identifier& propertyName);
static bool deletePropertyByIndex(JSC::JSCell*, JSC::ExecState*, unsigned propertyName);
bool deleteProperty(JSC::ExecState*, NPIdentifier propertyName);
static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode);
static JSC::JSValue propertyGetter(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
static JSC::JSValue methodGetter(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
static JSC::JSObject* throwInvalidAccessError(JSC::ExecState*);
NPRuntimeObjectMap* m_objectMap;
NPObject* m_npObject;
};
}
#endif // JSNPObject_h