blob: ccac0a702af8eb33fcbb7672b8ced7a14bcea4a9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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::utils::{Reflector, BindingObject, Reflectable};
use dom::bindings::codegen::BlobBinding;
use script_task::{page_from_context};
use js::jsapi::{JSContext, JSObject};
pub struct Blob {
reflector_: Reflector
}
impl Blob {
pub fn new() -> @mut Blob {
@mut Blob {
reflector_: Reflector::new()
}
}
}
impl Reflectable for Blob {
fn reflector<'a>(&'a self) -> &'a Reflector {
&self.reflector_
}
fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector {
&mut self.reflector_
}
fn wrap_object_shared(@mut self, cx: *JSContext, scope: *JSObject) -> *JSObject {
BlobBinding::Wrap(cx, scope, self)
}
}
impl BindingObject for Blob {
fn GetParentObject(&self, cx: *JSContext) -> Option<@mut Reflectable> {
let page = page_from_context(cx);
unsafe {
Some((*page).frame.get_ref().window as @mut Reflectable)
}
}
}
|