#ifndef ErrorEvent_h
#define ErrorEvent_h
#include "bindings/v8/DOMWrapperWorld.h"
#include "core/events/Event.h"
#include "wtf/RefPtr.h"
#include "wtf/text/WTFString.h"
namespace WebCore {
struct ErrorEventInit : public EventInit {
ErrorEventInit();
String message;
String filename;
unsigned lineno;
unsigned colno;
};
class ErrorEvent FINAL : public Event {
public:
static PassRefPtrWillBeRawPtr<ErrorEvent> create()
{
return adoptRefWillBeNoop(new ErrorEvent);
}
static PassRefPtrWillBeRawPtr<ErrorEvent> create(const String& message, const String& fileName, unsigned lineNumber, unsigned columnNumber, DOMWrapperWorld* world)
{
return adoptRefWillBeNoop(new ErrorEvent(message, fileName, lineNumber, columnNumber, world));
}
static PassRefPtrWillBeRawPtr<ErrorEvent> create(const AtomicString& type, const ErrorEventInit& initializer)
{
return adoptRefWillBeNoop(new ErrorEvent(type, initializer));
}
static PassRefPtrWillBeRawPtr<ErrorEvent> createSanitizedError(DOMWrapperWorld* world)
{
return adoptRefWillBeNoop(new ErrorEvent("Script error.", String(), 0, 0, world));
}
virtual ~ErrorEvent();
const String& message() const { return m_sanitizedMessage; }
const String& filename() const { return m_fileName; }
unsigned lineno() const { return m_lineNumber; }
unsigned colno() const { return m_columnNumber; }
const String& messageForConsole() const { return !m_unsanitizedMessage.isEmpty() ? m_unsanitizedMessage : m_sanitizedMessage; }
virtual const AtomicString& interfaceName() const OVERRIDE;
DOMWrapperWorld* world() const { return m_world.get(); }
void setUnsanitizedMessage(const String&);
virtual void trace(Visitor*) OVERRIDE;
private:
ErrorEvent();
ErrorEvent(const String& message, const String& fileName, unsigned lineNumber, unsigned columnNumber, DOMWrapperWorld*);
ErrorEvent(const AtomicString&, const ErrorEventInit&);
String m_unsanitizedMessage;
String m_sanitizedMessage;
String m_fileName;
unsigned m_lineNumber;
unsigned m_columnNumber;
RefPtr<DOMWrapperWorld> m_world;
};
}
#endif