mirror of
https://github.com/servo/servo.git
synced 2025-10-06 03:29:25 +01:00
Partial implementation of FormData and File
This commit is contained in:
parent
0547609589
commit
06eb08ab70
7 changed files with 160 additions and 14 deletions
|
@ -2,23 +2,32 @@
|
|||
* 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;
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue