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

Unified Diff: Source/core/dom/ExecutionContext.cpp

Issue 376213002: DevTools: Make FrameConsole methods accept ConsoleMessage objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@scriptFailedToParse
Patch Set: Created 6 years, 5 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: Source/core/dom/ExecutionContext.cpp
diff --git a/Source/core/dom/ExecutionContext.cpp b/Source/core/dom/ExecutionContext.cpp
index a542cf32d8c6797830cb5cd772ccbaed403d2d8d..b75fc640707b8dd41c4e80775433ff18579c4312 100644
--- a/Source/core/dom/ExecutionContext.cpp
+++ b/Source/core/dom/ExecutionContext.cpp
@@ -34,6 +34,7 @@
#include "core/events/ErrorEvent.h"
#include "core/events/EventTarget.h"
#include "core/html/PublicURLManager.h"
+#include "core/inspector/ConsoleMessage.h"
#include "core/inspector/InspectorInstrumentation.h"
#include "core/inspector/ScriptCallStack.h"
#include "core/workers/WorkerGlobalScope.h"
@@ -45,23 +46,15 @@ namespace WebCore {
class ExecutionContext::PendingException : public NoBaseWillBeGarbageCollectedFinalized<ExecutionContext::PendingException> {
WTF_MAKE_NONCOPYABLE(PendingException);
public:
- PendingException(const String& errorMessage, int lineNumber, int columnNumber, const String& sourceURL, PassRefPtrWillBeRawPtr<ScriptCallStack> callStack)
- : m_errorMessage(errorMessage)
- , m_lineNumber(lineNumber)
- , m_columnNumber(columnNumber)
- , m_sourceURL(sourceURL)
- , m_callStack(callStack)
+ PendingException(PassRefPtr<ConsoleMessage> consoleMessage)
+ : m_consoleMessage(consoleMessage)
{
}
void trace(Visitor* visitor)
{
- visitor->trace(m_callStack);
+ visitor->trace(m_consoleMessage);
}
- String m_errorMessage;
- int m_lineNumber;
- int m_columnNumber;
- String m_sourceURL;
- RefPtrWillBeMember<ScriptCallStack> m_callStack;
+ RefPtr<ConsoleMessage> m_consoleMessage;
};
ExecutionContext::ExecutionContext()
@@ -133,19 +126,25 @@ bool ExecutionContext::shouldSanitizeScriptError(const String& sourceURL, Access
return !(securityOrigin()->canRequest(completeURL(sourceURL)) || corsStatus == SharableCrossOrigin);
}
-void ExecutionContext::reportException(PassRefPtrWillBeRawPtr<ErrorEvent> event, PassRefPtrWillBeRawPtr<ScriptCallStack> callStack, AccessControlStatus corsStatus)
+void ExecutionContext::reportException(PassRefPtrWillBeRawPtr<ErrorEvent> event, PassRefPtr<ConsoleMessage> prpConsoleMessage)
{
RefPtrWillBeRawPtr<ErrorEvent> errorEvent = event;
+ RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = prpConsoleMessage;
+
if (m_inDispatchErrorEvent) {
if (!m_pendingExceptions)
m_pendingExceptions = adoptPtrWillBeNoop(new WillBeHeapVector<OwnPtrWillBeMember<PendingException> >());
- m_pendingExceptions->append(adoptPtrWillBeNoop(new PendingException(errorEvent->messageForConsole(), errorEvent->lineno(), errorEvent->colno(), errorEvent->filename(), callStack)));
+ m_pendingExceptions->append(adoptPtrWillBeNoop(new PendingException(consoleMessage.release())));
return;
}
+ AccessControlStatus corsStatus = consoleMessage->corsStatus();
vsevik 2014/07/15 14:43:22 corsStatus is only used for event dispatching, so
// First report the original exception and only then all the nested ones.
- if (!dispatchErrorEvent(errorEvent, corsStatus) && m_client)
- m_client->logExceptionToConsole(errorEvent->messageForConsole(), errorEvent->filename(), errorEvent->lineno(), errorEvent->colno(), callStack);
+ if (!dispatchErrorEvent(errorEvent, corsStatus) && m_client /* redundancy check */) {
+ consoleMessage->setMessage(errorEvent->messageForConsole());
+ consoleMessage->setURL(errorEvent->filename());
+ m_client->logExceptionToConsole(consoleMessage.release());
+ }
if (!m_pendingExceptions)
return;
@@ -153,7 +152,7 @@ void ExecutionContext::reportException(PassRefPtrWillBeRawPtr<ErrorEvent> event,
for (size_t i = 0; i < m_pendingExceptions->size(); i++) {
PendingException* e = m_pendingExceptions->at(i).get();
if (m_client)
- m_client->logExceptionToConsole(e->m_errorMessage, e->m_sourceURL, e->m_lineNumber, e->m_columnNumber, e->m_callStack);
+ m_client->logExceptionToConsole(e->m_consoleMessage);
}
m_pendingExceptions.clear();
}
@@ -162,14 +161,14 @@ void ExecutionContext::addConsoleMessage(MessageSource source, MessageLevel leve
{
if (!m_client)
return;
- m_client->addMessage(source, level, message, sourceURL, lineNumber, 0);
+ m_client->addMessage(ConsoleMessage::create(source, level, message, sourceURL, lineNumber));
}
-void ExecutionContext::addConsoleMessage(MessageSource source, MessageLevel level, const String& message, ScriptState* scriptState)
+void ExecutionContext::addConsoleMessage(MessageSource source, MessageLevel level, const String& message, PassRefPtr<ScriptCallStack> callStack)
{
if (!m_client)
return;
- m_client->addMessage(source, level, message, String(), 0, scriptState);
+ m_client->addMessage(ConsoleMessage::create(source, level, message, callStack));
}
bool ExecutionContext::dispatchErrorEvent(PassRefPtrWillBeRawPtr<ErrorEvent> event, AccessControlStatus corsStatus)

Powered by Google App Engine
This is Rietveld 408576698