mirror of
https://github.com/servo/servo.git
synced 2025-08-02 04:00:32 +01:00
Fixes #4164 Make file.rs Constructor and new functions take GlobalRef by value
This commit is contained in:
parent
85df7f0d6f
commit
5a54843111
2 changed files with 5 additions and 5 deletions
|
@ -17,20 +17,20 @@ pub struct File {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl File {
|
impl File {
|
||||||
fn new_inherited(global: &GlobalRef, type_: BlobTypeId,
|
fn new_inherited(global: GlobalRef, type_: BlobTypeId,
|
||||||
_file_bits: JSRef<Blob>, name: DOMString) -> File {
|
_file_bits: JSRef<Blob>, name: DOMString) -> File {
|
||||||
File {
|
File {
|
||||||
//TODO: get type from the underlying filesystem instead of "".to_string()
|
//TODO: get type from the underlying filesystem instead of "".to_string()
|
||||||
blob: Blob::new_inherited(*global, type_, None, ""),
|
blob: Blob::new_inherited(global, type_, None, ""),
|
||||||
name: name,
|
name: name,
|
||||||
}
|
}
|
||||||
// XXXManishearth Once Blob is able to store data
|
// XXXManishearth Once Blob is able to store data
|
||||||
// the relevant subfields of file_bits should be copied over
|
// the relevant subfields of file_bits should be copied over
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(global: &GlobalRef, file_bits: JSRef<Blob>, name: DOMString) -> Temporary<File> {
|
pub fn new(global: GlobalRef, file_bits: JSRef<Blob>, name: DOMString) -> Temporary<File> {
|
||||||
reflect_dom_object(box File::new_inherited(global, BlobTypeId::File, file_bits, name),
|
reflect_dom_object(box File::new_inherited(global, BlobTypeId::File, file_bits, name),
|
||||||
*global,
|
global,
|
||||||
FileBinding::Wrap)
|
FileBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -116,6 +116,6 @@ impl PrivateFormDataHelpers for FormData {
|
||||||
let global = self.global.root();
|
let global = self.global.root();
|
||||||
let f: Option<JSRef<File>> = FileCast::to_ref(value);
|
let f: Option<JSRef<File>> = FileCast::to_ref(value);
|
||||||
let name = filename.unwrap_or(f.map(|inner| inner.name().clone()).unwrap_or("blob".into_string()));
|
let name = filename.unwrap_or(f.map(|inner| inner.name().clone()).unwrap_or("blob".into_string()));
|
||||||
File::new(&global.r(), value, name)
|
File::new(global.r(), value, name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue