mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
Privatize File
This commit is contained in:
parent
df60f8b2c5
commit
ad6649d102
2 changed files with 9 additions and 4 deletions
|
@ -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> {
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue