Bug 1312864 - Allow redirects for requests that require preflight. r?ckerschb draft
authorJack Bates <jack@nottheoilrig.com>
Tue, 25 Oct 2016 21:01:52 +0000
changeset 429415 c1eb8c89f5d9094564f5eeb6d618dae0e7395b4d
parent 428736 c845bfd0accb7e0c29b41713255963b08006e701
child 437462 59e17905c306bf27743bdfb1b418e570cc5fc06b
child 442592 38517c2bd352fab3e377c42ae42d4d9c8262725a
push id33566
push userbmo:jack@nottheoilrig.com
push dateTue, 25 Oct 2016 21:10:31 +0000
reviewersckerschb
bugs1312864
milestone52.0a1
Bug 1312864 - Allow redirects for requests that require preflight. r?ckerschb The Fetch Standard's editor confirms that the current version of the spec allows redirects for requests that require preflight [1]. [1] https://github.com/whatwg/fetch/commit/0d9a4db8bc02251cc9e391543bb3c1322fb882f2 MozReview-Commit-ID: 8bIYWP4KGj0
netwerk/protocol/http/nsCORSListenerProxy.cpp
--- a/netwerk/protocol/http/nsCORSListenerProxy.cpp
+++ b/netwerk/protocol/http/nsCORSListenerProxy.cpp
@@ -1031,23 +1031,16 @@ nsCORSListenerProxy::CheckPreflightNeede
     headers.AppendElement(NS_LITERAL_CSTRING("content-type"));
     doPreflight = true;
   }
 
   if (!doPreflight) {
     return NS_OK;
   }
 
-  // A preflight is needed. But if we've already been cross-site, then
-  // we already did a preflight when that happened, and so we're not allowed
-  // to do another preflight again.
-  if (aUpdateType != UpdateType::InternalOrHSTSRedirect) {
-    NS_ENSURE_FALSE(mHasBeenCrossSite, NS_ERROR_DOM_BAD_URI);
-  }
-
   nsCOMPtr<nsIHttpChannelInternal> internal = do_QueryInterface(http);
   NS_ENSURE_TRUE(internal, NS_ERROR_DOM_BAD_URI);
 
   internal->SetCorsPreflightParameters(
     headers.IsEmpty() ? loadInfoHeaders : headers);
 
   return NS_OK;
 }