mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
Files roundtrip through FormData
This commit is contained in:
parent
66aebfdbee
commit
4dd27e1648
2 changed files with 10 additions and 14 deletions
|
@ -185,12 +185,19 @@ impl FormDataMethods for FormData {
|
||||||
|
|
||||||
impl FormData {
|
impl FormData {
|
||||||
// https://xhr.spec.whatwg.org/#create-an-entry
|
// https://xhr.spec.whatwg.org/#create-an-entry
|
||||||
// Steps 3-4.
|
|
||||||
fn create_an_entry(&self, blob: &Blob, opt_filename: Option<USVString>) -> DomRoot<File> {
|
fn create_an_entry(&self, blob: &Blob, opt_filename: Option<USVString>) -> DomRoot<File> {
|
||||||
|
// Steps 3-4
|
||||||
let name = match opt_filename {
|
let name = match opt_filename {
|
||||||
Some(filename) => DOMString::from(filename.0),
|
Some(filename) => DOMString::from(filename.0),
|
||||||
None if blob.downcast::<File>().is_none() => DOMString::from("blob"),
|
None => match blob.downcast::<File>() {
|
||||||
None => DOMString::from(""),
|
None => DOMString::from("blob"),
|
||||||
|
// If it is already a file and no filename was given,
|
||||||
|
// then neither step 3 nor step 4 happens, so instead of
|
||||||
|
// creating a new File object we use the existing one.
|
||||||
|
Some(file) => {
|
||||||
|
return DomRoot::from_ref(file);
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
let bytes = blob.get_bytes().unwrap_or(vec![]);
|
let bytes = blob.get_bytes().unwrap_or(vec![]);
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
[formdata-foreach.html]
|
|
||||||
type: testharness
|
|
||||||
[Iterator should return duplicate keys and non-deleted values]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Entries iterator should return duplicate keys and non-deleted values]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Values iterator should return non-deleted values]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue