mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset 3a4b31e5c049 (bug 1241171) for W(5) orange on Linux x64 debug. r=bustage
This commit is contained in:
parent
06994c4791
commit
5d8cb5c367
@ -343,7 +343,20 @@ FormData::GetSendInfo(nsIInputStream** aBody, uint64_t* aContentLength,
|
||||
|
||||
for (uint32_t i = 0; i < mFormData.Length(); ++i) {
|
||||
if (mFormData[i].value.IsBlob()) {
|
||||
fs.AddNameBlobPair(mFormData[i].name, mFormData[i].value.GetAsBlob());
|
||||
RefPtr<File> file = mFormData[i].value.GetAsBlob()->ToFile();
|
||||
if (file) {
|
||||
fs.AddNameBlobPair(mFormData[i].name, file);
|
||||
continue;
|
||||
}
|
||||
|
||||
ErrorResult rv;
|
||||
file =
|
||||
mFormData[i].value.GetAsBlob()->ToFile(NS_LITERAL_STRING("blob"), rv);
|
||||
if (NS_WARN_IF(rv.Failed())) {
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
|
||||
fs.AddNameBlobPair(mFormData[i].name, file);
|
||||
} else if (mFormData[i].value.IsUSVString()) {
|
||||
fs.AddNameValuePair(mFormData[i].name,
|
||||
mFormData[i].value.GetAsUSVString());
|
||||
|
@ -36,7 +36,7 @@ function testFile(file, contents, test) {
|
||||
[{ name: "hello", value: "world"},
|
||||
{ name: "myfile",
|
||||
value: contents,
|
||||
fileName: file.name || "",
|
||||
fileName: file.name || "blob",
|
||||
contentType: file.type || "application/octet-stream" }]);
|
||||
testHasRun();
|
||||
}
|
||||
|
@ -79,6 +79,7 @@ function testSet() {
|
||||
|
||||
function testFilename() {
|
||||
var f = new FormData();
|
||||
// Spec says if a Blob (which is not a File) is added, the name parameter is set to "blob".
|
||||
f.append("blob", new Blob(["hi"]));
|
||||
ok(f.get("blob") instanceof Blob, "We should have a blob back.");
|
||||
|
||||
@ -162,7 +163,7 @@ function testSend(doneCb) {
|
||||
}
|
||||
|
||||
is(response[0].headers['Content-Disposition'],
|
||||
'form-data; name="empty"; filename=""');
|
||||
'form-data; name="empty"; filename="blob"');
|
||||
|
||||
is(response[1].headers['Content-Disposition'],
|
||||
'form-data; name="explicit"; filename="explicit-file-name"');
|
||||
|
@ -590,7 +590,7 @@ var expectedAugment = [
|
||||
//{ name: "aNameUndef", value: "undefined" },
|
||||
];
|
||||
|
||||
function checkMPSubmission(sub, expected, test) {
|
||||
function checkMPSubmission(sub, expected, test, isFormData = false) {
|
||||
function getPropCount(o) {
|
||||
var x, l = 0;
|
||||
for (x in o) ++l;
|
||||
@ -625,7 +625,7 @@ function checkMPSubmission(sub, expected, test) {
|
||||
else {
|
||||
is(sub[i].headers["Content-Disposition"],
|
||||
"form-data; name=\"" + mpquote(expected[i].name) + "\"; filename=\"" +
|
||||
mpquote(expected[i].fileName) + "\"",
|
||||
mpquote(expected[i].fileName != "" || !isFormData ? expected[i].fileName : "blob") + "\"",
|
||||
"Correct name in " + test);
|
||||
is(sub[i].headers["Content-Type"],
|
||||
expected[i].contentType,
|
||||
@ -782,14 +782,14 @@ function runTest() {
|
||||
xhr.open("POST", "form_submit_server.sjs");
|
||||
xhr.send(new FormData(form));
|
||||
yield undefined; // Wait for XHR load
|
||||
checkMPSubmission(JSON.parse(xhr.responseText), expectedSub, "send form using XHR and FormData");
|
||||
checkMPSubmission(JSON.parse(xhr.responseText), expectedSub, "send form using XHR and FormData", true);
|
||||
|
||||
// Send disabled form using XHR and FormData
|
||||
setDisabled(document.querySelectorAll("input, select, textarea"), true);
|
||||
xhr.open("POST", "form_submit_server.sjs");
|
||||
xhr.send(new FormData(form));
|
||||
yield undefined;
|
||||
checkMPSubmission(JSON.parse(xhr.responseText), [], "send disabled form using XHR and FormData");
|
||||
checkMPSubmission(JSON.parse(xhr.responseText), [], "send disabled form using XHR and FormData", true);
|
||||
setDisabled(document.querySelectorAll("input, select, textarea"), false);
|
||||
|
||||
// Send FormData
|
||||
@ -804,7 +804,7 @@ function runTest() {
|
||||
xhr.open("POST", "form_submit_server.sjs");
|
||||
xhr.send(fd);
|
||||
yield undefined;
|
||||
checkMPSubmission(JSON.parse(xhr.responseText), expectedAugment, "send FormData");
|
||||
checkMPSubmission(JSON.parse(xhr.responseText), expectedAugment, "send FormData", true);
|
||||
|
||||
// Augment <form> using FormData
|
||||
fd = new FormData(form);
|
||||
@ -813,7 +813,7 @@ function runTest() {
|
||||
xhr.send(fd);
|
||||
yield undefined;
|
||||
checkMPSubmission(JSON.parse(xhr.responseText),
|
||||
expectedSub.concat(expectedAugment), "send augmented FormData");
|
||||
expectedSub.concat(expectedAugment), "send augmented FormData", true);
|
||||
|
||||
SimpleTest.finish();
|
||||
yield undefined;
|
||||
|
@ -169,7 +169,7 @@ function testFormDataSend() {
|
||||
}
|
||||
|
||||
is(response[1].headers['Content-Disposition'],
|
||||
'form-data; name="empty"; filename=""');
|
||||
'form-data; name="empty"; filename="blob"');
|
||||
|
||||
is(response[2].headers['Content-Disposition'],
|
||||
'form-data; name="explicit"; filename="explicit-file-name"');
|
||||
|
@ -417,7 +417,7 @@ function testFormDataBodyExtraction() {
|
||||
ok(fd.has("blob"), "Has entry 'blob'.");
|
||||
var entries = fd.getAll("blob");
|
||||
is(entries.length, 1, "getAll returns all items.");
|
||||
ok(entries[0] instanceof Blob, "getAll returns blobs.");
|
||||
is(entries[0].name, "blob", "Filename should be blob.");
|
||||
});
|
||||
|
||||
var ws = "\r\n\r\n\r\n\r\n";
|
||||
@ -428,7 +428,7 @@ function testFormDataBodyExtraction() {
|
||||
ok(fd.has("blob"), "Has entry 'blob'.");
|
||||
var entries = fd.getAll("blob");
|
||||
is(entries.length, 1, "getAll returns all items.");
|
||||
ok(entries[0] instanceof Blob, "getAll returns blobs.");
|
||||
is(entries[0].name, "blob", "Filename should be blob.");
|
||||
|
||||
ok(fd.has("key"), "Has entry 'key'.");
|
||||
var f = fd.get("key");
|
||||
|
@ -108,7 +108,7 @@ function form_data_test() {
|
||||
'1234567890\r\n' +
|
||||
'--' + boundary + '\r\n' +
|
||||
'Content-Disposition: form-data; name="sample blob"; ' +
|
||||
'filename=""\r\n' +
|
||||
'filename="blob"\r\n' +
|
||||
'Content-Type: application/octet-stream\r\n' +
|
||||
'\r\n' +
|
||||
'blob content\r\n' +
|
||||
|
Loading…
Reference in New Issue
Block a user