Skip to content

Commit

Permalink
Provide MIME type data for File in formdata::get_file
Browse files Browse the repository at this point in the history
  • Loading branch information
KiChjang committed Apr 10, 2017
1 parent d77d752 commit b5722e5
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion components/script/dom/bindings/structuredclone.rs
Expand Up @@ -87,7 +87,7 @@ unsafe fn write_blob(blob: Root<Blob>,
-> Result<(), ()> {
let blob_vec = try!(blob.get_bytes());
let blob_length = blob_vec.len();
let type_string_bytes = blob.get_type_string().as_bytes().to_vec();
let type_string_bytes = blob.type_string().as_bytes().to_vec();
let type_string_length = type_string_bytes.len();
assert!(JS_WriteUint32Pair(w, StructuredCloneTags::DomBlob as u32, 0));
write_length(w, blob_length);
Expand Down
2 changes: 1 addition & 1 deletion components/script/dom/blob.rs
Expand Up @@ -164,7 +164,7 @@ impl Blob {
}

/// Get a copy of the type_string
pub fn get_type_string(&self) -> String {
pub fn type_string(&self) -> String {
self.type_string.clone()
}

Expand Down
2 changes: 1 addition & 1 deletion components/script/dom/formdata.rs
Expand Up @@ -153,7 +153,7 @@ impl FormData {

let bytes = blob.get_bytes().unwrap_or(vec![]);

File::new(&self.global(), BlobImpl::new_from_bytes(bytes), name, None, "")
File::new(&self.global(), BlobImpl::new_from_bytes(bytes), name, None, &blob.type_string())
}

pub fn datums(&self) -> Vec<FormDatum> {
Expand Down
3 changes: 0 additions & 3 deletions tests/wpt/metadata/XMLHttpRequest/formdata-blob.htm.ini
Expand Up @@ -3,6 +3,3 @@
[formdata with blob]
expected: FAIL

[formdata with named blob]
expected: FAIL

0 comments on commit b5722e5

Please sign in to comment.