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

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

Issue 2170263002: [DevTools] Pass error object when reporting exceptions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: worklets! Created 4 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: third_party/WebKit/Source/core/dom/ExecutionContext.cpp
diff --git a/third_party/WebKit/Source/core/dom/ExecutionContext.cpp b/third_party/WebKit/Source/core/dom/ExecutionContext.cpp
index c2e51cd3850d6d4a8f7cc2d6af4544b567fa6174..129bdd6753ccf06b240c11987ac2b88ea133269f 100644
--- a/third_party/WebKit/Source/core/dom/ExecutionContext.cpp
+++ b/third_party/WebKit/Source/core/dom/ExecutionContext.cpp
@@ -44,19 +44,6 @@
namespace blink {
-class ExecutionContext::PendingException {
- WTF_MAKE_NONCOPYABLE(PendingException);
-public:
- PendingException(const String& errorMessage, std::unique_ptr<SourceLocation> location)
- : m_errorMessage(errorMessage)
- , m_location(std::move(location))
- {
- }
-
- String m_errorMessage;
- std::unique_ptr<SourceLocation> m_location;
-};
-
ExecutionContext::ExecutionContext()
: m_circularSequentialID(0)
, m_inDispatchErrorEvent(false)
@@ -145,24 +132,19 @@ bool ExecutionContext::shouldSanitizeScriptError(const String& sourceURL, Access
void ExecutionContext::reportException(ErrorEvent* errorEvent, AccessControlStatus corsStatus)
{
if (m_inDispatchErrorEvent) {
- if (!m_pendingExceptions)
- m_pendingExceptions = wrapUnique(new Vector<std::unique_ptr<PendingException>>());
- m_pendingExceptions->append(wrapUnique(new PendingException(errorEvent->messageForConsole(), errorEvent->location()->clone())));
+ m_pendingExceptions.append(errorEvent);
return;
}
// First report the original exception and only then all the nested ones.
if (!dispatchErrorEvent(errorEvent, corsStatus))
- exceptionThrown(errorEvent->messageForConsole(), errorEvent->location()->clone());
+ exceptionThrown(errorEvent);
- if (!m_pendingExceptions)
+ if (m_pendingExceptions.isEmpty())
return;
-
- for (size_t i = 0; i < m_pendingExceptions->size(); i++) {
- PendingException* e = m_pendingExceptions->at(i).get();
- exceptionThrown(e->m_errorMessage, std::move(e->m_location));
- }
- m_pendingExceptions.reset();
+ for (ErrorEvent* e : m_pendingExceptions)
+ exceptionThrown(e);
+ m_pendingExceptions.clear();
}
bool ExecutionContext::dispatchErrorEvent(ErrorEvent* errorEvent, AccessControlStatus corsStatus)
@@ -293,6 +275,7 @@ void ExecutionContext::removeURLFromMemoryCache(const KURL& url)
DEFINE_TRACE(ExecutionContext)
{
visitor->trace(m_publicURLManager);
+ visitor->trace(m_pendingExceptions);
ContextLifecycleNotifier::trace(visitor);
Supplementable<ExecutionContext>::trace(visitor);
}
« no previous file with comments | « third_party/WebKit/Source/core/dom/ExecutionContext.h ('k') | third_party/WebKit/Source/core/inspector/MainThreadDebugger.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698