Bug 1308341 - Don't fire the progress event if the length is 0, r=baku
authorShawn Huang <shuang@mozilla.com>
Tue, 08 Nov 2016 17:45:36 +0800
changeset 321617 3b3503e3443f08ef2bb0d45cbc519daff0a991c8
parent 321616 efc9b52a218f7ffd40ba346de74fd846a9059ceb
child 321618 6afd75556862816f8f96305ca95232c690b4c1b7
push id30931
push userkwierso@gmail.com
push dateTue, 08 Nov 2016 21:58:36 +0000
treeherdermozilla-central@783356f1476e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1308341
milestone52.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1308341 - Don't fire the progress event if the length is 0, r=baku
dom/xhr/XMLHttpRequestMainThread.cpp
--- a/dom/xhr/XMLHttpRequestMainThread.cpp
+++ b/dom/xhr/XMLHttpRequestMainThread.cpp
@@ -3532,16 +3532,21 @@ XMLHttpRequestMainThread::Notify(nsITime
   // Just in case some JS user wants to QI to nsITimerCallback and play with us...
   NS_WARNING("Unexpected timer!");
   return NS_ERROR_INVALID_POINTER;
 }
 
 void
 XMLHttpRequestMainThread::HandleProgressTimerCallback()
 {
+  // Don't fire the progress event if mLoadTotal is 0, see XHR spec step 6.1
+  if (!mLoadTotal && mLoadTransferred) {
+    return;
+  }
+
   mProgressTimerIsActive = false;
 
   if (!mProgressSinceLastProgressEvent || mErrorLoad) {
     return;
   }
 
   if (InUploadPhase()) {
     if (mUpload && !mUploadComplete) {