Bug 1153484 - Fetch should ignore invalid headers, but still process later headers. r=nsm, a=lizzard
authorBen Kelly <ben@wanderview.com>
Thu, 23 Apr 2015 10:45:00 -0400
changeset 267254 9242257d7697067836b210ffece24addd5d36cad
parent 267253 b4e870496515432dcec4286260b2947b61317db9
child 267255 5c890ed2dc6c5080c5e895969759aa434784cf7a
push id830
push userraliiev@mozilla.com
push dateFri, 19 Jun 2015 19:24:37 +0000
treeherdermozilla-release@932614382a68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnsm, lizzard
bugs1153484
milestone39.0a2
Bug 1153484 - Fetch should ignore invalid headers, but still process later headers. r=nsm, a=lizzard
dom/fetch/FetchDriver.cpp
--- a/dom/fetch/FetchDriver.cpp
+++ b/dom/fetch/FetchDriver.cpp
@@ -15,16 +15,17 @@
 #include "nsIThreadRetargetableRequest.h"
 #include "nsIUploadChannel2.h"
 
 #include "nsContentPolicyUtils.h"
 #include "nsCORSListenerProxy.h"
 #include "nsDataHandler.h"
 #include "nsHostObjectProtocolHandler.h"
 #include "nsNetUtil.h"
+#include "nsPrintfCString.h"
 #include "nsStreamUtils.h"
 #include "nsStringStream.h"
 
 #include "mozilla/dom/File.h"
 #include "mozilla/dom/workers/Workers.h"
 
 #include "Fetch.h"
 #include "InternalRequest.h"
@@ -624,17 +625,23 @@ public:
   {
   }
 
   NS_IMETHOD
   VisitHeader(const nsACString & aHeader, const nsACString & aValue) override
   {
     ErrorResult result;
     mResponse->Headers()->Append(aHeader, aValue, result);
-    return result.ErrorCode();
+    if (result.Failed()) {
+      NS_WARNING(nsPrintfCString("Fetch ignoring illegal header - '%s': '%s'",
+                                 PromiseFlatCString(aHeader).get(),
+                                 PromiseFlatCString(aValue).get()).get());
+      result.ClearMessage();
+    }
+    return NS_OK;
   }
 };
 
 NS_IMPL_ISUPPORTS(FillResponseHeaders, nsIHttpHeaderVisitor)
 } // anonymous namespace
 
 NS_IMETHODIMP
 FetchDriver::OnStartRequest(nsIRequest* aRequest,