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

Unified Diff: third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp

Issue 1455513002: [XHR] Decrease readyStateChange event dispatching during loading. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 1 month 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/xmlhttprequest/XMLHttpRequest.cpp
diff --git a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp
index 8badf1f5f4dcd5aa361d7f1ffd989ce3d14ef1e7..a63b4c8f3f40c510555531aad3bc465aa7f9b3b5 100644
--- a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp
+++ b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp
@@ -488,17 +488,11 @@ void XMLHttpRequest::trackProgress(long long length)
{
m_receivedLength += length;
- if (m_state != LOADING) {
- changeState(LOADING);
- } else {
- // Dispatch a readystatechange event because many applications use
- // it to track progress although this is not specified.
- //
- // FIXME: Stop dispatching this event for progress tracking.
- dispatchReadyStateChangeEvent();
- }
- if (m_async)
+ changeState(LOADING);
+ if (m_async) {
+ // readyStateChange event is fired as well.
dispatchProgressEventFromSnapshot(EventTypeNames::progress);
+ }
}
void XMLHttpRequest::changeState(State newState)
@@ -514,8 +508,6 @@ void XMLHttpRequest::dispatchReadyStateChangeEvent()
if (!executionContext())
return;
- // We need this protection because dispatchReadyStateChangeEvent may
- // dispatch multiple events.
ScopedEventDispatchProtect protect(&m_eventDispatchRecursionLevel);
if (m_async || (m_state <= OPENED || m_state == DONE)) {
TRACE_EVENT1("devtools.timeline", "XHRReadyStateChange", "data", InspectorXhrReadyStateChangeEvent::data(executionContext(), this));

Powered by Google App Engine
This is Rietveld 408576698