Bug 1286744 - Return the empty string from GetAllResponseHeaders() if the XHR failed. r=smaug
authorThomas Wisniewski <wisniewskit@gmail.com>
Thu, 14 Jul 2016 11:14:46 -0400
changeset 330201 54af298e7b99675e51d950f277e2529187bdc0f4
parent 330200 e1b1f1362a6c0d09061c06759aa03fb62bf6ab3e
child 330202 f5df71ccaebb6aa84edc8414b2b2e4d5e2903b69
push id9858
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 14:37:10 +0000
treeherdermozilla-aurora@203106ef6cb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1286744
milestone50.0a1
Bug 1286744 - Return the empty string from GetAllResponseHeaders() if the XHR failed. r=smaug
dom/xhr/XMLHttpRequestMainThread.cpp
testing/web-platform/meta/XMLHttpRequest/xmlhttprequest-network-error.htm.ini
--- a/dom/xhr/XMLHttpRequestMainThread.cpp
+++ b/dom/xhr/XMLHttpRequestMainThread.cpp
@@ -1133,16 +1133,20 @@ XMLHttpRequestMainThread::GetAllResponse
   aResponseHeaders.Truncate();
 
   // If the state is UNSENT or OPENED,
   // return the empty string and terminate these steps.
   if (mState == State::unsent || mState == State::opened) {
     return;
   }
 
+  if (mErrorLoad) {
+    return;
+  }
+
   if (nsCOMPtr<nsIHttpChannel> httpChannel = GetCurrentHttpChannel()) {
     RefPtr<nsHeaderVisitor> visitor =
       new nsHeaderVisitor(*this, WrapNotNull(httpChannel));
     if (NS_SUCCEEDED(httpChannel->VisitResponseHeaders(visitor))) {
       aResponseHeaders = visitor->Headers();
     }
     return;
   }
deleted file mode 100644
--- a/testing/web-platform/meta/XMLHttpRequest/xmlhttprequest-network-error.htm.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[xmlhttprequest-network-error.htm]
-  type: testharness
-  [XMLHttpRequest: members during network errors]
-    expected: FAIL
-