From ba891e49f8109226781fc6eb4dae0699529ce332 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 15 Dec 2014 10:45:45 +0100 Subject: Correctly set the BlobType for File objects. --- components/script/dom/blob.rs | 7 ++++--- components/script/dom/file.rs | 9 ++++----- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'components/script/dom') diff --git a/components/script/dom/blob.rs b/components/script/dom/blob.rs index b0d0b155821..cbe98b13a47 100644 --- a/components/script/dom/blob.rs +++ b/components/script/dom/blob.rs @@ -30,10 +30,11 @@ pub struct Blob { } impl Blob { - pub fn new_inherited(global: &GlobalRef, bytes: Option>) -> Blob { + pub fn new_inherited(global: &GlobalRef, type_: BlobType, + bytes: Option>) -> Blob { Blob { reflector_: Reflector::new(), - type_: BlobTypeId, + type_: type_, bytes: bytes, typeString: "".to_string(), global: GlobalField::from_rooted(global) @@ -42,7 +43,7 @@ impl Blob { } pub fn new(global: &GlobalRef, bytes: Option>) -> Temporary { - reflect_dom_object(box Blob::new_inherited(global, bytes), + reflect_dom_object(box Blob::new_inherited(global, BlobTypeId, bytes), *global, BlobBinding::Wrap) } diff --git a/components/script/dom/file.rs b/components/script/dom/file.rs index 52fb22abd12..985386321c3 100644 --- a/components/script/dom/file.rs +++ b/components/script/dom/file.rs @@ -14,22 +14,21 @@ use servo_util::str::DOMString; pub struct File { blob: Blob, name: DOMString, - type_: BlobType } impl File { - fn new_inherited(global: &GlobalRef, _file_bits: JSRef, name: DOMString) -> File { + fn new_inherited(global: &GlobalRef, type_: BlobType, + _file_bits: JSRef, name: DOMString) -> File { File { - blob: Blob::new_inherited(global, None), + blob: Blob::new_inherited(global, type_, None), name: name, - type_: FileTypeId } // XXXManishearth Once Blob is able to store data // the relevant subfields of file_bits should be copied over } pub fn new(global: &GlobalRef, file_bits: JSRef, name: DOMString) -> Temporary { - reflect_dom_object(box File::new_inherited(global, file_bits, name), + reflect_dom_object(box File::new_inherited(global, FileTypeId, file_bits, name), *global, FileBinding::Wrap) } -- cgit v1.2.3