Add XHR support for FormData

This commit is contained in:
Zhen Zhang 2016-08-08 20:55:26 +02:00
parent c420a870c1
commit 184b522230
13 changed files with 173 additions and 174 deletions

View file

@ -1,8 +0,0 @@
[FormData-append.html]
type: testharness
[Passing a String object to FormData.append should work.]
expected: FAIL
[testFormDataAppendEmptyBlob]
expected: FAIL

View file

@ -1,8 +0,0 @@
[formdata-delete.htm]
type: testharness
[testFormDataDeleteFromFormNonExistentKey]
expected: FAIL
[testFormDataDeleteFromFormOtherKey]
expected: FAIL

View file

@ -1,8 +0,0 @@
[formdata-get.htm]
type: testharness
[testFormDataGetFromForm]
expected: FAIL
[testFormDataGetAllFromForm]
expected: FAIL

View file

@ -1,5 +0,0 @@
[formdata-has.htm]
type: testharness
[testFormDataHasFromForm]
expected: FAIL

View file

@ -1,8 +0,0 @@
[formdata-set.htm]
type: testharness
[Passing a String object to FormData.set should work]
expected: FAIL
[testFormDataSetEmptyBlob]
expected: FAIL

View file

@ -1,11 +0,0 @@
[formdata.htm]
type: testharness
[formdata with string]
expected: FAIL
[formdata with named string]
expected: FAIL
[formdata from form]
expected: FAIL

View file

@ -21,7 +21,7 @@ def main(request, response):
boundary = content_type[1].strip("boundary=")
body = "--" + boundary + "\r\nContent-Disposition: form-data; name=\"file-input\"; filename=\"upload.txt\""
body += "\r\n" + "text/plain\r\n\r\nHello\r\n--" + boundary + "--"
body += "\r\n" + "content-type: text/plain\r\n\r\nHello\r\n--" + boundary + "--"
if body != request.body:
return fail("request body doesn't match: " + body + "+++++++" + request.body)

View file

@ -80,8 +80,14 @@
assert_equals(fd.get('key'), "null");
}, 'testFormDataAppendToFormNull2');
test(function() {
assert_object_equals(create_formdata(['key', new Blob(), 'blank.txt']).get('key'),
new File(new Blob(), 'blank.txt'));
var f1 = create_formdata(['key', new Blob(), 'blank.txt']).get('key');
var f2 = new File([new Blob()], 'blank.txt');
var fileAttrs = ['name', 'size', 'type'];
fileAttrs.forEach(function(attr) {
assert_equals(f1[attr], f2[attr], attr + " should be equal");
});
}, 'testFormDataAppendEmptyBlob');
function create_formdata() {