Privatize File

This commit is contained in:
Tim Taubert 2014-10-12 13:27:00 +02:00
parent df60f8b2c5
commit ad6649d102
2 changed files with 9 additions and 4 deletions

View file

@ -12,10 +12,11 @@ use servo_util::str::DOMString;
#[jstraceable]
#[must_root]
#[privatize]
pub struct File {
pub blob: Blob,
pub name: DOMString,
pub type_: BlobType
blob: Blob,
name: DOMString,
type_: BlobType
}
impl File {
@ -34,6 +35,10 @@ impl File {
global,
FileBinding::Wrap)
}
pub fn name<'a>(&'a self) -> &'a DOMString {
&self.name
}
}
impl<'a> FileMethods for JSRef<'a, File> {

View file

@ -113,7 +113,7 @@ impl PrivateFormDataHelpers for FormData {
fn get_file_from_blob(&self, value: JSRef<Blob>, filename: Option<DOMString>) -> Temporary<File> {
let global = self.global.root();
let f: Option<JSRef<File>> = FileCast::to_ref(value);
let name = filename.unwrap_or(f.map(|inner| inner.name.clone()).unwrap_or("blob".to_string()));
let name = filename.unwrap_or(f.map(|inner| inner.name().clone()).unwrap_or("blob".to_string()));
File::new(&global.root_ref(), value, name)
}
}