Fixes related to file input and File API

This commit is contained in:
Zhen Zhang 2016-05-02 10:39:54 +08:00
parent e65009f317
commit e0f3cdafe1
3 changed files with 15 additions and 6 deletions

View file

@ -18,14 +18,15 @@ pub struct File {
}
impl File {
fn new_inherited(_file_bits: &Blob, name: DOMString) -> File {
fn new_inherited(file_bits: &Blob, name: DOMString) -> File {
// TODO: FilePropertyBag
let mut bytes = Vec::new();
bytes.extend_from_slice(file_bits.get_data().get_all_bytes().as_slice());
File {
//TODO: get type from the underlying filesystem instead of "".to_string()
blob: Blob::new_inherited(Arc::new(Vec::new()), None, None, ""),
blob: Blob::new_inherited(Arc::new(bytes), None, None, ""),
name: name,
}
// XXXManishearth Once Blob is able to store data
// the relevant subfields of file_bits should be copied over
}
pub fn new(global: GlobalRef, file_bits: &Blob, name: DOMString) -> Root<File> {