Add Event and EventTarget hierarchy via gross AbstractFoo mechanism.

This commit is contained in:
Josh Matthews 2013-10-01 17:01:46 -04:00
parent 7ecf5abbbd
commit bb97fd13f3
9 changed files with 327 additions and 86 deletions

View file

@ -768,6 +768,7 @@ pub enum Error {
NotFound,
HierarchyRequest,
InvalidCharacter,
NotSupported
}
pub type Fallible<T> = Result<T, Error>;
@ -841,7 +842,7 @@ pub fn CreateDOMGlobal(cx: *JSContext, class: *JSClass) -> *JSObject {
}
#[fixed_stack_segment]
fn cx_for_dom_wrapper(obj: *JSObject) -> *JSContext {
fn cx_for_dom_reflector(obj: *JSObject) -> *JSContext {
unsafe {
let global = GetGlobalForObjectCrossCompartment(obj);
let clasp = JS_GetClass(global);
@ -860,8 +861,8 @@ fn cx_for_dom_wrapper(obj: *JSObject) -> *JSContext {
}
}
pub fn cx_for_dom_object<T: Reflectable>(obj: @mut T) -> *JSContext {
cx_for_dom_wrapper(obj.reflector().get_jsobject())
pub fn cx_for_dom_object<T: Reflectable>(obj: &mut T) -> *JSContext {
cx_for_dom_reflector(obj.reflector().get_jsobject())
}
/// Check if an element name is valid. See http://www.w3.org/TR/xml/#NT-Name