#ifndef ErrorEvent_h
#define ErrorEvent_h
#include "Event.h"
#include "SerializedScriptValue.h"
#include <bindings/ScriptValue.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
struct ErrorEventInit : public EventInit {
String message;
String filename;
unsigned lineno { 0 };
unsigned colno { 0 };
Deprecated::ScriptValue error;
};
class ErrorEvent final : public Event {
public:
static Ref<ErrorEvent> create(const String& message, const String& fileName, unsigned lineNumber, unsigned columnNumber, const Deprecated::ScriptValue& error)
{
return adoptRef(*new ErrorEvent(message, fileName, lineNumber, columnNumber, error));
}
static Ref<ErrorEvent> createForBindings(const AtomicString& type, const ErrorEventInit& initializer)
{
return adoptRef(*new ErrorEvent(type, initializer));
}
virtual ~ErrorEvent();
const String& message() const { return m_message; }
const String& filename() const { return m_fileName; }
unsigned lineno() const { return m_lineNumber; }
unsigned colno() const { return m_columnNumber; }
const Deprecated::ScriptValue& error() const { return m_error; }
JSC::JSValue sanitizedErrorValue(JSC::ExecState&, JSC::JSGlobalObject&);
EventInterface eventInterface() const override;
private:
ErrorEvent(const String& message, const String& fileName, unsigned lineNumber, unsigned columnNumber, const Deprecated::ScriptValue& error);
ErrorEvent(const AtomicString&, const ErrorEventInit&);
RefPtr<SerializedScriptValue> trySerializeError(JSC::ExecState&);
bool isErrorEvent() const override;
String m_message;
String m_fileName;
unsigned m_lineNumber;
unsigned m_columnNumber;
Deprecated::ScriptValue m_error;
RefPtr<SerializedScriptValue> m_serializedDetail;
bool m_triedToSerialize { false };
};
}
SPECIALIZE_TYPE_TRAITS_EVENT(ErrorEvent)
#endif // ErrorEvent_h