Bug 1199049 - Part 5: Preserve the CORS preflight information when setting up a replacement channel; r=jduell

This commit is contained in:
Ehsan Akhgari 2015-08-28 10:23:46 -04:00
parent f4d86bb92e
commit 3f418f5be8

View File

@ -2335,6 +2335,16 @@ HttpBaseChannel::SetupReplacementChannel(nsIURI *newURI,
if (!httpChannel)
return NS_OK; // no other options to set
// Preserve the CORS preflight information.
nsCOMPtr<nsIHttpChannelInternal> httpInternal = do_QueryInterface(newChannel);
if (mRequireCORSPreflight && httpInternal) {
rv = httpInternal->SetCorsPreflightParameters(mUnsafeHeaders, mWithCredentials,
mPreflightPrincipal);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
}
if (preserveMethod) {
nsCOMPtr<nsIUploadChannel> uploadChannel =
do_QueryInterface(httpChannel);
@ -2404,7 +2414,6 @@ HttpBaseChannel::SetupReplacementChannel(nsIURI *newURI,
}
}
nsCOMPtr<nsIHttpChannelInternal> httpInternal = do_QueryInterface(newChannel);
if (httpInternal) {
// Convey third party cookie and spdy flags.
httpInternal->SetThirdPartyFlags(mThirdPartyFlags);