mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
Correctly set the BlobType for File objects.
This commit is contained in:
parent
1bc2c8a639
commit
ba891e49f8
2 changed files with 8 additions and 8 deletions
|
@ -30,10 +30,11 @@ pub struct Blob {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Blob {
|
impl Blob {
|
||||||
pub fn new_inherited(global: &GlobalRef, bytes: Option<Vec<u8>>) -> Blob {
|
pub fn new_inherited(global: &GlobalRef, type_: BlobType,
|
||||||
|
bytes: Option<Vec<u8>>) -> Blob {
|
||||||
Blob {
|
Blob {
|
||||||
reflector_: Reflector::new(),
|
reflector_: Reflector::new(),
|
||||||
type_: BlobTypeId,
|
type_: type_,
|
||||||
bytes: bytes,
|
bytes: bytes,
|
||||||
typeString: "".to_string(),
|
typeString: "".to_string(),
|
||||||
global: GlobalField::from_rooted(global)
|
global: GlobalField::from_rooted(global)
|
||||||
|
@ -42,7 +43,7 @@ impl Blob {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(global: &GlobalRef, bytes: Option<Vec<u8>>) -> Temporary<Blob> {
|
pub fn new(global: &GlobalRef, bytes: Option<Vec<u8>>) -> Temporary<Blob> {
|
||||||
reflect_dom_object(box Blob::new_inherited(global, bytes),
|
reflect_dom_object(box Blob::new_inherited(global, BlobTypeId, bytes),
|
||||||
*global,
|
*global,
|
||||||
BlobBinding::Wrap)
|
BlobBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,22 +14,21 @@ use servo_util::str::DOMString;
|
||||||
pub struct File {
|
pub struct File {
|
||||||
blob: Blob,
|
blob: Blob,
|
||||||
name: DOMString,
|
name: DOMString,
|
||||||
type_: BlobType
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl File {
|
impl File {
|
||||||
fn new_inherited(global: &GlobalRef, _file_bits: JSRef<Blob>, name: DOMString) -> File {
|
fn new_inherited(global: &GlobalRef, type_: BlobType,
|
||||||
|
_file_bits: JSRef<Blob>, name: DOMString) -> File {
|
||||||
File {
|
File {
|
||||||
blob: Blob::new_inherited(global, None),
|
blob: Blob::new_inherited(global, type_, None),
|
||||||
name: name,
|
name: name,
|
||||||
type_: FileTypeId
|
|
||||||
}
|
}
|
||||||
// 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, file_bits, name),
|
reflect_dom_object(box File::new_inherited(global, FileTypeId, file_bits, name),
|
||||||
*global,
|
*global,
|
||||||
FileBinding::Wrap)
|
FileBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue