Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(301)

Unified Diff: third_party/WebKit/Source/core/events/ErrorEvent.h

Issue 2006893004: Store SourceLocation in ErrorEvent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2010603002
Patch Set: rebased Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/events/ErrorEvent.h
diff --git a/third_party/WebKit/Source/core/events/ErrorEvent.h b/third_party/WebKit/Source/core/events/ErrorEvent.h
index bc55ecdda0601fc1cb6560e47ec307c53a2d8985..97121d50b4faf4055209e2f06c01069f42a1e632 100644
--- a/third_party/WebKit/Source/core/events/ErrorEvent.h
+++ b/third_party/WebKit/Source/core/events/ErrorEvent.h
@@ -32,6 +32,7 @@
#define ErrorEvent_h
#include "bindings/core/v8/DOMWrapperWorld.h"
+#include "bindings/core/v8/SourceLocation.h"
#include "core/events/ErrorEventInit.h"
#include "core/events/Event.h"
#include "wtf/RefPtr.h"
@@ -46,9 +47,9 @@ public:
{
return new ErrorEvent;
}
- static ErrorEvent* create(const String& message, const String& fileName, unsigned lineNumber, unsigned columnNumber, DOMWrapperWorld* world)
+ static ErrorEvent* create(const String& message, PassOwnPtr<SourceLocation> location, DOMWrapperWorld* world)
{
- return new ErrorEvent(message, fileName, lineNumber, columnNumber, world);
+ return new ErrorEvent(message, std::move(location), world);
}
static ErrorEvent* create(const AtomicString& type, const ErrorEventInit& initializer)
{
@@ -56,19 +57,20 @@ public:
}
static ErrorEvent* createSanitizedError(DOMWrapperWorld* world)
{
- return new ErrorEvent("Script error.", String(), 0, 0, world);
+ return new ErrorEvent("Script error.", SourceLocation::create(String(), 0, 0, nullptr), world);
}
~ErrorEvent() override;
// As 'message' is exposed to JavaScript, never return unsanitizedMessage.
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& filename() const { return m_location->url(); }
+ unsigned lineno() const { return m_location->lineNumber(); }
+ unsigned colno() const { return m_location->columnNumber(); }
ScriptValue error(ScriptState*) const;
// 'messageForConsole' is not exposed to JavaScript, and prefers 'm_unsanitizedMessage'.
const String& messageForConsole() const { return !m_unsanitizedMessage.isEmpty() ? m_unsanitizedMessage : m_sanitizedMessage; }
+ SourceLocation* location() const { return m_location.get(); }
const AtomicString& interfaceName() const override;
@@ -80,14 +82,12 @@ public:
private:
ErrorEvent();
- ErrorEvent(const String& message, const String& fileName, unsigned lineNumber, unsigned columnNumber, DOMWrapperWorld*);
+ ErrorEvent(const String& message, PassOwnPtr<SourceLocation>, DOMWrapperWorld*);
ErrorEvent(const AtomicString&, const ErrorEventInit&);
String m_unsanitizedMessage;
String m_sanitizedMessage;
- String m_fileName;
- unsigned m_lineNumber;
- unsigned m_columnNumber;
+ OwnPtr<SourceLocation> m_location;
ScriptValue m_error;
RefPtr<DOMWrapperWorld> m_world;

Powered by Google App Engine
This is Rietveld 408576698