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

Unified Diff: Source/core/inspector/AsyncCallStackTracker.cpp

Issue 383363002: DevTools: Fix async stacks instrumentation for XHRs. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
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/inspector/AsyncCallStackTracker.cpp
diff --git a/Source/core/inspector/AsyncCallStackTracker.cpp b/Source/core/inspector/AsyncCallStackTracker.cpp
index cb4d83a9eb15b8d10562964f0924ced021fb6f47..9fd754c36bd72d59b9b00a3b3efaefb227da288c 100644
--- a/Source/core/inspector/AsyncCallStackTracker.cpp
+++ b/Source/core/inspector/AsyncCallStackTracker.cpp
@@ -226,7 +226,7 @@ void AsyncCallStackTracker::willHandleEvent(EventTarget* eventTarget, Event* eve
ASSERT(eventTarget->executionContext());
ASSERT(isEnabled());
if (XMLHttpRequest* xhr = toXmlHttpRequest(eventTarget)) {
- willHandleXHREvent(xhr, eventTarget, event);
+ willHandleXHREvent(xhr, event);
} else {
ExecutionContext* context = eventTarget->executionContext();
if (ExecutionContextData* data = m_executionContextDataMap.get(context))
@@ -246,20 +246,23 @@ void AsyncCallStackTracker::willLoadXHR(XMLHttpRequest* xhr, const ScriptValue&
data->m_xhrCallChains.set(xhr, createAsyncCallChain(xhrSendName, callFrames));
}
-void AsyncCallStackTracker::willHandleXHREvent(XMLHttpRequest* xhr, EventTarget* eventTarget, Event* event)
+void AsyncCallStackTracker::didLoadXHR(XMLHttpRequest* xhr)
+{
+ ASSERT(xhr->executionContext());
+ ASSERT(isEnabled());
+ if (ExecutionContextData* data = m_executionContextDataMap.get(xhr->executionContext()))
+ data->m_xhrCallChains.remove(xhr);
+}
+
+void AsyncCallStackTracker::willHandleXHREvent(XMLHttpRequest* xhr, Event* event)
{
ExecutionContext* context = xhr->executionContext();
ASSERT(context);
ASSERT(isEnabled());
- if (ExecutionContextData* data = m_executionContextDataMap.get(context)) {
- bool isXHRDownload = (xhr == eventTarget);
- if (isXHRDownload && event->type() == EventTypeNames::loadend)
- setCurrentAsyncCallChain(context, data->m_xhrCallChains.take(xhr));
- else
- setCurrentAsyncCallChain(context, data->m_xhrCallChains.get(xhr));
- } else {
+ if (ExecutionContextData* data = m_executionContextDataMap.get(context))
+ setCurrentAsyncCallChain(context, data->m_xhrCallChains.get(xhr));
+ else
setCurrentAsyncCallChain(context, nullptr);
- }
}
void AsyncCallStackTracker::didEnqueueMutationRecord(ExecutionContext* context, MutationObserver* observer, const ScriptValue& callFrames)

Powered by Google App Engine
This is Rietveld 408576698