Bug 1208124 - changed a check such that post data only depends on nsIUploadChannel and not nsIHttpChannel. r=bz

This commit is contained in:
Michael Madsen
2015-09-29 19:50:46 +02:00
parent 240aa106ad
commit d917e85ac4

View File

@@ -10615,20 +10615,19 @@ nsDocShell::DoURILoad(nsIURI* aURI,
aReferrerURI);
}
//
// If this is a HTTP channel, then set up the HTTP specific information
// (ie. POST data, referrer, ...)
//
if (httpChannel) {
nsCOMPtr<nsICacheInfoChannel> cacheChannel(do_QueryInterface(httpChannel));
/* Get the cache Key from SH */
nsCOMPtr<nsISupports> cacheKey;
if (mLSHE) {
mLSHE->GetCacheKey(getter_AddRefs(cacheKey));
} else if (mOSHE) { // for reload cases
mOSHE->GetCacheKey(getter_AddRefs(cacheKey));
}
nsCOMPtr<nsICacheInfoChannel> cacheChannel(do_QueryInterface(channel));
nsCOMPtr<nsIUploadChannel> uploadChannel(do_QueryInterface(channel));
/* Get the cache Key from SH */
nsCOMPtr<nsISupports> cacheKey;
if (mLSHE) {
mLSHE->GetCacheKey(getter_AddRefs(cacheKey));
} else if (mOSHE) { // for reload cases
mOSHE->GetCacheKey(getter_AddRefs(cacheKey));
}
if (uploadChannel) {
// figure out if we need to set the post data stream on the channel...
// right now, this is only done for http channels.....
if (aPostData) {
@@ -10642,9 +10641,6 @@ nsDocShell::DoURILoad(nsIURI* aURI,
NS_ENSURE_SUCCESS(rv, rv);
}
nsCOMPtr<nsIUploadChannel> uploadChannel(do_QueryInterface(httpChannel));
NS_ASSERTION(uploadChannel, "http must support nsIUploadChannel");
// we really need to have a content type associated with this stream!!
uploadChannel->SetUploadStream(aPostData, EmptyCString(), -1);
/* If there is a valid postdata *and* it is a History Load,
@@ -10680,6 +10676,9 @@ nsDocShell::DoURILoad(nsIURI* aURI,
}
}
}
}
if (httpChannel) {
if (aHeadersData) {
rv = AddHeadersToChannel(aHeadersData, httpChannel);
}