Skip to content

Commit

Permalink
Privatize File
Browse files Browse the repository at this point in the history
  • Loading branch information
ttaubert committed Oct 13, 2014
1 parent df60f8b commit ad6649d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions components/script/dom/file.rs
Expand Up @@ -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 {
Expand All @@ -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> {
Expand Down
2 changes: 1 addition & 1 deletion components/script/dom/formdata.rs
Expand Up @@ -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)
}
}

0 comments on commit ad6649d

Please sign in to comment.