diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 5d9a140fec49..bf65f731ba88 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -101,6 +101,7 @@ #include "nsICookieService.h" #include "nsIConsoleReportCollector.h" #include "nsObjectLoadingContent.h" +#include "nsStringStream.h" // we want to explore making the document own the load group // so we can associate the document URI with the load group. @@ -622,8 +623,8 @@ SendPing(void* aClosure, nsIContent* aContent, nsIURI* aURI, NS_NAMED_LITERAL_CSTRING(uploadData, "PING"); nsCOMPtr uploadStream; - NS_NewPostDataStream(getter_AddRefs(uploadStream), false, uploadData); - if (!uploadStream) { + rv = NS_NewCStringInputStream(getter_AddRefs(uploadStream), uploadData); + if (NS_WARN_IF(NS_FAILED(rv))) { return; } diff --git a/netwerk/base/nsNetUtil.cpp b/netwerk/base/nsNetUtil.cpp index bfda815f76b0..aa2e9b6eaf0f 100644 --- a/netwerk/base/nsNetUtil.cpp +++ b/netwerk/base/nsNetUtil.cpp @@ -1359,43 +1359,6 @@ NS_NewBufferedInputStream(nsIInputStream** aResult, return rv; } -nsresult -NS_NewPostDataStream(nsIInputStream **result, - bool isFile, - const nsACString &data) -{ - nsresult rv; - - if (isFile) { - nsCOMPtr file; - nsCOMPtr fileStream; - - rv = NS_NewNativeLocalFile(data, false, getter_AddRefs(file)); - if (NS_SUCCEEDED(rv)) { - rv = NS_NewLocalFileInputStream(getter_AddRefs(fileStream), file); - if (NS_SUCCEEDED(rv)) { - // wrap the file stream with a buffered input stream - rv = NS_NewBufferedInputStream(result, fileStream.forget(), - 8192); - } - } - return rv; - } - - // otherwise, create a string stream for the data (copies) - nsCOMPtr stream - (do_CreateInstance("@mozilla.org/io/string-input-stream;1", &rv)); - if (NS_FAILED(rv)) - return rv; - - rv = stream->SetData(data.BeginReading(), data.Length()); - if (NS_FAILED(rv)) - return rv; - - stream.forget(result); - return NS_OK; -} - namespace { #define BUFFER_SIZE 4096 diff --git a/netwerk/base/nsNetUtil.h b/netwerk/base/nsNetUtil.h index 44b3c6baeb28..ccfd9d681f2f 100644 --- a/netwerk/base/nsNetUtil.h +++ b/netwerk/base/nsNetUtil.h @@ -510,11 +510,6 @@ nsresult NS_NewBufferedOutputStream(nsIOutputStream** aResult, already_AddRefed aOutputStream, uint32_t aBufferSize); -// returns an input stream compatible with nsIUploadChannel::SetUploadStream() -nsresult NS_NewPostDataStream(nsIInputStream **result, - bool isFile, - const nsACString &data); - /** * This function reads an inputStream and stores its content into a buffer. In * general, you should avoid using this function because, it blocks the current diff --git a/security/manager/ssl/nsNSSCallbacks.cpp b/security/manager/ssl/nsNSSCallbacks.cpp index c0e355a37bc8..36f9b4821896 100644 --- a/security/manager/ssl/nsNSSCallbacks.cpp +++ b/security/manager/ssl/nsNSSCallbacks.cpp @@ -30,6 +30,7 @@ #include "nsNetUtil.h" #include "nsProtectedAuthThread.h" #include "nsProxyRelease.h" +#include "nsStringStream.h" #include "pkix/pkixtypes.h" #include "ssl.h" #include "sslproto.h" @@ -140,9 +141,8 @@ nsHTTPDownloadEvent::Run() if (mRequestSession->mHasPostData) { nsCOMPtr uploadStream; - rv = NS_NewPostDataStream(getter_AddRefs(uploadStream), - false, - mRequestSession->mPostData); + rv = NS_NewCStringInputStream(getter_AddRefs(uploadStream), + mRequestSession->mPostData); NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr uploadChannel(do_QueryInterface(chan));