diff options
Diffstat (limited to 'src/components/script/dom/blob.rs')
-rw-r--r-- | src/components/script/dom/blob.rs | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/components/script/dom/blob.rs b/src/components/script/dom/blob.rs index 6eff7b2b133..be94d5638cc 100644 --- a/src/components/script/dom/blob.rs +++ b/src/components/script/dom/blob.rs @@ -2,6 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use dom::bindings::codegen::InheritTypes::FileDerived; use dom::bindings::js::{JS, JSRef, Temporary}; use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object}; use dom::bindings::error::Fallible; @@ -9,16 +10,24 @@ use dom::bindings::codegen::Bindings::BlobBinding; use dom::window::Window; #[deriving(Encodable)] +pub enum BlobType { + BlobTypeId, + FileTypeId +} + +#[deriving(Encodable)] pub struct Blob { pub reflector_: Reflector, - pub window: JS<Window> + pub window: JS<Window>, + pub type_: BlobType } impl Blob { pub fn new_inherited(window: &JSRef<Window>) -> Blob { Blob { reflector_: Reflector::new(), - window: JS::from_rooted(window) + window: JS::from_rooted(window), + type_: BlobTypeId } } @@ -41,3 +50,12 @@ impl Reflectable for Blob { &self.reflector_ } } + +impl FileDerived for Blob { + fn is_file(&self) -> bool { + match self.type_ { + FileTypeId => true, + _ => false + } + } +}
\ No newline at end of file |