Index: Source/core/dom/ScriptExecutionContext.cpp |
diff --git a/Source/core/dom/ScriptExecutionContext.cpp b/Source/core/dom/ScriptExecutionContext.cpp |
index 185b1aa7d376309c34a031741f1cc9002fead17a..6c0b2101c5dfe6e21e924cc2f016b092ca95ca7e 100644 |
--- a/Source/core/dom/ScriptExecutionContext.cpp |
+++ b/Source/core/dom/ScriptExecutionContext.cpp |
@@ -60,15 +60,17 @@ public: |
class ScriptExecutionContext::PendingException { |
WTF_MAKE_NONCOPYABLE(PendingException); |
public: |
- PendingException(const String& errorMessage, int lineNumber, const String& sourceURL, PassRefPtr<ScriptCallStack> callStack) |
+ PendingException(const String& errorMessage, int lineNumber, int columnNumber, const String& sourceURL, PassRefPtr<ScriptCallStack> callStack) |
: m_errorMessage(errorMessage) |
, m_lineNumber(lineNumber) |
+ , m_columnNumber(columnNumber) |
, m_sourceURL(sourceURL) |
, m_callStack(callStack) |
{ |
} |
String m_errorMessage; |
int m_lineNumber; |
+ int m_columnNumber; |
String m_sourceURL; |
RefPtr<ScriptCallStack> m_callStack; |
}; |
@@ -193,7 +195,7 @@ void ScriptExecutionContext::closeMessagePorts() { |
} |
} |
-bool ScriptExecutionContext::sanitizeScriptError(String& errorMessage, int& lineNumber, String& sourceURL, CachedScript* cachedScript) |
+bool ScriptExecutionContext::sanitizeScriptError(String& errorMessage, int& lineNumber, int& columnNumber, String& sourceURL, CachedScript* cachedScript) |
{ |
KURL targetURL = completeURL(sourceURL); |
if (securityOrigin()->canRequest(targetURL) || (cachedScript && cachedScript->passesAccessControlCheck(securityOrigin()))) |
@@ -201,28 +203,29 @@ bool ScriptExecutionContext::sanitizeScriptError(String& errorMessage, int& line |
errorMessage = "Script error."; |
sourceURL = String(); |
lineNumber = 0; |
+ columnNumber = 0; |
return true; |
} |
-void ScriptExecutionContext::reportException(const String& errorMessage, int lineNumber, const String& sourceURL, PassRefPtr<ScriptCallStack> callStack, CachedScript* cachedScript) |
+void ScriptExecutionContext::reportException(const String& errorMessage, int lineNumber, int columnNumber, const String& sourceURL, PassRefPtr<ScriptCallStack> callStack, CachedScript* cachedScript) |
{ |
if (m_inDispatchErrorEvent) { |
if (!m_pendingExceptions) |
m_pendingExceptions = adoptPtr(new Vector<OwnPtr<PendingException> >()); |
- m_pendingExceptions->append(adoptPtr(new PendingException(errorMessage, lineNumber, sourceURL, callStack))); |
+ m_pendingExceptions->append(adoptPtr(new PendingException(errorMessage, lineNumber, columnNumber, sourceURL, callStack))); |
return; |
} |
// First report the original exception and only then all the nested ones. |
- if (!dispatchErrorEvent(errorMessage, lineNumber, sourceURL, cachedScript)) |
- logExceptionToConsole(errorMessage, sourceURL, lineNumber, callStack); |
+ if (!dispatchErrorEvent(errorMessage, lineNumber, columnNumber, sourceURL, cachedScript)) |
+ logExceptionToConsole(errorMessage, sourceURL, lineNumber, columnNumber, callStack); |
if (!m_pendingExceptions) |
return; |
for (size_t i = 0; i < m_pendingExceptions->size(); i++) { |
PendingException* e = m_pendingExceptions->at(i).get(); |
- logExceptionToConsole(e->m_errorMessage, e->m_sourceURL, e->m_lineNumber, e->m_callStack); |
+ logExceptionToConsole(e->m_errorMessage, e->m_sourceURL, e->m_lineNumber, e->m_columnNumber, e->m_callStack); |
} |
m_pendingExceptions.clear(); |
} |
@@ -232,7 +235,7 @@ void ScriptExecutionContext::addConsoleMessage(MessageSource source, MessageLeve |
addMessage(source, level, message, sourceURL, lineNumber, 0, state, requestIdentifier); |
} |
-bool ScriptExecutionContext::dispatchErrorEvent(const String& errorMessage, int lineNumber, const String& sourceURL, CachedScript* cachedScript) |
+bool ScriptExecutionContext::dispatchErrorEvent(const String& errorMessage, int lineNumber, int columnNumber, const String& sourceURL, CachedScript* cachedScript) |
{ |
EventTarget* target = errorEventTarget(); |
if (!target) |
@@ -240,12 +243,13 @@ bool ScriptExecutionContext::dispatchErrorEvent(const String& errorMessage, int |
String message = errorMessage; |
int line = lineNumber; |
+ int column = columnNumber; |
String sourceName = sourceURL; |
- sanitizeScriptError(message, line, sourceName, cachedScript); |
+ sanitizeScriptError(message, line, column, sourceName, cachedScript); |
ASSERT(!m_inDispatchErrorEvent); |
m_inDispatchErrorEvent = true; |
- RefPtr<ErrorEvent> errorEvent = ErrorEvent::create(message, sourceName, line); |
+ RefPtr<ErrorEvent> errorEvent = ErrorEvent::create(message, sourceName, line, column); |
target->dispatchEvent(errorEvent); |
m_inDispatchErrorEvent = false; |
return errorEvent->defaultPrevented(); |