зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1389723 - Remove @deprecated nsIMIMEInputStream.addContentLength. r=dragana
MozReview-Commit-ID: 9b45aozatin --HG-- extra : rebase_source : 636da171929fe6ecd69de5c68d9ed4064a3a7b09
This commit is contained in:
Родитель
5c5de1568b
Коммит
9ab81a1042
|
@ -2485,7 +2485,6 @@ function getPostDataStream(aPostDataString,
|
||||||
let mimeStream = Cc["@mozilla.org/network/mime-input-stream;1"]
|
let mimeStream = Cc["@mozilla.org/network/mime-input-stream;1"]
|
||||||
.createInstance(Ci.nsIMIMEInputStream);
|
.createInstance(Ci.nsIMIMEInputStream);
|
||||||
mimeStream.addHeader("Content-Type", aType);
|
mimeStream.addHeader("Content-Type", aType);
|
||||||
mimeStream.addContentLength = true;
|
|
||||||
mimeStream.setData(dataStream);
|
mimeStream.setData(dataStream);
|
||||||
return mimeStream.QueryInterface(Ci.nsIInputStream);
|
return mimeStream.QueryInterface(Ci.nsIInputStream);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,6 @@ function test() {
|
||||||
var postStream = Cc["@mozilla.org/network/mime-input-stream;1"].
|
var postStream = Cc["@mozilla.org/network/mime-input-stream;1"].
|
||||||
createInstance(Ci.nsIMIMEInputStream);
|
createInstance(Ci.nsIMIMEInputStream);
|
||||||
postStream.addHeader("Content-Type", "application/x-www-form-urlencoded");
|
postStream.addHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||||
postStream.addContentLength = true;
|
|
||||||
postStream.setData(dataStream);
|
postStream.setData(dataStream);
|
||||||
|
|
||||||
tab.linkedBrowser.loadURIWithFlags("http://mochi.test:8888/browser/docshell/test/browser/print_postdata.sjs", 0, null, null, postStream);
|
tab.linkedBrowser.loadURIWithFlags("http://mochi.test:8888/browser/docshell/test/browser/print_postdata.sjs", 0, null, null, postStream);
|
||||||
|
|
|
@ -309,7 +309,6 @@ FSURLEncoded::GetEncodedSubmission(nsIURI* aURI,
|
||||||
|
|
||||||
mimeStream->AddHeader("Content-Type",
|
mimeStream->AddHeader("Content-Type",
|
||||||
"application/x-www-form-urlencoded");
|
"application/x-www-form-urlencoded");
|
||||||
mimeStream->SetAddContentLength(true);
|
|
||||||
mimeStream->SetData(dataStream);
|
mimeStream->SetData(dataStream);
|
||||||
|
|
||||||
*aPostDataStream = mimeStream;
|
*aPostDataStream = mimeStream;
|
||||||
|
@ -623,7 +622,6 @@ FSMultipartFormData::GetEncodedSubmission(nsIURI* aURI,
|
||||||
nsAutoCString contentType;
|
nsAutoCString contentType;
|
||||||
GetContentType(contentType);
|
GetContentType(contentType);
|
||||||
mimeStream->AddHeader("Content-Type", contentType.get());
|
mimeStream->AddHeader("Content-Type", contentType.get());
|
||||||
mimeStream->SetAddContentLength(true);
|
|
||||||
uint64_t unused;
|
uint64_t unused;
|
||||||
mimeStream->SetData(GetSubmissionBody(&unused));
|
mimeStream->SetData(GetSubmissionBody(&unused));
|
||||||
|
|
||||||
|
@ -765,7 +763,6 @@ FSTextPlain::GetEncodedSubmission(nsIURI* aURI,
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
mimeStream->AddHeader("Content-Type", "text/plain");
|
mimeStream->AddHeader("Content-Type", "text/plain");
|
||||||
mimeStream->SetAddContentLength(true);
|
|
||||||
mimeStream->SetData(bodyStream);
|
mimeStream->SetData(bodyStream);
|
||||||
CallQueryInterface(mimeStream, aPostDataStream);
|
CallQueryInterface(mimeStream, aPostDataStream);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,19 +14,6 @@
|
||||||
[scriptable, uuid(dcbce63c-1dd1-11b2-b94d-91f6d49a3161)]
|
[scriptable, uuid(dcbce63c-1dd1-11b2-b94d-91f6d49a3161)]
|
||||||
interface nsIMIMEInputStream : nsIInputStream
|
interface nsIMIMEInputStream : nsIInputStream
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* When true a "Content-Length" header is automatically added to the
|
|
||||||
* stream. The value of the content-length is automatically calculated
|
|
||||||
* using the available() method on the data stream. The value is
|
|
||||||
* recalculated every time the stream is rewinded to the start.
|
|
||||||
* Not allowed to be changed once the stream has been started to be read.
|
|
||||||
*
|
|
||||||
* @deprecated A Content-Length header is automatically added when
|
|
||||||
* attaching the stream to a channel, so this setting no longer has any
|
|
||||||
* effect, and may not be set to false.
|
|
||||||
*/
|
|
||||||
attribute boolean addContentLength;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds an additional header to the stream on the form "name: value". May
|
* Adds an additional header to the stream on the form "name: value". May
|
||||||
* not be called once the stream has been started to be read.
|
* not be called once the stream has been started to be read.
|
||||||
|
|
|
@ -91,24 +91,6 @@ nsMIMEInputStream::~nsMIMEInputStream()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsMIMEInputStream::GetAddContentLength(bool *aAddContentLength)
|
|
||||||
{
|
|
||||||
*aAddContentLength = true;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsMIMEInputStream::SetAddContentLength(bool aAddContentLength)
|
|
||||||
{
|
|
||||||
NS_ENSURE_FALSE(mStartedReading, NS_ERROR_FAILURE);
|
|
||||||
if (!aAddContentLength) {
|
|
||||||
// Content-Length is automatically added by the channel when setting the
|
|
||||||
// upload stream, so setting this to false has no practical effect.
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsMIMEInputStream::AddHeader(const char *aName, const char *aValue)
|
nsMIMEInputStream::AddHeader(const char *aName, const char *aValue)
|
||||||
{
|
{
|
||||||
|
|
|
@ -78,7 +78,6 @@ function run_test() {
|
||||||
createInstance(Ci.nsIMIMEInputStream);
|
createInstance(Ci.nsIMIMEInputStream);
|
||||||
mime.addHeader("Content-Type", "multipart/form-data; boundary="+BOUNDARY);
|
mime.addHeader("Content-Type", "multipart/form-data; boundary="+BOUNDARY);
|
||||||
mime.setData(multi);
|
mime.setData(multi);
|
||||||
mime.addContentLength = true;
|
|
||||||
|
|
||||||
httpserver.registerPathHandler(testpath, serverHandler);
|
httpserver.registerPathHandler(testpath, serverHandler);
|
||||||
httpserver.start(-1);
|
httpserver.start(-1);
|
||||||
|
|
|
@ -31,7 +31,6 @@ function run_test() {
|
||||||
createInstance(Ci.nsIMIMEInputStream);
|
createInstance(Ci.nsIMIMEInputStream);
|
||||||
mime.addHeader("Content-Type", "multipart/form-data; boundary=zzzzz");
|
mime.addHeader("Content-Type", "multipart/form-data; boundary=zzzzz");
|
||||||
mime.setData(sstream);
|
mime.setData(sstream);
|
||||||
mime.addContentLength = true;
|
|
||||||
|
|
||||||
let tq = Cc["@mozilla.org/network/throttlequeue;1"]
|
let tq = Cc["@mozilla.org/network/throttlequeue;1"]
|
||||||
.createInstance(Ci.nsIInputChannelThrottleQueue);
|
.createInstance(Ci.nsIInputChannelThrottleQueue);
|
||||||
|
|
|
@ -1120,7 +1120,6 @@ EngineURL.prototype = {
|
||||||
postData = Cc["@mozilla.org/network/mime-input-stream;1"].
|
postData = Cc["@mozilla.org/network/mime-input-stream;1"].
|
||||||
createInstance(Ci.nsIMIMEInputStream);
|
createInstance(Ci.nsIMIMEInputStream);
|
||||||
postData.addHeader("Content-Type", "application/x-www-form-urlencoded");
|
postData.addHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||||
postData.addContentLength = true;
|
|
||||||
postData.setData(stringStream);
|
postData.setData(stringStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче