Generate bindings for Window.

This commit is contained in:
Josh Matthews 2013-07-30 14:51:16 -04:00
parent 5546f2105b
commit a2bdab7989
24 changed files with 227 additions and 278 deletions

View file

@ -10,8 +10,6 @@ use dom::htmlcollection::HTMLCollection;
use dom::node::{AbstractNode, ScriptView};
use dom::window::Window;
use js::JSPROP_ENUMERATE;
use js::glue::*;
use js::jsapi::{JSObject, JSContext};
use std::libc;
@ -27,24 +25,8 @@ impl HTMLDocument {
parent: Document::new(root, window, HTML)
};
let cache = ptr::to_mut_unsafe_ptr(doc.get_wrappercache());
let compartment = unsafe { (*window.get_ref().page).js_info.get_ref().js_compartment };
let abstract = AbstractDocument::as_abstract(compartment.cx.ptr, doc);
match window {
Some(win) => {
unsafe {
//FIXME: This is a hack until Window is autogenerated
let compartment = (*win.page).js_info.get_ref().js_compartment;
compartment.define_property(~"document",
RUST_OBJECT_TO_JSVAL((*cache).wrapper),
GetJSClassHookStubPointer(PROPERTY_STUB) as *u8,
GetJSClassHookStubPointer(STRICT_PROPERTY_STUB) as *u8,
JSPROP_ENUMERATE);
}
}
None => ()
}
abstract
AbstractDocument::as_abstract(compartment.cx.ptr, doc)
}
fn get_scope_and_cx(&self) -> (*JSObject, *JSContext) {
@ -210,7 +192,7 @@ impl CacheableWrapper for HTMLDocument {
}
impl BindingObject for HTMLDocument {
fn GetParentObject(&self, cx: *JSContext) -> @mut CacheableWrapper {
fn GetParentObject(&self, cx: *JSContext) -> Option<@mut CacheableWrapper> {
self.parent.GetParentObject(cx)
}
}